OGS
|
Class for parallel reading of binary partitioned mesh files into a NodePartitionedMesh via MPI.
Definition at line 38 of file NodePartitionedMeshReader.h.
#include <NodePartitionedMeshReader.h>
Classes | |
struct | PartitionedMeshInfo |
A collection of integers that configure the partitioned mesh data. More... | |
Public Member Functions | |
NodePartitionedMeshReader (MPI_Comm comm) | |
~NodePartitionedMeshReader () | |
MeshLib::NodePartitionedMesh * | read (const std::string &file_name_base) |
Create a NodePartitionedMesh object, read data to it, and return a pointer to it. Data files are in binary format. | |
Private Member Functions | |
void | registerNodeDataMpiType () |
Define MPI data type for NodeData struct. | |
MeshLib::NodePartitionedMesh * | newMesh (std::string const &mesh_name, std::vector< MeshLib::Node * > const &mesh_nodes, std::vector< unsigned long > const &glb_node_ids, std::vector< MeshLib::Element * > const &mesh_elems, MeshLib::Properties const &properties) const |
Create a new mesh of NodePartitionedMesh after reading and processing the data. | |
template<typename DATA > | |
bool | readDataFromFile (std::string const &filename, MPI_Offset offset, MPI_Datatype type, DATA &data) const |
MeshLib::NodePartitionedMesh * | readMesh (const std::string &file_name_base) |
Create a NodePartitionedMesh object, read binary mesh data in the manner of parallel, and return a pointer to it. Four binary files have to been read in this function named as: | |
MeshLib::Properties | readProperties (const std::string &file_name_base) const |
void | readProperties (const std::string &file_name_base, MeshLib::MeshItemType t, MeshLib::Properties &p) const |
void | readDomainSpecificPartOfPropertyVectors (std::vector< std::optional< MeshLib::IO::PropertyVectorMetaData > > const &vec_pvmd, MeshLib::IO::PropertyVectorPartitionMetaData const &pvpmd, MeshLib::MeshItemType t, std::istream &is, MeshLib::Properties &p) const |
template<typename T > | |
void | createPropertyVectorPart (std::istream &is, MeshLib::IO::PropertyVectorMetaData const &pvmd, MeshLib::IO::PropertyVectorPartitionMetaData const &pvpmd, MeshLib::MeshItemType t, unsigned long global_offset, MeshLib::Properties &p) const |
template<typename T > | |
void | createSpecificPropertyVectorPart (std::istream &is, MeshLib::IO::PropertyVectorMetaData const &pvmd, MeshLib::MeshItemType t, unsigned long global_offset, MeshLib::Properties &p) const |
void | setNodes (const std::vector< NodeData > &node_data, std::vector< MeshLib::Node * > &mesh_node, std::vector< unsigned long > &glb_node_ids) const |
Set mesh nodes from a temporary array containing node data read from file. | |
void | setElements (const std::vector< MeshLib::Node * > &mesh_nodes, const std::vector< unsigned long > &elem_data, std::vector< MeshLib::Element * > &mesh_elems, const bool ghost=false) const |
Set mesh elements from a temporary array containing node data read from file. | |
Private Attributes | |
BaseLib::MPI::Mpi | mpi_ |
Pointer to MPI communicator, the rank and the size. | |
MPI_Datatype | _mpi_node_type |
MPI data type for struct NodeData. | |
struct MeshLib::IO::NodePartitionedMeshReader::PartitionedMeshInfo | _mesh_info |
|
explicit |
comm | MPI communicator. |
Definition at line 49 of file NodePartitionedMeshReader.cpp.
References registerNodeDataMpiType().
MeshLib::IO::NodePartitionedMeshReader::~NodePartitionedMeshReader | ( | ) |
Definition at line 54 of file NodePartitionedMeshReader.cpp.
References _mpi_node_type.
|
inlineprivate |
Definition at line 183 of file NodePartitionedMeshReader.h.
References mpi_, MeshLib::IO::PropertyVectorMetaData::number_of_components, MeshLib::IO::PropertyVectorPartitionMetaData::number_of_tuples, MeshLib::IO::PropertyVectorPartitionMetaData::offset, OGS_FATAL, MeshLib::IO::PropertyVectorMetaData::property_name, BaseLib::MPI::Mpi::rank, and MeshLib::PropertyVector< PROP_VAL_TYPE >::size().
Referenced by readDomainSpecificPartOfPropertyVectors().
|
inlineprivate |
Read data for property OGS_VERSION or IntegrationPointMetaData, and create property vector for it.
Definition at line 209 of file NodePartitionedMeshReader.h.
References mpi_, MeshLib::IO::PropertyVectorMetaData::number_of_components, MeshLib::IO::PropertyVectorMetaData::number_of_tuples, OGS_FATAL, MeshLib::IO::PropertyVectorMetaData::property_name, BaseLib::MPI::Mpi::rank, BaseLib::MPI::Mpi::size, and MeshLib::PropertyVector< PROP_VAL_TYPE >::size().
Referenced by readDomainSpecificPartOfPropertyVectors().
|
private |
Create a new mesh of NodePartitionedMesh after reading and processing the data.
mesh_name | Name assigned to the new mesh. |
mesh_nodes | Node data. |
glb_node_ids | Global IDs of nodes. |
mesh_elems | Element data. |
properties | Collection of PropertyVector's assigned to the mesh. |
Definition at line 399 of file NodePartitionedMeshReader.cpp.
References _mesh_info, BaseLib::MPI::allgather(), mpi_, MeshLib::IO::NodePartitionedMeshReader::PartitionedMeshInfo::number_of_global_base_nodes, MeshLib::IO::NodePartitionedMeshReader::PartitionedMeshInfo::number_of_global_nodes, MeshLib::IO::NodePartitionedMeshReader::PartitionedMeshInfo::number_of_regular_base_nodes, MeshLib::IO::NodePartitionedMeshReader::PartitionedMeshInfo::number_of_regular_nodes, and BaseLib::sizesToOffsets().
Referenced by readMesh().
MeshLib::NodePartitionedMesh * MeshLib::IO::NodePartitionedMeshReader::read | ( | const std::string & | file_name_base | ) |
Create a NodePartitionedMesh object, read data to it, and return a pointer to it. Data files are in binary format.
file_name_base | Name of file to be read, and it must be base name without name extension. |
Definition at line 71 of file NodePartitionedMeshReader.cpp.
References BaseLib::MPI::Mpi::communicator, BaseLib::RunTime::elapsed(), ERR(), INFO(), BaseLib::IsFileExisting(), mpi_, OGS_FATAL, readMesh(), BaseLib::MPI::Mpi::size, and BaseLib::RunTime::start().
Referenced by MeshLib::IO::readMeshFromFile().
|
private |
Parallel reading of a binary file via MPI_File_read, reading mesh data head, nodes, non-ghost elements and ghost elements.
int
type), an error is printed.filename | File name containing data. |
offset | Displacement of the data accessible from the view. see MPI_File_set_view() documentation. |
type | Type of data. |
data | A container to be filled with data. Its size is used to determine how many values should be read. |
DATA | A homogeneous container type supporting data() and size(). |
Definition at line 108 of file NodePartitionedMeshReader.cpp.
References BaseLib::MPI::Mpi::communicator, ERR(), is_safely_convertable(), and mpi_.
Referenced by readMesh().
|
private |
Definition at line 296 of file NodePartitionedMeshReader.cpp.
References createPropertyVectorPart(), createSpecificPropertyVectorPart(), DBUG(), MeshLib::IntegrationPoint, MeshLib::IO::PropertyVectorPartitionMetaData::offset, and WARN().
Referenced by readProperties().
|
private |
Create a NodePartitionedMesh object, read binary mesh data in the manner of parallel, and return a pointer to it. Four binary files have to been read in this function named as:
in which, the first file contains an array of integers for the PartitionMeshInfo for all partitions, the second file contains a struct type (long, double double double) array of nodes information of global IDs and coordinates of all partitions, the third file contains a long type integer array of element information of material ID, element type and node IDs of each non-ghost element of all partitions, and the forth file contains a long type integer array of element information of material ID, element type and node IDs of each ghost element of all partitions.
file_name_base | Name of file to be read, which must be a name with the path to the file and without file extension. |
Definition at line 146 of file NodePartitionedMeshReader.cpp.
References _mesh_info, _mpi_node_type, BaseLib::extractBaseName(), mpi_, newMesh(), MeshLib::IO::NodePartitionedMeshReader::PartitionedMeshInfo::number_of_ghost_elements, MeshLib::IO::NodePartitionedMeshReader::PartitionedMeshInfo::number_of_nodes, MeshLib::IO::NodePartitionedMeshReader::PartitionedMeshInfo::number_of_regular_elements, MeshLib::IO::NodePartitionedMeshReader::PartitionedMeshInfo::offset, BaseLib::MPI::Mpi::rank, readDataFromFile(), readProperties(), setElements(), setNodes(), and BaseLib::MPI::Mpi::size.
Referenced by read().
|
private |
Definition at line 211 of file NodePartitionedMeshReader.cpp.
References MeshLib::Cell, MeshLib::IntegrationPoint, MeshLib::Node, and readProperties().
Referenced by readMesh(), and readProperties().
|
private |
Definition at line 221 of file NodePartitionedMeshReader.cpp.
References BaseLib::MPI::allreduce(), DBUG(), ERR(), mpi_, OGS_FATAL, BaseLib::MPI::Mpi::rank, readDomainSpecificPartOfPropertyVectors(), MeshLib::IO::readPropertyVectorMetaData(), MeshLib::IO::readPropertyVectorPartitionMetaData(), BaseLib::MPI::Mpi::size, MeshLib::toString(), WARN(), and MeshLib::IO::writePropertyVectorMetaData().
|
private |
Define MPI data type for NodeData struct.
Definition at line 59 of file NodePartitionedMeshReader.cpp.
References _mpi_node_type, and MeshLib::IO::NodeData::index.
Referenced by NodePartitionedMeshReader().
|
private |
Set mesh elements from a temporary array containing node data read from file.
mesh_nodes | Vector of mesh nodes used to set element nodes. |
elem_data | Vector containing element data read from file. |
mesh_elems | Vector of mesh elements to be set. |
ghost | Flag of processing ghost elements. |
Definition at line 445 of file NodePartitionedMeshReader.cpp.
References _mesh_info, MeshLib::HEX20, MeshLib::HEX27, MeshLib::HEX8, MeshLib::INVALID, MeshLib::LINE2, MeshLib::LINE3, MeshLib::IO::NodePartitionedMeshReader::PartitionedMeshInfo::number_of_ghost_elements, MeshLib::IO::NodePartitionedMeshReader::PartitionedMeshInfo::number_of_regular_elements, OGS_FATAL, MeshLib::POINT1, MeshLib::PRISM15, MeshLib::PRISM6, MeshLib::PYRAMID13, MeshLib::PYRAMID5, MeshLib::QUAD4, MeshLib::QUAD8, MeshLib::QUAD9, MeshLib::TET10, MeshLib::TET4, MeshLib::TRI3, and MeshLib::TRI6.
Referenced by readMesh().
|
private |
Set mesh nodes from a temporary array containing node data read from file.
node_data | Vector containing node data read from file. |
mesh_node | Vector of mesh nodes to be set. |
glb_node_ids | Global IDs of nodes of a partition. |
Definition at line 429 of file NodePartitionedMeshReader.cpp.
References _mesh_info, MeshLib::IO::NodeData::index, MeshLib::Node, MeshLib::IO::NodePartitionedMeshReader::PartitionedMeshInfo::number_of_nodes, MeshLib::IO::NodeData::x, MeshLib::IO::NodeData::y, and MeshLib::IO::NodeData::z.
Referenced by readMesh().
|
private |
Referenced by newMesh(), readMesh(), setElements(), and setNodes().
|
private |
MPI data type for struct NodeData.
Definition at line 61 of file NodePartitionedMeshReader.h.
Referenced by ~NodePartitionedMeshReader(), readMesh(), and registerNodeDataMpiType().
|
private |
Pointer to MPI communicator, the rank and the size.
Definition at line 58 of file NodePartitionedMeshReader.h.
Referenced by createPropertyVectorPart(), createSpecificPropertyVectorPart(), newMesh(), read(), readDataFromFile(), readMesh(), and readProperties().