41 namespace NekMeshUtils
46 if (m_mesh->m_verbose)
47 cout << endl << endl <<
"Tetrahdral mesh generation" << endl;
51 map<int, NodeSharedPtr> IdToNode;
52 map<NodeSharedPtr, int> IdToNodeRev;
56 map<int, NekDouble> IdToDelta;
57 vector<Array<OneD, int> > surfacetris;
60 if(m_surface.size() == 0)
62 m_surface = m_mesh->m_element[2];
66 for(
int i = 0; i < m_surface.size(); i++)
68 vector<NodeSharedPtr> n = m_surface[i]->GetVertexList();
70 for(
int j = 0; j < n.size(); j++)
72 pair<NodeSet::iterator,bool> testIns =
73 alreadyInSurface.insert(n[j]);
83 IdToNodeRev[n[j]] = cnt;
84 IdToDelta[cnt] = m_mesh->m_octree->Query(n[j]->GetLoc());
89 tri[j] = IdToNodeRev[(*testIns.first)];
92 surfacetris.push_back(tri);
100 if (m_mesh->m_verbose)
102 cout <<
"\tInital Node Count: " << IdToNode.size() << endl;
105 tetgen->InitialMesh(IdToNode, surfacetris);
107 vector<Array<OneD, NekDouble> > newp;
108 int ctbefore = IdToNode.size();
114 tetgen->GetNewPoints(ctbefore, newp);
115 for (
int i = 0; i < newp.size(); i++)
117 NekDouble d = m_mesh->m_octree->Query(newp[i]);
118 IdToDelta[ctbefore + i] = d;
120 tetgen->RefineMesh(IdToDelta);
121 }
while (newpb != newp.size());
125 tetgen->GetNewPoints(ctbefore, newp);
126 for (
int i = 0; i < newp.size(); i++)
129 new Node(ctbefore + i, newp[i][0], newp[i][1], newp[i][2]));
130 IdToNode[ctbefore + i] = n;
133 m_tetconnect = tetgen->Extract();
138 for (
int i = 0; i < m_tetconnect.size(); i++)
140 vector<NodeSharedPtr> n;
141 n.push_back(IdToNode[m_tetconnect[i][0]]);
142 n.push_back(IdToNode[m_tetconnect[i][1]]);
143 n.push_back(IdToNode[m_tetconnect[i][2]]);
144 n.push_back(IdToNode[m_tetconnect[i][3]]);
147 tags.push_back(m_id);
151 m_mesh->m_element[3].push_back(E);
154 if (m_mesh->m_verbose)
155 cout <<
"\tTets :" << m_tetconnect.size() << endl;
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
Represents a point in the domain.
std::unordered_set< NodeSharedPtr, NodeHash > NodeSet
ElementFactory & GetElementFactory()
std::shared_ptr< Element > ElementSharedPtr
std::shared_ptr< Node > NodeSharedPtr
Basic information about an element.