Mesh file reader in msh format. More...
Classes | |
| class | MshToArcaneTypeInfo |
| Mapping information between MSH type and Arcane type. More... | |
| struct | MshElementBlock |
| Info of a block for $Elements for version 4. More... | |
| struct | MshNodeBlock |
| Info of a block for $Nodes. More... | |
| class | MshItemKindInfo |
| Information to create entities of a certain kind. More... | |
| class | MshMeshAllocateInfo |
| Information to create Arcane entities. More... | |
Public Member Functions | |
| MshParallelMeshReader (ITraceMng *tm) | |
| eReturnType | readMeshFromMshFile (IMesh *mesh, const String &filename, bool use_internal_partition) override |
| Reads the mesh contained in the file filename and constructs it in mesh. | |
| Public Member Functions inherited from Arcane::TraceAccessor | |
| TraceAccessor (ITraceMng *m) | |
| Constructs an accessor via the trace manager m. | |
| TraceAccessor (const TraceAccessor &rhs) | |
| Copy constructor. | |
| TraceAccessor & | operator= (const TraceAccessor &rhs) |
| Copy assignment operator. | |
| virtual | ~TraceAccessor () |
| Frees resources. | |
| ITraceMng * | traceMng () const |
| Trace manager. | |
| TraceMessage | info () const |
| Flow for an information message. | |
| TraceMessage | pinfo () const |
| Flow for a parallel information message. | |
| TraceMessage | info (char category) const |
| Flow for an information message of a given category. | |
| TraceMessage | pinfo (char category) const |
| Flow for a parallel information message of a given category. | |
| TraceMessage | info (bool v) const |
| Flow for an information message. | |
| TraceMessage | warning () const |
| Flow for a warning message. | |
| TraceMessage | pwarning () const |
| TraceMessage | error () const |
| Flow for an error message. | |
| TraceMessage | perror () const |
| TraceMessage | log () const |
| Flow for a log message. | |
| TraceMessage | plog () const |
| Flow for a log message. | |
| TraceMessage | logdate () const |
| Flow for a log message preceded by the date. | |
| TraceMessage | fatal () const |
| Flow for a fatal error message. | |
| TraceMessage | pfatal () const |
| Flow for a parallel fatal error message. | |
| TraceMessageDbg | debug (Trace::eDebugLevel=Trace::Medium) const |
| Flow for a debug message. | |
| Trace::eDebugLevel | configDbgLevel () const |
| Debug level of the configuration file. | |
| TraceMessage | info (Int32 verbose_level) const |
| Flow for an information message of a given level. | |
| TraceMessage | linfo () const |
| Flow for an information message with the local information level of this instance. | |
| TraceMessage | linfo (Int32 relative_level) const |
| Flow for an information message with the local information level of this instance. | |
| void | fatalMessage (const StandaloneTraceMessage &o) const |
Private Member Functions | |
| void | _readNodesFromFile () |
| Reads mesh nodes. | |
| void | _readNodesOneEntity (MshNodeBlock &node_block) |
| Integer | _readElementsFromFile () |
| Reading of elements (cells, faces, ...). | |
| void | _readMeshFromFile () |
| void | _setNodesCoordinates () |
| Positions the node coordinates. | |
| void | _allocateCells () |
| void | _allocateGroups () |
| void | _addFaceGroup (const MshElementBlock &block, const String &group_name) |
| Adds faces to the group group_name. | |
| void | _addFaceGroupOnePart (const MshElementBlock &block, ConstArrayView< Int64 > connectivities, const String &group_name) |
| void | _addCellOrNodeGroup (ArrayView< Int64 > block_uids, Int32 block_index, const String &group_name, IItemFamily *family, bool filter_invalid) |
| Adds cells or nodes to the group group_name. | |
| void | _addCellOrNodeGroupOnePart (ConstArrayView< Int64 > uids, const String &group_name, Int32 block_index, IItemFamily *family, bool filter_invalid) |
| void | _readPhysicalNames () |
| void | _readEntities () |
| Reading entities. | |
| void | _readPeriodic () |
| Reading periodic information. | |
| void | _readOneEntity (Int32 entity_dim, Int32 entity_index_in_dim) |
| bool | _getIsEndOfFileAndBroadcast () |
| Returns true if we are at the end of the file. | |
| String | _getNextLineAndBroadcast () |
| Reads the next line value and broadcasts it to other ranks. | |
| Int32 | _getIntegerAndBroadcast () |
| Int64 | _getInt64AndBroadcast () |
| void | _getInt64ArrayAndBroadcast (ArrayView< Int64 > values) |
| void | _getInt32ArrayAndBroadcast (ArrayView< Int32 > values) |
| void | _getDoubleArrayAndBroadcast (ArrayView< double > values) |
| void | _readOneElementBlock (MshElementBlock &block) |
| Reads an 'Element' type block. | |
| void | _computeNodesPartition () |
| void | _computeOwnItems (MshElementBlock &block, MshItemKindInfo &item_kind_info, bool is_generate_uid) |
| Real3 | _getReal3 () |
| Int32 | _getInt32 () |
| Int64 | _getInt64 () |
| void | _goToNextLine () |
| void | _readAndCheck (const String &expected_value) |
| Tries to read the value value. | |
| void | _addMshTypeInfo (Int32 msh_type, ItemTypeId arcane_type, ConstArrayView< Int16 > reorder_infos={}) |
| const MshToArcaneTypeInfo & | mshToArcaneTypeInfo (Int32 msh_type) const |
| void | _initTypes () |
Private Attributes | |
| IMesh * | m_mesh = nullptr |
| IParallelMng * | m_parallel_mng = nullptr |
| Int32 | m_master_io_rank = A_NULL_RANK |
| bool | m_is_parallel = false |
| Ref< IosFile > | m_ios_file |
| impl::MshMeshGenerationInfo * | m_mesh_info = nullptr |
| MshMeshAllocateInfo | m_mesh_allocate_info |
| Int32 | m_nb_part = 4 |
| Number of partitions for reading nodes and blocks. | |
| UniqueArray< Int32 > | m_parts_rank |
| List of ranks participating in data conservation. | |
| bool | m_is_binary = false |
| True if the format is binary. | |
| UniqueArray< MshToArcaneTypeInfo > | m_msh_to_arcane_type_infos |
| Conversion information between MSH and Arcane types for entities. | |
| Int32 | m_verbosity_level = 0 |
| Verbosity level. | |
Additional Inherited Members | |
| Protected Member Functions inherited from Arcane::TraceAccessor | |
| void | _setLocalVerboseLevel (Int32 v) |
| Int32 | _localVerboseLevel () const |
Mesh file reader in msh format.
The msh format is used by the gmsh library.
The reader supports version 4.1 of this format.
Currently, the following tags are supported:
Definition at line 82 of file MshParallelMeshReader.cc.
| using Arcane::MshParallelMeshReader::eReturnType = typename IMeshReader::eReturnType |
Definition at line 96 of file MshParallelMeshReader.cc.
| using Arcane::MshParallelMeshReader::MshEntitiesNodes = impl::MshMeshGenerationInfo::MshEntitiesNodes |
Definition at line 89 of file MshParallelMeshReader.cc.
| using Arcane::MshParallelMeshReader::MshEntitiesWithNodes = impl::MshMeshGenerationInfo::MshEntitiesWithNodes |
Definition at line 90 of file MshParallelMeshReader.cc.
| using Arcane::MshParallelMeshReader::MshPeriodicInfo = impl::MshMeshGenerationInfo::MshPeriodicInfo |
Definition at line 92 of file MshParallelMeshReader.cc.
| using Arcane::MshParallelMeshReader::MshPeriodicOneInfo = impl::MshMeshGenerationInfo::MshPeriodicOneInfo |
Definition at line 91 of file MshParallelMeshReader.cc.
| using Arcane::MshParallelMeshReader::MshPhysicalName = impl::MshMeshGenerationInfo::MshPhysicalName |
Definition at line 88 of file MshParallelMeshReader.cc.
|
explicit |
Definition at line 293 of file MshParallelMeshReader.cc.
|
private |
Adds cells or nodes to the group group_name.
Definition at line 1421 of file MshParallelMeshReader.cc.
References m_parts_rank.
|
private |
Definition at line 1437 of file MshParallelMeshReader.cc.
|
private |
Adds faces to the group group_name.
Definition at line 1315 of file MshParallelMeshReader.cc.
References Arcane::MshParallelMeshReader::MshElementBlock::connectivities, m_parts_rank, and Arcane::Array< T >::view().
|
private |
Definition at line 1330 of file MshParallelMeshReader.cc.
|
private |
Definition at line 1919 of file MshParallelMeshReader.cc.
|
private |
Definition at line 1198 of file MshParallelMeshReader.cc.
|
private |
Definition at line 1220 of file MshParallelMeshReader.cc.
|
private |
Rank to which the nodes of my part belong.
Definition at line 512 of file MshParallelMeshReader.cc.
References Arcane::TraceAccessor::info(), Arcane::math::isNearlyEqual(), m_nb_part, m_parts_rank, Arcane::math::max(), Arcane::math::min(), Arcane::IParallelMng::reduce(), Arcane::MessagePassing::ReduceMax, Arcane::MessagePassing::ReduceMin, Arcane::MessagePassing::ReduceSum, and Arcane::Real3POD::x.
Referenced by _readNodesFromFile().
|
private |
Definition at line 1076 of file MshParallelMeshReader.cc.
|
private |
Definition at line 429 of file MshParallelMeshReader.cc.
|
private |
Definition at line 470 of file MshParallelMeshReader.cc.
Definition at line 409 of file MshParallelMeshReader.cc.
|
private |
Definition at line 486 of file MshParallelMeshReader.cc.
|
private |
Definition at line 373 of file MshParallelMeshReader.cc.
Definition at line 389 of file MshParallelMeshReader.cc.
|
private |
Returns true if we are at the end of the file.
Definition at line 334 of file MshParallelMeshReader.cc.
References Arcane::TraceAccessor::info().
|
private |
Reads the next line value and broadcasts it to other ranks.
Definition at line 311 of file MshParallelMeshReader.cc.
References Arcane::TraceAccessor::info().
Referenced by _readAndCheck(), _readPeriodic(), and readMeshFromMshFile().
|
private |
Definition at line 449 of file MshParallelMeshReader.cc.
|
private |
Definition at line 502 of file MshParallelMeshReader.cc.
|
private |
Definition at line 1877 of file MshParallelMeshReader.cc.
|
private |
Tries to read the value value.
Definition at line 1741 of file MshParallelMeshReader.cc.
References _getNextLineAndBroadcast(), ARCANE_FATAL, Arcane::String::bytes(), Arcane::TraceAccessor::info(), m_is_binary, Arcane::SpanImpl< T, SizeType, Extent >::size(), and Arcane::FixedArray< T, NbElement >::span().
Referenced by _readEntities().
|
private |
Reading of elements (cells, faces, ...).
Here is the format description:
* $Elements * numEntityBlocks(size_t) numElements(size_t) * minElementTag(size_t) maxElementTag(size_t) * entityDim(int) entityTag(int) elementType(int; see below) * numElementsInBlock(size_t) * elementTag(size_t) nodeTag(size_t) ... * ... * ... * $EndElements *
In version 4, elements are sorted by type (eItemKind). Each entity block may have a different dimension. There is no mesh dimension associated with it. Therefore, we consider the dimension of the mesh to be the highest dimension of the blocks we read. This also means that we are forced to read all blocks before we can know the mesh dimension.
In parallel, each block is distributed across the ranks in m_parts_rank.
Definition at line 863 of file MshParallelMeshReader.cc.
References _readOneElementBlock(), ARCANE_FATAL, ARCANE_THROW, Arcane::TraceAccessor::info(), Arcane::ItemTypeInfo::itemTypeId(), m_is_binary, m_verbosity_level, Arcane::math::max(), Arcane::ItemTypeInfo::nbLocalNode(), Arcane::Array< T >::resize(), Arcane::ItemTypeMng::typeFromId(), Arcane::ItemTypeInfo::typeName(), and Arcane::FixedArray< T, NbElement >::view().
|
private |
Reading entities.
The format is:
* $Entities * numPoints(size_t) numCurves(size_t) * numSurfaces(size_t) numVolumes(size_t) * pointTag(int) X(double) Y(double) Z(double) * numPhysicalTags(size_t) physicalTag(int) ... * ... * curveTag(int) minX(double) minY(double) minZ(double) * maxX(double) maxY(double) maxZ(double) * numPhysicalTags(size_t) physicalTag(int) ... * numBoundingPoints(size_t) pointTag(int) ... * ... * surfaceTag(int) minX(double) minY(double) minZ(double) * maxX(double) maxY(double) maxZ(double) * numPhysicalTags(size_t) physicalTag(int) ... * numBoundingCurves(size_t) curveTag(int) ... * ... * volumeTag(int) minX(double) minY(double) minZ(double) * maxX(double) maxY(double) maxZ(double) * numPhysicalTags(size_t) physicalTag(int) ... * numBoundngSurfaces(size_t) surfaceTag(int) ... * ... * $EndEntities *
Definition at line 1542 of file MshParallelMeshReader.cc.
References _readAndCheck(), ARCANE_FATAL, Arcane::TraceAccessor::info(), m_is_binary, m_verbosity_level, and Arcane::FixedArray< T, NbElement >::view().
|
private |
Definition at line 1775 of file MshParallelMeshReader.cc.
|
private |
Reads mesh nodes.
Reads the uniqueId() of the nodes and their associated coordinates.
The format is as follows:
Definition at line 591 of file MshParallelMeshReader.cc.
References _computeNodesPartition(), ARCANE_THROW, Arcane::MshParallelMeshReader::MshNodeBlock::index, Arcane::TraceAccessor::info(), m_is_binary, m_nb_part, Arcane::Array< T >::resize(), and Arcane::FixedArray< T, NbElement >::view().
|
private |
Definition at line 633 of file MshParallelMeshReader.cc.
|
private |
Reads an 'Element' type block.
Definition at line 758 of file MshParallelMeshReader.cc.
References Arcane::Array< T >::addRange(), Arcane::IParallelMng::commRank(), Arcane::MshParallelMeshReader::MshElementBlock::connectivities, Arcane::TraceAccessor::info(), Arcane::MshParallelMeshReader::MshElementBlock::item_nb_node, m_is_binary, m_nb_part, m_parts_rank, m_verbosity_level, Arcane::MshParallelMeshReader::MshElementBlock::nb_entity, Arcane::IParallelMng::recv(), Arcane::Array< T >::resize(), and Arcane::Array< T >::view().
Referenced by _readElementsFromFile().
|
private |
Definition at line 1599 of file MshParallelMeshReader.cc.
|
private |
Reading periodic information.
The format is:
* $Periodic * numPeriodicLinks(size_t) * entityDim(int) entityTag(int) entityTagMaster(int) * numAffine(size_t) value(double) ... * numCorrespondingNodes(size_t) * nodeTag(size_t) nodeTagMaster(size_t) * ... * ... * $EndPeriodic *
Definition at line 1690 of file MshParallelMeshReader.cc.
References _getNextLineAndBroadcast(), ARCANE_FATAL, Arcane::TraceAccessor::info(), Arcane::impl::MshMeshGenerationInfo::MshPeriodicOneInfo::m_affine_values, Arcane::impl::MshMeshGenerationInfo::MshPeriodicOneInfo::m_corresponding_nodes, m_verbosity_level, Arcane::Array< T >::resize(), Arccore::Array< T >::resize(), and Arcane::FixedArray< T, NbElement >::view().
|
private |
Definition at line 1477 of file MshParallelMeshReader.cc.
|
private |
Positions the node coordinates.
The list is distributed across the processors of the ranks in m_parts_rank. We loop through the ranks in this list, and each rank sends to the others the list of coordinates of the nodes it contains. Each rank checks if any nodes from this list belong to it, and if so, positions them.
Definition at line 1164 of file MshParallelMeshReader.cc.
References Arcane::IItemFamily::itemsUniqueIdToLocalId(), m_parts_rank, Arcane::Array< T >::resize(), and Arcane::ConstArrayView< T >::size().
|
private |
Definition at line 1935 of file MshParallelMeshReader.cc.
|
overridevirtual |
Reads the mesh contained in the file filename and constructs it in mesh.
Implements Arcane::IMshMeshReader.
Definition at line 1952 of file MshParallelMeshReader.cc.
References _getNextLineAndBroadcast(), Arcane::IParallelMng::commSize(), Arcane::TraceAccessor::error(), Arcane::TraceAccessor::info(), Arcane::platform::isFileReadable(), Arcane::IParallelMng::isMasterIO(), Arcane::IParallelMng::isParallel(), Arcane::String::localstr(), m_nb_part, m_parts_rank, Arcane::makeRef(), Arcane::IParallelMng::masterIORank(), Arcane::IMeshReader::RTError, Arcane::IMeshReader::RTOk, Arcane::IParallelMng::sequentialParallelMng(), and Arcane::FixedArray< T, NbElement >::view().
Definition at line 211 of file MshParallelMeshReader.cc.
|
private |
True if the format is binary.
Definition at line 219 of file MshParallelMeshReader.cc.
Referenced by _readAndCheck(), _readElementsFromFile(), _readEntities(), _readNodesFromFile(), and _readOneElementBlock().
|
private |
Definition at line 210 of file MshParallelMeshReader.cc.
|
private |
Definition at line 209 of file MshParallelMeshReader.cc.
|
private |
Definition at line 207 of file MshParallelMeshReader.cc.
|
private |
Definition at line 213 of file MshParallelMeshReader.cc.
|
private |
Definition at line 212 of file MshParallelMeshReader.cc.
|
private |
Conversion information between MSH and Arcane types for entities.
Definition at line 221 of file MshParallelMeshReader.cc.
|
private |
Number of partitions for reading nodes and blocks.
Definition at line 215 of file MshParallelMeshReader.cc.
Referenced by _computeNodesPartition(), _readNodesFromFile(), _readOneElementBlock(), and readMeshFromMshFile().
|
private |
Definition at line 208 of file MshParallelMeshReader.cc.
|
private |
List of ranks participating in data conservation.
Definition at line 217 of file MshParallelMeshReader.cc.
Referenced by _addCellOrNodeGroup(), _addFaceGroup(), _computeNodesPartition(), _readOneElementBlock(), _setNodesCoordinates(), and readMeshFromMshFile().
|
private |
Verbosity level.
Definition at line 223 of file MshParallelMeshReader.cc.
Referenced by _readElementsFromFile(), _readEntities(), _readOneElementBlock(), and _readPeriodic().