38 #include <boost/thread.hpp>
54 "Reads mesh configuration and will generate the mesh file.");
69 vector<string> filename;
70 filename.push_back(nm);
74 ASSERTL0(pSession->DefinesElement(
"NEKTAR/MESHING"),
"no meshing tag");
75 ASSERTL0(pSession->DefinesElement(
"NEKTAR/MESHING/INFORMATION"),
76 "no information tag");
77 ASSERTL0(pSession->DefinesElement(
"NEKTAR/MESHING/PARAMETERS"),
80 TiXmlElement *mcf = pSession->GetElement(
"NEKTAR/MESHING");
82 TiXmlElement *info = mcf->FirstChildElement(
"INFORMATION");
83 TiXmlElement *I = info->FirstChildElement(
"I");
84 map<string, string> information;
88 I->QueryStringAttribute(
"PROPERTY", &tmp1);
89 I->QueryStringAttribute(
"VALUE", &tmp2);
90 information[tmp1] = tmp2;
91 I = I->NextSiblingElement(
"I");
94 TiXmlElement *param = mcf->FirstChildElement(
"PARAMETERS");
95 TiXmlElement *
P = param->FirstChildElement(
"P");
96 map<string, string> parameters;
100 P->QueryStringAttribute(
"PARAM", &tmp1);
101 P->QueryStringAttribute(
"VALUE", &tmp2);
102 parameters[tmp1] = tmp2;
103 P = P->NextSiblingElement(
"P");
106 set<string> boolparameters;
108 if (pSession->DefinesElement(
"NEKTAR/MESHING/BOOLPARAMETERS"))
110 TiXmlElement *bparam = mcf->FirstChildElement(
"BOOLPARAMETERS");
111 TiXmlElement *BP = bparam->FirstChildElement(
"P");
116 BP->QueryStringAttribute(
"VALUE", &tmp);
117 boolparameters.insert(tmp);
118 BP = BP->NextSiblingElement(
"P");
122 set<string> refinement;
123 if(pSession->DefinesElement(
"NEKTAR/MESHING/REFINEMENT"))
125 TiXmlElement *refine = mcf->FirstChildElement(
"REFINEMENT");
126 TiXmlElement *
L = refine->FirstChildElement(
"LINE");
131 TiXmlElement *T = L->FirstChildElement(
"X1");
132 ss << T->GetText() <<
",";
133 T = L->FirstChildElement(
"Y1");
134 ss << T->GetText() <<
",";
135 T = L->FirstChildElement(
"Z1");
136 ss << T->GetText() <<
",";
137 T = L->FirstChildElement(
"X2");
138 ss << T->GetText() <<
",";
139 T = L->FirstChildElement(
"Y2");
140 ss << T->GetText() <<
",";
141 T = L->FirstChildElement(
"Z2");
142 ss << T->GetText() <<
",";
143 T = L->FirstChildElement(
"R");
144 ss << T->GetText() <<
",";
145 T = L->FirstChildElement(
"D");
148 refinement.insert(ss.str());
150 L = L->NextSiblingElement(
"LINE");
156 it = information.find(
"CADFile");
157 ASSERTL0(it != information.end(),
"no cadfile defined");
160 it = information.find(
"MeshType");
161 ASSERTL0(it != information.end(),
"no meshtype defined");
162 m_makeBL = it->second ==
"3DBndLayer";
163 m_2D = it->second ==
"2D";
164 if (it->second ==
"2DBndLayer")
169 if(!m_makeBL && !
m_2D)
171 ASSERTL0(it->second ==
"3D",
"unsure on MeshType")
175 it = parameters.find(
"MinDelta");
176 ASSERTL0(it != parameters.end(),
"no mindelta defined");
179 it = parameters.find(
"MaxDelta");
180 ASSERTL0(it != parameters.end(),
"no maxdelta defined");
183 it = parameters.find(
"EPS");
184 ASSERTL0(it != parameters.end(),
"no eps defined");
187 it = parameters.find(
"Order");
188 ASSERTL0(it != parameters.end(),
"no order defined");
193 it = parameters.find(
"BndLayerSurfaces");
194 ASSERTL0(it != parameters.end(),
"no BndLayersurfs defined");
197 it = parameters.find(
"BndLayerThickness");
198 ASSERTL0(it != parameters.end(),
"no BndLayerthick defined");
201 it = parameters.find(
"BndLayerLayers");
206 it = parameters.find(
"BndLayerProgression");
207 m_blprog = it != parameters.end() ? it->second :
"2.0";
212 if(
m_2D && m_cadfile.find(
'.') == std::string::npos)
217 it = parameters.find(
"Xmin");
218 ASSERTL0(it != parameters.end(),
"no xmin defined");
219 ss << it->second <<
",";
220 it = parameters.find(
"Ymin");
221 ASSERTL0(it != parameters.end(),
"no ymin defined");
222 ss << it->second <<
",";
223 it = parameters.find(
"Xmax");
224 ASSERTL0(it != parameters.end(),
"no xmax defined");
225 ss << it->second <<
",";
226 it = parameters.find(
"Ymax");
227 ASSERTL0(it != parameters.end(),
"no zmax defined");
228 ss << it->second <<
",";
229 it = parameters.find(
"AOA");
230 ASSERTL0(it != parameters.end(),
"no aoa defined");
237 sit = boolparameters.find(
"SurfaceOptimiser");
239 sit = boolparameters.find(
"WriteOctree");
240 m_woct = sit != boolparameters.end();
241 sit = boolparameters.find(
"VariationalOptimiser");
248 for(sit = refinement.begin(); sit != refinement.end(); sit++)
266 vector<ModuleSharedPtr> mods;
271 mods.back()->RegisterConfig(
"filename",
m_cadfile);
275 mods.back()->RegisterConfig(
"2D",
"");
285 mods.back()->RegisterConfig(
"mindel",
m_minDelta);
286 mods.back()->RegisterConfig(
"maxdel",
m_maxDelta);
287 mods.back()->RegisterConfig(
"eps",
m_eps);
290 mods.back()->RegisterConfig(
"refinement",
m_refinement);
294 mods.back()->RegisterConfig(
"writeoctree",
"");
305 mods.back()->RegisterConfig(
"blcurves",
m_blsurfs);
306 mods.back()->RegisterConfig(
"blthick",
m_blthick);
320 mods.back()->RegisterConfig(
"blsurfs",
m_blsurfs);
321 mods.back()->RegisterConfig(
"blthick",
m_blthick);
322 mods.back()->RegisterConfig(
"bllayers",
m_bllayers);
323 mods.back()->RegisterConfig(
"blprog",
m_blprog);
332 mods.back()->RegisterConfig(
"opti",
"");
338 unsigned int np = boost::thread::physical_concurrency();
341 cout <<
"Detecting 4 cores, will attempt to run in parrallel" << endl;
345 mods.back()->RegisterConfig(
"hyperelastic",
"");
346 mods.back()->RegisterConfig(
"maxiter",
"10");
347 mods.back()->RegisterConfig(
"numthreads",boost::lexical_cast<string>(np));
355 mods.back()->RegisterConfig(
"layers",
m_bllayers);
356 mods.back()->RegisterConfig(
"surf",
m_blsurfs);
357 mods.back()->RegisterConfig(
"nq",boost::lexical_cast<string>(
m_mesh->m_nummode));
358 mods.back()->RegisterConfig(
"r",
m_blprog);
361 for(
int i = 0; i < mods.size(); i++)
363 mods[i]->SetDefaults();
#define ASSERTL0(condition, msg)
pair< ModuleType, string > ModuleKey
MeshSharedPtr m_mesh
Mesh object.
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
static SessionReaderSharedPtr CreateInstance(int argc, char *argv[])
Creates an instance of the SessionReader class.
std::map< std::string, ConfigOption > m_config
List of configuration values.
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
boost::shared_ptr< Mesh > MeshSharedPtr
Shared pointer to a mesh.
std::pair< ModuleType, std::string > ModuleKey
ModuleFactory & GetModuleFactory()
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.