18#ifndef NODE_HELPER_HPP
19#define NODE_HELPER_HPP
28template<
DOF... D> vec
get_trial_position(
const shared_ptr<Node>&) {
throw std::logic_error(
"not implemented"); }
38template<
DOF... D> vec
get_trial_velocity(
const shared_ptr<Node>&) {
throw std::logic_error(
"not implemented"); }
44template<
DOF... D> vec
get_incre_velocity(
const shared_ptr<Node>&) {
throw std::logic_error(
"not implemented"); }
48template<>
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;
53template<>
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;
58template<>
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;
63template<>
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);
69template<>
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);
75template<>
inline vec get_current_displacement<DOF::U1>(
const shared_ptr<Node>& t_node) {
return t_node->get_current_displacement().head(1); }
77template<>
inline vec get_current_velocity<DOF::U1>(
const shared_ptr<Node>& t_node) {
return t_node->get_current_velocity().head(1); }
79template<>
inline vec get_current_acceleration<DOF::U1>(
const shared_ptr<Node>& t_node) {
return t_node->get_current_acceleration().head(1); }
81template<>
inline vec get_trial_displacement<DOF::U1>(
const shared_ptr<Node>& t_node) {
return t_node->get_trial_displacement().head(1); }
83template<>
inline vec get_trial_velocity<DOF::U1>(
const shared_ptr<Node>& t_node) {
return t_node->get_trial_velocity().head(1); }
85template<>
inline vec get_trial_acceleration<DOF::U1>(
const shared_ptr<Node>& t_node) {
return t_node->get_trial_acceleration().head(1); }
87template<>
inline vec get_incre_displacement<DOF::U1>(
const shared_ptr<Node>& t_node) {
return t_node->get_incre_displacement().head(1); }
89template<>
inline vec get_incre_velocity<DOF::U1>(
const shared_ptr<Node>& t_node) {
return t_node->get_incre_velocity().head(1); }
91template<>
inline vec get_incre_acceleration<DOF::U1>(
const shared_ptr<Node>& t_node) {
return t_node->get_incre_acceleration().head(1); }
93template<>
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);
100template<>
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);
107template<>
inline vec get_current_displacement<DOF::U1, DOF::U2>(
const shared_ptr<Node>& t_node) {
return t_node->get_current_displacement().head(2); }
109template<>
inline vec get_current_velocity<DOF::U1, DOF::U2>(
const shared_ptr<Node>& t_node) {
return t_node->get_current_velocity().head(2); }
111template<>
inline vec get_current_acceleration<DOF::U1, DOF::U2>(
const shared_ptr<Node>& t_node) {
return t_node->get_current_acceleration().head(2); }
113template<>
inline vec get_trial_displacement<DOF::U1, DOF::U2>(
const shared_ptr<Node>& t_node) {
return t_node->get_trial_displacement().head(2); }
115template<>
inline vec get_trial_velocity<DOF::U1, DOF::U2>(
const shared_ptr<Node>& t_node) {
return t_node->get_trial_velocity().head(2); }
117template<>
inline vec get_trial_acceleration<DOF::U1, DOF::U2>(
const shared_ptr<Node>& t_node) {
return t_node->get_trial_acceleration().head(2); }
119template<>
inline vec get_incre_displacement<DOF::U1, DOF::U2>(
const shared_ptr<Node>& t_node) {
return t_node->get_incre_displacement().head(2); }
121template<>
inline vec get_incre_velocity<DOF::U1, DOF::U2>(
const shared_ptr<Node>& t_node) {
return t_node->get_incre_velocity().head(2); }
123template<>
inline vec get_incre_acceleration<DOF::U1, DOF::U2>(
const shared_ptr<Node>& t_node) {
return t_node->get_incre_acceleration().head(2); }
125template<>
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);
132template<>
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);
139template<>
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); }
141template<>
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); }
143template<>
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); }
145template<>
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); }
147template<>
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); }
149template<>
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); }
151template<>
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); }
153template<>
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); }
155template<>
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