NeoPZ
Public Member Functions | Private Attributes | List of all members
TPZGmshReader Class Reference

Implement the interface between TPZGeoMesh and the files produced by Gmsh (version 3.0 or 4.0 ) in msh format. More...

#include <TPZGmshReader.h>

Collaboration diagram for TPZGmshReader:
[legend]

Public Member Functions

 TPZGmshReader ()
 Default constructor. More...
 
 ~TPZGmshReader ()
 Default destructor. More...
 
 TPZGmshReader (const TPZGmshReader &other)
 Copy constructor. More...
 
const TPZGmshReaderoperator= (const TPZGmshReader &other)
 Assignement constructor. More...
 
TPZGeoMeshGeometricGmshMesh (std::string file_name, TPZGeoMesh *gmesh=NULL)
 Convert Gmsh msh files in a TPZGeoMesh object. More...
 
void SetCharacteristiclength (REAL length)
 Set the Characteristic length. More...
 
void SetFormatVersion (std::string format_version)
 Set the format version. More...
 
void PrintPartitionSummary (std::ostream &out)
 Print the partition summary after the reading process. More...
 
TPZGeoMeshGeometricGmshMesh4 (std::string file_name, TPZGeoMesh *gmesh=NULL)
 Convert a Gmsh *.msh file with format 4 to a TPZGeoMesh object. More...
 
void InsertElement (TPZGeoMesh *gmesh, int &physical_identifier, int &el_type, int &el_identifier, std::vector< int > &node_identifiers)
 
int GetNumberofNodes (int &el_type)
 
TPZGeoMeshGeometricGmshMesh3 (std::string file_name, TPZGeoMesh *gmesh=NULL)
 Convert a Gmsh *.msh file with format 3 to a TPZGeoMesh object. More...
 
bool InsertElement (TPZGeoMesh *gmesh, std::ifstream &line)
 Insert elements following msh file format */. More...
 
TPZManVector< std::map< int, std::string >, 4 > & GetDimPhysicalTagName ()
 Get the structure dim - physical tag - name. More...
 
void SetDimPhysicalTagName (TPZManVector< std::map< int, std::string >, 4 > &dim_physical_tag_and_name)
 Set the structure dim - physical tag - name. More...
 
void SetDimNamePhysical (TPZManVector< std::map< std::string, int >, 4 > &dim_name_and_physical_tag)
 Get the structure dim - name - physical tag. More...
 
TPZManVector< std::map< std::string, int >, 4 > & GetDimNamePhysical ()
 Get the structure dim - name - physical tag. More...
 
void GetDimNamePhysical (TPZVec< std::map< std::string, int >> &dim_name_and_physical_tag)
 Get the structure dim - name - physical tag. More...
 
TPZVec< int64_t > & EntityIndex ()
 
int NHexahedra ()
 Return the number of hexahedra created. More...
 
int NTetrahera ()
 Return the number of tetrahedra created. More...
 
int NPrisms ()
 Return the number of prisms created. More...
 
int NPyramids ()
 Return the number of pyramids created. More...
 
int NQuadrilaterals ()
 Return the number of quadrilaterals created. More...
 
int NTriangles ()
 Return the number of triangles created. More...
 
int NLines ()
 Return the number of line created. More...
 
int NPoints ()
 Return the number of line created. More...
 
int Dimension ()
 Return the dimension of the mesh. More...
 

Private Attributes

std::string m_format_version
 gmsh file format version (supported versions = {3,4}) More...
 
int m_n_volumes
 Number of volumes. More...
 
int m_n_surfaces
 Number of surfaces. More...
 
int m_n_curves
 Number of curves. More...
 
int m_n_points
 Number of points. More...
 
int m_n_physical_volumes
 Number of volumes with physical tag. More...
 
int m_n_physical_surfaces
 Number of surfaces with physical tag. More...
 
int m_n_physical_curves
 Number of curves with physical tag. More...
 
int m_n_physical_points
 Number of points with physical tag. More...
 
