52 "Reads Nektar++ xml file.");
79 vector<string> filename;
80 filename.push_back(
m_config[
"infile"].as<string>());
87 m_mesh->m_expDim = graph->GetMeshDimension ();
88 m_mesh->m_spaceDim = graph->GetSpaceDimension();
91 map<int, NodeSharedPtr> vIdMap;
92 int nVerts = graph->GetNvertices();
93 for (
int i = 0; i < nVerts; ++i)
98 (*vert)(0), (*vert)(1), (*vert)(2)));
99 m_mesh->m_vertexSet.insert(n);
100 vIdMap[vert->GetVid()] = n;
103 map<int, EdgeSharedPtr> eIdMap;
105 map<int, FaceSharedPtr> fIdMap;
113 pair<EdgeSet::iterator,bool> testIns;
116 for (it = tmp.begin(); it != tmp.end(); ++it)
118 pair<int, SpatialDomains::GeometrySharedPtr> tmp2(
119 it->first, boost::dynamic_pointer_cast<
123 vector<NodeSharedPtr> curve;
124 int id0 = it->second->GetVid(0);
125 int id1 = it->second->GetVid(1);
130 testIns =
m_mesh->m_edgeSet.insert(ed);
131 (*(testIns.first))->m_id = it->second->GetEid();
132 eIdMap[it->second->GetEid()] = ed;
142 pair<FaceSet::iterator,bool> testIns;
145 for (it = tmp.begin(); it != tmp.end(); ++it)
147 pair<int, SpatialDomains::GeometrySharedPtr> tmp2(
148 it->first, boost::dynamic_pointer_cast<
151 vector<NodeSharedPtr> faceVertices;
152 vector<EdgeSharedPtr> faceEdges;
153 vector<NodeSharedPtr> faceNodes;
155 for(
int i = 0; i < 3; ++i)
157 faceVertices.push_back(vIdMap[it->second->GetVid(i)]);
158 faceEdges.push_back(eIdMap[it->second->GetEid(i)]);
163 testIns =
m_mesh->m_faceSet.insert(fac);
164 (*(testIns.first))->m_id = it->second->GetFid();
165 fIdMap[it->second->GetFid()] = fac;
171 for (it2 = tmp3.begin(); it2 != tmp3.end(); ++it2)
173 pair<int, SpatialDomains::GeometrySharedPtr> tmp2(
174 it2->first, boost::dynamic_pointer_cast<
177 vector<NodeSharedPtr> faceVertices;
178 vector<EdgeSharedPtr> faceEdges;
179 vector<NodeSharedPtr> faceNodes;
181 for(
int i = 0; i < 4; ++i)
183 faceVertices.push_back(vIdMap[it2->second->GetVid(i)]);
184 faceEdges.push_back(eIdMap[it2->second->GetEid(i)]);
189 testIns =
m_mesh->m_faceSet.insert(fac);
190 (*(testIns.first))->m_id = it2->second->GetFid();
191 fIdMap[it2->second->GetFid()] = fac;
200 for(
int i = 0; i < cvec.size(); ++i)
202 int id = cvec[i]->m_curveID;
203 ASSERTL1(eIdMap.find(
id) != eIdMap.end(),
"Failed to find curved edge");
205 edg->m_curveType = cvec[i]->m_ptype;
206 for(
int j = 0; j < cvec[i]->m_points.size()-2; ++j)
209 (*cvec[i]->m_points[j+1])(1),
210 (*cvec[i]->m_points[j+1])(2)));
211 edg->m_edgeNodes.push_back(n);
216 cvec = graph->GetCurvedFaces();
218 for(
int i = 0; i < cvec.size(); ++i)
220 int id = cvec[i]->m_curveID;
221 ASSERTL1(fIdMap.find(
id) != fIdMap.end(),
"Failed to find curved edge");
223 fac->m_curveType = cvec[i]->m_ptype;
224 int Ntot = cvec[i]->m_points.size();
231 int N = ((int)sqrt(8.0*Ntot+1.0)-1)/2;
232 for(
int j = 3+3*(N-2); j < Ntot; ++j)
235 (*cvec[i]->m_points[j])(1),
236 (*cvec[i]->m_points[j])(2)));
237 fac->m_faceNodes.push_back(n);
242 int N = (int)sqrt((
double)Ntot);
243 for(
int j = 1; j < N-1; ++j)
245 for(
int k = 1; k < N-1; ++k)
248 (*cvec[i]->m_points[j*N+k])(0),
249 (*cvec[i]->m_points[j*N+k])(1),
250 (*cvec[i]->m_points[j*N+k])(2)));
251 fac->m_faceNodes.push_back(n);
271 for(compIt = GraphComps.begin(); compIt != GraphComps.end(); ++compIt)
274 int dim = (*compIt->second)[0]->GetShapeDim();
276 if(dim ==
m_mesh->m_expDim)
278 nel += (*compIt->second).size();
284 for(compIt = GraphComps.begin(); compIt != GraphComps.end(); ++compIt)
287 int dim = (*compIt->second)[0]->GetShapeDim();
290 for(geomIt = (*compIt->second).begin();
291 geomIt != (*compIt->second).end();
294 ElmtConfig conf((*geomIt)->GetShapeType(),1,
true,
true);
297 vector<NodeSharedPtr> nodeList;
298 for (
int i = 0; i < (*geomIt)->GetNumVerts(); ++i)
300 nodeList.push_back(vIdMap[(*geomIt)->GetVid(i)]);
304 tags.push_back(compIt->first);
307 CreateInstance((*geomIt)->GetShapeType(),conf,nodeList,tags);
309 E->SetId((*geomIt)->GetGlobalID());
311 if(dim ==
m_mesh->m_expDim)
313 m_mesh->m_element[dim][(*geomIt)->GetGlobalID()] = E;
317 m_mesh->m_element[dim].push_back(E);
323 for (
int i = 0; i < (*geomIt)->GetNumEdges(); ++i)
328 edg->m_elLink.push_back(pair<ElementSharedPtr,int>(E,i));
335 for (
int i = 0; i < (*geomIt)->GetNumFaces(); ++i)
340 fac->m_elLink.push_back(pair<ElementSharedPtr,int>(E,i));