24 #ifndef CFIELD_FACTORY
25 #define CFIELD_FACTORY
40 #include "Cfield_intercor.h"
41 #include "Cfield_opticalFlow.h"
42 #include "Cfield_opticalFlow_fem.h"
43 #include "Cfield_opticalFlow_integrated.h"
44 #include "Cfield_opticalFlow_integrated_block.h"
51 template<
typename T,
typename Timg>
58 std::vector<std::string> m_infos;
59 std::string class_name, m_type, m_variable;
60 CParameterNetCDF m_paramFile;
62 const char* m_paramPath;
69 class_name =
"Field : factory";
76 m_infos.push_back(
"field_IC");
77 m_infos.push_back(
"field_OFI");
78 m_infos.push_back(
"field_OFIB");
79 m_infos.push_back(
"field_OFFEM");
96 std::cerr<<class_name<<
" : "<<number<<
" refers to an unknown or incompatible correlation class"<<std::flush;
101 if (m_verbose){printf(
"%s -> %s class loaded\n",class_name.c_str(), m_type.c_str());}
104 pField->m_paramPath = m_paramPath;
106 pField->m_verbose = m_verbose;
108 pField->m_type = m_type;
110 pField->m_name = m_variable;
113 pField->init(m_paramFile);
125 if(type==m_infos[0])
return create(0);
126 else if(type==m_infos[1])
return create(1);
127 else if(type==m_infos[2])
return create(2);
128 else if(type==m_infos[3])
return create(3);
129 else{std::cerr<<class_name<<
" : "<<type<<
" refers to an unknown or incompatible correlation class"<<std::flush;
return NULL;}
136 m_paramFile = paramFile;
138 std::string type_name;
141 paramFile.loadVar(var,&m_variable);
142 paramFile.loadAttribute(
"type", type_name);
144 if(m_verbose){printf(
"correlation type : %s\n", type_name.c_str());}
146 if (type_name.compare(0,2,
"IC") == 0)
147 {m_type =
"field_IC";}
148 else if(type_name.compare(0,4,
"OFIB") == 0)
149 {m_type =
"field_OFIB";}
150 else if(type_name.compare(0,3,
"OFI") == 0)
151 {m_type =
"field_OFI";}
152 else if(type_name.compare(0,5,
"OFFEM") == 0)
153 {m_type =
"field_OFFEM";}
155 {std::cerr<<class_name<<
" : "<<type_name<<
" is unknown"<<std::flush;
return NULL;}
157 if(m_verbose){printf(
"field type : %s\n", m_type.c_str());}
166 commandLine(argc,argv);
172 if(m_paramPath!=
"true")
176 NcFile file(m_paramPath,NcFile::ReadOnly);
178 error = m_paramFile.setFile(&file);
179 if ( error != 1 ){std::cerr<<
"Error while loading"<<m_paramPath<<
" parameter file"<<std::endl;
return NULL;}
181 pField =
create(m_paramFile);
182 if (pField == NULL){std::cerr<<
"Error while loading"<<pField<<
" pointer"<<std::endl;
return NULL;}
190 std::cout<<
" --correlator option : Command line\n";
191 std::cout<<
" --building!!\n";
203 void commandLine(
int argc,
char *argv[])
207 m_paramPath = cimg_option(
"-p",
"./parameters.nc",
"parameter, mesh or true");
209 m_verbose = cimg_option(
"-v",
false,0);
213 printf(
"Mode Verbose\n");
214 printf(
"%s : %s\n",class_name.c_str(),m_paramPath);
222 printf(
"\nclass %s\n",class_name.c_str());
223 for (
int i=0; i<m_infos.size(); i++)
226 printf(
"\t(%i) mode : %s\n",i,m_infos[i].c_str());
In this class, specific projection field method is implemented. In the case of F.E.M. the node value is equal to the field at node position, so "fromField2Mod" simply implements a parallelized loop over elements and extracts from previous fields the node value at node location.
Definition: Cfield_opticalFlow_fem.h:49
Cfield_factory(const std::string name)
Definition: Cfield_factory.h:66
Cfield< T, Timg > * create(const int &number)
Definition: Cfield_factory.h:83
In this class, specific projection field method is implemented. In the case of O.F.F.E.M. the node value must be identified through a projection, so "fromField2Mod" implements a parallelized loop over image pixel and identifies modes from a least square method strategy.
Definition: Cfield_opticalFlow_integrated.h:50
In this class, specific projection field method is implemented. In the case of O.F.F.E.M. the node value must be identified through a projection, so "fromField2Mod" implements a parallelized loop over image pixel and identifies modes from a least square method strategy.
Definition: Cfield_opticalFlow_integrated_block.h:49
Definition: Cfield_intercor.h:46
It returns a pointer toward a specific field container according to a parameter.nc file...
Definition: Cfield_factory.h:52