int m_dimension
 Geometry dimension. More...
 
REAL m_characteristic_lentgh
 Characteristic length to apply a Scale affine transformation. More...
 
TPZManVector< std::map< int, std::vector< int > >, 4 > m_dim_entity_tag_and_physical_tag
 Data structure of both: physical entities and names indexed by dimension. More...
 
TPZManVector< std::map< int, std::string >, 4 > m_dim_physical_tag_and_name
 Structure of both: physical entities and names indexed by dimension. More...
 
TPZManVector< std::map< std::string, int >, 4 > m_dim_name_and_physical_tag
 Structure of both: names and physical id indexed by dimension. More...
 
TPZManVector< std::map< int, int >, 4 > m_dim_physical_tag_and_physical_tag
 Structure of both: physical id and user defined physical tag indexed by dimension. More...
 
TPZVec< int64_t > m_entity_index
 Entity index to which the element belongs. More...
 
int m_n_hexahedron_els
 Number of hexahedra. More...
 
int m_n_tetrahedron_els
 Number of tetrahedra. More...
 
int m_n_prism_els
 Number of prisms. More...
 
int m_n_pyramid_els
 Number of pyramids. More...
 
int m_n_quadrilateral_els
 Number of quadrilaterals. More...
 
int m_n_triangle_els
 Number of triangles. More...
 
int m_n_line_els
 Number of triangles. More...
 
int m_n_point_els
 Number of points. More...
 

Detailed Description

Implement the interface between TPZGeoMesh and the files produced by Gmsh (version 3.0 or 4.0 ) in msh format.

Since
January 16, 2017 What is Gmsh ? Take a look on http://gmsh.info/ Gmsh is a free 3D finite element grid generator with a build-in CAD engine and post-processor. Its design goal is to provide a fast, light and user-friendly meshing tool with parametric input and advanced visualization capabilities. Gmsh is built around four modules: geometry, mesh, solver and post-processing. The specification of any input to these modules is done either interactively using the graphical user interface or in ASCII text files using Gmsh's own scripting language. Note about the implementation for file format 4 The mandatory sections are considered MeshFormat, Entities, Nodes and Elements. The optional section PhysicalName is considered the others (PartitionedEntities,Periodic,GhostElements,NodeData,ElementData,ElementNodeData) are just ignored. To conclude a successful read of your *.msh file, you should have physical tags to be able to insert elements into a TPZGeoMesh object.

Definition at line 66 of file TPZGmshReader.h.

Constructor & Destructor Documentation

◆ TPZGmshReader() [1/2]

TPZGmshReader::TPZGmshReader ( )

◆ ~TPZGmshReader()

TPZGmshReader::~TPZGmshReader ( )

Default destructor.

Definition at line 60 of file TPZGmshReader.cpp.

◆ TPZGmshReader() [2/2]

TPZGmshReader::TPZGmshReader ( const TPZGmshReader other)

Member Function Documentation

◆ Dimension()

int TPZGmshReader::Dimension ( )
inline

Return the dimension of the mesh.

Definition at line 259 of file TPZGmshReader.h.

◆ EntityIndex()

TPZVec<int64_t>& TPZGmshReader::EntityIndex ( )
inline

Definition at line 213 of file TPZGmshReader.h.

◆ GeometricGmshMesh()

TPZGeoMesh * TPZGmshReader::GeometricGmshMesh ( std::string  file_name,
TPZGeoMesh gmesh = NULL 
)

Convert Gmsh msh files in a TPZGeoMesh object.

Definition at line 64 of file TPZGmshReader.cpp.

References DebugStop, GeometricGmshMesh3(), GeometricGmshMesh4(), and m_format_version.

◆ GeometricGmshMesh3()

TPZGeoMesh * TPZGmshReader::GeometricGmshMesh3 ( std::string  file_name,
TPZGeoMesh gmesh = NULL 
)

◆ GeometricGmshMesh4()

TPZGeoMesh * TPZGmshReader::GeometricGmshMesh4 ( std::string  file_name,
TPZGeoMesh gmesh = NULL 
)

