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_nonviscous_force; // current damping force
58 vec current_inertial_force; // current inertial force
59 vec current_displacement; // current displacement
60 vec current_velocity; // current velocity
61 vec current_acceleration; // current acceleration
62
63 vec incre_resistance; // incremental resistance
64 vec incre_damping_force; // incremental damping force
65 vec incre_nonviscous_force; // incremental damping force
66 vec incre_inertial_force; // incremental inertial force
67 vec incre_displacement; // incremental displacement
68 vec incre_velocity; // incremental velocity
69 vec incre_acceleration; // incremental acceleration
70
71 vec trial_resistance; // trial resistance
72 vec trial_damping_force; // trial damping force
73 vec trial_nonviscous_force; // trial damping force
74 vec trial_inertial_force; // trial inertial force
75 vec trial_displacement; // trial displacement
76 vec trial_velocity; // trial velocity
77 vec trial_acceleration; // trial acceleration
78};
79
80class Node final : protected NodeData, public Tag {
81 bool initialized = false;
82
83 std::mutex node_mutex;
84
85 std::vector<DOF> dof_identifier;
86
87public:
88 explicit Node(unsigned = 0);
89 Node(unsigned, vec&&);
90 Node(unsigned, unsigned);
91 Node(unsigned, unsigned, vec&&);
92 Node(const Node&) = delete; // copy forbidden
93 Node(Node&&) = delete; // move forbidden
94 Node& operator=(const Node&) = delete; // assign forbidden
95 Node& operator=(Node&&) = delete; // assign forbidden
96 ~Node() override = default;
97
98 void initialize(const shared_ptr<DomainBase>&);
99
100 void set_initialized(bool);
101 [[nodiscard]] bool get_initialized() const;
102
103 void set_dof_number(unsigned);
104 [[nodiscard]] unsigned get_dof_number() const;
105
106 void set_dof_identifier(const std::vector<DOF>&);
107 [[nodiscard]] const std::vector<DOF>& get_dof_identifier() const;
108
109 void set_original_dof(unsigned&);
110 void set_original_dof(const uvec&);
111 [[nodiscard]] const uvec& get_original_dof() const;
112
113 void set_reordered_dof(const uvec&);
114 [[nodiscard]] const uvec& get_reordered_dof() const;
115
116 void set_coordinate(const vec&);
117 [[nodiscard]] const vec& get_coordinate() const;
118
119 void set_current_resistance(const vec&);
120 void set_current_damping_force(const vec&);
121 void set_current_nonviscous_force(const vec&);
122 void set_current_inertial_force(const vec&);
123 void set_current_displacement(const vec&);
124 void set_current_velocity(const vec&);
125 void set_current_acceleration(const vec&);
126
127 void set_incre_resistance(const vec&);
128 void set_incre_damping_force(const vec&);
129 void set_incre_nonviscous_force(const vec&);
130 void set_incre_inertial_force(const vec&);
131 void set_incre_displacement(const vec&);
132 void set_incre_velocity(const vec&);
133 void set_incre_acceleration(const vec&);
134
135 void set_trial_resistance(const vec&);
136 void set_trial_damping_force(const vec&);
137 void set_trial_nonviscous_force(const vec&);
138 void set_trial_inertial_force(const vec&);
139 void set_trial_displacement(const vec&);
140 void set_trial_velocity(const vec&);
141 void set_trial_acceleration(const vec&);
142
143 [[nodiscard]] const vec& get_current_resistance() const;
144 [[nodiscard]] const vec& get_current_damping_force() const;
145 [[nodiscard]] const vec& get_current_nonviscous_force() const;
146 [[nodiscard]] const vec& get_current_inertial_force() const;
147 [[nodiscard]] const vec& get_current_displacement() const;
148 [[nodiscard]] const vec& get_current_velocity() const;
149 [[nodiscard]] const vec& get_current_acceleration() const;
150
151 [[nodiscard]] const vec& get_incre_resistance() const;
152 [[nodiscard]] const vec& get_incre_damping_force() const;
153 [[nodiscard]] const vec& get_incre_nonviscous_force() const;
154 [[nodiscard]] const vec& get_incre_inertial_force() const;
155 [[nodiscard]] const vec& get_incre_displacement() const;
156 [[nodiscard]] const vec& get_incre_velocity() const;
157 [[nodiscard]] const vec& get_incre_acceleration() const;
158
159 [[nodiscard]] const vec& get_trial_resistance() const;
160 [[nodiscard]] const vec& get_trial_damping_force() const;
161 [[nodiscard]] const vec& get_trial_nonviscous_force() const;
162 [[nodiscard]] const vec& get_trial_inertial_force() const;
163 [[nodiscard]] const vec& get_trial_displacement() const;
164 [[nodiscard]] const vec& get_trial_velocity() const;
165 [[nodiscard]] const vec& get_trial_acceleration() const;
166
167 void update_current_resistance(const vec&);
168 void update_current_damping_force(const vec&);
169 void update_current_nonviscous_force(const vec&);
170 void update_current_inertial_force(const vec&);
171 void update_current_displacement(const vec&);
172 void update_current_velocity(const vec&);
173 void update_current_acceleration(const vec&);
174
175 void update_incre_resistance(const vec&);
176 void update_incre_damping_force(const vec&);
177 void update_incre_nonviscous_force(const vec&);
178 void update_incre_inertial_force(const vec&);
179 void update_incre_displacement(const vec&);
180 void update_incre_velocity(const vec&);
181 void update_incre_acceleration(const vec&);
182
183 void update_trial_resistance(const vec&);
184 void update_trial_damping_force(const vec&);
185 void update_trial_nonviscous_force(const vec&);
186 void update_trial_inertial_force(const vec&);
187 void update_trial_displacement(const vec&);
188 void update_trial_velocity(const vec&);
189 void update_trial_acceleration(const vec&);
190
191 void update_current_status(const vec&);
192 void update_current_status(const vec&, const vec&);
193 void update_current_status(const vec&, const vec&, const vec&);
194
195 void update_incre_status(const vec&);
196 void update_incre_status(const vec&, const vec&);
197 void update_incre_status(const vec&, const vec&, const vec&);
198
199 void update_trial_status(const vec&);
200 void update_trial_status(const vec&, const vec&);
201 void update_trial_status(const vec&, const vec&, const vec&);
202
203 void commit_status();
204 void reset_status();
205 void clear_status();
206
207 [[nodiscard]] std::vector<vec> record(OutputType) const;
208
209 void print() override;
210};
211
212#endif
213
OutputType
Definition OutputType.h:23
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:80
const vec & get_incre_damping_force() const
Definition Node.cpp:207
Node & operator=(const Node &)=delete
void update_incre_damping_force(const vec &)
Definition Node.cpp:275
const vec & get_coordinate() const
Definition Node.cpp:147
void update_trial_damping_force(const vec &)
Definition Node.cpp:324
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:189
const vec & get_trial_acceleration() const
Definition Node.cpp:231
const vec & get_trial_resistance() const
Definition Node.cpp:219
void set_current_nonviscous_force(const vec &)
Definition Node.cpp:153
~Node() override=default
void set_incre_velocity(const vec &)
Definition Node.cpp:173
const vec & get_incre_resistance() const
Definition Node.cpp:205
void update_incre_displacement(const vec &)
Definition Node.cpp:296
const vec & get_trial_damping_force() const
Definition Node.cpp:221
void set_trial_inertial_force(const vec &)
Definition Node.cpp:183
const vec & get_current_nonviscous_force() const
Definition Node.cpp:195
const vec & get_trial_nonviscous_force() const
Definition Node.cpp:223
void update_current_nonviscous_force(const vec &)
Definition Node.cpp:243
void print() override
Definition Node.cpp:580
void update_incre_inertial_force(const vec &)
Definition Node.cpp:289
const vec & get_incre_inertial_force() const
Definition Node.cpp:211
void update_trial_status(const vec &)
Definition Node.cpp:406
void set_current_acceleration(const vec &)
Definition Node.cpp:161
unsigned get_dof_number() const
Definition Node.cpp:105
void update_current_status(const vec &)
Definition Node.cpp:366
void update_trial_velocity(const vec &)
Definition Node.cpp:352
void set_initialized(bool)
Definition Node.cpp:94
void update_incre_velocity(const vec &)
Definition Node.cpp:303
const vec & get_incre_nonviscous_force() const
Definition Node.cpp:209
void update_current_resistance(const vec &)
Definition Node.cpp:233
void update_current_acceleration(const vec &)
Definition Node.cpp:263
Node(const Node &)=delete
void set_trial_damping_force(const vec &)
Definition Node.cpp:179
void update_current_inertial_force(const vec &)
Definition Node.cpp:248
void set_reordered_dof(const uvec &)
Definition Node.cpp:141
void set_current_displacement(const vec &)
Definition Node.cpp:157
void update_trial_inertial_force(const vec &)
Definition Node.cpp:338
void update_trial_resistance(const vec &)
Definition Node.cpp:317
const uvec & get_reordered_dof() const
Definition Node.cpp:143
const vec & get_incre_velocity() const
Definition Node.cpp:215
void reset_status()
Definition Node.cpp:460
const vec & get_current_resistance() const
Definition Node.cpp:191
void set_dof_identifier(const std::vector< DOF > &)
Definition Node.cpp:107
void set_trial_resistance(const vec &)
Definition Node.cpp:177
const vec & get_incre_displacement() const
Definition Node.cpp:213
const vec & get_trial_inertial_force() const
Definition Node.cpp:225
const vec & get_current_displacement() const
Definition Node.cpp:199
void set_incre_resistance(const vec &)
Definition Node.cpp:163
void set_dof_number(unsigned)
Definition Node.cpp:98
const vec & get_trial_displacement() const
Definition Node.cpp:227
void update_incre_nonviscous_force(const vec &)
Definition Node.cpp:282
void clear_status()
Definition Node.cpp:491
void set_incre_damping_force(const vec &)
Definition Node.cpp:165
void set_current_damping_force(const vec &)
Definition Node.cpp:151
void set_incre_nonviscous_force(const vec &)
Definition Node.cpp:167
void update_trial_nonviscous_force(const vec &)
Definition Node.cpp:331
void update_trial_acceleration(const vec &)
Definition Node.cpp:359
void set_trial_nonviscous_force(const vec &)
Definition Node.cpp:181
void set_trial_velocity(const vec &)
Definition Node.cpp:187
void set_current_velocity(const vec &)
Definition Node.cpp:159
void set_incre_acceleration(const vec &)
Definition Node.cpp:175
void commit_status()
Definition Node.cpp:429
std::vector< vec > record(OutputType) const
Definition Node.cpp:531
const vec & get_current_velocity() const
Definition Node.cpp:201
void update_current_velocity(const vec &)
Definition Node.cpp:258
const vec & get_current_acceleration() const
Definition Node.cpp:203
const vec & get_current_damping_force() const
Definition Node.cpp:193
void set_current_resistance(const vec &)
Definition Node.cpp:149
void set_current_inertial_force(const vec &)
Definition Node.cpp:155
const vec & get_trial_velocity() const
Definition Node.cpp:229
const vec & get_current_inertial_force() const
Definition Node.cpp:197
void update_incre_acceleration(const vec &)
Definition Node.cpp:310
void set_trial_displacement(const vec &)
Definition Node.cpp:185
void update_trial_displacement(const vec &)
Definition Node.cpp:345
void set_incre_displacement(const vec &)
Definition Node.cpp:171
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:253
const vec & get_incre_acceleration() const
Definition Node.cpp:217
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:238
void set_incre_inertial_force(const vec &)
Definition Node.cpp:169
void update_incre_resistance(const vec &)
Definition Node.cpp:268
void update_incre_status(const vec &)
Definition Node.cpp:383
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:67
vec trial_damping_force
Definition Node.h:72
vec incre_resistance
Definition Node.h:63
vec trial_nonviscous_force
Definition Node.h:73
vec current_resistance
Definition Node.h:55
vec incre_inertial_force
Definition Node.h:66
vec current_damping_force
Definition Node.h:56
vec current_displacement
Definition Node.h:59
vec trial_acceleration
Definition Node.h:77
vec current_velocity
Definition Node.h:60
vec current_acceleration
Definition Node.h:61
vec trial_inertial_force
Definition Node.h:74
vec trial_displacement
Definition Node.h:75
vec trial_velocity
Definition Node.h:76
vec current_inertial_force
Definition Node.h:58
uvec original_dof
Definition Node.h:52
vec incre_nonviscous_force
Definition Node.h:65
vec incre_velocity
Definition Node.h:68
vec coordinate
Definition Node.h:50
vec incre_damping_force
Definition Node.h:64
uvec reordered_dof
Definition Node.h:53
vec current_nonviscous_force
Definition Node.h:57
vec incre_acceleration
Definition Node.h:69
vec trial_resistance
Definition Node.h:71