Skip to content
Snippets Groups Projects
Commit 5efa30f1 authored by Karsten Rink's avatar Karsten Rink
Browse files

changed default mesh-open-type to vtu; mode points-array name attribute in VTKInterface optional

parent 775ab5ee
No related branches found
No related tags found
No related merge requests found
...@@ -62,7 +62,7 @@ public: ...@@ -62,7 +62,7 @@ public:
else if (t==ImportFileType::NETCDF) else if (t==ImportFileType::NETCDF)
return "NetCDF files (*.nc)"; return "NetCDF files (*.nc)";
else if (t==ImportFileType::OGS) else if (t==ImportFileType::OGS)
return "Geosys files (*.gsp *.gli *.gml *.msh *.stn);;Project files (*.gsp);;GeoSys FEM Conditions (*.cnd *.bc *.ic *.st);;GLI files (*.gli);;MSH files (*.msh);;STN files (*.stn);;All files (* *.*)"; return "OpenGeosys files (*.gsp *.gml *.vtu *.stn);;GeoSys legacy files (*.gli *.msh);;GeoSys FEM Conditions (*.cnd *.bc *.ic *.st);;All files (* *.*)";
else if (t==ImportFileType::PETREL) else if (t==ImportFileType::PETREL)
return "Petrel files (*)"; return "Petrel files (*)";
else if (t==ImportFileType::RASTER) else if (t==ImportFileType::RASTER)
......
...@@ -82,7 +82,9 @@ MeshLib::Mesh* VTKInterface::readVTUFile(const std::string &file_name) ...@@ -82,7 +82,9 @@ MeshLib::Mesh* VTKInterface::readVTUFile(const std::string &file_name)
std::vector<unsigned> cell_types(nElems); std::vector<unsigned> cell_types(nElems);
const rapidxml::xml_node<>* mat_id_node (piece_node->first_node("CellData")->first_node("DataArray")); const rapidxml::xml_node<>* mat_id_node (piece_node->first_node("CellData")->first_node("DataArray"));
if (mat_id_node && (std::string(mat_id_node->first_attribute("Name")->value()).compare("MaterialIDs") == 0)) if (mat_id_node &&
((std::string(mat_id_node->first_attribute("Name")->value()).compare("MaterialIDs") == 0) ||
(std::string(mat_id_node->first_attribute("Name")->value()).compare("MatGroup") == 0)))
{ {
if (std::string(mat_id_node->first_attribute("format")->value()).compare("ascii") == 0) if (std::string(mat_id_node->first_attribute("format")->value()).compare("ascii") == 0)
{ {
...@@ -96,7 +98,9 @@ MeshLib::Mesh* VTKInterface::readVTUFile(const std::string &file_name) ...@@ -96,7 +98,9 @@ MeshLib::Mesh* VTKInterface::readVTUFile(const std::string &file_name)
const rapidxml::xml_node<>* points_node (piece_node->first_node("Points")->first_node("DataArray")); const rapidxml::xml_node<>* points_node (piece_node->first_node("Points")->first_node("DataArray"));
if (points_node && (std::string(points_node->first_attribute("Name")->value()).compare("Points") == 0)) // This _may_ have an attribute "Name" with the value "Points" but you cannot count on it.
// However, there shouldn't be any other DataArray nodes so most likely not checking the name isn't a problem.
if (points_node)
{ {
if (std::string(points_node->first_attribute("format")->value()).compare("ascii") == 0) if (std::string(points_node->first_attribute("format")->value()).compare("ascii") == 0)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment