Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | List of all members
Nektar::Utilities::InputMCF Class Reference

#include <InputMCF.h>

Inheritance diagram for Nektar::Utilities::InputMCF:
Inheritance graph
[legend]
Collaboration diagram for Nektar::Utilities::InputMCF:
Collaboration graph
[legend]

Public Member Functions

 InputMCF (NekMeshUtils::MeshSharedPtr m)
 Set up InputCAD object. More...
 
virtual ~InputMCF ()
 
virtual void Process ()
 
void ParseFile (std::string nm)
 
- Public Member Functions inherited from Nektar::NekMeshUtils::InputModule
NEKMESHUTILS_EXPORT InputModule (MeshSharedPtr p_m)
 
NEKMESHUTILS_EXPORT void OpenStream ()
 Open a file for input. More...
 
- Public Member Functions inherited from Nektar::NekMeshUtils::Module
NEKMESHUTILS_EXPORT Module (MeshSharedPtr p_m)
 
NEKMESHUTILS_EXPORT void RegisterConfig (std::string key, std::string value)
 Register a configuration option with a module. More...
 
NEKMESHUTILS_EXPORT void PrintConfig ()
 Print out all configuration options for a module. More...
 
NEKMESHUTILS_EXPORT void SetDefaults ()
 Sets default configuration options for those which have not been set. More...
 
NEKMESHUTILS_EXPORT MeshSharedPtr GetMesh ()
 
virtual NEKMESHUTILS_EXPORT void ProcessVertices ()
 Extract element vertices. More...
 
virtual NEKMESHUTILS_EXPORT void ProcessEdges (bool ReprocessEdges=true)
 Extract element edges. More...
 
virtual NEKMESHUTILS_EXPORT void ProcessFaces (bool ReprocessFaces=true)
 Extract element faces. More...
 
virtual NEKMESHUTILS_EXPORT void ProcessElements ()
 Generate element IDs. More...
 
virtual NEKMESHUTILS_EXPORT void ProcessComposites ()
 Generate composites. More...
 
virtual NEKMESHUTILS_EXPORT void ClearElementLinks ()
 

Static Public Member Functions

static
NekMeshUtils::ModuleSharedPtr 
create (NekMeshUtils::MeshSharedPtr m)
 Creates an instance of this class. More...
 

Static Public Attributes

static NekMeshUtils::ModuleKey className
 ModuleKey for class. More...
 

Private Attributes

std::string m_minDelta
 
std::string m_maxDelta
 
std::string m_eps
 
std::string m_cadfile
 
std::string m_order
 
std::string m_blsurfs
 
std::string m_blthick
 
std::string m_blprog
 
std::string m_bllayers
 
std::string m_refinement
 
std::string m_nacadomain
 
bool m_makeBL
 
bool m_surfopti
 
bool m_varopti
 
bool m_refine
 
bool m_woct
 
bool m_2D
 
bool m_splitBL
 
bool m_naca
 

Additional Inherited Members

- Protected Member Functions inherited from Nektar::NekMeshUtils::InputModule
NEKMESHUTILS_EXPORT void PrintSummary ()
 Print summary of elements. More...
 
- Protected Member Functions inherited from Nektar::NekMeshUtils::Module
NEKMESHUTILS_EXPORT void ReorderPrisms (PerMap &perFaces)
 Reorder node IDs so that prisms and tetrahedra are aligned correctly. More...
 
NEKMESHUTILS_EXPORT void PrismLines (int prism, PerMap &perFaces, std::set< int > &prismsDone, std::vector< ElementSharedPtr > &line)
 
- Protected Attributes inherited from Nektar::NekMeshUtils::InputModule
io::filtering_istream m_mshFile
 Input stream. More...
 
std::ifstream m_mshFileStream
 Input stream. More...
 
- Protected Attributes inherited from Nektar::NekMeshUtils::Module
MeshSharedPtr m_mesh
 Mesh object. More...
 
std::map< std::string,
ConfigOption
m_config
 List of configuration values. More...
 

Detailed Description

Definition at line 46 of file InputMCF.h.

Constructor & Destructor Documentation

Nektar::Utilities::InputMCF::InputMCF ( NekMeshUtils::MeshSharedPtr  m)

Set up InputCAD object.

Definition at line 59 of file InputMCF.cpp.

59  : InputModule(m)
60 {
61 }
NEKMESHUTILS_EXPORT InputModule(MeshSharedPtr p_m)
Nektar::Utilities::InputMCF::~InputMCF ( )
virtual

Definition at line 63 of file InputMCF.cpp.

64 {
65 }

Member Function Documentation

static NekMeshUtils::ModuleSharedPtr Nektar::Utilities::InputMCF::create ( NekMeshUtils::MeshSharedPtr  m)
inlinestatic