◆ GetDimNamePhysical() [1/2]

TPZManVector<std::map<std::string,int>,4>& TPZGmshReader::GetDimNamePhysical ( )
inline

Get the structure dim - name - physical tag.

Definition at line 204 of file TPZGmshReader.h.

◆ GetDimNamePhysical() [2/2]

void TPZGmshReader::GetDimNamePhysical ( TPZVec< std::map< std::string, int >> &  dim_name_and_physical_tag)
inline

Get the structure dim - name - physical tag.

Definition at line 209 of file TPZGmshReader.h.

◆ GetDimPhysicalTagName()

TPZManVector<std::map<int,std::string>,4>& TPZGmshReader::GetDimPhysicalTagName ( )
inline

Get the structure dim - physical tag - name.

Definition at line 188 of file TPZGmshReader.h.

◆ GetNumberofNodes()

int TPZGmshReader::GetNumberofNodes ( int &  el_type)

Definition at line 592 of file TPZGmshReader.cpp.

References DebugStop.

Referenced by GeometricGmshMesh4().

◆ InsertElement() [1/2]

void TPZGmshReader::InsertElement ( TPZGeoMesh gmesh,
int &  physical_identifier,
int &  el_type,
int &  el_identifier,
std::vector< int > &  node_identifiers 
)

Gmsh representation Quadrangle8 and Quadrangle9, but by default Quadrangle9 is always generated. (?_?).

Definition at line 467 of file TPZGmshReader.cpp.

References DebugStop, m_n_hexahedron_els, m_n_line_els, m_n_point_els, m_n_prism_els, m_n_pyramid_els, m_n_quadrilateral_els, m_n_tetrahedron_els, m_n_triangle_els, TPZManVector< T, NumExtAlloc >::Resize(), and TPZVec< T >::size().

Referenced by GeometricGmshMesh3(), and GeometricGmshMesh4().

◆ InsertElement() [2/2]

bool TPZGmshReader::InsertElement ( TPZGeoMesh gmesh,
std::ifstream &  line 
)

Insert elements following msh file format */.

Insert elements following msh file format.

Definition at line 869 of file TPZGmshReader.cpp.

References DebugStop, dimension, m_dim_physical_tag_and_physical_tag, m_entity_index, TPZVec< T >::Resize(), and TPZGeoMesh::SetDimension().

◆ NHexahedra()

int TPZGmshReader::NHexahedra ( )
inline

Return the number of hexahedra created.

Definition at line 219 of file TPZGmshReader.h.

◆ NLines()

int TPZGmshReader::NLines ( )
inline

Return the number of line created.

Definition at line 249 of file TPZGmshReader.h.

◆ NPoints()

int TPZGmshReader::NPoints ( )
inline

Return the number of line created.

Definition at line 254 of file TPZGmshReader.h.

◆ NPrisms()

int TPZGmshReader::NPrisms ( )
inline

Return the number of prisms created.

Definition at line 229 of file TPZGmshReader.h.

◆ NPyramids()

int TPZGmshReader::NPyramids ( )
inline

Return the number of pyramids created.

Definition at line 234 of file TPZGmshReader.h.

◆ NQuadrilaterals()

int TPZGmshReader::NQuadrilaterals ( )
inline

Return the number of quadrilaterals created.

Definition at line 239 of file TPZGmshReader.h.

◆ NTetrahera()

int TPZGmshReader::NTetrahera ( )
inline

Return the number of tetrahedra created.

Definition at line 224 of file TPZGmshReader.h.

◆ NTriangles()

int TPZGmshReader::NTriangles ( )
inline

Return the number of triangles created.

Definition at line 244 of file TPZGmshReader.h.

◆ operator=()

const TPZGmshReader & TPZGmshReader::operator= ( const TPZGmshReader other)

◆ PrintPartitionSummary()

void TPZGmshReader::PrintPartitionSummary ( std::ostream &  out)

