suanPan
Loading...
Searching...
No Matches
Node.h
Go to the documentation of this file.
1/*******************************************************************************
2 * Copyright (C) 2017-2023 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 ******************************************************************************/
38#ifndef NODE_H
39#define NODE_H
40
41#include <Domain/Tag.h>
42
43class DomainBase;
44enum class OutputType;
45enum class DOF : unsigned short;
46
47struct NodeData {
48 unsigned num_dof = 0; // number of DoFs
49
50 vec coordinate; // coordinates of the node
51
52 uvec original_dof; // original indices
53 uvec reordered_dof; // renumbered indices
54
55 vec current_resistance; // current resistance
56 vec current_damping_force; // current damping force
57 vec current_inertial_force; // current inertial force
58 vec current_displacement; // current displacement
59 vec current_velocity; // current velocity
60 vec current_acceleration; // current acceleration
61
62 vec incre_resistance; // incremental resistance
63 vec incre_damping_force; // incremental damping force
64 vec incre_inertial_force; // incremental inertial force
65 vec incre_displacement; // incremental displacement
66 vec incre_velocity; // incremental velocity
67 vec incre_acceleration; // incremental acceleration
68
69 vec trial_resistance; // trial resistance
70 vec trial_damping_force; // trial damping force
71 vec trial_inertial_force; // trial inertial force
72 vec trial_displacement; // trial displacement
73 vec trial_velocity; // trial velocity
74 vec trial_acceleration; // trial acceleration
75};
76
77class Node final : protected NodeData, public Tag {
78 bool initialized = false;
79
80 std::mutex node_mutex;
81
82 std::vector<DOF> dof_identifier;
83
84public:
85 explicit Node(unsigned = 0);
86 Node(unsigned, vec&&);
87 Node(unsigned, unsigned);
88 Node(unsigned, unsigned, vec&&);
89 Node(const Node&) = delete; // copy forbidden
90 Node(Node&&) = delete; // move forbidden
91 Node& operator=(const Node&) = delete; // assign forbidden
92 Node& operator=(Node&&) = delete; // assign forbidden
93 ~Node() override = default;
94
95 void initialize(const shared_ptr<DomainBase>&);
96
97 void set_initialized(bool);
98 [[nodiscard]] bool get_initialized() const;
99
100 void set_dof_number(unsigned);
101 [[nodiscard]] unsigned get_dof_number() const;
102
103 void set_dof_identifier(const std::vector<DOF>&);
104 [[nodiscard]] const std::vector<DOF>& get_dof_identifier() const;
105
106 void set_original_dof(unsigned&);
107 void set_original_dof(const uvec&);
108 [[nodiscard]] const uvec& get_original_dof() const;
109
110 void set_reordered_dof(const uvec&);
111 [[nodiscard]] const uvec& get_reordered_dof() const;
112
113 void set_coordinate(const vec&);
114 [[nodiscard]] const vec& get_coordinate() const;
115
116 void set_current_resistance(const vec&);
117 void set_current_damping_force(const vec&);
118 void set_current_inertial_force(const vec&);
119 void set_current_displacement(const vec&);
120 void set_current_velocity(const vec&);
121 void set_current_acceleration(const vec&);
122
123 void set_incre_resistance(const vec&);
124 void set_incre_damping_force(const vec&);
125 void set_incre_inertial_force(const vec&);
126 void set_incre_displacement(const vec&);
127 void set_incre_velocity(const vec&);
128 void set_incre_acceleration(const vec&);
129
130 void set_trial_resistance(const vec&);
131 void set_trial_damping_force(const vec&);
132 void set_trial_inertial_force(const vec&);
133 void set_trial_displacement(const vec&);
134 void set_trial_velocity(const vec&);
135 void set_trial_acceleration(const vec&);
136
137 [[nodiscard]] const vec& get_current_resistance() const;
138 [[nodiscard]] const vec& get_current_damping_force() const;
139 [[nodiscard]] const vec& get_current_inertial_force() const;
140 [[nodiscard]] const vec& get_current_displacement() const;
141 [[nodiscard]] const vec& get_current_velocity() const;
142 [[nodiscard]] const vec& get_current_acceleration() const;
143
144 [[nodiscard]] const vec& get_incre_resistance() const;
145 [[nodiscard]] const vec& get_incre_damping_force() const;
146 [[nodiscard]] const vec& get_incre_inertial_force() const;
147 [[nodiscard]] const vec& get_incre_displacement() const;
148 [[nodiscard]] const vec& get_incre_velocity() const;
149 [[nodiscard]] const vec& get_incre_acceleration() const;
150
151 [[nodiscard]] const vec& get_trial_resistance() const;
152 [[nodiscard]] const vec& get_trial_damping_force() const;
153 [[nodiscard]] const vec& get_trial_inertial_force() const;
154 [[nodiscard]] const vec& get_trial_displacement() const;
155 [[nodiscard]] const vec& get_trial_velocity() const;
156 [[nodiscard]] const vec& get_trial_acceleration() const;
157
158 void update_current_resistance(const vec&);
159 void update_current_damping_force(const vec&);
160 void update_current_inertial_force(const vec&);
161 void update_current_displacement(const vec&);
162 void update_current_velocity(const vec&);
163 void update_current_acceleration(const vec&);
164
165 void update_incre_resistance(const vec&);
166 void update_incre_damping_force(const vec&);
167 void update_incre_inertial_force(const vec&);
168 void update_incre_displacement(const vec&);
169 void update_incre_velocity(const vec&);
170 void update_incre_acceleration(const vec&);
171
172 void update_trial_resistance(const vec&);
173 void update_trial_damping_force(const vec&);
174 void update_trial_inertial_force(const vec&);
175 void update_trial_displacement(const vec&);
176 void update_trial_velocity(const vec&);
177 void update_trial_acceleration(const vec&);
178
179 void update_current_status(const vec&);
180 void update_current_status(const vec&, const vec&);
181 void update_current_status(const vec&, const vec&, const vec&);
182
183 void update_incre_status(const vec&);
184 void update_incre_status(const vec&, const vec&);
185 void update_incre_status(const vec&, const vec&, const vec&);
186
187 void update_trial_status(const vec&);
188 void update_trial_status(const vec&, const vec&);
189 void update_trial_status(const vec&, const vec&, const vec&);
190
191 void commit_status();
192 void reset_status();
193 void clear_status();
194
195 [[nodiscard]] std::vector<vec> record(OutputType) const;
196
197 void print() override;
198};
199
200#endif
201
OutputType
Definition OutputType.h:21
The DomainBase class is a template.
Definition DomainBase.h:104
The Node class holds the number of DoFs, coordinate, displacement, velocity and acceleration.
Definition Node.h:77
const vec & get_incre_damping_force() const
Definition Node.cpp:199
Node & operator=(const Node &)=delete
void update_incre_damping_force(const vec &)
Definition Node.cpp:258
const vec & get_coordinate() const
Definition Node.cpp:147
void update_trial_damping_force(const vec &)
Definition Node.cpp:300
void set_coordinate(const vec &)
Definition Node.cpp:145
const std::vector< DOF > & get_dof_identifier() const
Definition Node.cpp:120
const uvec & get_original_dof() const
Definition Node.cpp:139
void set_trial_acceleration(const vec &)
Definition Node.cpp:183
const vec & get_trial_acceleration() const
Definition Node.cpp:219
const vec & get_trial_resistance() const
Definition Node.cpp:209
~Node() override=default
void set_incre_velocity(const vec &)
Definition Node.cpp:169
const vec & get_incre_resistance() const
Definition Node.cpp:197
void update_incre_displacement(const vec &)
Definition Node.cpp:272
const vec & get_trial_damping_force() const
Definition Node.cpp:211
void set_trial_inertial_force(const vec &)
Definition Node.cpp:177
void print() override
Definition Node.cpp:536
void update_incre_inertial_force(const vec &)
Definition Node.cpp:265
const vec & get_incre_inertial_force() const
Definition Node.cpp:201
void update_trial_status(const vec &)
Definition Node.cpp:375
void set_current_acceleration(const vec &)
Definition Node.cpp:159
unsigned get_dof_number() const
Definition Node.cpp:105
void update_current_status(const vec &)
Definition Node.cpp:335
void update_trial_velocity(const vec &)
Definition Node.cpp:321
void set_initialized(bool)
Definition Node.cpp:94
void update_incre_velocity(const vec &)
Definition Node.cpp:279
void update_current_resistance(const vec &)
Definition Node.cpp:221
void update_current_acceleration(const vec &)
Definition Node.cpp:246
Node(const Node &)=delete
void set_trial_damping_force(const vec &)
Definition Node.cpp:175
void update_current_inertial_force(const vec &)
Definition Node.cpp:231
void set_reordered_dof(const uvec &)
Definition Node.cpp:141
void set_current_displacement(const vec &)
Definition Node.cpp:155
void update_trial_inertial_force(const vec &)
Definition Node.cpp:307
void update_trial_resistance(const vec &)
Definition Node.cpp:293
const uvec & get_reordered_dof() const
Definition Node.cpp:143
const vec & get_incre_velocity() const
Definition Node.cpp:205
void reset_status()
Definition Node.cpp:425
const vec & get_current_resistance() const
Definition Node.cpp:185
void set_dof_identifier(const std::vector< DOF > &)
Definition Node.cpp:107
void set_trial_resistance(const vec &)
Definition Node.cpp:173
const vec & get_incre_displacement() const
Definition Node.cpp:203
const vec & get_trial_inertial_force() const
Definition Node.cpp:213
const vec & get_current_displacement() const
Definition Node.cpp:191
void set_incre_resistance(const vec &)
Definition Node.cpp:161
void set_dof_number(unsigned)
Definition Node.cpp:98
const vec & get_trial_displacement() const
Definition Node.cpp:215
void clear_status()
Definition Node.cpp:452
void set_incre_damping_force(const vec &)
Definition Node.cpp:163
void set_current_damping_force(const vec &)
Definition Node.cpp:151
void update_trial_acceleration(const vec &)
Definition Node.cpp:328
void set_trial_velocity(const vec &)
Definition Node.cpp:181
void set_current_velocity(const vec &)
Definition Node.cpp:157
void set_incre_acceleration(const vec &)
Definition Node.cpp:171
void commit_status()
Definition Node.cpp:398
std::vector< vec > record(OutputType) const
Definition Node.cpp:487
const vec & get_current_velocity() const
Definition Node.cpp:193
void update_current_velocity(const vec &)
Definition Node.cpp:241
const vec & get_current_acceleration() const
Definition Node.cpp:195
const vec & get_current_damping_force() const
Definition Node.cpp:187
void set_current_resistance(const vec &)
Definition Node.cpp:149
void set_current_inertial_force(const vec &)
Definition Node.cpp:153
const vec & get_trial_velocity() const
Definition Node.cpp:217
const vec & get_current_inertial_force() const
Definition Node.cpp:189
void update_incre_acceleration(const vec &)
Definition Node.cpp:286
void set_trial_displacement(const vec &)
Definition Node.cpp:179
void update_trial_displacement(const vec &)
Definition Node.cpp:314
void set_incre_displacement(const vec &)
Definition Node.cpp:167
void set_original_dof(unsigned &)
Definition Node.cpp:122
Node(Node &&)=delete
bool get_initialized() const
Definition Node.cpp:96
void update_current_displacement(const vec &)
Definition Node.cpp:236
const vec & get_incre_acceleration() const
Definition Node.cpp:207
void initialize(const shared_ptr< DomainBase > &)
This method should be called after Element objects are set. Element objects will set the minimum numb...
Definition Node.cpp:65
Node & operator=(Node &&)=delete
void update_current_damping_force(const vec &)
Definition Node.cpp:226
void set_incre_inertial_force(const vec &)
Definition Node.cpp:165
void update_incre_resistance(const vec &)
Definition Node.cpp:251
void update_incre_status(const vec &)
Definition Node.cpp:352
A base Tag class.
Definition Tag.h:38
DOF
Definition DOF.h:29
Definition Node.h:47
unsigned num_dof
Definition Node.h:48
vec incre_displacement
Definition Node.h:65
vec trial_damping_force
Definition Node.h:70
vec incre_resistance
Definition Node.h:62
vec current_resistance
Definition Node.h:55
vec incre_inertial_force
Definition Node.h:64
vec current_damping_force
Definition Node.h:56
vec current_displacement
Definition Node.h:58
vec trial_acceleration
Definition Node.h:74
vec current_velocity
Definition Node.h:59
vec current_acceleration
Definition Node.h:60
vec trial_inertial_force
Definition Node.h:71
vec trial_displacement
Definition Node.h:72
vec trial_velocity
Definition Node.h:73
vec current_inertial_force
Definition Node.h:57
uvec original_dof
Definition Node.h:52
vec incre_velocity
Definition Node.h:66
vec coordinate
Definition Node.h:50
vec incre_damping_force
Definition Node.h:63
uvec reordered_dof
Definition Node.h:53
vec incre_acceleration
Definition Node.h:67
vec trial_resistance
Definition Node.h:69