Commit 06a81cec authored by Kirill Terekhov's avatar Kirill Terekhov
Browse files

Some fixes and updates

FixEdgeOrder() would now recompute connections to cells after correcting
order of edges.

Update XML writer according to specification. Fix edge order for 2d
cells.

Updated DrawGrid example for current version of INMOST.
parent 9088109a
if(USE_MESH)
#add_subdirectory(DrawGrid)
add_subdirectory(DrawGrid)
add_subdirectory(OldDrawGrid)
add_subdirectory(GridGen)
endif(USE_MESH)
......
......@@ -8,6 +8,7 @@ find_package(GLUT)
if(OPENGL_FOUND)
if(GLUT_FOUND)
message("linking DrawGrid with GLUT and OpenGL")
include_directories(${OPENGL_INCLUDE_DIR})
include_directories(${GLUT_INCLUDE_DIR})
add_executable(DrawGrid ${SOURCE})
......@@ -20,9 +21,9 @@ if(OPENGL_FOUND)
endif(USE_MPI)
install(TARGETS DrawGrid EXPORT inmost-targets RUNTIME DESTINATION bin)
else(GLUT_FOUND)
message("GLUT not found")
message("GLUT not found, not building DrawGrid")
endif(GLUT_FOUND)
else(OPENGL_FOUND)
message("OpenGL not found")
message("OpenGL not found, not building DrawGrid")
endif(OPENGL_FOUND)
......@@ -3,7 +3,7 @@
//#define OCTREECUTCELL_DEBUG
#define DISCR_DEBUG
#include "../../inmost.h"
#include "inmost.h"
#include "my_glut.h"
#include <iostream>
#include <sstream>
......@@ -20,7 +20,7 @@ double zoom = 1;
int width = 800, height = 800;
double sleft = 1e20, sright = -1e20, sbottom = 1e20, stop = -1e20, sfar = -1e20, snear = 1e20;
Tag mat,colort; int maxmat = -1, maxcolor = 0;
std::map<GeometricData,ElementType> table;
Mesh::GeomParam table;
double reset_timer = Timer();
double shift[3] = {0,0,0};
int boundary = 2;
......@@ -30,7 +30,7 @@ bool perspective = false;
int text = 4;
int display_orphans = 1;
int badfaces = 1;
ElementSet * problem_set, * orphan_edges, * orphan_faces;
ElementSet problem_set, orphan_edges, orphan_faces;
#if defined(DISCR_DEBUG)
......@@ -44,7 +44,7 @@ static void tensor_prod3(Storage::real * K, Storage::real v[3], Storage::real ou
out[2] = v[0] * K[6] + v[1] * K[7] + v[2] * K[8];
}
void FindHarmonicPoint(Face * fKL, Cell * cK, Cell * cL, Tag tensor, Storage::real xK[3], Storage::real xL[3], Storage::real y[3], Storage::real & coef)
void FindHarmonicPoint(Face & fKL, Cell & cK, Cell & cL, Tag tensor, Storage::real xK[3], Storage::real xL[3], Storage::real y[3], Storage::real & coef)
{
Storage::real yK[3], yL[3], xKL[3], nKL[3], dK, dL, lK, lL, lKs[3], lLs[3], D, t;
Storage::real coefK, coefL, coefQ, coefDiv;
......@@ -81,7 +81,7 @@ void FindHarmonicPoint(Face * fKL, Cell * cK, Cell * cL, Tag tensor, Storage::re
}
void FindBoundaryPoint(Face * fK, Cell * cK, Tag tensor, Storage::real xK[3], Storage::real y[3])
void FindBoundaryPoint(Face & fK, Cell & cK, Tag tensor, Storage::real xK[3], Storage::real y[3])
{
Storage::real nK[3], lKs[3], lK, xfK[3], t;
Storage::real_array KK = cK->RealArray(tensor);
......@@ -393,8 +393,8 @@ void keyboard(unsigned char key, int x, int y)
{
unsigned visited = 0;
colort = mesh->CreateTag("COLOR",DATA_INTEGER,CELL,NONE,1);
std::vector<Cell *> queue;
adjacent<Element> around;
std::vector<Cell> queue;
ElementArray<Element> around;
queue.reserve(256);
while(visited != mesh->NumberOfCells() )
{
......@@ -404,7 +404,7 @@ void keyboard(unsigned char key, int x, int y)
{
if( it->Integer(colort) == 0 )
{
queue.push_back(&*it);
queue.push_back(it->self());
visited++;
queue.back()->Integer(colort) = maxcolor;
break;
......@@ -415,7 +415,7 @@ void keyboard(unsigned char key, int x, int y)
around = queue.back()->BridgeAdjacencies(FACE,CELL);
queue.pop_back();
for(adjacent<Element>::iterator it = around.begin(); it != around.end(); ++it)
for(ElementArray<Element>::iterator it = around.begin(); it != around.end(); ++it)
if( it->Integer(colort) == 0 )
{
queue.push_back(it->getAsCell());
......@@ -474,13 +474,13 @@ public:
face2gl DrawFace(Element * f, int mmat, double campos[3])
face2gl DrawFace(Element & f, int mmat, double campos[3])
{
double cnt[3];
face2gl ret;
f->Centroid(cnt);
ret.set_center(cnt,campos);
adjacent<Node> nodes = f->getNodes();
ElementArray<Node> nodes = f->getNodes();
if( f->nbAdjElements(CELL) == 0 )
ret.set_color(1,0,0,0.25);
......@@ -494,7 +494,7 @@ face2gl DrawFace(Element * f, int mmat, double campos[3])
ret.set_color(1-r,r,1-r,0.25);
}
for( adjacent<Node>::iterator kt = nodes.begin(); kt != nodes.end(); kt++)
for( ElementArray<Node>::iterator kt = nodes.begin(); kt != nodes.end(); kt++)
ret.add_vert(&(kt->Coords()[0]));
......@@ -503,7 +503,7 @@ face2gl DrawFace(Element * f, int mmat, double campos[3])
//glLineWidth(2.0);
if( boundary == 1 ) glColor3f(0,0,1); else glColor3f(0,0,0);
glBegin(GL_LINE_LOOP);
for( adjacent<Node>::iterator kt = nodes.begin(); kt != nodes.end(); kt++)
for( ElementArray<Node>::iterator kt = nodes.begin(); kt != nodes.end(); kt++)
glVertex3dv(&(kt->Coords()[0]));
glEnd();
//glLineWidth(1.0);
......@@ -596,7 +596,7 @@ void draw()
//glTranslated((l+r)*0.5,(b+t)*0.5,(near+far)*0.5);
int pacef = std::max(1,mesh->MaxLocalIDFACE()/10000);
int pacef = std::max(1,mesh->FaceLastLocalID()/10000);
std::vector<face2gl> polygons;
......@@ -604,14 +604,11 @@ void draw()
if( badfaces )
{
for(INMOST_DATA_INTEGER_TYPE it = 0; it < mesh->MaxLocalIDFACE(); it += (interactive ? pacef : 1))
for(INMOST_DATA_INTEGER_TYPE it = 0; it < mesh->FaceLastLocalID(); it += (interactive ? pacef : 1)) if( mesh->isValidFace(it) )
{
Face * f = mesh->FaceByLocalID(it);
if( f != NULL )
{
if( !f->CheckNormalOrientation() )
polygons.push_back(DrawFace(f,1,campos));
}
Face f = mesh->FaceByLocalID(it);
if( !f->CheckNormalOrientation() )
polygons.push_back(DrawFace(f,1,campos));
}
}
......@@ -628,8 +625,8 @@ void draw()
{
Storage::real cnt[3];
it->Centroid(cnt);
adjacent<Face> faces = it->getFaces();
for(adjacent<Face>::iterator jt = faces.begin(); jt != faces.end(); ++jt) if(!jt->Boundary())
ElementArray<Face> faces = it->getFaces();
for(ElementArray<Face>::iterator jt = faces.begin(); jt != faces.end(); ++jt) if(!jt->Boundary())
{
Storage::real_array cc = jt->RealArray(avg_coord);
glVertex3dv(cnt);
......@@ -664,8 +661,8 @@ void draw()
for(Mesh::iteratorFace it = mesh->BeginFace(); it != mesh->EndFace(); ++it) if(!it->Boundary() )
{
Storage::real nrm[3], scale, f1[3], f2[3], l, cnt[3], v[3];
Cell * c1 = it->BackCell(), * c2 = it->FrontCell();
if( c1 != NULL && c2 != NULL )
Cell c1 = it->BackCell(), c2 = it->FrontCell();
if( c1.isValid() && c2.isValid() )
{
it->Centroid(cnt);
it->OrientedUnitNormal(c1,nrm);
......@@ -735,19 +732,19 @@ void draw()
{
for(int qq = 0; qq < show_cells.size(); qq++)
{
if( show_cells[qq] < 0 || show_cells[qq] >= mesh->MaxLocalIDCELL() ) continue;
Element * it = mesh->ElementByLocalID(CELL,show_cells[qq]);
if( it != NULL )
if( show_cells[qq] < 0 || show_cells[qq] >= mesh->CellLastLocalID() ) continue;
Element it = mesh->ElementByLocalID(CELL,show_cells[qq]);
if( it.isValid() )
{
Storage::integer_array mats;
adjacent<Edge> edges = it->getEdges();
ElementArray<Edge> edges = it->getEdges();
Storage::real cnt[3];
for(unsigned k = 0; k < edges.size(); k++)
{
edges[k].Centroid(cnt);
if( mats_tag.isValid() )mats = edges[k].IntegerArray(mats_tag);
adjacent<Node> nodes = edges[k].getNodes();
ElementArray<Node> nodes = edges[k].getNodes();
if( matfilter == 0 || (mats_tag.isValid() && std::binary_search(mats.begin(),mats.end(),matfilter-1)) )
......@@ -787,7 +784,7 @@ void draw()
}
}
adjacent<Face> faces = it->getFaces();
ElementArray<Face> faces = it->getFaces();
for(unsigned k = 0; k < faces.size(); k++)
{
......@@ -843,22 +840,22 @@ void draw()
{
for(int qq = 0; qq < show_faces.size(); qq++)
{
Element * it = NULL;
if( show_faces[qq] < 0 || show_faces[qq] >= mesh->MaxLocalID(FACE) ) continue;
Element it = InvalidElement();
if( show_faces[qq] < 0 || show_faces[qq] >= mesh->LastLocalID(FACE) ) continue;
it = mesh->ElementByLocalID(FACE,show_faces[qq]);
if( it != NULL )
if( it.isValid() )
{
Storage::integer_array mats;
Storage::real cnt[3], cntf[3];
adjacent<Edge> edges = it->getEdges();
ElementArray<Edge> edges = it->getEdges();
it->Centroid(cntf);
for(unsigned k = 0; k < edges.size(); k++)
//if( edges[k].nbAdjElements(CELL) == 0 )
{
if(mats_tag.isValid() ) mats = edges[k].IntegerArray(mats_tag);
adjacent<Node> nodes = edges[k].getNodes();
ElementArray<Node> nodes = edges[k].getNodes();
if( matfilter == 0 || (mats_tag.isValid() &&std::binary_search(mats.begin(),mats.end(),matfilter-1)) )
{
......@@ -914,9 +911,9 @@ void draw()
if( text == 3 || text == 5 ) if(text) printtext(str);
}
#if 0
adjacent<Cell> cells = it->getCells();
ElementArray<Cell> cells = it->getCells();
for(adjacent<Cell>::iterator jt = cells.begin(); jt != cells.end(); ++jt)
for(ElementArray<Cell>::iterator jt = cells.begin(); jt != cells.end(); ++jt)
{
glColor3f(0,0,0);
jt->Centroid(cnt);
......@@ -948,7 +945,7 @@ void draw()
}
glEnd();
*/
for(adjacent<Cell>::iterator jt = cells.begin(); jt != cells.end(); ++jt)
for(ElementArray<Cell>::iterator jt = cells.begin(); jt != cells.end(); ++jt)
{
jt->Centroid(cnt);
......@@ -958,9 +955,9 @@ void draw()
glVertex3dv(cnt);
glEnd();
adjacent<Face> faces = jt->getFaces();
ElementArray<Face> faces = jt->getFaces();
for(adjacent<Face>::iterator qt = faces.begin(); qt != faces.end(); ++qt)
for(ElementArray<Face>::iterator qt = faces.begin(); qt != faces.end(); ++qt)
{
qt->Centroid(cnt);
glColor3f(0,0,1);
......@@ -1042,14 +1039,14 @@ void draw()
{
if( parentfilter != -1 && parent_tag.isValid() && it->Integer(parent_tag) != parentfilter ) continue;
Storage::integer_array mats;
adjacent<Edge> edges = it->getEdges();
ElementArray<Edge> edges = it->getEdges();
Storage::real cnt[3];
for(unsigned k = 0; k < edges.size(); k++)
{
edges[k].Centroid(cnt);
mats = edges[k].IntegerArray(mats_tag);
adjacent<Node> nodes = edges[k].getNodes();
ElementArray<Node> nodes = edges[k].getNodes();
if( matfilter == 0 || std::binary_search(mats.begin(),mats.end(),matfilter-1) )
......@@ -1086,7 +1083,7 @@ void draw()
}
}
adjacent<Face> faces = it->getFaces();
ElementArray<Face> faces = it->getFaces();
for(unsigned k = 0; k < faces.size(); k++)
{
......@@ -1145,7 +1142,7 @@ void draw()
//end = mesh->MaxLocalID(EDGE);
//for(Mesh::iteratorEdge it = mesh->BeginEdge(); it != mesh->EndEdge(); it++)
//for(int i = 0; i < end; i++)
if( orphan_edges != NULL ) for(ElementSet::iterator iit = orphan_edges->begin(); iit != orphan_edges->end(); ++iit)
if( orphan_edges != NULL ) for(ElementSet::iterator iit = orphan_edges.Begin(); iit != orphan_edges.End(); ++iit)
{
Element * it = &*iit;//mesh->ElementByLocalID(EDGE,i);
//if( it == NULL ) continue;
......@@ -1154,7 +1151,7 @@ void draw()
Storage::integer_array mats = it->IntegerArray(mats_tag);
Storage::real cnt[3];
adjacent<Node> nodes = it->getNodes();
ElementArray<Node> nodes = it->getNodes();
if( matfilter == 0 || std::binary_search(mats.begin(),mats.end(),matfilter-1) )
{
......@@ -1203,14 +1200,14 @@ void draw()
Storage::integer_array mats;
Storage::real cnt[3];
adjacent<Edge> edges = it->getEdges();
ElementArray<Edge> edges = it->getEdges();
for(unsigned k = 0; k < edges.size(); k++)
//if( edges[k].nbAdjElements(CELL) == 0 )
{
mats = edges[k].IntegerArray(mats_tag);
adjacent<Node> nodes = edges[k].getNodes();
ElementArray<Node> nodes = edges[k].getNodes();
if( matfilter == 0 || std::binary_search(mats.begin(),mats.end(),matfilter-1) )
{
......@@ -1268,45 +1265,48 @@ void draw()
#endif
if( boundary )
{
int end = mesh->MaxLocalID(FACE);
//for(Mesh::iteratorFace it = mesh->BeginFace(); it != mesh->EndFace(); it++)
if( colort.isValid() )
for(ElementType etype = FACE; etype <= CELL; etype = NextElementType(etype) )
{
for(int i = 0; i < end; i+= interactive ? pacef : 1)
int end = mesh->LastLocalID(etype);
//for(Mesh::iteratorFace it = mesh->BeginFace(); it != mesh->EndFace(); it++)
if( colort.isValid() )
{
Element * it = mesh->ElementByLocalID(FACE,i);
if( it == NULL ) continue;
if( it->Boundary() )
for(int i = 0; i < end; i+= interactive ? pacef : 1)
{
int mmat = color ? (it->getAsFace()->BackCell() == NULL ? 0 : it->getAsFace()->BackCell()->Integer(colort)) : (it->getAsFace()->BackCell() == NULL ? 0 : it->getAsFace()->BackCell()->Integer(mat));
if( matfilter == 0 || matfilter-1 == mmat )
polygons.push_back(DrawFace(&*it,mmat,campos));
Element it = mesh->ElementByLocalID(etype,i);
if( !it.isValid() ) continue;
if( it->Boundary() )
{
int mmat = color ? (!it->getAsFace()->BackCell().isValid() ? 0 : it->getAsFace()->BackCell()->Integer(colort)) : (!it->getAsFace()->BackCell().isValid() ? 0 : it->getAsFace()->BackCell()->Integer(mat));
if( matfilter == 0 || matfilter-1 == mmat )
polygons.push_back(DrawFace(it->self(),mmat,campos));
}
}
}
}
else
{
for(int i = 0; i < end; i+= interactive ? pacef : 1)
else
{
Element * it = mesh->ElementByLocalID(FACE,i);
if( it == NULL ) continue;
if( it->Boundary() )
polygons.push_back(DrawFace(&*it,0,campos));
for(int i = 0; i < end; i+= interactive ? pacef : 1)
{
Element it = mesh->ElementByLocalID(etype,i);
if( !it.isValid() ) continue;
if( it->Boundary() )
polygons.push_back(DrawFace(it->self(),0,campos));
}
}
}
}
if( display_orphans )
{
if( orphan_edges != NULL ) for(ElementSet::iterator iit = orphan_edges->begin(); iit != orphan_edges->end(); ++iit)
if( orphan_edges.isValid()) for(ElementSet::iterator iit = orphan_edges.Begin(); iit != orphan_edges.End(); ++iit)
{
Element * it = &*iit;//mesh->ElementByLocalID(EDGE,i);
Element it = iit->self();//mesh->ElementByLocalID(EDGE,i);
//if( it == NULL ) continue;
//if( it->nbAdjElements(CELL) == 0 )
{
Storage::real cnt[3];
adjacent<Node> nodes = it->getNodes();
ElementArray<Node> nodes = it->getNodes();
{
glBegin(GL_LINES);
......@@ -1317,18 +1317,18 @@ void draw()
}
}
}
if( orphan_faces != NULL ) for(ElementSet::iterator iit = orphan_faces->begin(); iit != orphan_faces->end(); ++iit)
if( orphan_faces.isValid() ) for(ElementSet::iterator iit = orphan_faces.Begin(); iit != orphan_faces.End(); ++iit)
{
Element * it = &*iit;
Element it = iit->self();
{
Storage::integer_array mats;
Storage::real cnt[3];
adjacent<Edge> edges = it->getEdges();
ElementArray<Edge> edges = it->getEdges();
for(unsigned k = 0; k < edges.size(); k++)
{
adjacent<Node> nodes = edges[k].getNodes();
ElementArray<Node> nodes = edges[k].getNodes();
{
glBegin(GL_LINES);
glVertex3dv(&nodes[0].Coords()[0]);
......@@ -1339,7 +1339,7 @@ void draw()
if( matfilter == 0 || std::binary_search(mats.begin(),mats.end(),matfilter-1) )
polygons.push_back(DrawFace(&*it,0,campos));
polygons.push_back(DrawFace(it->self(),0,campos));
}
}
}
......@@ -1388,7 +1388,7 @@ void draw()
{
if( it->GetElementDimension() == 2 )
{
adjacent<Node> nodes = it->getNodes();
ElementArray<Node> nodes = it->getNodes();
if( it->GetGeometricType() == MultiPolygon )
{
glColor3f(1,0,0);
......@@ -1400,14 +1400,14 @@ void draw()
}
else glColor3f(0,1,0);
glBegin(GL_POLYGON);
for( adjacent<Node>::iterator kt = nodes.begin(); kt != nodes.end(); kt++)
for( ElementArray<Node>::iterator kt = nodes.begin(); kt != nodes.end(); kt++)
glVertex3d(kt->Coords()[0]+dir[0]*scale,kt->Coords()[1]+dir[1]*scale,kt->Coords()[2]+dir[2]*scale);
glEnd();
}
adjacent<Element> faces = it->getAdjElements(FACE);
for(adjacent<Element>::iterator f = faces.begin(); f != faces.end(); f++)// if( Geometry::Boundary(&*f) )
ElementArray<Element> faces = it->getAdjElements(FACE);
for(ElementArray<Element>::iterator f = faces.begin(); f != faces.end(); f++)// if( Geometry::Boundary(&*f) )
{
adjacent<Node> nodes = f->getNodes();
ElementArray<Node> nodes = f->getNodes();
if( it->GetGeometricType() == MultiPolygon )
{
glColor3f(1,0,0);
......@@ -1422,7 +1422,7 @@ void draw()
glBegin(GL_POLYGON);
else
glBegin(GL_LINES);
for(adjacent<Node>::iterator n = nodes.begin(); n != nodes.end(); n++)
for(ElementArray<Node>::iterator n = nodes.begin(); n != nodes.end(); n++)
glVertex3d(n->Coords()[0]+dir[0]*scale,n->Coords()[1]+dir[1]*scale,n->Coords()[2]+dir[2]*scale);
glEnd();
......@@ -1430,8 +1430,8 @@ void draw()
glBegin(GL_LINES);
adjacent<Cell> cells = f->getCells();
for(adjacent<Cell>::iterator c = cells.begin(); c != cells.end(); c++)
ElementArray<Cell> cells = f->getCells();
for(ElementArray<Cell>::iterator c = cells.begin(); c != cells.end(); c++)
if( &*c != &*it )
{
Storage::real cc2[3];
......@@ -1450,11 +1450,11 @@ void draw()
if( it->GetElementDimension() == 3 )
{
glBegin(GL_LINES);
adjacent<Edge> edges = it->getEdges();
for(adjacent<Edge>::iterator e = edges.begin(); e != edges.end(); e++)
ElementArray<Edge> edges = it->getEdges();
for(ElementArray<Edge>::iterator e = edges.begin(); e != edges.end(); e++)
{
adjacent<Element> nodes = e->getAdjElements(NODE);
for(adjacent<Element>::iterator jt = nodes.begin(); jt != nodes.end(); jt++)
ElementArray<Element> nodes = e->getAdjElements(NODE);
for(ElementArray<Element>::iterator jt = nodes.begin(); jt != nodes.end(); jt++)
{
Storage::real_array nc = jt->getAsNode()->Coords();
glVertex3d(nc[0]+dir[0]*scale,nc[1]+dir[1]*scale,nc[2]+dir[2]*scale);
......@@ -1533,12 +1533,12 @@ void draw()
{
delete CommonInput;
CommonInput = NULL;
Element * it = NULL;
Element it = InvalidElement();
Storage::real cnt[3];
if( show_cell != -1 )
{
it = mesh->ElementByLocalID(CELL,show_cell);
if( it == NULL )
if( !it.isValid() )
{
std::cout << "cell " << show_cell << " not accepted " << std::endl;
show_cell = -1;
......@@ -1553,7 +1553,7 @@ void draw()
if( show_face != -1 )
{
it = mesh->ElementByLocalID(FACE,show_face);
if( it == NULL )
if( !it.isValid() )
{
std::cout << "face " << show_face << " not accepted " << std::endl;
show_face = -1;
......@@ -1565,7 +1565,7 @@ void draw()
show_face = -1;
}
}
if( it != NULL )
if( it.isValid() )
{
it->Centroid(cnt);
shift[0] = -cnt[0];
......@@ -1716,8 +1716,8 @@ int main(int argc, char ** argv)
if( argc <= 2 )
{
orphan_edges = mesh->CreateSet();
orphan_faces = mesh->CreateSet();
orphan_edges = mesh->CreateSet("ORPHAN_EDGES").first;
orphan_faces = mesh->CreateSet("ORPHAN_FACES").first;
}
for(ElementType mask = FACE; mask >= NODE; mask = mask >> 1 )
......@@ -1727,9 +1727,9 @@ int main(int argc, char ** argv)
if( it->nbAdjElements(mask << 1) == 0 )
{
norphan++;
if( argc > 2 ) delete &*it;
else if( mask == EDGE ) orphan_edges->Insert(&*it);
else if( mask == FACE ) orphan_faces->Insert(&*it);
if( argc > 2 ) it->Delete();
else if( mask == EDGE ) orphan_edges->PutElement(it->self());
else if( mask == FACE ) orphan_faces->PutElement(it->self());
}
if( norphan > 0 ) std::cout << "orphan elements " << ElementTypeName(mask) << " " << norphan << std::endl;
}
......@@ -1743,8 +1743,8 @@ int main(int argc, char ** argv)
if( !it->CheckNormalOrientation() )
{
badorient++;
if( it->BackCell() != NULL ) neighbours[it->BackCell()->GetGeometricType()]++;
if( it->FrontCell() != NULL ) neighbours[it->FrontCell()->GetGeometricType()]++;
if( it->BackCell().isValid() ) neighbours[it->BackCell()->GetGeometricType()]++;
if( it->FrontCell().isValid() ) neighbours[it->FrontCell()->GetGeometricType()]++;
elemtypes[it->GetGeometricType()]++;
}
......@@ -1794,10 +1794,10 @@ int main(int argc, char ** argv)
if( mesh->HaveTag("GMSH_TAGS") )
{
Tag t = mesh->GetTag("GMSH_TAGS");
for(int k = 0; k < mesh->MaxLocalIDFACE(); k++)
for(int k = 0; k < mesh->FaceLastLocalID(); k++) if( mesh->isValidFace(k) )
{
Face * f = mesh->FaceByLocalID(k);
if( f != NULL && f->HaveData(t) && !f->Boundary() ) show_faces.push_back(k);
Face f = mesh->FaceByLocalID(k);
if( f->HaveData(t) && !f->Boundary() ) show_faces.push_back(k);
}
}
......
......@@ -299,7 +299,11 @@ namespace INMOST
throw BadFile;
}
else if( subtype == FACE )
elems->push_back(CreateCell(subarr.Convert<Face>()).first.GetHandle());
{
Cell c = CreateCell(subarr.Convert<Face>()).first;
if( repair_orientation ) c.FixEdgeOrder();
elems->push_back(c.GetHandle());
}
break;
}
}
......@@ -887,41 +891,8 @@ namespace INMOST
std::fstream fout(File.c_str(),std::ios::out);
fout << "<ParallelMesh>\n";
fout << "\t<Mesh>\n";
fout << "\t\t<Tags>\n";
for(int k = 0; k < (int)tags.size(); ++k)
{
if( tags[k].GetTagName().substr(0,9) == "PROTECTED" ) continue;
std::string names[6] = {"Nodes","Edges","Faces","Cells","Sets","Mesh"};
std::string definition = "", sparse = "", type = "";
switch(tags[k].GetDataType())
{
case DATA_REAL: type = "Real"; break;
case DATA_INTEGER: type = "Integer"; break;
case DATA_BULK: type = "Bulk"; break;