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

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)
This diff is collapsed.
......@@ -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;
case DATA_REFERENCE: type = "Reference"; break;
case DATA_REMOTE_REFERENCE: type = "RemoteReference"; break;
#if defined(USE_AUTODIFF)
case DATA_VARIABLE: type = "Variable"; break;
#endif
}
for(ElementType etype = NODE; etype <= MESH; etype = NextElementType(etype) )
{
if( tags[k].isDefined(etype) ) definition += names[ElementNum(etype)] + ",";
if( tags[k].isSparse(etype) ) sparse += names[ElementNum(etype)] + ",";
}
if( !definition.empty() ) definition.resize(definition.size()-1); //remove trailing comma
if( !sparse.empty() ) sparse.resize(sparse.size()-1); //remove trailing comma
if( sparse == "" ) sparse = "None";
fout << "\t\t\t<Tag Name =\"" << tags[k].GetTagName() << "\"\n";
if( tags[k].GetSize() !=ENUMUNDEF )
fout << "\t\t\t Size =\"" << tags[k].GetSize() << "\"\n";
fout << "\t\t\t Type =\"" << type << "\"\n";
fout << "\t\t\t Sparse=\"" << sparse << "\"\n";
fout << "\t\t\t Definition=\"" << definition << "\"/>\n";
}
Tag idx = CreateTag("TEMPORARY_XML_ENUMERATOR",DATA_INTEGER,MESH|ESET|CELL|FACE|EDGE|NODE,NONE,1);
Integer(GetHandle(),idx) = 0;
fout << "\t\t</Tags>\n";
fout << "\t\t<Nodes Number=\"" << NumberOfNodes() << "\" Dimensions=\"" << GetDimensions() << "\">\n";
fout << "\t\t\t<![CDATA[\n";
dynarray<Storage::real,3> xyz(GetDimensions());
......@@ -1034,6 +1005,39 @@ namespace INMOST
fout << "\t\t\t</Set>\n";
}
fout << "\t\t</Sets>\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;
case DATA_REFERENCE: type = "Reference"; break;
case DATA_REMOTE_REFERENCE: type = "RemoteReference"; break;
#if defined(USE_AUTODIFF)
case DATA_VARIABLE: type = "Variable"; break;
#endif
}
for(ElementType etype = NODE; etype <= MESH; etype = NextElementType(etype) )
{
if( tags[k].isDefined(etype) ) definition += names[ElementNum(etype)] + ",";
if( tags[k].isSparse(etype) ) sparse += names[ElementNum(etype)] + ",";
}
if( !definition.empty() ) definition.resize(definition.size()-1); //remove trailing comma
if( !sparse.empty() ) sparse.resize(sparse.size()-1); //remove trailing comma
if( sparse == "" ) sparse = "None";
fout << "\t\t\t<Tag Name =\"" << tags[k].GetTagName() << "\"\n";
if( tags[k].GetSize() !=ENUMUNDEF )
fout << "\t\t\t Size =\"" << tags[k].GetSize() << "\"\n";
fout << "\t\t\t Type =\"" << type << "\"\n";
fout << "\t\t\t Sparse=\"" << sparse << "\"\n";
fout << "\t\t\t Definition=\"" << definition << "\"/>\n";
}
fout << "\t\t</Tags>\n";
fout << "\t\t<Data>\n";
for(iteratorTag t = BeginTag(); t != EndTag(); ++t)
{
......
......@@ -138,6 +138,7 @@ namespace INMOST
if( jt == jend ) return false; //no matching edge
}
adj_type::size_type it = 1, iend = lc.size()-1;
bool corrected = false;
while(it < iend) //loop over edges
{
adj_type const & ilc = m->LowConn(lc[it]);
......@@ -164,12 +165,20 @@ namespace INMOST
HandleType temp = lc[it];
lc[it] = lc[jt];
lc[jt] = temp;
corrected = true;
break;
}
}
if( jt == jend ) return false; //no matching edge
}
}
if( corrected )
{
ElementArray<Node> nodes(GetMeshLink());
GetMeshLink()->RestoreCellNodes(GetHandle(),nodes);
Element::adj_type & hc = GetMeshLink()->HighConn(GetHandle());
hc.replace(hc.begin(),hc.end(),nodes.begin(),nodes.end());
}
//check that the loop is closed
adj_type const & ilc = m->LowConn(lc[iend]);
if( ilc.size() != 2 ) return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment