OGS
|
Class for parallel reading of binary partitioned mesh files into a NodePartitionedMesh via MPI.
Definition at line 37 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 | |
MPI_Comm | _mpi_comm |
Pointer to MPI communicator. | |
int | _mpi_comm_size |
Number of processes in the communicator: _mpi_comm. | |
int | _mpi_rank |
Rank of compute core. | |
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 48 of file NodePartitionedMeshReader.cpp.
References _mpi_comm, _mpi_comm_size, _mpi_rank, and registerNodeDataMpiType().
MeshLib::IO::NodePartitionedMeshReader::~NodePartitionedMeshReader | ( | ) |
Definition at line 57 of file NodePartitionedMeshReader.cpp.
References _mpi_node_type.
|
inlineprivate |
Definition at line 188 of file NodePartitionedMeshReader.h.
References _mpi_rank, MeshLib::IO::PropertyVectorMetaData::number_of_components, MeshLib::IO::PropertyVectorPartitionMetaData::number_of_tuples, MeshLib::IO::PropertyVectorPartitionMetaData::offset, OGS_FATAL, MeshLib::IO::PropertyVectorMetaData::property_name, 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 214 of file NodePartitionedMeshReader.h.
References _mpi_comm_size, _mpi_rank, MeshLib::IO::PropertyVectorMetaData::number_of_components, MeshLib::IO::PropertyVectorMetaData::number_of_tuples, OGS_FATAL, MeshLib::IO::PropertyVectorMetaData::property_name, 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 403 of file NodePartitionedMeshReader.cpp.
References _mesh_info, _mpi_comm, _mpi_comm_size, 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, and MeshLib::IO::NodePartitionedMeshReader::PartitionedMeshInfo::number_of_regular_nodes.
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 74 of file NodePartitionedMeshReader.cpp.
References _mpi_comm, _mpi_comm_size, BaseLib::RunTime::elapsed(), ERR(), INFO(), BaseLib::IsFileExisting(), OGS_FATAL, readMesh(), 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 111 of file NodePartitionedMeshReader.cpp.
References _mpi_comm, ERR(), and is_safely_convertable().
Referenced by readMesh().
|
private |
Definition at line 300 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 148 of file NodePartitionedMeshReader.cpp.
References _mesh_info, _mpi_comm_size, _mpi_node_type, _mpi_rank, BaseLib::extractBaseName(), 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, readDataFromFile(), readProperties(), setElements(), and setNodes().
Referenced by read().
|
private |
Definition at line 213 of file NodePartitionedMeshReader.cpp.
References MeshLib::Cell, MeshLib::IntegrationPoint, MeshLib::Node, and readProperties().
Referenced by readMesh(), and readProperties().
|
private |
Definition at line 223 of file NodePartitionedMeshReader.cpp.
References _mpi_comm, _mpi_comm_size, _mpi_rank, DBUG(), ERR(), OGS_FATAL, readDomainSpecificPartOfPropertyVectors(), MeshLib::IO::readPropertyVectorMetaData(), MeshLib::IO::readPropertyVectorPartitionMetaData(), MeshLib::toString(), WARN(), and MeshLib::IO::writePropertyVectorMetaData().
|
private |
Define MPI data type for NodeData struct.
Definition at line 62 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 469 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 453 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 |
Pointer to MPI communicator.
Definition at line 57 of file NodePartitionedMeshReader.h.
Referenced by NodePartitionedMeshReader(), newMesh(), read(), readDataFromFile(), and readProperties().
|
private |
Number of processes in the communicator: _mpi_comm.
Definition at line 60 of file NodePartitionedMeshReader.h.
Referenced by NodePartitionedMeshReader(), createSpecificPropertyVectorPart(), newMesh(), read(), readMesh(), and readProperties().
|
private |
MPI data type for struct NodeData.
Definition at line 66 of file NodePartitionedMeshReader.h.
Referenced by ~NodePartitionedMeshReader(), readMesh(), and registerNodeDataMpiType().
|
private |
Rank of compute core.
Definition at line 63 of file NodePartitionedMeshReader.h.
Referenced by NodePartitionedMeshReader(), createPropertyVectorPart(), createSpecificPropertyVectorPart(), readMesh(), and readProperties().