24 #ifndef CSHAPEFUNCTION_GLOBAL_HOMOGENEOUS
25 #define CSHAPEFUNCTION_GLOBAL_HOMOGENEOUS
40 template<
typename T,
typename Timg>
46 std::vector<int> m_modHD;
47 std::vector<int> m_range;
52 this->class_name =
"CshapeFunction_global_homogeneous";
56 virtual void init(CParameterNetCDF &fp)
66 for (
int i=0; i<this->m_mods.size(); i++)
68 if (this->m_mods[i] ==
"D"){m_modHD.push_back(i);m_range.push_back(0);}
69 if (this->m_mods[i] ==
"Exx"){m_modHD.push_back(i);m_range.push_back(1);}
70 if (this->m_mods[i] ==
"Eyy"){m_modHD.push_back(i);m_range.push_back(2);}
71 if (this->m_mods[i] ==
"Ezz"){m_modHD.push_back(i);m_range.push_back(3);}
72 if (this->m_mods[i] ==
"Exy"){m_modHD.push_back(i);m_range.push_back(4);}
73 if (this->m_mods[i] ==
"Exz"){m_modHD.push_back(i);m_range.push_back(5);}
74 if (this->m_mods[i] ==
"Eyz"){m_modHD.push_back(i);m_range.push_back(6);}
77 if (this->m_verbose){std::cout<<
"\tmodes HD : [ ";
for (
int i=0; i<m_modHD.size(); i++){std::cout<<m_modHD[i]<<
" ";}std::cout<<
"]\n";}
81 virtual void exec(
const CImg<Timg> &box,
const std::vector<T> &x, CImgList<T> &N)
87 set(x, m_modHD, m_range, N);
91 void set(
const std::vector<T> &x,
const std::vector<int> &md,
const std::vector<int> &rg, CImgList<T> &N)
97 for(
int mode=0; mode<md.size(); mode++)
100 N[dim][md[mode]] = shape(dim, rg[mode], x);
107 T shape(
const int &dim,
const int &range,
const std::vector<T> &x)
117 case 0:
return x[0];
break;
118 case 1:
return x[0];
break;
119 case 2:
return 0;
break;
120 case 3:
return 0;
break;
121 case 4:
return x[1];
break;
122 case 5:
return x[2];
break;
123 case 6:
return 0;
break;
126 std::cerr<<this->class_name<<
"::"<<
": error: mode="<<range<<
" is unknown\n"<<std::flush;
134 case 0:
return x[1];
break;
135 case 1:
return 0;
break;
136 case 2:
return x[1];
break;
137 case 3:
return 0;
break;
138 case 4:
return x[0];
break;
139 case 5:
return 0;
break;
140 case 6:
return x[2];
break;
143 std::cerr<<this->class_name<<
"::"<<
": error: mode="<<range<<
" is unknown\n"<<std::flush;
150 case 0:
return x[2];
break;
151 case 1:
return 0;
break;
152 case 2:
return 0;
break;
153 case 3:
return x[2];
break;
154 case 4:
return 0;
break;
155 case 5:
return x[2];
break;
156 case 6:
return x[1];
break;
159 std::cerr<<this->class_name<<
"::"<<
": error: mode="<<range<<
" is unknown\n"<<std::flush;
165 std::cerr<<this->class_name<<
"::"<<
": error: dim="<<dim<<
" is unknown\n"<<std::flush;
This class implements Homogeneous deformation shape functions available for 2D and 3D cases...
Definition: CshapeFunction_global_homogeneous.h:41
virtual void init(CParameterNetCDF &fp)
Definition: CshapeFunction_global_homogeneous.h:56
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