Creates an instance of this class.

Definition at line 54 of file InputMCF.h.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr().

55  {
57  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
void Nektar::Utilities::InputMCF::ParseFile ( std::string  nm)

Definition at line 67 of file InputMCF.cpp.

References ASSERTL0, Nektar::LibUtilities::SessionReader::CreateInstance(), Nektar::iterator, L, m_2D, m_bllayers, m_blprog, m_blsurfs, m_blthick, m_cadfile, m_eps, m_makeBL, m_maxDelta, m_minDelta, m_naca, m_nacadomain, m_order, m_refine, m_refinement, m_splitBL, m_surfopti, m_varopti, m_woct, and class_topology::P.

Referenced by Process().

68 {
69  vector<string> filename;
70  filename.push_back(nm);
73 
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"),
78  "no parameters tag");
79 
80  TiXmlElement *mcf = pSession->GetElement("NEKTAR/MESHING");
81 
82  TiXmlElement *info = mcf->FirstChildElement("INFORMATION");
83  TiXmlElement *I = info->FirstChildElement("I");
84  map<string, string> information;
85  while (I)
86  {
87  string tmp1, tmp2;
88  I->QueryStringAttribute("PROPERTY", &tmp1);
89  I->QueryStringAttribute("VALUE", &tmp2);
90  information[tmp1] = tmp2;
91  I = I->NextSiblingElement("I");
92  }
93 
94  TiXmlElement *param = mcf->FirstChildElement("PARAMETERS");
95  TiXmlElement *P = param->FirstChildElement("P");
96  map<string, string> parameters;
97  while (P)
98  {
99  string tmp1, tmp2;
100  P->QueryStringAttribute("PARAM", &tmp1);
101  P->QueryStringAttribute("VALUE", &tmp2);
102  parameters[tmp1] = tmp2;
103  P = P->NextSiblingElement("P");
104  }
105 
106  set<string> boolparameters;
107 
108  if (pSession->DefinesElement("NEKTAR/MESHING/BOOLPARAMETERS"))
109  {
110  TiXmlElement *bparam = mcf->FirstChildElement("BOOLPARAMETERS");
111  TiXmlElement *BP = bparam->FirstChildElement("P");
112 
113  while (BP)
114  {
115  string tmp;
116  BP->QueryStringAttribute("VALUE", &tmp);
117  boolparameters.insert(tmp);
118  BP = BP->NextSiblingElement("P");
119  }
120  }
121 
122  set<string> refinement;
123  if(pSession->DefinesElement("NEKTAR/MESHING/REFINEMENT"))
124  {
125  TiXmlElement *refine = mcf->FirstChildElement("REFINEMENT");
126  TiXmlElement *L = refine->FirstChildElement("LINE");
127 
128  while (L)
129  {
130  stringstream ss;
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");
146  ss << T->GetText();
147 
148  refinement.insert(ss.str());
149 
150  L = L->NextSiblingElement("LINE");
151  }
152  }
153 
155 
156  it = information.find("CADFile");
157  ASSERTL0(it != information.end(), "no cadfile defined");
158  m_cadfile = it->second;
159 
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")
165  {
166  m_makeBL = true;
167  m_2D = true;
168  }
169  if(!m_makeBL && !m_2D)
170  {
171  ASSERTL0(it->second == "3D", "unsure on MeshType")
172  }
173 
174 
175  it = parameters.find("MinDelta");
176  ASSERTL0(it != parameters.end(), "no mindelta defined");
177  m_minDelta = it->second;
178 
179  it = parameters.find("MaxDelta");
180  ASSERTL0(it != parameters.end(), "no maxdelta defined");
181  m_maxDelta = it->second;
182 
183  it = parameters.find("EPS");
184  ASSERTL0(it != parameters.end(), "no eps defined");
185  m_eps = it->second;
186 
187  it = parameters.find("Order");
188  ASSERTL0(it != parameters.end(), "no order defined");
189  m_order = it->second;
190 
191  if (m_makeBL)
192  {
193  it = parameters.find("BndLayerSurfaces");
194  ASSERTL0(it != parameters.end(), "no BndLayersurfs defined");
195  m_blsurfs = it->second;
196 
197  it = parameters.find("BndLayerThickness");
198  ASSERTL0(it != parameters.end(), "no BndLayerthick defined");
199  m_blthick = it->second;
200 
201  it = parameters.find("BndLayerLayers");
202  m_splitBL = it != parameters.end();
203  if(m_splitBL)
204  {
205  m_bllayers = it->second;
206  it = parameters.find("BndLayerProgression");
207  m_blprog = it != parameters.end() ? it->second : "2.0";
208  }
209  }
210 
211  m_naca = false;
212  if(m_2D && m_cadfile.find('.') == std::string::npos)
213  {
214  m_naca = true;
215 
216  stringstream ss;
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");
231  ss << it->second;
232 
233  m_nacadomain = ss.str();
234  }
235 
237  sit = boolparameters.find("SurfaceOptimiser");
238  m_surfopti = sit != boolparameters.end();
239  sit = boolparameters.find("WriteOctree");
240  m_woct = sit != boolparameters.end();
241  sit = boolparameters.find("VariationalOptimiser");
242  m_varopti = sit != boolparameters.end();
243 
244  m_refine = refinement.size() > 0;
245  if(m_refine)
246  {
247  stringstream ss;
248  for(sit = refinement.begin(); sit != refinement.end(); sit++)
249  {
250  ss << *sit;
251  ss << ":";
252  }
253  m_refinement = ss.str();
254  m_refinement.erase(m_refinement.end()-1);
255  }
256 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:198
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Definition: MeshPartition.h:51
static SessionReaderSharedPtr CreateInstance(int argc, char *argv[])
Creates an instance of the SessionReader class.
std::string m_nacadomain
Definition: InputMCF.h:64
NekDouble L
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
std::string m_refinement
Definition: InputMCF.h:64
void Nektar::Utilities::InputMCF::Process ( )
virtual

Implements Nektar::NekMeshUtils::Module.

Definition at line 258 of file InputMCF.cpp.

References Nektar::FieldUtils::eProcessModule, Nektar::FieldUtils::GetModuleFactory(), m_2D, m_bllayers, m_blprog, m_blsurfs, m_blthick, m_cadfile, Nektar::NekMeshUtils::Module::m_config, m_eps, m_makeBL, m_maxDelta, Nektar::NekMeshUtils::Module::m_mesh, m_minDelta, m_naca, m_nacadomain, m_order, m_refine, m_refinement, m_splitBL, m_surfopti, m_varopti, m_woct, and ParseFile().

259 {
260  ParseFile(m_config["infile"].as<string>());
261 
262  m_mesh->m_expDim = 3;
263  m_mesh->m_spaceDim = 3;
264  m_mesh->m_nummode = boost::lexical_cast<int>(m_order) + 1;
265 
266  vector<ModuleSharedPtr> mods;
267 
268  ////**** CAD ****////
269  mods.push_back(GetModuleFactory().CreateInstance(
270  ModuleKey(eProcessModule, "loadcad"), m_mesh));
271  mods.back()->RegisterConfig("filename", m_cadfile);
272 
273  if(m_2D)
274  {
275  mods.back()->RegisterConfig("2D","");
276  }
277  if(m_naca)
278  {
279  mods.back()->RegisterConfig("NACA",m_nacadomain);
280  }
281 
282  ////**** Octree ****////
283  mods.push_back(GetModuleFactory().CreateInstance(
284  ModuleKey(eProcessModule, "loadoctree"), m_mesh));
285  mods.back()->RegisterConfig("mindel", m_minDelta);
286  mods.back()->RegisterConfig("maxdel", m_maxDelta);
287  mods.back()->RegisterConfig("eps", m_eps);
288  if (m_refine)
289  {
290  mods.back()->RegisterConfig("refinement", m_refinement);
291  }
292  if (m_woct)
293  {
294  mods.back()->RegisterConfig("writeoctree", "");
295  }
296 
297  if(m_2D)
298  {
299  m_mesh->m_expDim = 2;
300  m_mesh->m_spaceDim = 2;
301  mods.push_back(GetModuleFactory().CreateInstance(
302  ModuleKey(eProcessModule, "2dgenerator"), m_mesh));
303  if (m_makeBL)
304  {
305  mods.back()->RegisterConfig("blcurves", m_blsurfs);
306  mods.back()->RegisterConfig("blthick", m_blthick);
307  }
308  }
309  else
310  {
311  ////**** SurfaceMesh ****////
312  mods.push_back(GetModuleFactory().CreateInstance(
313  ModuleKey(eProcessModule, "surfacemesh"), m_mesh));
314 
315  ////**** VolumeMesh ****////
316  mods.push_back(GetModuleFactory().CreateInstance(
317  ModuleKey(eProcessModule, "volumemesh"), m_mesh));
318  if(m_makeBL)
319  {
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);
324  }
325  }
326 
327  ////**** HOSurface ****////
328  mods.push_back(GetModuleFactory().CreateInstance(
329  ModuleKey(eProcessModule, "hosurface"), m_mesh));
330  if (m_surfopti)
331  {
332  mods.back()->RegisterConfig("opti", "");
333  }
334 
335  ////*** VARIATIONAL OPTIMISATION ****////
336  if(m_varopti)
337  {
338  unsigned int np = boost::thread::physical_concurrency();
339  if(m_mesh->m_verbose)
340  {
341  cout << "Detecting 4 cores, will attempt to run in parrallel" << endl;
342  }
343  mods.push_back(GetModuleFactory().CreateInstance(
344  ModuleKey(eProcessModule, "varopti"), m_mesh));
345  mods.back()->RegisterConfig("hyperelastic","");
346  mods.back()->RegisterConfig("maxiter","10");
347  mods.back()->RegisterConfig("numthreads",boost::lexical_cast<string>(np));
348  }
349 
350  ////**** SPLIT BL ****////
351  if(m_splitBL)
352  {
353  mods.push_back(GetModuleFactory().CreateInstance(
354  ModuleKey(eProcessModule, "bl"), m_mesh));
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);
359  }
360 
361  for(int i = 0; i < mods.size(); i++)
362  {
363  mods[i]->SetDefaults();
364  mods[i]->Process();
365  }
366 }
pair< ModuleType, string > ModuleKey
std::string m_nacadomain
Definition: InputMCF.h:64
void ParseFile(std::string nm)
Definition: InputMCF.cpp:67
std::map< std::string, ConfigOption > m_config
List of configuration values.
std::string m_refinement
Definition: InputMCF.h:64
ModuleFactory & GetModuleFactory()

