42 namespace NekMeshUtils
47 if (m_mesh->m_verbose)
48 cout << endl << endl <<
"Tetrahdral mesh generation" << endl;
53 map<int, NodeSharedPtr> TetgenIdToNode;
54 map<int, int> NodeIdToTetgenId;
61 map<int, NekDouble> TetgenIdToDelta;
62 vector<Array<OneD, int> >
69 for (
int i = 0; i < m_mesh->m_element[2].size(); i++)
71 ASSERTL0(m_mesh->m_element[2][i]->GetConf().m_e ==
73 "quad found in surface mesh with no prism mapping");
75 vector<NodeSharedPtr> n = m_mesh->m_element[2][i]->GetVertexList();
77 for (
int j = 0; j < n.size(); j++)
80 it = NodeIdToTetgenId.find(n[j]->m_id);
81 if (it == NodeIdToTetgenId.end())
84 NodeIdToTetgenId[n[j]->m_id] = cnt;
85 TetgenIdToNode[cnt] = n[j];
86 TetgenIdToDelta[cnt] = m_octree->Query(n[j]->GetLoc());
94 surfacetris.push_back(tri);
99 m_surftopriface = m_blmesh->GetSurfToPri();
104 for (
int i = 0; i < m_mesh->m_element[2].size(); i++)
106 if (m_mesh->m_element[2][i]->GetConf().m_e !=
111 fit = m_surftopriface.find(m_mesh->m_element[2][i]->GetId());
112 if (fit == m_surftopriface.end())
117 vector<NodeSharedPtr> n =
118 m_mesh->m_element[2][i]->GetVertexList();
120 for (
int j = 0; j < n.size(); j++)
123 it = NodeIdToTetgenId.find(n[j]->m_id);
124 if (it == NodeIdToTetgenId.end())
127 NodeIdToTetgenId[n[j]->m_id] = cnt;
128 TetgenIdToNode[cnt] = n[j];
129 TetgenIdToDelta[cnt] = m_octree->Query(n[j]->GetLoc());
137 surfacetris.push_back(tri);
143 vector<NodeSharedPtr> n = fit->second->m_vertexList;
145 for (
int j = 0; j < n.size(); j++)
148 it = NodeIdToTetgenId.find(n[j]->m_id);
149 if (it == NodeIdToTetgenId.end())
152 NodeIdToTetgenId[n[j]->m_id] = cnt;
153 TetgenIdToNode[cnt] = n[j];
154 TetgenIdToDelta[cnt] = m_octree->Query(n[j]->GetLoc());
162 surfacetris.push_back(tri);
167 if (m_mesh->m_verbose)
169 cout <<
"\tInital Node Count: " << TetgenIdToNode.size() << endl;
172 tetgen->InitialMesh(TetgenIdToNode, surfacetris);
174 vector<Array<OneD, NekDouble> > newp;
175 int ctbefore = TetgenIdToNode.size();
182 tetgen->GetNewPoints(ctbefore, newp);
183 for (
int i = 0; i < newp.size(); i++)
186 TetgenIdToDelta[ctbefore + i] = d;
188 tetgen->RefineMesh(TetgenIdToDelta);
189 }
while (newpb != newp.size());
193 tetgen->GetNewPoints(ctbefore, newp);
194 for (
int i = 0; i < newp.size(); i++)
197 new Node(m_mesh->m_numNodes++, newp[i][0], newp[i][1], newp[i][2]));
198 TetgenIdToNode[ctbefore + i] = n;
201 m_tetconnect = tetgen->Extract();
206 for (
int i = 0; i < m_tetconnect.size(); i++)
208 vector<NodeSharedPtr> n;
209 n.push_back(TetgenIdToNode[m_tetconnect[i][0]]);
210 n.push_back(TetgenIdToNode[m_tetconnect[i][1]]);
211 n.push_back(TetgenIdToNode[m_tetconnect[i][2]]);
212 n.push_back(TetgenIdToNode[m_tetconnect[i][3]]);
219 m_mesh->m_element[3].push_back(E);
222 if (m_mesh->m_verbose)
223 cout <<
"\tTets :" << m_tetconnect.size() << endl;
#define ASSERTL0(condition, msg)
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.
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
ElementFactory & GetElementFactory()
Represents a point in the domain.
boost::shared_ptr< TetGenInterface > TetGenInterfaceSharedPtr
boost::shared_ptr< Node > NodeSharedPtr
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
boost::shared_ptr< Element > ElementSharedPtr