21 fprintf(stderr,
"Usage: CheckXmlFile meshfile.xml\n");
26 = LibUtilities::SessionReader::CreateInstance(argc, argv);
30 string meshfile(argv[argc-1]);
36 int expdim = mesh->GetMeshDimension();
46 string outname(strtok(argv[argc-1],
"."));
48 FILE *fp = fopen(outname.c_str(),
"w");
53 int nverts = mesh->GetNvertices();
57 for(
int i = 0; i < nverts; ++i)
59 mesh->GetVertex(i)->GetCoords(x,y,z);
66 for(triIter = trigeom.begin(); triIter != trigeom.end(); ++triIter)
68 fprintf(fp,
"%d %d %d %d\n",(triIter->second)->GetVid(0)+1,(triIter->second)->GetVid(1)+1,(triIter->second)->GetVid(2)+1,(triIter->second)->GetVid(2)+1);
72 for(quadIter = quadgeom.begin(); quadIter != quadgeom.end(); ++quadIter)
74 fprintf(fp,
"%d %d %d %d\n",(quadIter->second)->GetVid(0)+1,(quadIter->second)->GetVid(1)+1,(quadIter->second)->GetVid(2)+1,(quadIter->second)->GetVid(3)+1);
81 string outname(strtok(argv[argc-1],
"."));
89 int nverts = mesh->GetNvertices();
93 for(
int i = 0; i < nverts; ++i)
96 mesh->GetVertex(i)->GetCoords(x,y,z);
103 for (
int i = 0; i < nverts; ++i)
105 for (
int j = i+1; j < nverts; ++j)
107 if ((xc[i]-xc[j])*(xc[i]-xc[j]) +
108 (yc[i]-yc[j])*(yc[i]-yc[j]) +
109 (zc[i]-zc[j])*(zc[i]-zc[j]) < 1e-10)
111 cout <<
"Duplicate vertices: " << i <<
" " << j << endl;
118 bool NoRotateIssues =
true;
119 bool NoOrientationIssues =
true;
120 for(tetIter = tetgeom.begin(); tetIter != tetgeom.end(); ++tetIter)
126 if((tetIter->second)->GetFace(0)->GetVid(2) != (tetIter->second)->GetVid(2))
128 cout <<
"ERROR: Face " << tetIter->second->GetFid(0) <<
" (vert "<< (tetIter->second)->GetFace(0)->GetVid(2) <<
") is not aligned with base vertex of Tet " << (tetIter->second)->GetGlobalID() <<
" (vert "<< (tetIter->second)->GetVid(2) <<
")" << endl;
129 NoRotateIssues =
false;
132 for(
int i = 1; i < 4; ++i)
135 if((tetIter->second)->GetFace(i)->GetVid(2) != (tetIter->second)->GetVid(3))
137 cout <<
"ERROR: Face " << tetIter->second->GetFid(i) <<
" is not aligned with top Vertex of Tet " << (tetIter->second)->GetGlobalID() << endl;
138 NoRotateIssues =
false;
143 if(NoOrientationIssues)
145 cout <<
"All Tet have correct ordering for anticlockwise rotation" << endl;
150 cout <<
"All Tet faces are correctly aligned" << endl;
155 for(pyrIter = pyrgeom.begin(); pyrIter != pyrgeom.end(); ++pyrIter)
163 NoRotateIssues =
true;
164 NoOrientationIssues =
true;
165 for(Iter = prismgeom.begin(); Iter != prismgeom.end(); ++Iter)
169 if((Iter->second)->GetFace(1)->GetVid(2) != (Iter->second)->GetVid(4))
171 cout <<
"ERROR: Face " << Iter->second->GetFid(1) <<
" (vert "<< (Iter->second)->GetFace(1)->GetVid(2) <<
") not aligned to face 1 singular vert of Prism " << (Iter->second)->GetGlobalID() <<
" (vert "<< (Iter->second)->GetVid(4) <<
")" << endl;
172 NoRotateIssues =
false;
177 if((Iter->second)->GetFace(3)->GetVid(2) != (Iter->second)->GetVid(5))
179 cout <<
"ERROR: Face " << Iter->second->GetFid(3) <<
" (vert "<< (Iter->second)->GetFace(3)->GetVid(2) <<
") not aligned to face 3 singular vert of Prism " << (Iter->second)->GetGlobalID() <<
" (vert "<< (Iter->second)->GetVid(5) <<
")" << endl;
180 NoRotateIssues =
false;
187 cout <<
"All Prism Tri faces are correctly aligned" << endl;
191 for(hexIter = hexgeom.begin(); hexIter != hexgeom.end(); ++hexIter)
200 ASSERTL0(
false,
"Expansion dimension not recognised");
#define ASSERTL0(condition, msg)
std::map< int, PrismGeomSharedPtr > PrismGeomMap
std::map< int, PyrGeomSharedPtr > PyrGeomMap
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
bool CheckTetRotation(Array< OneD, NekDouble > &xc, Array< OneD, NekDouble > &yc, Array< OneD, NekDouble > &xz, std::map< int, SpatialDomains::TetGeomSharedPtr >::iterator &tetIter, int id)
std::map< int, TetGeomSharedPtr > TetGeomMap
std::map< int, TriGeomSharedPtr > TriGeomMap
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
std::map< int, QuadGeomSharedPtr > QuadGeomMap
boost::shared_ptr< MeshGraph > MeshGraphSharedPtr
std::map< int, HexGeomSharedPtr > HexGeomMap