49 namespace NekMeshUtils
54 "Generates a volume mesh");
59 ConfigOption(
false,
"0",
"Generate prisms on these surfs");
72 cout << endl <<
"Volume meshing" << endl;
75 vector<unsigned int> blSurfs;
89 if (
m_mesh->m_cad->GetNumSurf() > 100)
105 vector<unsigned int> symsurfs = blmesh->GetSymSurfs();
106 vector<ElementSharedPtr> els =
m_mesh->m_element[2];
107 m_mesh->m_element[2].clear();
108 for (
int i = 0; i < els.size(); i++)
111 symsurfs.begin(), symsurfs.end(), els[i]->m_parentCAD->GetId());
113 if (f == symsurfs.end())
115 m_mesh->m_element[2].push_back(els[i]);
120 vector<EdgeSharedPtr> es = els[i]->GetEdgeList();
121 for (
int j = 0; j < es.size(); j++)
123 vector<pair<ElementSharedPtr, int> > lk = es[j]->m_elLink;
124 es[j]->m_elLink.clear();
125 for (
int k = 0; k < lk.size(); k++)
127 if (lk[k].first == els[i])
131 es[j]->m_elLink.push_back(lk[k]);
137 for (
int i = 0; i < symsurfs.size(); i++)
140 vector<CADSystem::EdgeLoopSharedPtr> e =
141 m_mesh->m_cad->GetSurf(symsurfs[i])->GetEdges();
142 for (
int k = 0; k < e.size(); k++)
144 for (
int j = 0; j < e[k]->edges.size(); j++)
146 cIds.insert(e[k]->edges[j]->GetId());
151 map<int, vector<NodeSharedPtr> > curveNodeMap;
153 for (it =
m_mesh->m_vertexSet.begin();
154 it !=
m_mesh->m_vertexSet.end(); it++)
156 vector<pair<int, CADCurveSharedPtr> > cc =
157 (*it)->GetCADCurves();
158 for (
int j = 0; j < cc.size(); j++)
163 curveNodeMap[cc[j].first].push_back((*it));
169 map<int, vector<NodeSharedPtr> >
::iterator cit;
170 for (cit = curveNodeMap.begin(); cit != curveNodeMap.end(); cit++)
172 vector<NekDouble> ts;
173 for (
int i = 0; i < cit->second.size(); i++)
175 ts.push_back(cit->second[i]->GetCADCurveInfo(cit->first));
181 for (
int i = 0; i < ts.size() - 1; i++)
183 if (ts[i] > ts[i + 1])
185 swap(ts[i], ts[i + 1]);
186 swap(cit->second[i], cit->second[i + 1]);
195 map<NodeSharedPtr, NodeSharedPtr> nmap = blmesh->GetSymNodes();
196 for (cit = curveNodeMap.begin(); cit != curveNodeMap.end(); cit++)
198 for (
int j = 0; j < cit->second.size() - 1; j++)
201 nmap.find(cit->second[j]);
203 nmap.find(cit->second[j + 1]);
205 if (f1 == nmap.end() || f2 == nmap.end())
213 vector<NodeSharedPtr> ns;
214 ns.push_back(cit->second[j]);
217 ns.push_back(cit->second[j + 1]);
223 tags.push_back(prefix * 2 + symsurfs[i]);
226 E->m_parentCAD =
m_mesh->m_cad->GetSurf(symsurfs[i]);
227 m_mesh->m_element[2].push_back(E);
230 for (
int k = 0; k < E->GetEdgeCount(); ++k)
232 pair<EdgeSet::iterator, bool> testIns;
234 testIns =
m_mesh->m_edgeSet.insert(ed);
239 ed2->m_elLink.push_back(
240 pair<ElementSharedPtr, int>(E, k));
246 e2->m_elLink.push_back(
247 pair<ElementSharedPtr, int>(E, k));
254 for (cit = curveNodeMap.begin(); cit != curveNodeMap.end(); cit++)
256 for (
int j = 0; j < cit->second.size(); j++)
259 nmap.find(cit->second[j]);
260 if (f1 == nmap.end())
264 cit->second[j] = f1->second;
267 map<int, CurveMeshSharedPtr> cm;
268 for (cit = curveNodeMap.begin(); cit != curveNodeMap.end(); cit++)
271 cit->first,
m_mesh, cit->second);
275 symsurfs[i],
m_mesh, cm, symsurfs[i]);
279 vector<unsigned int> blsurfs = blmesh->GetBLSurfs();
282 vector<ElementSharedPtr> tetsurface = blmesh->GetPseudoSurface();
283 for (
int i = 0; i <
m_mesh->m_element[2].size(); i++)
285 if (
m_mesh->m_element[2][i]->GetConf().m_e ==
292 find(blsurfs.begin(), blsurfs.end(),
293 m_mesh->m_element[2][i]->m_parentCAD->GetId());
295 if (f == blsurfs.end())
297 tetsurface.push_back(
m_mesh->m_element[2][i]);
Basic information about an element.
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.
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
pair< ModuleType, string > ModuleKey
MeshSharedPtr m_mesh
Mesh object.
ElementFactory & GetElementFactory()
static bool GenerateSeqVector(const char *const str, std::vector< unsigned int > &vec)
boost::shared_ptr< BLMesh > BLMeshSharedPtr
virtual NEKMESHUTILS_EXPORT void ProcessFaces(bool ReprocessFaces=true)
Extract element faces.
boost::shared_ptr< FaceMesh > FaceMeshSharedPtr
virtual NEKMESHUTILS_EXPORT void ProcessElements()
Generate element IDs.
Represents a command-line configuration option.
boost::shared_ptr< Node > NodeSharedPtr
boost::shared_ptr< TetMesh > TetMeshSharedPtr
std::map< std::string, ConfigOption > m_config
List of configuration values.
virtual NEKMESHUTILS_EXPORT void ClearElementLinks()
boost::shared_ptr< Edge > EdgeSharedPtr
Shared pointer to an edge.
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
boost::shared_ptr< Mesh > MeshSharedPtr
Shared pointer to a mesh.
Abstract base class for processing modules.
virtual NEKMESHUTILS_EXPORT void ProcessVertices()
Extract element vertices.
virtual NEKMESHUTILS_EXPORT void ProcessEdges(bool ReprocessEdges=true)
Extract element edges.
InputIterator find(InputIterator first, InputIterator last, InputIterator startingpoint, const EqualityComparable &value)
boost::shared_ptr< Element > ElementSharedPtr
virtual NEKMESHUTILS_EXPORT void ProcessComposites()
Generate composites.
ModuleFactory & GetModuleFactory()
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.