24 #ifndef CSHAPEFUNCTION_GLOBAL_RIGIDBODY
25 #define CSHAPEFUNCTION_GLOBAL_RIGIDBODY
40 template<
typename T,
typename Timg>
46 std::vector<int> m_modRB;
47 std::vector<int> m_range;
52 this->class_name =
"CshapeFunction_global_rigidBody";
56 virtual void init(CParameterNetCDF &fp)
66 for (
int i=0; i<this->m_mods.size(); i++)
68 if (this->m_mods[i] ==
"Tx"){m_modRB.push_back(i);m_range.push_back(0);}
69 if (this->m_mods[i] ==
"Ty"){m_modRB.push_back(i);m_range.push_back(1);}
70 if (this->m_mods[i] ==
"Tz"){m_modRB.push_back(i);m_range.push_back(2);}
71 if (this->m_mods[i] ==
"Rz"){m_modRB.push_back(i);m_range.push_back(3);}
72 if (this->m_mods[i] ==
"Ry"){m_modRB.push_back(i);m_range.push_back(4);}
73 if (this->m_mods[i] ==
"Rx"){m_modRB.push_back(i);m_range.push_back(5);}
76 if (this->m_verbose){std::cout<<
"\tmodes RB : [ ";
for (
int i=0; i<m_modRB.size(); i++){std::cout<<m_modRB[i]<<
" ";}std::cout<<
"]\n";}
77 if (this->m_verbose){std::cout<<
"\trang RB : [ ";
for (
int i=0; i<m_range.size(); i++){std::cout<<m_range[i]<<
" ";}std::cout<<
"]\n";}
81 virtual void exec(
const CImg<Timg> &box,
const std::vector<T> &x, CImgList<T> &N)
84 set(x, m_modRB, m_range, N);
88 void set(
const std::vector<T> &x,
const std::vector<int> &md,
const std::vector<int> &rg, CImgList<T> &N)
94 for(
int mode=0; mode<md.size(); mode++)
97 N[dim][md[mode]] = shape(dim, rg[mode], x);
104 T shape(
const int &dim,
const int &range,
const std::vector<T> &x)
113 case 0:
return 1;
break;
114 case 1:
return 0;
break;
115 case 2:
return 0;
break;
116 case 3:
return -x[1];
break;
117 case 4:
return x[2];
break;
118 case 5:
return 0;
break;
121 std::cerr<<this->class_name<<
"::"<<
": error: mode="<<range<<
" is unknown\n"<<std::flush;
129 case 0:
return 0;
break;
130 case 1:
return 1;
break;
131 case 2:
return 0;
break;
132 case 3:
return x[0];
break;
133 case 4:
return 0;
break;
134 case 5:
return -x[2];
break;
137 std::cerr<<this->class_name<<
"::"<<
": error: mode="<<range<<
" is unknown\n"<<std::flush;
144 case 0:
return 0;
break;
145 case 1:
return 0;
break;
146 case 2:
return 1;
break;
147 case 3:
return 0;
break;
148 case 4:
return -x[0];
break;
149 case 5:
return x[1];
break;
152 std::cerr<<this->class_name<<
"::"<<
": error: mode="<<range<<
" is unknown\n"<<std::flush;
158 std::cerr<<this->class_name<<
"::"<<
": error: dim="<<dim<<
" is unknown\n"<<std::flush;
This is the mother class of global shape function objets (virtual pure). The vector which stores the ...
Definition: CshapeFunction_global.h:40
This class implements Rigid Body shape functions available for 2D and 3D cases. It implements 3 rigid...
Definition: CshapeFunction_global_rigidBody.h:41
virtual void init(CParameterNetCDF &fp)
Definition: CshapeFunction_global_rigidBody.h:56