suanPan
Section.h
Go to the documentation of this file.
1/*******************************************************************************
2 * Copyright (C) 2017-2024 Theodore Chang
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 ******************************************************************************/
28#ifndef SECTION_H
29#define SECTION_H
30
31#include <Domain/Tag.h>
32
33enum class SectionType : unsigned {
34 D0 = 0,
35 D1 = 1,
36 D2 = 2,
37 D3 = 3,
38 NM2D = 3,
39 NM3D = 6,
40 OS3D = 12,
41};
42
43enum class OutputType;
44
45class DomainBase;
46class Material;
47
49 const unsigned material_tag; // material tag
50
52
53 const vec eccentricity;
54
55 const double area;
56 const double linear_density = 0.;
57 const double characteristic_length = -1.;
58
59 vec trial_deformation{}; // trial deformation
60 vec current_deformation{}; // current deformation
61
62 vec trial_deformation_rate{}; // trial deformation rate
63 vec current_deformation_rate{}; // current deformation rate
64
65 vec trial_resistance{}; // trial resistance
66 vec current_resistance{}; // current resistance
67
68 mat initial_stiffness{}; // stiffness matrix
69 mat current_stiffness{}; // stiffness matrix
70 mat trial_stiffness{}; // stiffness matrix
71
72 mat initial_geometry{}; // geometry matrix
73 mat current_geometry{}; // geometry matrix
74 mat trial_geometry{}; // geometry matrix
75};
76
77class Section : protected DataSection, public Tag {
78 const bool initialized = false;
79 const bool symmetric = false;
80
81public:
82 explicit Section(
83 unsigned = 0, // section tag
84 SectionType = SectionType::D0, // section type
85 unsigned = 0, // material tag
86 double = 0., // area
87 vec&& = {0., 0.} // eccentricity
88 );
89 Section(const Section&) = default; // default copy ctor
90 Section(Section&&) = delete; // move forbidden
91 Section& operator=(const Section&) = delete; // assign forbidden
92 Section& operator=(Section&&) = delete; // assign forbidden
93
94 ~Section() override = default;
95
96 [[nodiscard]] SectionType get_section_type() const;
97 [[nodiscard]] double get_area() const;
98 [[nodiscard]] double get_linear_density() const;
99
100 int initialize_base(const shared_ptr<DomainBase>&);
101
102 virtual int initialize(const shared_ptr<DomainBase>&) = 0;
103
104 void set_initialized(bool) const;
105 void set_symmetric(bool) const;
106 [[nodiscard]] bool is_initialized() const;
107 [[nodiscard]] bool is_symmetric() const;
108
109 void set_eccentricity(const vec&) const;
110 [[nodiscard]] const vec& get_eccentricity() const;
111
112 virtual void set_characteristic_length(double) const;
113 [[nodiscard]] double get_characteristic_length() const;
114
115 [[nodiscard]] virtual const vec& get_trial_deformation() const;
116 [[nodiscard]] virtual const vec& get_trial_deformation_rate() const;
117 [[nodiscard]] virtual const vec& get_trial_resistance() const;
118 [[nodiscard]] virtual const mat& get_trial_stiffness() const;
119 [[nodiscard]] virtual const mat& get_trial_geometry() const;
120
121 [[nodiscard]] virtual const vec& get_current_deformation() const;
122 [[nodiscard]] virtual const vec& get_current_deformation_rate() const;
123 [[nodiscard]] virtual const vec& get_current_resistance() const;
124 [[nodiscard]] virtual const mat& get_current_stiffness() const;
125 [[nodiscard]] virtual const mat& get_current_geometry() const;
126
127 [[nodiscard]] virtual const mat& get_initial_stiffness() const;
128 [[nodiscard]] virtual const mat& get_initial_geometry() const;
129
130 virtual unique_ptr<Section> get_copy() = 0;
131
132 int update_incre_status(double);
133 int update_incre_status(double, double);
134 int update_trial_status(double);
135 int update_trial_status(double, double);
136
137 virtual int update_incre_status(const vec&);
138 virtual int update_incre_status(const vec&, const vec&);
139 virtual int update_trial_status(const vec&);
140 virtual int update_trial_status(const vec&, const vec&);
141
142 virtual int clear_status() = 0;
143 virtual int commit_status() = 0;
144 virtual int reset_status() = 0;
145
146 virtual std::vector<vec> record(OutputType);
147};
148
149namespace suanpan {
150 unique_ptr<Section> make_copy(const shared_ptr<Section>&);
151 unique_ptr<Section> make_copy(const unique_ptr<Section>&);
152 unique_ptr<Section> initialized_section_copy(const shared_ptr<DomainBase>&, uword);
153} // namespace suanpan
154
155#endif
156
OutputType
Definition: OutputType.h:23
The DomainBase class is a template.
Definition: DomainBase.h:104
A Material abstract base class.
Definition: Material.h:111
A Section class.
Definition: Section.h:77
bool is_initialized() const
Definition: Section.cpp:75
void set_symmetric(bool) const
Definition: Section.cpp:73
virtual const vec & get_trial_deformation() const
Definition: Section.cpp:87
void set_eccentricity(const vec &) const
Definition: Section.cpp:79
virtual int clear_status()=0
int update_incre_status(double)
Definition: Section.cpp:111
Section & operator=(const Section &)=delete
Section(unsigned=0, SectionType=SectionType::D0, unsigned=0, double=0., vec &&={0., 0.})
Definition: Section.cpp:23
const vec & get_eccentricity() const
Definition: Section.cpp:81
SectionType get_section_type() const
Definition: Section.cpp:27
virtual const mat & get_initial_stiffness() const
Definition: Section.cpp:107
virtual const vec & get_trial_resistance() const
Definition: Section.cpp:91
void set_initialized(bool) const
Definition: Section.cpp:71
~Section() override=default
int initialize_base(const shared_ptr< DomainBase > &)
Definition: Section.cpp:33
virtual std::vector< vec > record(OutputType)
Definition: Section.cpp:141
double get_area() const
Definition: Section.cpp:29
virtual const mat & get_current_stiffness() const
Definition: Section.cpp:103
virtual const vec & get_trial_deformation_rate() const
Definition: Section.cpp:89
virtual const mat & get_initial_geometry() const
Definition: Section.cpp:109
virtual const mat & get_trial_geometry() const
Definition: Section.cpp:95
double get_characteristic_length() const
Definition: Section.cpp:85
virtual void set_characteristic_length(double) const
Definition: Section.cpp:83
int update_trial_status(double)
Definition: Section.cpp:122
Section(Section &&)=delete
virtual int commit_status()=0
virtual const vec & get_current_resistance() const
Definition: Section.cpp:101
double get_linear_density() const
Definition: Section.cpp:31
bool is_symmetric() const
Definition: Section.cpp:77
Section(const Section &)=default
Section & operator=(Section &&)=delete
virtual const vec & get_current_deformation() const
Definition: Section.cpp:97
virtual int reset_status()=0
virtual const vec & get_current_deformation_rate() const
Definition: Section.cpp:99
virtual const mat & get_current_geometry() const
Definition: Section.cpp:105
virtual int initialize(const shared_ptr< DomainBase > &)=0
virtual unique_ptr< Section > get_copy()=0
virtual const mat & get_trial_stiffness() const
Definition: Section.cpp:93
A base Tag class.
Definition: Tag.h:38
SectionType
Definition: Section.h:33
Definition: MatrixModifier.hpp:36
unique_ptr< Material > make_copy(const shared_ptr< Material > &)
Definition: Material.cpp:370
unique_ptr< Section > initialized_section_copy(const shared_ptr< DomainBase > &, uword)
Definition: Section.cpp:154
Definition: Section.h:48
vec trial_deformation
Definition: Section.h:59
mat initial_stiffness
Definition: Section.h:68
vec trial_resistance
Definition: Section.h:65
mat trial_geometry
Definition: Section.h:74
mat current_stiffness
Definition: Section.h:69
const double characteristic_length
Definition: Section.h:57
vec trial_deformation_rate
Definition: Section.h:62
mat current_geometry
Definition: Section.h:73
const SectionType section_type
Definition: Section.h:51
const unsigned material_tag
Definition: Section.h:49
vec current_deformation
Definition: Section.h:60
const vec eccentricity
Definition: Section.h:53
vec current_resistance
Definition: Section.h:66
const double linear_density
Definition: Section.h:56
vec current_deformation_rate
Definition: Section.h:63
mat trial_stiffness
Definition: Section.h:70
const double area
Definition: Section.h:55
mat initial_geometry
Definition: Section.h:72