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

#include <InputCAD.h>

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

Public Member Functions

 InputCAD (MeshSharedPtr m)
 Set up InputCAD object. More...
 
virtual ~InputCAD ()
 
virtual void Process ()
 
- Public Member Functions inherited from Nektar::Utilities::InputModule
 InputModule (FieldSharedPtr p_m)
 
void AddFile (string fileType, string fileName)
 
 InputModule (MeshSharedPtr p_m)
 
void OpenStream ()
 Open a file for input. More...
 
- Public Member Functions inherited from Nektar::Utilities::Module
 Module (FieldSharedPtr p_f)
 
virtual void Process (po::variables_map &vm)=0
 
virtual std::string GetModuleName ()=0
 
void RegisterConfig (string key, string value)
 Register a configuration option with a module. More...
 
void PrintConfig ()
 Print out all configuration options for a module. More...
 
void SetDefaults ()
 Sets default configuration options for those which have not been set. More...
 
bool GetRequireEquiSpaced (void)
 
void SetRequireEquiSpaced (bool pVal)
 
void EvaluateTriFieldAtEquiSpacedPts (LocalRegions::ExpansionSharedPtr &exp, const Array< OneD, const NekDouble > &infield, Array< OneD, NekDouble > &outfield)
 
 Module (MeshSharedPtr p_m)
 
void RegisterConfig (std::string key, std::string value)
 
void PrintConfig ()
 
void SetDefaults ()
 
MeshSharedPtr GetMesh ()
 
virtual void ProcessVertices ()
 Extract element vertices. More...
 
virtual void ProcessEdges (bool ReprocessEdges=true)
 Extract element edges. More...
 
virtual void ProcessFaces (bool ReprocessFaces=true)
 Extract element faces. More...
 
virtual void ProcessElements ()
 Generate element IDs. More...
 
virtual void ProcessComposites ()
 Generate composites. More...
 
virtual void ClearElementLinks ()
 

Static Public Member Functions

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

Static Public Attributes

static ModuleKey className
 ModuleKey for class. More...
 

Private Attributes

NekDouble m_minDelta
 
NekDouble m_maxDelta
 
NekDouble m_eps
 
NekDouble m_blthick
 
int m_order
 
string m_CADName
 
string m_udsName
 
bool m_makeBL
 
bool m_writeoctree
 

Additional Inherited Members

- Protected Member Functions inherited from Nektar::Utilities::InputModule
void PrintSummary ()
 Print summary of elements. More...
 
void PrintSummary ()
 Print summary of elements. More...
 
- Protected Member Functions inherited from Nektar::Utilities::Module
 Module ()
 
void ReorderPrisms (PerMap &perFaces)
 Reorder node IDs so that prisms and tetrahedra are aligned correctly. More...
 
void PrismLines (int prism, PerMap &perFaces, std::set< int > &prismsDone, std::vector< ElementSharedPtr > &line)
 
- Protected Attributes inherited from Nektar::Utilities::InputModule
set< string > m_allowedFiles
 
std::ifstream m_mshFile
 Input stream. More...
 
- Protected Attributes inherited from Nektar::Utilities::Module
FieldSharedPtr m_f
 Field object. More...
 
map< string, ConfigOptionm_config
 List of configuration values. More...
 
bool m_requireEquiSpaced
 
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 InputCAD.h.

Constructor & Destructor Documentation

Nektar::Utilities::InputCAD::InputCAD ( MeshSharedPtr  m)

Set up InputCAD object.

Definition at line 67 of file InputCAD.cpp.

67  : InputModule(m)
68 {
69 }
Nektar::Utilities::InputCAD::~InputCAD ( )
virtual

Definition at line 71 of file InputCAD.cpp.

72 {
73 }

Member Function Documentation

static ModuleSharedPtr Nektar::Utilities::InputCAD::create ( MeshSharedPtr  m)
inlinestatic

Creates an instance of this class.

Definition at line 54 of file InputCAD.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::InputCAD::Process ( )
virtual

Implements Nektar::Utilities::Module.

Definition at line 75 of file InputCAD.cpp.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), ASSERTL0, Nektar::Utilities::Module::ClearElementLinks(), Nektar::LibUtilities::SessionReader::CreateInstance(), Nektar::LibUtilities::NekFactory< tKey, tBase, >::CreateInstance(), Nektar::Utilities::eOutputModule, Nektar::StdRegions::find(), Nektar::ParseUtils::GenerateSeqVector(), Nektar::Utilities::GetModuleFactory(), m_blthick, m_CADName, Nektar::Utilities::Module::m_config, m_eps, m_makeBL, m_maxDelta, Nektar::Utilities::Module::m_mesh, m_minDelta, m_order, m_udsName, m_writeoctree, Nektar::Utilities::Module::ProcessComposites(), Nektar::Utilities::Module::ProcessEdges(), Nektar::Utilities::Module::ProcessElements(), Nektar::Utilities::Module::ProcessFaces(), and Nektar::Utilities::Module::ProcessVertices().

