41 template<
typename T,
typename Timg>
48 std::string class_name, m_variable, m_type;
49 std::vector<std::string> m_infos;
50 CParameterNetCDF m_paramFile;
52 const char* m_paramPath;
62 class_name=
"Mesh : factory";
66 m_infos.push_back(
"global");
67 m_infos.push_back(
"generate_regularFem");
68 m_infos.push_back(
"generate_centroid");
69 m_infos.push_back(
"generate_centroid_integrated");
70 m_infos.push_back(
"import_image");
97 std::cerr<<class_name<<
" : "<<number<<
" refers to an unknown or incompatible mesh class"<<std::flush;
102 if (m_verbose){printf(
"%s -> %s class loaded\n",class_name.c_str(), m_type.c_str());}
104 pMesh->m_verbose = m_verbose;
105 pMesh->m_type = m_type;
106 pMesh->m_name = m_variable;
108 pMesh->init(m_paramFile);
120 if(type==m_infos[0])
return create(0);
121 else if(type==m_infos[1])
return create(1);
122 else if(type==m_infos[2])
return create(2);
123 else if(type==m_infos[3])
return create(3);
124 else if(type==m_infos[4])
return create(4);
127 std::cerr<<class_name<<
" : "<<type<<
" refers to an unknown or incompatible mesh class"<<std::flush;
137 m_paramFile = paramFile;
140 std::string mesh_name;
143 paramFile.loadVar(var,&m_variable);
144 paramFile.loadAttribute(
"mesh", mesh_name);
146 if(m_verbose){printf(
"mesh name : %s\n", mesh_name.c_str());}
149 if (m_variable.compare(0,3,
"OFI") == 0)
151 std::vector<std::string> modes;
152 m_paramFile.loadAttribute(
"modes", modes);
157 m_variable = mesh_name;
158 paramFile.loadVar(var,&m_variable);
159 paramFile.loadAttribute(
"type", m_type);
161 if(m_verbose){printf(
"mesh type : %s\n", m_type.c_str());}
163 return create(m_type);
170 commandLine(argc,argv);
176 if(m_paramPath!=
"true")
179 NcFile file(m_paramPath,NcFile::ReadOnly);
182 NcToken name =
"dim_mode";
183 NcDim* dim = file.get_dim(name);
186 if(m_verbose){std::cout<<
"num modes : "<<
m_num_mode<<
"\n";}
188 if ( error = m_paramFile.setFile(&file) !=1 )
190 std::cerr<<
"Error while loading"<<m_paramPath<<
" parameter file"<<std::endl;
194 pMesh = create(m_paramFile);
196 if (pMesh == NULL){
return NULL;}
204 std::cout<<
" --mesh option : Command line\n";
205 std::cout<<
" --building!!\n";
216 void commandLine(
int argc,
char *argv[])
220 m_paramPath = cimg_option(
"-p",
"./parameters.nc",
"parameter, mesh or true");
222 m_verbose = cimg_option(
"-v",
false,0);
226 printf(
"Mode Verbose\n");
227 printf(
"%s : %s\n",class_name.c_str(),m_paramPath);
232 void stringSplit(std::string manyString, std::vector<std::string> value)
236 char *split=(
char*)(
" ,;");
238 cstr =
new char [manyString.size()+1];
239 strcpy(cstr,manyString.c_str());
240 ptr=strtok(cstr,split);
243 value.push_back(ptr);
244 ptr=strtok(NULL,split);
253 printf(
"\nclass %s\n",class_name.c_str());
254 for (
int i=0; i<m_infos.size(); i++)
257 printf(
"\t(%i) mode : %s\n",i,m_infos[i].c_str());
Definition: Cmesh_import_image.h:42
As Cmesh_Q4 this class is based on regular and rectangular elements. This class works on 7 main attri...
Definition: Cmesh_generate_centroid.h:58
Cmesh< T, Timg > * create(CParameterNetCDF ¶mFile)
Definition: Cmesh_factory.h:133
As Cmesh_Q4 this class is based on regular and rectangular elements. This class works on 7 main attri...
Definition: Cmesh_generate_centroid_integrated.h:55
Definition: Cmesh_factory.h:42
long m_num_mode
to improve//
Definition: Cmesh_factory.h:56
Class is based on Q4 elements, i.e. 4 nodes elements. This class works on 7 main attributes declared ...
Definition: Cmesh_generate_regularFem.h:52
Cmesh< T, Timg > * create(int argc, char *argv[])
Definition: Cmesh_factory.h:167
Definition: Cmesh_global.h:40