dune-grid 2.9.0
|
#include <dune/grid/io/file/gmshreader.hh>
Public Types | |
typedef GridType | Grid |
using | Opts = Gmsh::ReaderOptions |
Public Member Functions | |
GmshReader ()=default | |
Dynamic Gmsh reader interface. More... | |
GmshReader (const std::string &fileName, Gmsh::ReaderOptions options=defaultOpts) | |
Construct a Gmsh reader object (alternatively use one of the static member functions) More... | |
GmshReader (const std::string &fileName, GridFactory< Grid > &factory, Gmsh::ReaderOptions options=defaultOpts) | |
Construct a Gmsh reader object from a file name and a grid factory. More... | |
const std::vector< int > & | elementData () const |
Access element data (maps element index to Gmsh physical entity) More... | |
const std::vector< int > & | boundaryData () const |
Access boundary data (maps boundary segment index to Gmsh physical entity) More... | |
bool | hasElementData () const |
If element data is available. More... | |
bool | hasBoundaryData () const |
If boundary data is available. More... | |
std::vector< int > | extractElementData () |
Erase element data from reader and return the data. More... | |
std::vector< int > | extractBoundaryData () |
Erase boundary data from reader and return the data. More... | |
std::unique_ptr< Grid > | createGrid () |
Create the grid. More... | |
Static Public Member Functions | |
static std::unique_ptr< Grid > | read (const std::string &fileName, bool verbose=true, bool insertBoundarySegments=true) |
static std::unique_ptr< Grid > | read (const std::string &fileName, std::vector< int > &boundarySegmentToPhysicalEntity, std::vector< int > &elementToPhysicalEntity, bool verbose=true, bool insertBoundarySegments=true) |
Read Gmsh file, possibly with data. More... | |
static void | read (Dune::GridFactory< Grid > &factory, const std::string &fileName, bool verbose=true, bool insertBoundarySegments=true) |
static void | read (Dune::GridFactory< Grid > &factory, const std::string &fileName, DataFlagArg boundarySegmentData, DataArg elementData, bool verbose=true) |
read Gmsh file, possibly with data More... | |
static void | read (Dune::GridFactory< Grid > &factory, const std::string &fileName, std::vector< int > &boundarySegmentToPhysicalEntity, std::vector< int > &elementToPhysicalEntity, bool verbose, bool insertBoundarySegments) |
Read Gmsh file, possibly with data. More... | |
Static Public Attributes | |
static constexpr Opts | defaultOpts |
Read Gmsh mesh file.
Read a .msh (version 2) file generated using Gmsh and construct a grid using the grid factory interface.
The file format used by gmsh can hold grids that are more general than the simplex grids that the gmsh grid generator is able to construct. We try to read as many grids as possible, as long as they are valid files. You can test this by checking whether gmsh will load the file and display its content.
All grids in a gmsh file live in three-dimensional Euclidean space. If the world dimension of the grid type that you are reading the file into is less than three, the remaining coordinates are simply ignored.
.msh
typedef GridType Dune::GmshReader< GridType >::Grid |
using Dune::GmshReader< GridType >::Opts = Gmsh::ReaderOptions |
|
default |
Dynamic Gmsh reader interface.
|
inline |
Construct a Gmsh reader object (alternatively use one of the static member functions)
Construct a Gmsh reader object from a file name
fileName | Name of the file to read from. |
options | Options of the type Dune::Gmsh::ReaderOptions |
To pass several options, combine them with the |-operator like this
Per default the reader has enabled the following options
Passing any option to the interface will overwrite these defaults.
A Dune grid object can be obtained via the createGrid()
member
|
inline |
Construct a Gmsh reader object from a file name and a grid factory.
fileName | Name of the file to read from. |
options | Options of the type Dune::Gmsh::ReaderOptions |
|
inline |
Access boundary data (maps boundary segment index to Gmsh physical entity)
|
inline |
Create the grid.
|
inline |
Access element data (maps element index to Gmsh physical entity)
|
inline |
Erase boundary data from reader and return the data.
|
inline |
Erase element data from reader and return the data.
|
inline |
If boundary data is available.
|
inline |
If element data is available.
|
inlinestatic |
|
inlinestatic |
Read Gmsh file, possibly with data.
fileName | Name of the file to read from. |
boundarySegmentToPhysicalEntity | Container to fill with boundary segment physical entity data (if insertBoundarySegments=true) |
elementToPhysicalEntity | Container to fill with element physical entity data |
verbose | Whether to be chatty |
insertBoundarySegments | Whether boundary segments are inserted into the factory |
|
inlinestatic |
|
inlinestatic |
read Gmsh file, possibly with data
factory | The GridFactory to fill. |
fileName | Name of the file to read from. |
boundarySegmentData | Container to fill with boundary segment physical entity data, or std::ignore , or a bool value. Boundary segments are inserted when a container or true is given, otherwise they are not inserted. |
elementData | Container to fill with element physical entity data, or std::ignore . |
verbose | Whether to be chatty. |
Containers to fill with data must be std::vector<int>
lvalues. Element data is indexed by the insertion index of the element, boundarySegment data is indexed by the insertion index of the boundary intersection. These can be obtained from the factory
, and are lost once the grid gets modified (refined or load-balanced).
|
inlinestatic |
Read Gmsh file, possibly with data.
factory | The GridFactory to fill. |
fileName | Name of the file to read from. |
boundarySegmentToPhysicalEntity | Container to fill with boundary segment physical entity data (if insertBoundarySegments=true) |
elementToPhysicalEntity | Container to fill with element physical entity data |
verbose | Whether to be chatty |
insertBoundarySegments | Whether boundary segments are inserted into the factory |
|
staticconstexpr |