76 {
77  vector<string> filename;
78  filename.push_back(m_config["infile"].as<string>());
79  string fn = filename[0].substr(0, filename[0].find("."));
80 
83 
84  // these parameters must be defined for any mesh generation to work
85  pSession->LoadParameter("MinDelta", m_minDelta);
86  pSession->LoadParameter("MaxDelta", m_maxDelta);
87  pSession->LoadParameter("EPS", m_eps);
88  pSession->LoadParameter("Order", m_order);
89  m_CADName = pSession->GetSolverInfo("CADFile");
90 
91  if (pSession->DefinesSolverInfo("MeshType"))
92  {
93  if (pSession->GetSolverInfo("MeshType") == "BL")
94  {
95  m_makeBL = true;
96  pSession->LoadParameter("BLThick", m_blthick);
97  }
98  else
99  {
100  m_makeBL = false;
101  }
102  }
103  else
104  {
105  m_makeBL = false;
106  }
107 
108  if (pSession->DefinesSolverInfo("WriteOctree"))
109  {
110  m_writeoctree = pSession->GetSolverInfo("WriteOctree") == "TRUE";
111  }
112 
113  vector<unsigned int> symsurfs;
114  vector<unsigned int> blsurfs;
115  if (m_makeBL)
116  {
117  string sym, bl;
118  sym = pSession->GetSolverInfo("SymPlane");
119  bl = pSession->GetSolverInfo("BLSurfs");
120  ParseUtils::GenerateSeqVector(sym.c_str(), symsurfs);
121  ParseUtils::GenerateSeqVector(bl.c_str(), blsurfs);
122  sort(symsurfs.begin(), symsurfs.end());
123  sort(blsurfs.begin(), blsurfs.end());
124  ASSERTL0(blsurfs.size() > 0,
125  "No surfaces selected to make boundary layer on");
126  }
127 
128  if (pSession->DefinesSolverInfo("UserDefinedSpacing"))
129  {
130  m_udsName = pSession->GetSolverInfo("UserDefinedSpacing");
131  ASSERTL0(boost::filesystem::exists(m_udsName.c_str()),
132  "UserDefinedSpacing file does not exist");
133  }
134  else
135  {
136  m_udsName = "N";
137  }
138 
139  CADSystemSharedPtr m_cad =
141 
142  if (m_mesh->m_verbose)
143  {
144  cout << "Building mesh for: " << m_CADName << endl;
145  }
146 
147  ASSERTL0(m_cad->LoadCAD(), "Failed to load CAD");
148 
149  if (m_mesh->m_verbose)
150  {
151  cout << "With parameters:" << endl;
152  cout << "\tmin delta: " << m_minDelta << endl
153  << "\tmax delta: " << m_maxDelta << endl
154  << "\tesp: " << m_eps << endl
155  << "\torder: " << m_order << endl;
156  m_cad->Report();
157  }
158 
159  if (m_makeBL && m_mesh->m_verbose)
160  {
161 
162  cout << "\tWill make boundary layers on surfs: ";
163  for (int i = 0; i < blsurfs.size(); i++)
164  {
165  cout << blsurfs[i] << " ";
166  }
167  cout << endl << "\tWith the symmetry planes: ";
168  for (int i = 0; i < symsurfs.size(); i++)
169  {
170  cout << symsurfs[i] << " ";
171  }
172  cout << endl << "\tWith thickness " << m_blthick << endl;
173  }
174 
175  // create octree
177  m_cad, m_mesh->m_verbose, m_minDelta, m_maxDelta, m_eps, m_udsName);
178 
179  m_octree->Build();
180 
181  if (m_writeoctree)
182  {
183  MeshSharedPtr oct = boost::shared_ptr<Mesh>(new Mesh());
184  oct->m_expDim = 3;
185  oct->m_spaceDim = 3;
186  oct->m_nummode = 2;
187 
188  m_octree->GetOctreeMesh(oct);
189 
191  ModuleKey(eOutputModule, "xml"), oct);
192  mod->RegisterConfig("outfile", fn + "_oct.xml");
193  mod->ProcessVertices();
194  mod->ProcessEdges();
195  mod->ProcessFaces();
196  mod->ProcessElements();
197  mod->ProcessComposites();
198  mod->Process();
199  }
200 
201  m_mesh->m_expDim = 3;
202  m_mesh->m_spaceDim = 3;
203  m_mesh->m_nummode = m_order + 1;
204  if (m_makeBL)
205  {
206  m_mesh->m_numcomp = 2; // prisms and tets
207  }
208  else
209  {
210  m_mesh->m_numcomp = 1; // just tets
211  }
212  // m_mesh->m_nummode = 2;
213 
214  // create surface mesh
215  m_mesh->m_expDim--; // just to make it easier to surface mesh for now
216  SurfaceMeshSharedPtr m_surfacemesh =
218  m_mesh, m_cad, m_octree, symsurfs, m_blthick);
219 
220  m_surfacemesh->Mesh();
221 
222  ProcessVertices();
223  ProcessEdges();
224  ProcessFaces();
225  ProcessElements();
227 
228  m_surfacemesh->Report();
229 
230  m_mesh->m_expDim = 3;
231  m_mesh->m_fields.push_back("u");
232  m_mesh->m_fields.push_back("v");
233  m_mesh->m_fields.push_back("w");
234  m_mesh->m_fields.push_back("p");
235 
236  map<int, FaceSharedPtr> surftopriface;
237  // map of surface element id to opposite prism
238  // face for psudo surface in tetmesh
239 
240  TetMeshSharedPtr m_tet;
241  if (m_makeBL)
242  {
244  m_mesh, blsurfs, symsurfs, m_blthick);
245 
246  m_blmesh->Mesh();
247 
248  // create tet mesh
250  m_mesh, m_octree, m_blmesh);
251  }
252  else
253  {
255  }
256 
257  m_tet->Mesh();
258 
260  ProcessVertices();
261  ProcessEdges();
262  ProcessFaces();
263  ProcessElements();
265 
266  m_surfacemesh->HOSurf();
267 
268  if (m_mesh->m_verbose)
269  {
270  cout << endl;
271  cout << m_mesh->m_element[3].size() << endl;
272  }
273 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:188
pair< ModuleType, string > ModuleKey
tBaseSharedPtr CreateInstance(tKey idKey BOOST_PP_COMMA_IF(MAX_PARAM) BOOST_PP_ENUM_BINARY_PARAMS(MAX_PARAM, tParam, x))
Create an instance of the class referred to by idKey.
Definition: NekFactory.hpp:162
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
map< string, ConfigOption > m_config
List of configuration values.
MeshSharedPtr m_mesh
Mesh object.
boost::shared_ptr< SurfaceMesh > SurfaceMeshSharedPtr
Definition: SurfaceMesh.h:106
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Definition: MeshPartition.h:51
static bool GenerateSeqVector(const char *const str, std::vector< unsigned int > &vec)
Definition: ParseUtils.hpp:79
virtual void ClearElementLinks()
virtual void ProcessEdges(bool ReprocessEdges=true)
Extract element edges.
static SessionReaderSharedPtr CreateInstance(int argc, char *argv[])
Creates an instance of the SessionReader class.
virtual void ProcessVertices()
Extract element vertices.
boost::shared_ptr< BLMesh > BLMeshSharedPtr
Definition: BLMesh.h:89
virtual void ProcessElements()
Generate element IDs.
boost::shared_ptr< TetMesh > TetMeshSharedPtr
Definition: TetMesh.h:103
virtual void ProcessComposites()
Generate composites.
boost::shared_ptr< Module > ModuleSharedPtr
boost::shared_ptr< Octree > OctreeSharedPtr
Definition: Octree.h:186
boost::shared_ptr< Mesh > MeshSharedPtr
Shared pointer to a mesh.
Definition: Mesh.h:137
boost::shared_ptr< CADSystem > CADSystemSharedPtr
Definition: CADSystem.h:185
virtual void ProcessFaces(bool ReprocessFaces=true)
Extract element faces.
InputIterator find(InputIterator first, InputIterator last, InputIterator startingpoint, const EqualityComparable &value)
Definition: StdRegions.hpp:315
ModuleFactory & GetModuleFactory()

