Skip to content
Snippets Groups Projects
Commit 694adbbd authored by wenqing's avatar wenqing
Browse files

[MeshIO] Added a new function for reading serial mesh data

parent 5a5b9140
No related branches found
No related tags found
No related merge requests found
......@@ -55,27 +55,20 @@ MeshLib::Mesh* readMeshFromFile(const std::string &file_name)
}
else if (world_size == 1)
{
MeshLib::Mesh* mesh = nullptr;
if (BaseLib::hasFileExtension("msh", file_name))
{
MeshLib::IO::Legacy::MeshIO meshIO;
mesh = meshIO.loadMeshFromFile(file_name);
}
if (BaseLib::hasFileExtension("vtu", file_name))
mesh = MeshLib::IO::VtuInterface::readVTUFile(file_name);
if (mesh == nullptr)
{
ERR("readMeshFromFile(): Unknown mesh file format in file %s.",
file_name.c_str());
}
MeshLib::Mesh* mesh = readMeshFromFileSerial(file_name);
MeshLib::NodePartitionedMesh* part_mesh
= new MeshLib::NodePartitionedMesh(*mesh);
delete mesh;
return part_mesh;
}
return nullptr;
#else
return readMeshFromFileSerial(file_name);
#endif
}
MeshLib::Mesh* readMeshFromFileSerial(const std::string &file_name)
{
if (BaseLib::hasFileExtension("msh", file_name))
{
MeshLib::IO::Legacy::MeshIO meshIO;
......@@ -86,8 +79,9 @@ MeshLib::Mesh* readMeshFromFile(const std::string &file_name)
return MeshLib::IO::VtuInterface::readVTUFile(file_name);
ERR("readMeshFromFile(): Unknown mesh file format in file %s.", file_name.c_str());
#endif
return nullptr;
}
} // end namespace IO
} // end namespace MeshLib
......@@ -27,6 +27,7 @@ class Mesh;
namespace IO
{
MeshLib::Mesh* readMeshFromFileSerial(const std::string &file_name);
MeshLib::Mesh* readMeshFromFile(const std::string &file_name);
}
}
......
......@@ -43,6 +43,10 @@ class NodePartitionedMesh : public Mesh
for (std::size_t i = 0; i < _nodes.size(); i++)
{
_global_node_ids[i] = _nodes[i]->getID();
// TODO To add copying of the connected nodes (and elements)
// in the copy constructor of class Node in order to
// drop the following lines.
auto node = _nodes[i];
// Copy constructor of Mesh does not copy the connected
// nodes to node.
......
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