46    std::map<int, SpatialDomains::TetGeomSharedPtr>::iterator &tetIter, 
int id);
 
   48int main(
int argc, 
char *argv[])
 
   55        fprintf(stderr, 
"Usage: CheckXmlFile  meshfile.xml\n");
 
   60        LibUtilities::SessionReader::CreateInstance(argc, argv);
 
   64    string meshfile(argv[argc - 1]);
 
   66        SpatialDomains::MeshGraph::Read(vSession);
 
   71    int expdim = mesh->GetMeshDimension();
 
   81            string outname(strtok(argv[argc - 1], 
"."));
 
   83            FILE *fp = fopen(outname.c_str(), 
"w");
 
   88            int nverts = mesh->GetNvertices();
 
   92            for (
int i = 0; i < nverts; ++i)
 
   94                mesh->GetVertex(i)->GetCoords(x, y, 
z);
 
  100            std::map<int, SpatialDomains::TriGeomSharedPtr>::iterator triIter;
 
  101            for (triIter = trigeom.begin(); triIter != trigeom.end(); ++triIter)
 
  103                fprintf(fp, 
"%d %d %d %d\n", (triIter->second)->GetVid(0) + 1,
 
  104                        (triIter->second)->GetVid(1) + 1,
 
  105                        (triIter->second)->GetVid(2) + 1,
 
  106                        (triIter->second)->GetVid(2) + 1);
 
  109            std::map<int, SpatialDomains::QuadGeomSharedPtr>::iterator quadIter;
 
  110            for (quadIter = quadgeom.begin(); quadIter != quadgeom.end();
 
  113                fprintf(fp, 
"%d %d %d %d\n", (quadIter->second)->GetVid(0) + 1,
 
  114                        (quadIter->second)->GetVid(1) + 1,
 
  115                        (quadIter->second)->GetVid(2) + 1,
 
  116                        (quadIter->second)->GetVid(3) + 1);
 
  123            string outname(strtok(argv[argc - 1], 
"."));
 
  131            int nverts = mesh->GetNvertices();
 
  135            for (
int i = 0; i < nverts; ++i)
 
  138                mesh->GetVertex(i)->GetCoords(x, y, 
z);
 
  144            for (
int i = 0; i < nverts; ++i)
 
  146                for (
int j = i + 1; j < nverts; ++j)
 
  148                    if ((xc[i] - xc[j]) * (xc[i] - xc[j]) +
 
  149                            (yc[i] - yc[j]) * (yc[i] - yc[j]) +
 
  150                            (zc[i] - zc[j]) * (zc[i] - zc[j]) <
 
  153                        cout << 
"Duplicate vertices: " << i << 
" " << j << endl;
 
  158            std::map<int, SpatialDomains::TetGeomSharedPtr>::iterator tetIter;
 
  160            bool NoRotateIssues      = 
true;
 
  161            bool NoOrientationIssues = 
true;
 
  162            for (tetIter = tetgeom.begin(); tetIter != tetgeom.end(); ++tetIter)
 
  165                NoOrientationIssues =
 
  169                if ((tetIter->second)->GetFace(0)->GetVid(2) !=
 
  170                    (tetIter->second)->GetVid(2))
 
  172                    cout << 
"ERROR: Face " << tetIter->second->GetFid(0)
 
  174                         << (tetIter->second)->GetFace(0)->GetVid(2)
 
  175                         << 
") is not aligned with base vertex of Tet " 
  176                         << (tetIter->second)->GetGlobalID() << 
" (vert " 
  177                         << (tetIter->second)->GetVid(2) << 
")" << endl;
 
  178                    NoRotateIssues = 
false;
 
  181                for (
int i = 1; i < 4; ++i)
 
  184                    if ((tetIter->second)->GetFace(i)->GetVid(2) !=
 
  185                        (tetIter->second)->GetVid(3))
 
  187                        cout << 
"ERROR: Face " << tetIter->second->GetFid(i)
 
  188                             << 
" is not aligned with top Vertex of Tet " 
  189                             << (tetIter->second)->GetGlobalID() << endl;
 
  190                        NoRotateIssues = 
false;
 
  194            if (NoOrientationIssues)
 
  196                cout << 
"All Tet have correct ordering for anticlockwise " 
  203                cout << 
"All Tet faces are correctly aligned" << endl;
 
  206            std::map<int, SpatialDomains::PyrGeomSharedPtr>::iterator pyrIter;
 
  207            for (pyrIter = pyrgeom.begin(); pyrIter != pyrgeom.end(); ++pyrIter)
 
  213            std::map<int, SpatialDomains::PrismGeomSharedPtr>::iterator Iter;
 
  214            NoRotateIssues      = 
true;
 
  215            NoOrientationIssues = 
true;
 
  216            for (Iter = prismgeom.begin(); Iter != prismgeom.end(); ++Iter)
 
  220                if ((Iter->second)->GetFace(1)->GetVid(2) !=
 
  221                    (Iter->second)->GetVid(4))
 
  223                    cout << 
"ERROR: Face " << Iter->second->GetFid(1)
 
  224                         << 
" (vert " << (Iter->second)->GetFace(1)->GetVid(2)
 
  225                         << 
") not aligned to face 1 singular vert of Prism " 
  226                         << (Iter->second)->GetGlobalID() << 
" (vert " 
  227                         << (Iter->second)->GetVid(4) << 
")" << endl;
 
  228                    NoRotateIssues = 
false;
 
  232                if ((Iter->second)->GetFace(3)->GetVid(2) !=
 
  233                    (Iter->second)->GetVid(5))
 
  235                    cout << 
"ERROR: Face " << Iter->second->GetFid(3)
 
  236                         << 
" (vert " << (Iter->second)->GetFace(3)->GetVid(2)
 
  237                         << 
") not aligned to face 3 singular vert of Prism " 
  238                         << (Iter->second)->GetGlobalID() << 
" (vert " 
  239                         << (Iter->second)->GetVid(5) << 
")" << endl;
 
  240                    NoRotateIssues = 
false;
 
  246                cout << 
"All Prism Tri faces are correctly aligned" << endl;
 
  249            std::map<int, SpatialDomains::HexGeomSharedPtr>::iterator hexIter;
 
  250            for (hexIter = hexgeom.begin(); hexIter != hexgeom.end(); ++hexIter)
 
  258            ASSERTL0(
false, 
"Expansion dimension not recognised");
 
  278    std::map<int, SpatialDomains::TetGeomSharedPtr>::iterator &tetIter, 
int id)
 
  280    bool RotationOK = 
true;
 
  284    v[0].
x = xc[(tetIter->second)->GetVid(0)];
 
  285    v[0].
y = yc[(tetIter->second)->GetVid(0)];
 
  286    v[0].
z = zc[(tetIter->second)->GetVid(0)];
 
  288    v[1].
x = xc[(tetIter->second)->GetVid(1)];
 
  289    v[1].
y = yc[(tetIter->second)->GetVid(1)];
 
  290    v[1].
z = zc[(tetIter->second)->GetVid(1)];
 
  292    v[2].
x = xc[(tetIter->second)->GetVid(2)];
 
  293    v[2].
y = yc[(tetIter->second)->GetVid(2)];
 
  294    v[2].
z = zc[(tetIter->second)->GetVid(2)];
 
  296    v[3].
x = xc[(tetIter->second)->GetVid(3)];
 
  297    v[3].
y = yc[(tetIter->second)->GetVid(3)];
 
  298    v[3].
z = zc[(tetIter->second)->GetVid(3)];
 
  301    abx = (v[1].
y - v[0].
y) * (v[2].
z - v[0].
z) -
 
  302          (v[1].
z - v[0].
z) * (v[2].y - v[0].y);
 
  303    aby = (v[1].
z - v[0].
z) * (v[2].x - v[0].x) -
 
  304          (v[1].
x - v[0].
x) * (v[2].
z - v[0].
z);
 
  305    abz = (v[1].
x - v[0].
x) * (v[2].y - v[0].y) -
 
  306          (v[1].
y - v[0].
y) * (v[2].x - v[0].x);
 
  309    if (((v[3].x - v[0].x) * abx + (v[3].
y - v[0].
y) * aby +
 
  310         (v[3].
z - v[0].
z) * abz) < 0.0)
 
  312        cerr << 
"ERROR: Element " << 
id + 1 << 
"is NOT counter-clockwise\n" 
int main(int argc, char *argv[])
 
bool CheckTetRotation(Array< OneD, NekDouble > &xc, Array< OneD, NekDouble > &yc, Array< OneD, NekDouble > &xz, std::map< int, SpatialDomains::TetGeomSharedPtr >::iterator &tetIter, int id)
 
#define ASSERTL0(condition, msg)
 
std::shared_ptr< SessionReader > SessionReaderSharedPtr
 
std::map< int, TriGeomSharedPtr > TriGeomMap
 
std::map< int, PyrGeomSharedPtr > PyrGeomMap
 
std::map< int, QuadGeomSharedPtr > QuadGeomMap
 
std::map< int, TetGeomSharedPtr > TetGeomMap
 
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
 
std::map< int, PrismGeomSharedPtr > PrismGeomMap
 
std::map< int, HexGeomSharedPtr > HexGeomMap
 
std::vector< double > z(NPUPPER)
 
The above copyright notice and this permission notice shall be included.