24 #ifndef CSHAPEFUNCTION_FACTORY
25 #define CSHAPEFUNCTION_FACTORY
36 #include "CshapeFunction_FEM.h"
44 template<
typename T,
typename Timg>
51 std::vector<std::string> m_infos;
52 std::string class_name, m_variable, m_type;
53 CParameterNetCDF m_paramFile;
55 const char* m_paramPath;
62 class_name =
"CshapeFunction_factory";
65 m_infos.push_back(
"rigid_body");
66 m_infos.push_back(
"image");
67 m_infos.push_back(
"blade");
68 m_infos.push_back(
"homogeneous");
69 m_infos.push_back(
"brasilian");
70 m_infos.push_back(
"Q4");
71 m_infos.push_back(
"C8");
91 std::cerr<<class_name<<
" : "<<number<<
" refers to an unknown or incompatible correlation class"<<std::flush;
96 if (m_verbose){printf(
"%s -> %s class loaded\n",class_name.c_str(), m_type.c_str());}
98 pShape->m_verbose = m_verbose;
99 pShape->m_paramPath = m_paramPath;
101 pShape->m_type = m_type;
102 pShape->m_name = m_variable;
104 pShape->init(m_paramFile);
116 if(type == m_infos[0])
return create(0);
117 else if(type==m_infos[1])
return create(1);
118 else if(type==m_infos[2])
return create(2);
119 else if(type==m_infos[3])
return create(3);
120 else if(type==m_infos[4])
return create(4);
121 else if(type==m_infos[5])
return create(5);
122 else if(type==m_infos[6])
return create(6);
125 std::cerr<<class_name<<
"::"<<__func__<<
": error: type = "<<type<<
" is unknown.\n"<<std::flush;
134 m_paramFile = paramFile;
138 paramFile.loadVar(var,&m_variable);
139 m_paramFile.loadAttribute(
"shape",m_type);
141 return create(m_type);
148 commandLine(argc,argv);
154 if(m_paramPath!=
"true")
157 NcFile file(m_paramPath,NcFile::ReadOnly);
159 if ( error = m_paramFile.setFile(&file) !=1 )
161 std::cerr<<
"Error while loading"<<m_paramPath<<
" parameter file"<<std::endl;
165 pShape = create(m_paramFile);
166 if (pShape == NULL){
return NULL;}
174 std::cout<<
" --correlator option : Command line\n";
175 std::cout<<
" --building!!\n";
187 void commandLine(
int argc,
char *argv[])
191 m_paramPath = cimg_option(
"-p",
"./parameters.nc",
"parameter, mesh or true");
193 m_verbose = cimg_option(
"-v",
false,0);
197 printf(
"Mode Verbose\n");
198 printf(
"%s : %s\n",class_name.c_str(),m_paramPath);
203 void stringSplit(std::string manyString, std::vector<std::string> value)
207 char *split=(
char*)(
" ,;");
209 cstr =
new char [manyString.size()+1];
210 strcpy(cstr,manyString.c_str());
211 ptr=strtok(cstr,split);
214 value.push_back(ptr);
215 ptr=strtok(NULL,split);
224 printf(
"\nclass %s\n",class_name.c_str());
225 for (
int i=0; i<m_infos.size(); i++)
228 printf(
"\t(%i) mode : %s\n",i,m_infos[i].c_str());
This factory create a pointer toward the required ShapeFunction class. The pointer creation could onl...
Definition: CshapeFunction_factory.h:45
This class implements C8P1 shape functions available for 3D cases.
Definition: CshapeFunction_FEM_C8.h:39
This class implements Q4P1 shape functions available for 2D cases.
Definition: CshapeFunction_FEM_Q4.h:39
This class implements Homogeneous deformation shape functions available for 2D and 3D cases...
Definition: CshapeFunction_global_homogeneous.h:41
This is the mother class of shape function objets (virtual pure).
Definition: CshapeFunction.h:48
This class implements Brasilian shape functions available for 2D case (isotropic elasticity). The implemented mode is called "B" and a link toward Homogeneous modes is provided. Brasilian mode within the entire set of required modes by user is noted "m_modB" and the identified parameter is 1/E with E the Young modulus:
Definition: CshapeFunction_global_brasilian.h:46
Definition: CshapeFunction_global_image.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
This class implements Blade flexion and compression shape functions available for 2D case (CL encastr...
Definition: CshapeFunction_global_blade.h:44