◆ SetCharacteristiclength()

void TPZGmshReader::SetCharacteristiclength ( REAL  length)

Set the Characteristic length.

Definition at line 858 of file TPZGmshReader.cpp.

References m_characteristic_lentgh.

◆ SetDimNamePhysical()

void TPZGmshReader::SetDimNamePhysical ( TPZManVector< std::map< std::string, int >, 4 > &  dim_name_and_physical_tag)
inline

Get the structure dim - name - physical tag.

Definition at line 198 of file TPZGmshReader.h.

◆ SetDimPhysicalTagName()

void TPZGmshReader::SetDimPhysicalTagName ( TPZManVector< std::map< int, std::string >, 4 > &  dim_physical_tag_and_name)
inline

Set the structure dim - physical tag - name.

Definition at line 193 of file TPZGmshReader.h.

◆ SetFormatVersion()

void TPZGmshReader::SetFormatVersion ( std::string  format_version)

Set the format version.

Definition at line 863 of file TPZGmshReader.cpp.

References m_format_version.

Member Data Documentation

◆ m_characteristic_lentgh

REAL TPZGmshReader::m_characteristic_lentgh
private

Characteristic length to apply a Scale affine transformation.

Definition at line 99 of file TPZGmshReader.h.

Referenced by GeometricGmshMesh3(), GeometricGmshMesh4(), operator=(), PrintPartitionSummary(), SetCharacteristiclength(), and TPZGmshReader().

◆ m_dim_entity_tag_and_physical_tag

TPZManVector<std::map<int,std::vector<int> >,4> TPZGmshReader::m_dim_entity_tag_and_physical_tag
private

Data structure of both: physical entities and names indexed by dimension.

Definition at line 104 of file TPZGmshReader.h.

Referenced by GeometricGmshMesh4(), operator=(), and TPZGmshReader().

◆ m_dim_name_and_physical_tag

TPZManVector<std::map<std::string,int>,4> TPZGmshReader::m_dim_name_and_physical_tag
private

Structure of both: names and physical id indexed by dimension.

Definition at line 112 of file TPZGmshReader.h.

Referenced by GeometricGmshMesh3(), GeometricGmshMesh4(), operator=(), and TPZGmshReader().

◆ m_dim_physical_tag_and_name

TPZManVector<std::map<int,std::string>,4> TPZGmshReader::m_dim_physical_tag_and_name
private

Structure of both: physical entities and names indexed by dimension.

Definition at line 109 of file TPZGmshReader.h.

Referenced by GeometricGmshMesh3(), GeometricGmshMesh4(), operator=(), and TPZGmshReader().

◆ m_dim_physical_tag_and_physical_tag

TPZManVector<std::map<int,int>,4> TPZGmshReader::m_dim_physical_tag_and_physical_tag
private

Structure of both: physical id and user defined physical tag indexed by dimension.

Definition at line 115 of file TPZGmshReader.h.

Referenced by GeometricGmshMesh3(), GeometricGmshMesh4(), InsertElement(), operator=(), and TPZGmshReader().

◆ m_dimension

int TPZGmshReader::m_dimension
private

Geometry dimension.

Definition at line 96 of file TPZGmshReader.h.

Referenced by GeometricGmshMesh4(), operator=(), PrintPartitionSummary(), and TPZGmshReader().

◆ m_entity_index

TPZVec<int64_t> TPZGmshReader::m_entity_index
private

Entity index to which the element belongs.

Definition at line 118 of file TPZGmshReader.h.

Referenced by InsertElement(), operator=(), and TPZGmshReader().

◆ m_format_version

std::string TPZGmshReader::m_format_version
private

gmsh file format version (supported versions = {3,4})

Definition at line 69 of file TPZGmshReader.h.

Referenced by GeometricGmshMesh(), operator=(), PrintPartitionSummary(), SetFormatVersion(), and TPZGmshReader().

◆ m_n_curves

int TPZGmshReader::m_n_curves
private

Number of curves.