Member Data Documentation

ModuleKey Nektar::Utilities::InputMCF::className
static
Initial value:
"Reads mesh configuration and will generate the mesh file.")

ModuleKey for class.

Definition at line 59 of file InputMCF.h.

bool Nektar::Utilities::InputMCF::m_2D
private

Definition at line 67 of file InputMCF.h.

Referenced by ParseFile(), and Process().

std::string Nektar::Utilities::InputMCF::m_bllayers
private

Definition at line 64 of file InputMCF.h.

Referenced by ParseFile(), and Process().

std::string Nektar::Utilities::InputMCF::m_blprog
private

Definition at line 64 of file InputMCF.h.

Referenced by ParseFile(), and Process().

std::string Nektar::Utilities::InputMCF::m_blsurfs
private

Definition at line 64 of file InputMCF.h.

Referenced by ParseFile(), and Process().

std::string Nektar::Utilities::InputMCF::m_blthick
private

Definition at line 64 of file InputMCF.h.

Referenced by ParseFile(), and Process().

std::string Nektar::Utilities::InputMCF::m_cadfile
private

Definition at line 64 of file InputMCF.h.

Referenced by ParseFile(), and Process().

std::string Nektar::Utilities::InputMCF::m_eps
private

Definition at line 64 of file InputMCF.h.

