18 #ifndef NODE_HELPER_HPP
19 #define NODE_HELPER_HPP
28 template<
DOF... D> vec
get_trial_position(
const shared_ptr<Node>&) {
throw std::logic_error(
"not implemented"); }
38 template<
DOF... D> vec
get_trial_velocity(
const shared_ptr<Node>&) {
throw std::logic_error(
"not implemented"); }
44 template<
DOF... D> vec
get_incre_velocity(
const shared_ptr<Node>&) {
throw std::logic_error(
"not implemented"); }
48 template<>
inline bool check_dof_definition<DOF::U1>(
const shared_ptr<Node>& t_node) {
49 auto& t_dof = t_node->get_dof_identifier();
50 return !t_dof.empty() && t_dof.at(0) ==
DOF::U1;
53 template<>
inline bool check_dof_definition<DOF::U1, DOF::U2>(
const shared_ptr<Node>& t_node) {
54 auto& t_dof = t_node->get_dof_identifier();
55 return t_dof.size() > 1 && t_dof.at(0) ==
DOF::U1 && t_dof.at(1) ==
DOF::U2;
58 template<>
inline bool check_dof_definition<DOF::U1, DOF::U2, DOF::U3>(
const shared_ptr<Node>& t_node) {
59 auto& t_dof = t_node->get_dof_identifier();
60 return t_dof.size() > 2 && t_dof.at(0) ==
DOF::U1 && t_dof.at(1) ==
DOF::U2 && t_dof.at(2) ==
DOF::U3;
63 template<>
inline vec get_current_position<DOF::U1>(
const shared_ptr<Node>& t_node) {
64 vec t_vec = t_node->get_current_displacement().head(1);
65 if(
auto& t_coor = t_node->get_coordinate(); !t_coor.empty()) t_vec(0) += t_coor(0);
69 template<>
inline vec get_trial_position<DOF::U1>(
const shared_ptr<Node>& t_node) {
70 vec t_vec = t_node->get_trial_displacement().head(1);
71 if(
auto& t_coor = t_node->get_coordinate(); !t_coor.empty()) t_vec(0) += t_coor(0);
75 template<>
inline vec get_current_displacement<DOF::U1>(
const shared_ptr<Node>& t_node) {
return t_node->get_current_displacement().head(1); }
77 template<>
inline vec get_current_velocity<DOF::U1>(
const shared_ptr<Node>& t_node) {
return t_node->get_current_velocity().head(1); }
79 template<>
inline vec get_current_acceleration<DOF::U1>(
const shared_ptr<Node>& t_node) {
return t_node->get_current_acceleration().head(1); }
81 template<>
inline vec get_trial_displacement<DOF::U1>(
const shared_ptr<Node>& t_node) {
return t_node->get_trial_displacement().head(1); }
83 template<>
inline vec get_trial_velocity<DOF::U1>(
const shared_ptr<Node>& t_node) {
return t_node->get_trial_velocity().head(1); }
85 template<>
inline vec get_trial_acceleration<DOF::U1>(
const shared_ptr<Node>& t_node) {
return t_node->get_trial_acceleration().head(1); }
87 template<>
inline vec get_incre_displacement<DOF::U1>(
const shared_ptr<Node>& t_node) {
return t_node->get_incre_displacement().head(1); }
89 template<>
inline vec get_incre_velocity<DOF::U1>(
const shared_ptr<Node>& t_node) {
return t_node->get_incre_velocity().head(1); }
91 template<>
inline vec get_incre_acceleration<DOF::U1>(
const shared_ptr<Node>& t_node) {
return t_node->get_incre_acceleration().head(1); }
93 template<>
inline vec get_current_position<DOF::U1, DOF::U2>(
const shared_ptr<Node>& t_node) {
94 const auto& t_coor = t_node->get_coordinate();
95 vec t_vec = t_node->get_current_displacement().head(2);
96 for(
auto I = 0llu; I < std::min(2llu, t_coor.n_elem); ++I) t_vec(I) += t_coor(I);
100 template<>
inline vec get_trial_position<DOF::U1, DOF::U2>(
const shared_ptr<Node>& t_node) {
101 const auto& t_coor = t_node->get_coordinate();
102 vec t_vec = t_node->get_trial_displacement().head(2);
103 for(
auto I = 0llu; I < std::min(2llu, t_coor.n_elem); ++I) t_vec(I) += t_coor(I);
107 template<>
inline vec get_current_displacement<DOF::U1, DOF::U2>(
const shared_ptr<Node>& t_node) {
return t_node->get_current_displacement().head(2); }
109 template<>
inline vec get_current_velocity<DOF::U1, DOF::U2>(
const shared_ptr<Node>& t_node) {
return t_node->get_current_velocity().head(2); }
111 template<>
inline vec get_current_acceleration<DOF::U1, DOF::U2>(
const shared_ptr<Node>& t_node) {
return t_node->get_current_acceleration().head(2); }
113 template<>
inline vec get_trial_displacement<DOF::U1, DOF::U2>(
const shared_ptr<Node>& t_node) {
return t_node->get_trial_displacement().head(2); }
115 template<>
inline vec get_trial_velocity<DOF::U1, DOF::U2>(
const shared_ptr<Node>& t_node) {
return t_node->get_trial_velocity().head(2); }
117 template<>
inline vec get_trial_acceleration<DOF::U1, DOF::U2>(
const shared_ptr<Node>& t_node) {
return t_node->get_trial_acceleration().head(2); }
119 template<>
inline vec get_incre_displacement<DOF::U1, DOF::U2>(
const shared_ptr<Node>& t_node) {
return t_node->get_incre_displacement().head(2); }
121 template<>
inline vec get_incre_velocity<DOF::U1, DOF::U2>(
const shared_ptr<Node>& t_node) {
return t_node->get_incre_velocity().head(2); }
123 template<>
inline vec get_incre_acceleration<DOF::U1, DOF::U2>(
const shared_ptr<Node>& t_node) {
return t_node->get_incre_acceleration().head(2); }
125 template<>
inline vec get_current_position<DOF::U1, DOF::U2, DOF::U3>(
const shared_ptr<Node>& t_node) {
126 const auto& t_coor = t_node->get_coordinate();
127 vec t_vec = t_node->get_current_displacement().head(3);
128 for(
auto I = 0llu; I < std::min(3llu, t_coor.n_elem); ++I) t_vec(I) += t_coor(I);
132 template<>
inline vec get_trial_position<DOF::U1, DOF::U2, DOF::U3>(
const shared_ptr<Node>& t_node) {
133 const auto& t_coor = t_node->get_coordinate();
134 vec t_vec = t_node->get_trial_displacement().head(3);
135 for(
auto I = 0llu; I < std::min(3llu, t_coor.n_elem); ++I) t_vec(I) += t_coor(I);
139 template<>
inline vec get_current_displacement<DOF::U1, DOF::U2, DOF::U3>(
const shared_ptr<Node>& t_node) {
return t_node->get_current_displacement().head(3); }
141 template<>
inline vec get_current_velocity<DOF::U1, DOF::U2, DOF::U3>(
const shared_ptr<Node>& t_node) {
return t_node->get_current_velocity().head(3); }
143 template<>
inline vec get_current_acceleration<DOF::U1, DOF::U2, DOF::U3>(
const shared_ptr<Node>& t_node) {
return t_node->get_current_acceleration().head(3); }
145 template<>
inline vec get_trial_displacement<DOF::U1, DOF::U2, DOF::U3>(
const shared_ptr<Node>& t_node) {
return t_node->get_trial_displacement().head(3); }
147 template<>
inline vec get_trial_velocity<DOF::U1, DOF::U2, DOF::U3>(
const shared_ptr<Node>& t_node) {
return t_node->get_trial_velocity().head(3); }
149 template<>
inline vec get_trial_acceleration<DOF::U1, DOF::U2, DOF::U3>(
const shared_ptr<Node>& t_node) {
return t_node->get_trial_acceleration().head(3); }
151 template<>
inline vec get_incre_displacement<DOF::U1, DOF::U2, DOF::U3>(
const shared_ptr<Node>& t_node) {
return t_node->get_incre_displacement().head(3); }
153 template<>
inline vec get_incre_velocity<DOF::U1, DOF::U2, DOF::U3>(
const shared_ptr<Node>& t_node) {
return t_node->get_incre_velocity().head(3); }
155 template<>
inline vec get_incre_acceleration<DOF::U1, DOF::U2, DOF::U3>(
const shared_ptr<Node>& t_node) {
return t_node->get_incre_acceleration().head(3); }
vec get_current_displacement(const shared_ptr< Node > &)
Definition: NodeHelper.hpp:30
vec get_current_acceleration(const shared_ptr< Node > &)
Definition: NodeHelper.hpp:34
vec get_current_velocity(const shared_ptr< Node > &)
Definition: NodeHelper.hpp:32
vec get_incre_velocity(const shared_ptr< Node > &)
Definition: NodeHelper.hpp:44
vec get_incre_displacement(const shared_ptr< Node > &)
Definition: NodeHelper.hpp:42
bool check_dof_definition(const shared_ptr< Node > &)
Definition: NodeHelper.hpp:24
vec get_current_position(const shared_ptr< Node > &)
Definition: NodeHelper.hpp:26
vec get_incre_acceleration(const shared_ptr< Node > &)
Definition: NodeHelper.hpp:46
vec get_trial_acceleration(const shared_ptr< Node > &)
Definition: NodeHelper.hpp:40
vec get_trial_position(const shared_ptr< Node > &)
Definition: NodeHelper.hpp:28
vec get_trial_velocity(const shared_ptr< Node > &)
Definition: NodeHelper.hpp:38
vec get_trial_displacement(const shared_ptr< Node > &)
Definition: NodeHelper.hpp:36