suanPan
ElementBase.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 ELEMENTBASE_H
29#define ELEMENTBASE_H
30
31#include <Domain/Tag.h>
33#include <Element/MappingDOF.h>
34
35class Node;
36class DomainBase;
37class Material;
38class Section;
39enum class OutputType;
40enum class DOF : unsigned short;
41
42class ElementBase : public Tag, public vtkBase {
43 virtual void update_strain_energy() = 0;
44 virtual void update_kinetic_energy() = 0;
45 virtual void update_viscous_energy() = 0;
46 virtual void update_nonviscous_energy() = 0;
47 virtual void update_complementary_energy() = 0;
48 virtual void update_momentum() = 0;
49
50protected:
51 friend mat get_coordinate(const ElementBase*, unsigned);
52
53 friend vec get_incre_displacement(const ElementBase*);
54 friend vec get_incre_velocity(const ElementBase*);
55 friend vec get_incre_acceleration(const ElementBase*);
56 friend vec get_trial_displacement(const ElementBase*);
57 friend vec get_trial_velocity(const ElementBase*);
58 friend vec get_trial_acceleration(const ElementBase*);
59 friend vec get_current_displacement(const ElementBase*);
60 friend vec get_current_velocity(const ElementBase*);
61 friend vec get_current_acceleration(const ElementBase*);
62
63 [[nodiscard]] virtual mat get_coordinate(unsigned) const = 0;
64
65 [[nodiscard]] virtual vec get_node_incre_resistance() const = 0;
66 [[nodiscard]] virtual vec get_node_trial_resistance() const = 0;
67 [[nodiscard]] virtual vec get_node_current_resistance() const = 0;
68
69 [[nodiscard]] virtual std::vector<shared_ptr<Material>> get_material(const shared_ptr<DomainBase>&) const = 0;
70 [[nodiscard]] virtual std::vector<shared_ptr<Section>> get_section(const shared_ptr<DomainBase>&) const = 0;
71
72public:
73 explicit ElementBase(const unsigned T)
74 : Tag(T) {}
75
76 ElementBase(const ElementBase&) = delete; // copy forbidden
77 ElementBase(ElementBase&&) = delete; // move forbidden
78 ElementBase& operator=(const ElementBase&) = delete; // assign forbidden
79 ElementBase& operator=(ElementBase&&) = delete; // assign forbidden
80
81 ~ElementBase() override = default;
82
83 virtual int initialize_base(const shared_ptr<DomainBase>&) = 0;
84 virtual int initialize(const shared_ptr<DomainBase>&) = 0;
85
86 virtual void set_initialized(bool) const = 0;
87 virtual void set_symmetric(bool) const = 0;
88 [[nodiscard]] virtual bool is_initialized() const = 0;
89 [[nodiscard]] virtual bool is_symmetric() const = 0;
90 [[nodiscard]] virtual bool is_nlgeom() const = 0;
91
92 virtual void update_dof_encoding() = 0;
93
94 [[nodiscard]] virtual bool if_update_mass() const = 0;
95 [[nodiscard]] virtual bool if_update_viscous() const = 0;
96 [[nodiscard]] virtual bool if_update_nonviscous() const = 0;
97 [[nodiscard]] virtual bool if_update_stiffness() const = 0;
98 [[nodiscard]] virtual bool if_update_geometry() const = 0;
99
100 [[nodiscard]] virtual bool allow_modify_mass() const = 0;
101 [[nodiscard]] virtual bool allow_modify_viscous() const = 0;
102 [[nodiscard]] virtual bool allow_modify_nonviscous() const = 0;
103
104 [[nodiscard]] virtual const uvec& get_dof_encoding() const = 0;
105 [[nodiscard]] virtual const uvec& get_node_encoding() const = 0;
106
107 [[nodiscard]] virtual const std::vector<MappingDOF>& get_dof_mapping() const = 0;
108
109 [[nodiscard]] virtual const uvec& get_material_tag() const = 0;
110 [[nodiscard]] virtual const uvec& get_section_tag() const = 0;
111
112 [[nodiscard]] virtual unsigned get_dof_number() const = 0;
113 [[nodiscard]] virtual unsigned get_node_number() const = 0;
114 [[nodiscard]] virtual unsigned get_total_number() const = 0;
115
116 virtual void clear_node_ptr() = 0;
117 [[nodiscard]] virtual const std::vector<weak_ptr<Node>>& get_node_ptr() const = 0;
118
119 [[nodiscard]] virtual vec get_incre_displacement() const = 0;
120 [[nodiscard]] virtual vec get_incre_velocity() const = 0;
121 [[nodiscard]] virtual vec get_incre_acceleration() const = 0;
122 [[nodiscard]] virtual vec get_trial_displacement() const = 0;
123 [[nodiscard]] virtual vec get_trial_velocity() const = 0;
124 [[nodiscard]] virtual vec get_trial_acceleration() const = 0;
125 [[nodiscard]] virtual vec get_current_displacement() const = 0;
126 [[nodiscard]] virtual vec get_current_velocity() const = 0;
127 [[nodiscard]] virtual vec get_current_acceleration() const = 0;
128
129 [[nodiscard]] virtual const vec& get_trial_resistance() const = 0;
130 [[nodiscard]] virtual const vec& get_current_resistance() const = 0;
131 [[nodiscard]] virtual const vec& get_trial_damping_force() const = 0;
132 [[nodiscard]] virtual const vec& get_current_damping_force() const = 0;
133 [[nodiscard]] virtual const cx_mat& get_trial_nonviscous_force() const = 0;
134 [[nodiscard]] virtual const cx_mat& get_current_nonviscous_force() const = 0;
135 [[nodiscard]] virtual const vec& get_trial_inertial_force() = 0;
136 [[nodiscard]] virtual const vec& get_current_inertial_force() = 0;
137
138 [[nodiscard]] virtual const vec& get_trial_body_force() const = 0;
139 [[nodiscard]] virtual const vec& get_current_body_force() const = 0;
140 [[nodiscard]] virtual const vec& get_trial_traction() const = 0;
141 [[nodiscard]] virtual const vec& get_current_traction() const = 0;
142
143 [[nodiscard]] virtual const mat& get_trial_mass() const = 0;
144 [[nodiscard]] virtual const mat& get_trial_viscous() const = 0;
145 [[nodiscard]] virtual const mat& get_trial_nonviscous() const = 0;
146 [[nodiscard]] virtual const mat& get_trial_stiffness() const = 0;
147 [[nodiscard]] virtual const mat& get_trial_geometry() const = 0;
148 [[nodiscard]] virtual const mat& get_trial_secant() const = 0;
149
150 [[nodiscard]] virtual const mat& get_current_mass() const = 0;
151 [[nodiscard]] virtual const mat& get_current_viscous() const = 0;
152 [[nodiscard]] virtual const mat& get_current_nonviscous() const = 0;
153 [[nodiscard]] virtual const mat& get_current_stiffness() const = 0;
154 [[nodiscard]] virtual const mat& get_current_geometry() const = 0;
155 [[nodiscard]] virtual const mat& get_current_secant() const = 0;
156
157 [[nodiscard]] virtual const mat& get_initial_mass() const = 0;
158 [[nodiscard]] virtual const mat& get_initial_viscous() const = 0;
159 [[nodiscard]] virtual const mat& get_initial_nonviscous() const = 0;
160 [[nodiscard]] virtual const mat& get_initial_stiffness() const = 0;
161 [[nodiscard]] virtual const mat& get_initial_geometry() const = 0;
162 [[nodiscard]] virtual const mat& get_initial_secant() const = 0;
163
164 [[nodiscard]] virtual const mat& get_mass_container() const = 0;
165 [[nodiscard]] virtual const mat& get_stiffness_container() const = 0;
166
167 virtual int update_status() = 0;
168 virtual int clear_status() = 0;
169 virtual int commit_status() = 0;
170 virtual int reset_status() = 0;
171
172 virtual const vec& update_body_force(const vec&) = 0;
173 virtual const vec& update_traction(const vec&) = 0;
174
175 virtual std::vector<vec> record(OutputType) = 0;
176
177 [[nodiscard]] virtual double get_strain_energy() const = 0;
178 [[nodiscard]] virtual double get_complementary_energy() const = 0;
179 [[nodiscard]] virtual double get_kinetic_energy() const = 0;
180 [[nodiscard]] virtual double get_viscous_energy() const = 0;
181 [[nodiscard]] virtual double get_nonviscous_energy() const = 0;
182 [[nodiscard]] virtual const vec& get_momentum() const = 0;
183 [[nodiscard]] virtual double get_momentum_component(DOF) const = 0;
184
185 [[nodiscard]] virtual double get_characteristic_length() const = 0;
186
187 [[nodiscard]] virtual mat compute_shape_function(const mat&, unsigned) const = 0;
188};
189
190#endif
191
OutputType
Definition: OutputType.h:23
The DomainBase class is a template.
Definition: DomainBase.h:104
A ElementBase class.
Definition: ElementBase.h:42
virtual void update_dof_encoding()=0
virtual vec get_current_velocity() const =0
virtual const mat & get_current_mass() const =0
virtual bool is_initialized() const =0
virtual const mat & get_current_viscous() const =0
virtual const cx_mat & get_current_nonviscous_force() const =0
virtual const uvec & get_node_encoding() const =0
virtual double get_characteristic_length() const =0
virtual const vec & get_trial_traction() const =0
virtual const mat & get_initial_mass() const =0
virtual bool if_update_geometry() const =0
virtual vec get_node_trial_resistance() const =0
virtual unsigned get_total_number() const =0
virtual int initialize(const shared_ptr< DomainBase > &)=0
virtual mat compute_shape_function(const mat &, unsigned) const =0
virtual const mat & get_mass_container() const =0
virtual vec get_incre_displacement() const =0
virtual int reset_status()=0
virtual bool allow_modify_viscous() const =0
virtual double get_viscous_energy() const =0
virtual double get_kinetic_energy() const =0
ElementBase & operator=(const ElementBase &)=delete
virtual const mat & get_trial_viscous() const =0
virtual std::vector< shared_ptr< Section > > get_section(const shared_ptr< DomainBase > &) const =0
virtual const mat & get_initial_stiffness() const =0
virtual const uvec & get_dof_encoding() const =0
virtual void clear_node_ptr()=0
virtual bool if_update_nonviscous() const =0
ElementBase(const ElementBase &)=delete
virtual double get_momentum_component(DOF) const =0
virtual bool allow_modify_mass() const =0
virtual vec get_trial_acceleration() const =0
virtual const mat & get_current_nonviscous() const =0
virtual double get_nonviscous_energy() const =0
virtual vec get_trial_displacement() const =0
virtual bool if_update_mass() const =0
virtual const vec & get_trial_inertial_force()=0
virtual const uvec & get_material_tag() const =0
virtual const vec & get_current_damping_force() const =0
virtual const mat & get_trial_stiffness() const =0
virtual const mat & get_trial_nonviscous() const =0
virtual vec get_incre_velocity() const =0
virtual void set_initialized(bool) const =0
virtual double get_complementary_energy() const =0
virtual const uvec & get_section_tag() const =0
virtual const mat & get_current_secant() const =0
~ElementBase() override=default
virtual bool if_update_stiffness() const =0
virtual const vec & get_current_inertial_force()=0
virtual int update_status()=0
virtual const vec & get_current_body_force() const =0
virtual const mat & get_initial_nonviscous() const =0
virtual const std::vector< weak_ptr< Node > > & get_node_ptr() const =0
virtual vec get_current_displacement() const =0
virtual const mat & get_trial_geometry() const =0
ElementBase(const unsigned T)
Definition: ElementBase.h:73
virtual int initialize_base(const shared_ptr< DomainBase > &)=0
virtual void set_symmetric(bool) const =0
virtual const mat & get_initial_viscous() const =0
virtual const std::vector< MappingDOF > & get_dof_mapping() const =0
ElementBase & operator=(ElementBase &&)=delete
virtual const mat & get_current_geometry() const =0
virtual const mat & get_trial_secant() const =0
virtual bool is_nlgeom() const =0
virtual const vec & get_trial_resistance() const =0
virtual unsigned get_node_number() const =0
virtual const mat & get_current_stiffness() const =0
virtual const mat & get_initial_geometry() const =0
virtual const vec & get_momentum() const =0
virtual unsigned get_dof_number() const =0
ElementBase(ElementBase &&)=delete
virtual bool if_update_viscous() const =0
friend mat get_coordinate(const ElementBase *, unsigned)
Definition: Element.cpp:643
virtual int commit_status()=0
virtual vec get_node_current_resistance() const =0
virtual const vec & update_traction(const vec &)=0
virtual int clear_status()=0
virtual const vec & get_current_traction() const =0
virtual const vec & get_trial_damping_force() const =0
virtual vec get_node_incre_resistance() const =0
virtual vec get_trial_velocity() const =0
virtual const vec & get_current_resistance() const =0
virtual vec get_current_acceleration() const =0
virtual bool allow_modify_nonviscous() const =0
virtual const mat & get_initial_secant() const =0
virtual const mat & get_stiffness_container() const =0
virtual std::vector< shared_ptr< Material > > get_material(const shared_ptr< DomainBase > &) const =0
virtual std::vector< vec > record(OutputType)=0
virtual const cx_mat & get_trial_nonviscous_force() const =0
virtual const vec & get_trial_body_force() const =0
virtual vec get_incre_acceleration() const =0
virtual double get_strain_energy() const =0
virtual bool is_symmetric() const =0
virtual mat get_coordinate(unsigned) const =0
virtual const vec & update_body_force(const vec &)=0
virtual const mat & get_trial_mass() const =0
A Material abstract base class.
Definition: Material.h:111
The Node class holds the number of DoFs, coordinate, displacement, velocity and acceleration.
Definition: Node.h:80
A Section class.
Definition: Section.h:77
A base Tag class.
Definition: Tag.h:38
The vtkBase class.
Definition: vtkBase.h:44
DOF
Definition: DOF.h:29