Referenced by ParseFile(), and Process().

bool Nektar::Utilities::InputMCF::m_makeBL
private

Definition at line 67 of file InputMCF.h.

Referenced by ParseFile(), and Process().

std::string Nektar::Utilities::InputMCF::m_maxDelta
private

Definition at line 64 of file InputMCF.h.

Referenced by ParseFile(), and Process().

std::string Nektar::Utilities::InputMCF::m_minDelta
private

Definition at line 64 of file InputMCF.h.

Referenced by ParseFile(), and Process().

bool Nektar::Utilities::InputMCF::m_naca
private

Definition at line 67 of file InputMCF.h.

Referenced by ParseFile(), and Process().

std::string Nektar::Utilities::InputMCF::m_nacadomain
private

Definition at line 64 of file InputMCF.h.

Referenced by ParseFile(), and Process().

std::string Nektar::Utilities::InputMCF::m_order
private

Definition at line 64 of file InputMCF.h.

Referenced by ParseFile(), and Process().

bool Nektar::Utilities::InputMCF::m_refine
private

Definition at line 67 of file InputMCF.h.

Referenced by ParseFile(), and Process().

std::string Nektar::Utilities::InputMCF::m_refinement
private

Definition at line 64 of file InputMCF.h.

Referenced by ParseFile(), and Process().

bool Nektar::Utilities::InputMCF::m_splitBL
private

Definition at line 67 of file InputMCF.h.

Referenced by ParseFile(), and Process().

bool Nektar::Utilities::InputMCF::m_surfopti
private

Definition at line 67 of file InputMCF.h.

Referenced by ParseFile(), and Process().

bool Nektar::Utilities::InputMCF::m_varopti
private

Definition at line 67 of file InputMCF.h.

Referenced by ParseFile(), and Process().

bool Nektar::Utilities::InputMCF::m_woct
private

Definition at line 67 of file InputMCF.h.

Referenced by ParseFile(), and Process().