Dune Core Modules (2.11.0)

Dune::Gmsh4Reader< Grid, GridCreator, SizeType > Class Template Reference

File-Reader for GMsh unstructured .msh files. More...

#include <dune/gmsh4/gmsh4reader.hh>

Public Member Functions

template<class... Args, std::enable_if_t< std::is_constructible< GridCreator, Args... >::value, int > = 0>
 Gmsh4Reader (Args &&... args)
 Constructor. Creates a new GridCreator with the passed factory.
 
 Gmsh4Reader (GridCreator &creator)
 Constructor. Stores the references in a non-destroying shared_ptr.
 
 Gmsh4Reader (std::shared_ptr< GridCreator > creator)
 Constructor. Stores the shared_ptr.
 
void read (std::string const &filename, bool fillCreator=true)
 Read the grid from file with filename into the GridFactory stored in the GridCreator. More...
 
std::vector< std::string > const & pieces () const
 Return the filenames of parallel pieces.
 
void readSerialFileFromStream (std::ifstream &input, bool fillCreator=true)
 Read the grid from an input stream, referring to a .msh file, into the GridCreator. More...
 
void readParallelFileFromStream (std::ifstream &input, int rank, int size, bool fillCreator=true)
 Read the grid from and input stream, referring to a .pro file, into the GridCreator. More...
 
void fillGridCreator (bool insertPieces=true)
 Construct a grid using the GridCreator.
 

Static Public Member Functions

template<class... Args>
static std::unique_ptr< GridcreateGridFromFile (const std::string &filename, Args &&... args)
 
template<class... Args>
static void fillFactory (GridFactory< Grid > &factory, const std::string &filename, Args &&... args)
 

Detailed Description

template<class Grid, class GridCreator = Gmsh4::ContinuousGridCreator<Grid>, class SizeType = std::size_t>
class Dune::Gmsh4Reader< Grid, GridCreator, SizeType >

File-Reader for GMsh unstructured .msh files.

Reads .msh files version 4.x and constructs a grid from the cells stored in the file Additionally, stored data can be read.

Template Parameters
GridType of the grid to construct.
GridCreatorPolicy type to control what to pass to a grid factory with data given from the file. See GridCreatorInterface [ContinuousGridCreator]
SizeTypeData type for indices in the .msh file. Should match in size the data_size information in the header of the .msh file. This type is used for the internal data in the caches. [std::size_t]

Member Function Documentation

◆ createGridFromFile()

template<class Grid , class FilerReaderImp >
template<class... Args>
static std::unique_ptr< Grid > Dune::Gmsh4::FileReader< Grid, FilerReaderImp >::createGridFromFile ( const std::string &  filename,
Args &&...  args 
)
inlinestaticinherited

Reads the grid from a file with filename and returns a unique_ptr to the created grid. Redirects to concrete implementation of derivated class.

◆ fillFactory()

template<class Grid , class FilerReaderImp >
template<class... Args>
static void Dune::Gmsh4::FileReader< Grid, FilerReaderImp >::fillFactory ( GridFactory< Grid > &  factory,
const std::string &  filename,
Args &&...  args 
)
inlinestaticinherited

Reads the grid from a file with filename into a grid-factory. Redirects to concrete implementation of derivated class.

◆ read()

template<class G , class C , class S >
void Dune::Gmsh4Reader< G, C, S >::read ( std::string const &  filename,
bool  fillCreator = true 
)

Read the grid from file with filename into the GridFactory stored in the GridCreator.

Parameters
filenameThe name of the input file
fillCreatorIf false, only fill internal data structures, if true, also calls fillGridCreator. [true]

References DUNE_THROW, GMSH4_ASSERT, GMSH4_ASSERT_MSG, Dune::GeometryTypes::line, Dune::GmshReader< GridType >::read(), and Dune::size().

◆ readParallelFileFromStream()

template<class G , class C , class S >
void Dune::Gmsh4Reader< G, C, S >::readParallelFileFromStream ( std::ifstream &  input,
int  rank,
int  size,
bool  fillCreator = true 
)

Read the grid from and input stream, referring to a .pro file, into the GridCreator.

Parameters
inputA STL input stream to read the Gmsh file from.
fillCreatorIf false, only fill internal data structures, if true, also calls fillGridCreator. [true]

References DUNE_THROW.

◆ readSerialFileFromStream()

template<class G , class C , class S >
void Dune::Gmsh4Reader< G, C, S >::readSerialFileFromStream ( std::ifstream &  input,
bool  fillCreator = true 
)

Read the grid from an input stream, referring to a .msh file, into the GridCreator.

Advanced read methods

Parameters
inputA STL input stream to read the Gmsh file from.
fillCreatorIf false, only fill internal data structures, if true, also calls fillGridCreator. [true]

References Dune::GeometryTypes::line.


The documentation for this class was generated from the following files:
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden & Uni Heidelberg  |  generated with Hugo v0.111.3 (Feb 14, 23:39, 2026)