20 fprintf(stderr,
"Usage: CheckXmlFile meshfile.xml\n");
25 = LibUtilities::SessionReader::CreateInstance(argc, argv);
29 string meshfile(argv[argc-1]);
35 int expdim = mesh->GetMeshDimension();
45 string outname(strtok(argv[argc-1],
"."));
47 FILE *fp = fopen(outname.c_str(),
"w");
52 int nverts = mesh->GetNvertices();
56 for(
int i = 0; i < nverts; ++i)
58 mesh->GetVertex(i)->GetCoords(x,y,z);
65 for(triIter = trigeom.begin(); triIter != trigeom.end(); ++triIter)
67 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);
71 for(quadIter = quadgeom.begin(); quadIter != quadgeom.end(); ++quadIter)
73 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);
80 string outname(strtok(argv[argc-1],
"."));
88 int nverts = mesh->GetNvertices();
92 for(
int i = 0; i < nverts; ++i)
95 mesh->GetVertex(i)->GetCoords(x,y,z);
102 for (
int i = 0; i < nverts; ++i)
104 for (
int j = i+1; j < nverts; ++j)
106 if ((xc[i]-xc[j])*(xc[i]-xc[j]) +
107 (yc[i]-yc[j])*(yc[i]-yc[j]) +
108 (zc[i]-zc[j])*(zc[i]-zc[j]) < 1e-10)
110 cout <<
"Duplicate vertices: " << i <<
" " << j << endl;
117 bool NoRotateIssues =
true;
118 bool NoOrientationIssues =
true;
119 for(tetIter = tetgeom.begin(); tetIter != tetgeom.end(); ++tetIter)
125 if((tetIter->second)->GetFace(0)->GetVid(2) != (tetIter->second)->GetVid(2))
127 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;
128 NoRotateIssues =
false;
131 for(
int i = 1; i < 4; ++i)
134 if((tetIter->second)->GetFace(i)->GetVid(2) != (tetIter->second)->GetVid(3))
136 cout <<
"ERROR: Face " << tetIter->second->GetFid(i) <<
" is not aligned with top Vertex of Tet " << (tetIter->second)->GetGlobalID() << endl;
137 NoRotateIssues =
false;
142 if(NoOrientationIssues)
144 cout <<
"All Tet have correct ordering for anticlockwise rotation" << endl;
149 cout <<
"All Tet faces are correctly aligned" << endl;
154 for(pyrIter = pyrgeom.begin(); pyrIter != pyrgeom.end(); ++pyrIter)
162 NoRotateIssues =
true;
163 NoOrientationIssues =
true;
164 for(Iter = prismgeom.begin(); Iter != prismgeom.end(); ++Iter)
168 if((Iter->second)->GetFace(1)->GetVid(2) != (Iter->second)->GetVid(4))
170 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;
171 NoRotateIssues =
false;
176 if((Iter->second)->GetFace(3)->GetVid(2) != (Iter->second)->GetVid(5))
178 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;
179 NoRotateIssues =
false;
186 cout <<
"All Prism Tri faces are correctly aligned" << endl;
190 for(hexIter = hexgeom.begin(); hexIter != hexgeom.end(); ++hexIter)
199 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