Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::MshMeshReader Class Reference

Mesh file reader in msh format. More...

Inheritance diagram for Arcane::MshMeshReader:
Collaboration diagram for Arcane::MshMeshReader:

Classes

struct  MeshV4ElementsBlock
 Information about a block for $Elements for version 4. More...
struct  MeshPhysicalName
 Information about a physical name. More...
struct  MeshPhysicalNameList
 Information about the '$PhysicalNames' block. More...
struct  MeshV4EntitiesNodes
 Info for 0D entities. More...
struct  MeshV4EntitiesWithNodes
 Info for 1D, 2D, and 3D entities. More...
struct  MeshInfo

Public Types

using eReturnType = typename IMeshReader::eReturnType

Public Member Functions

 MshMeshReader (ITraceMng *tm)
eReturnType readMeshFromMshFile (IMesh *mesh, const String &file_name, bool use_internal_partition) override
Public Member Functions inherited from Arcane::TraceAccessor
 TraceAccessor (ITraceMng *m)
 Constructs an accessor via the trace manager m.
 TraceAccessor (const TraceAccessor &rhs)
 Copy constructor.
TraceAccessoroperator= (const TraceAccessor &rhs)
 Copy assignment operator.
virtual ~TraceAccessor ()
 Frees resources.
ITraceMngtraceMng () 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

eReturnType _readNodesFromAsciiMshV2File (IosFile &, Array< Real3 > &)
eReturnType _readNodesFromAsciiMshV4File (IosFile &, MeshInfo &mesh_info)
eReturnType _readNodesFromBinaryMshFile (IosFile &, Array< Real3 > &)
Integer _readElementsFromAsciiMshV2File (IosFile &, MeshInfo &mesh_info)
Integer _readElementsFromAsciiMshV4File (IosFile &, MeshInfo &mesh_info)
 Reading elements (cells, faces, ...).
eReturnType _readMeshFromNewMshFile (IMesh *, IosFile &)
void _allocateCells (IMesh *mesh, MeshInfo &mesh_info, bool is_read_items)
void _allocateGroups (IMesh *mesh, MeshInfo &mesh_info, bool is_read_items)
void _addFaceGroup (IMesh *mesh, MeshV4ElementsBlock &block, const String &group_name)
void _addCellGroup (IMesh *mesh, MeshV4ElementsBlock &block, const String &group_name)
void _addNodeGroup (IMesh *mesh, MeshV4ElementsBlock &block, const String &group_name)
Integer _switchMshType (Integer, Integer &)
void _readPhysicalNames (IosFile &ios_file, MeshInfo &mesh_info)
void _readEntitiesV4 (IosFile &ios_file, MeshInfo &mesh_info)
 Reading of entities.

Private Attributes

Integer m_version = 0

Additional Inherited Members

Protected Member Functions inherited from Arcane::TraceAccessor
void _setLocalVerboseLevel (Int32 v)
Int32 _localVerboseLevel () const

Detailed Description

Mesh file reader in msh format.

The msh format is used by the gmsh library.

The reader supports versions 2.0 and 4.1 of this format.

Only a portion of the format's features are supported:

  • only order 1 elements are supported.
  • parametric coordinates are not supported
  • only the $Nodes and $Entities sections are read

Definition at line 89 of file MshMeshReader.cc.

Member Typedef Documentation

◆ eReturnType

using Arcane::MshMeshReader::eReturnType = typename IMeshReader::eReturnType

Definition at line 95 of file MshMeshReader.cc.

Constructor & Destructor Documentation

◆ MshMeshReader()

Arcane::MshMeshReader::MshMeshReader ( ITraceMng * tm)
inlineexplicit

Definition at line 226 of file MshMeshReader.cc.

Member Function Documentation

◆ _addCellGroup()

void Arcane::MshMeshReader::_addCellGroup ( IMesh * mesh,
MeshV4ElementsBlock & block,
const String & group_name )
private

Definition at line 831 of file MshMeshReader.cc.

◆ _addFaceGroup()

void Arcane::MshMeshReader::_addFaceGroup ( IMesh * mesh,
MeshV4ElementsBlock & block,
const String & group_name )
private

Definition at line 763 of file MshMeshReader.cc.

◆ _addNodeGroup()

void Arcane::MshMeshReader::_addNodeGroup ( IMesh * mesh,
MeshV4ElementsBlock & block,
const String & group_name )
private

Definition at line 853 of file MshMeshReader.cc.

◆ _allocateCells()

void Arcane::MshMeshReader::_allocateCells ( IMesh * mesh,
MeshInfo & mesh_info,
bool is_read_items )
private

Definition at line 632 of file MshMeshReader.cc.

◆ _allocateGroups()

void Arcane::MshMeshReader::_allocateGroups ( IMesh * mesh,
MeshInfo & mesh_info,
bool is_read_items )
private

Definition at line 695 of file MshMeshReader.cc.

◆ _readElementsFromAsciiMshV2File()

Integer Arcane::MshMeshReader::_readElementsFromAsciiMshV2File ( IosFile & ios_file,
MeshInfo & mesh_info )
private

Definition at line 430 of file MshMeshReader.cc.

◆ _readElementsFromAsciiMshV4File()