Definition at line 78 of file TPZGmshReader.h.

Referenced by GeometricGmshMesh4(), operator=(), PrintPartitionSummary(), and TPZGmshReader().

◆ m_n_hexahedron_els

int TPZGmshReader::m_n_hexahedron_els
private

Number of hexahedra.

Definition at line 121 of file TPZGmshReader.h.

Referenced by InsertElement(), and PrintPartitionSummary().

◆ m_n_line_els

int TPZGmshReader::m_n_line_els
private

Number of triangles.

Definition at line 139 of file TPZGmshReader.h.

Referenced by InsertElement(), and PrintPartitionSummary().

◆ m_n_physical_curves

int TPZGmshReader::m_n_physical_curves
private

Number of curves with physical tag.

Definition at line 90 of file TPZGmshReader.h.

Referenced by GeometricGmshMesh4(), operator=(), PrintPartitionSummary(), and TPZGmshReader().

◆ m_n_physical_points

int TPZGmshReader::m_n_physical_points
private

Number of points with physical tag.

Definition at line 93 of file TPZGmshReader.h.

Referenced by GeometricGmshMesh4(), operator=(), PrintPartitionSummary(), and TPZGmshReader().

◆ m_n_physical_surfaces

int TPZGmshReader::m_n_physical_surfaces
private

Number of surfaces with physical tag.

Definition at line 87 of file TPZGmshReader.h.

Referenced by GeometricGmshMesh4(), operator=(), PrintPartitionSummary(), and TPZGmshReader().

◆ m_n_physical_volumes

int TPZGmshReader::m_n_physical_volumes
private

Number of volumes with physical tag.

Definition at line 84 of file TPZGmshReader.h.

Referenced by GeometricGmshMesh4(), operator=(), PrintPartitionSummary(), and TPZGmshReader().

◆ m_n_point_els

int TPZGmshReader::m_n_point_els
private

Number of points.

Definition at line 142 of file TPZGmshReader.h.

Referenced by InsertElement(), and PrintPartitionSummary().

◆ m_n_points

int TPZGmshReader::m_n_points
private

Number of points.

Definition at line 81 of file TPZGmshReader.h.

Referenced by GeometricGmshMesh4(), operator=(), PrintPartitionSummary(), and TPZGmshReader().

◆ m_n_prism_els

int TPZGmshReader::m_n_prism_els
private

Number of prisms.

Definition at line 127 of file TPZGmshReader.h.

Referenced by InsertElement(), and PrintPartitionSummary().

◆ m_n_pyramid_els

int TPZGmshReader::m_n_pyramid_els
private

Number of pyramids.

Definition at line 130 of file TPZGmshReader.h.

Referenced by InsertElement(), and PrintPartitionSummary().

◆ m_n_quadrilateral_els

int TPZGmshReader::m_n_quadrilateral_els
private

Number of quadrilaterals.

Definition at line 133 of file TPZGmshReader.h.

Referenced by InsertElement(), and PrintPartitionSummary().

◆ m_n_surfaces

int TPZGmshReader::m_n_surfaces
private

Number of surfaces.

Definition at line 75 of file TPZGmshReader.h.

Referenced by GeometricGmshMesh4(), operator=(), PrintPartitionSummary(), and TPZGmshReader().

◆ m_n_tetrahedron_els

int TPZGmshReader::m_n_tetrahedron_els
private

Number of tetrahedra.

Definition at line 124 of file TPZGmshReader.h.

Referenced by InsertElement(), and PrintPartitionSummary().

◆ m_n_triangle_els

int TPZGmshReader::m_n_triangle_els
private

Number of triangles.

Definition at line 136 of file TPZGmshReader.h.

Referenced by InsertElement(), and PrintPartitionSummary().

◆ m_n_volumes

int TPZGmshReader::m_n_volumes
private

Number of volumes.

Definition at line 72 of file TPZGmshReader.h.

Referenced by GeometricGmshMesh4(), operator=(), PrintPartitionSummary(), and TPZGmshReader().


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