Member Data Documentation

ModuleKey Nektar::Utilities::InputCAD::className
static
Initial value:
"Reads CAD geometry and will generate the mesh file.")

ModuleKey for class.

Definition at line 59 of file InputCAD.h.

NekDouble Nektar::Utilities::InputCAD::m_blthick
private

Definition at line 62 of file InputCAD.h.

Referenced by Process().

string Nektar::Utilities::InputCAD::m_CADName
private

Definition at line 64 of file InputCAD.h.

Referenced by Process().

NekDouble Nektar::Utilities::InputCAD::m_eps
private

Definition at line 62 of file InputCAD.h.

Referenced by Process().

bool Nektar::Utilities::InputCAD::m_makeBL
private

Definition at line 65 of file InputCAD.h.

Referenced by Process().

NekDouble Nektar::Utilities::InputCAD::m_maxDelta
private

Definition at line 62 of file InputCAD.h.

Referenced by Process().

NekDouble Nektar::Utilities::InputCAD::m_minDelta
private

Definition at line 62 of file InputCAD.h.

Referenced by Process().

int Nektar::Utilities::InputCAD::m_order
private

Definition at line 63 of file InputCAD.h.

Referenced by Process().

string Nektar::Utilities::InputCAD::m_udsName
private

Definition at line 64 of file InputCAD.h.

Referenced by Process().

bool Nektar::Utilities::InputCAD::m_writeoctree
private

Definition at line 65 of file InputCAD.h.

Referenced by Process().