Integer Arcane::MshMeshReader::_readElementsFromAsciiMshV4File ( IosFile & ios_file,
MeshInfo & mesh_info )
private

Reading elements (cells, faces, ...).

In version 4, elements are sorted by type (eItemKind)

*$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

Definition at line 510 of file MshMeshReader.cc.

References Arcane::Array< T >::add(), Arcane::Array< T >::addRange(), ARCANE_FATAL, ARCANE_THROW, Arcane::TraceAccessor::info(), Arcane::math::max(), and Arcane::Array< T >::resize().

Referenced by _readMeshFromNewMshFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _readEntitiesV4()

void Arcane::MshMeshReader::_readEntitiesV4 ( IosFile & ios_file,
MeshInfo & mesh_info )
private

Reading of 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 953 of file MshMeshReader.cc.

References ARCANE_FATAL, and Arcane::TraceAccessor::info().

Referenced by _readMeshFromNewMshFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _readMeshFromNewMshFile()

IMeshReader::eReturnType Arcane::MshMeshReader::_readMeshFromNewMshFile ( IMesh * mesh,
IosFile & ios_file )
private

The version 2.0 of the '.msh' file format is Gmsh's new native mesh file format. It is very similar to the old one (see Section 9.1.1 [Version 1.0], page 139), but is more general: it contains information about itself and allows to associate an arbitrary number of integer tags with each element. Ialso exists in both ASCII and binary form. The '.msh' file format, version 2.0, is divided in three main sections, defining the file format ($MeshFormat-$EndMeshFormat), the nodes ($Nodes-$EndNodes) and the elements ($Elements-$EndElements) in the mesh: /code $MeshFormat 2.0 file-type data-size (one-binary) is an integer of value 1 written in binary form. This integer is used for detecting if the computer on which the binary file was written and the computer on which the file is read are of the same type (little or big endian).

$EndMeshFormat $Nodes number-of-nodes node-number x-coord y-coord z-coord ... $EndNodes $Elements number-of-elements elm-number elm-type number-of-tags < tag > ... node-number-list ... $EndElements

Definition at line 1047 of file MshMeshReader.cc.

References _readElementsFromAsciiMshV4File(), _readEntitiesV4(), _readNodesFromAsciiMshV4File(), ARCANE_THROW, Arcane::TraceAccessor::info(), Arcane::IParallelMng::isParallel(), Arcane::IMeshReader::RTOk, and Arcane::IPrimaryMesh::setDimension().

Referenced by readMeshFromMshFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _readNodesFromAsciiMshV2File()

IMeshReader::eReturnType Arcane::MshMeshReader::_readNodesFromAsciiMshV2File ( IosFile & ios_file,
Array< Real3 > & node_coords )
private

Definition at line 330 of file MshMeshReader.cc.

◆ _readNodesFromAsciiMshV4File()

IMeshReader::eReturnType Arcane::MshMeshReader::_readNodesFromAsciiMshV4File ( IosFile & ios_file,
MeshInfo & mesh_info )
private
$Nodes
numEntityBlocks(size_t) numNodes(size_t)
minNodeTag(size_t) maxNodeTag(size_t)
entityDim(int) entityTag(int) parametric(int; 0 or 1)
numNodesInBlock(size_t)
nodeTag(size_t)
...
x(double) y(double) z(double)
< u(double; if parametric and entityDim >= 1) >
< v(double; if parametric and entityDim >= 2) >
< w(double; if parametric and entityDim == 3) >
...
...
*$EndNodes

Definition at line 373 of file MshMeshReader.cc.

References ARCANE_THROW, Arcane::TraceAccessor::info(), Arcane::Array< T >::resize(), and Arcane::IMeshReader::RTOk.

Referenced by _readMeshFromNewMshFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _readNodesFromBinaryMshFile()

IMeshReader::eReturnType Arcane::MshMeshReader::_readNodesFromBinaryMshFile ( IosFile & ios_file,
Array< Real3 > & node_coords )
private

Definition at line 621 of file MshMeshReader.cc.

◆ _readPhysicalNames()

void Arcane::MshMeshReader::_readPhysicalNames ( IosFile & ios_file,
MeshInfo & mesh_info )
private

Definition at line 893 of file MshMeshReader.cc.

◆ _switchMshType()

Integer Arcane::MshMeshReader::_switchMshType ( Integer mshElemType,
Integer & nNodes )
private

Definition at line 264 of file MshMeshReader.cc.

◆ readMeshFromMshFile()

IMeshReader::eReturnType Arcane::MshMeshReader::readMeshFromMshFile ( IMesh * mesh,
const String & filename,
bool use_internal_partition )
overridevirtual

readMeshFromMshFile switches whether the targeted file is to be read with _readMeshFromOldMshFile or _readMeshFromNewMshFile function.

Implements Arcane::IMshMeshReader.

Definition at line 1155 of file MshMeshReader.cc.

References _readMeshFromNewMshFile(), Arcane::TraceAccessor::error(), Arcane::TraceAccessor::info(), Arcane::String::localstr(), and Arcane::IMeshReader::RTError.

Here is the call graph for this function:

Member Data Documentation

◆ m_version

Integer Arcane::MshMeshReader::m_version = 0
private

Definition at line 234 of file MshMeshReader.cc.


The documentation for this class was generated from the following file: