42 namespace NekMeshUtils
47 if (m_mesh->m_verbose)
48 cout << endl << endl <<
"Tetrahdral mesh generation" << endl;
52 map<int, NodeSharedPtr> IdToNode;
53 map<NodeSharedPtr, int> IdToNodeRev;
57 map<int, NekDouble> IdToDelta;
58 vector<Array<OneD, int> > surfacetris;
61 if(m_surface.size() == 0)
63 m_surface = m_mesh->m_element[2];
67 for(
int i = 0; i < m_surface.size(); i++)
69 vector<NodeSharedPtr> n = m_surface[i]->GetVertexList();
71 for(
int j = 0; j < n.size(); j++)
73 pair<NodeSet::iterator,bool> testIns =
74 alreadyInSurface.insert(n[j]);
84 IdToNodeRev[n[j]] = cnt;
85 IdToDelta[cnt] = m_mesh->m_octree->Query(n[j]->GetLoc());
90 tri[j] = IdToNodeRev[(*testIns.first)];
93 surfacetris.push_back(tri);
101 if (m_mesh->m_verbose)
103 cout <<
"\tInital Node Count: " << IdToNode.size() << endl;
106 tetgen->InitialMesh(IdToNode, surfacetris);
108 vector<Array<OneD, NekDouble> > newp;
109 int ctbefore = IdToNode.size();
115 tetgen->GetNewPoints(ctbefore, newp);
116 for (
int i = 0; i < newp.size(); i++)
118 NekDouble d = m_mesh->m_octree->Query(newp[i]);
119 IdToDelta[ctbefore + i] = d;
121 tetgen->RefineMesh(IdToDelta);
122 }
while (newpb != newp.size());
126 tetgen->GetNewPoints(ctbefore, newp);
127 for (
int i = 0; i < newp.size(); i++)
130 new Node(ctbefore + i, newp[i][0], newp[i][1], newp[i][2]));
131 IdToNode[ctbefore + i] = n;
134 m_tetconnect = tetgen->Extract();
139 for (
int i = 0; i < m_tetconnect.size(); i++)
141 vector<NodeSharedPtr> n;
142 n.push_back(IdToNode[m_tetconnect[i][0]]);
143 n.push_back(IdToNode[m_tetconnect[i][1]]);
144 n.push_back(IdToNode[m_tetconnect[i][2]]);
145 n.push_back(IdToNode[m_tetconnect[i][3]]);
148 tags.push_back(m_id);
152 m_mesh->m_element[3].push_back(E);
155 if (m_mesh->m_verbose)
156 cout <<
"\tTets :" << m_tetconnect.size() << endl;
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()
boost::unordered_set< NodeSharedPtr, NodeHash > NodeSet
boost::shared_ptr< Node > NodeSharedPtr
boost::shared_ptr< Element > ElementSharedPtr