FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
FEAT::Geometry::MeshFileReader Class Reference

Mesh file reader class. More...

#include <mesh_file_reader.hpp>

Public Types

enum class  MeshType { unknown = 0 , conformal }
 mesh type enumeration More...
 
enum class  ShapeType { unknown = 0 , simplex , hypercube }
 shape type enumeration More...
 

Public Member Functions

 MeshFileReader ()
 default constructor More...
 
 MeshFileReader (const MeshFileReader &)=delete
 
 MeshFileReader (std::istream &is)
 Input-Stream constructor. More...
 
virtual ~MeshFileReader ()
 virtual destructor More...
 
void add_mesh_file (const Dist::Comm &comm, const String &filename)
 Adds a single mesh file to the list of streams to be parsed. More...
 
void add_mesh_file (const String &filename)
 Adds a single mesh file to the list of streams to be parsed. More...
 
void add_mesh_files (const Dist::Comm &comm, const std::deque< String > &filenames, String dirpath="")
 Adds a list of mesh files to the list of streams to be parsed. More...
 
void add_mesh_files (const std::deque< String > &filenames, String dirpath="")
 Adds a list of mesh files to the list of streams to be parsed. More...
 
void add_stream (std::istream &is)
 Adds an input stream to the list of streams to be parsed. More...
 
MeshType get_mesh_type () const
 Returns the mesh-type from the root markup node. More...
 
const Stringget_meshtype_string () const
 Returns the mesh-type string from the root markup node. More...
 
int get_shape_dim () const
 Returns the shape-dimension from the root markup node. More...
 
ShapeType get_shape_type () const
 Returns the shape-type from the root markup node. More...
 
int get_world_dim () const
 Returns the world-dimension from the root markup node. More...
 
MeshFileReaderoperator= (const MeshFileReader &)=delete
 
template<typename RootMesh_ >
std::unique_ptr< RootMeshNode< RootMesh_ > > parse (MeshAtlas< RootMesh_ > &mesh_atlas, PartitionSet *part_set=nullptr)
 Parses the mesh file into a mesh node and a mesh atlas. More...
 
template<typename RootMesh_ >
void parse (MeshNodeLinker< RootMesh_ > &linker, RootMeshNode< RootMesh_ > &root_mesh_node, MeshAtlas< RootMesh_ > &mesh_atlas, PartitionSet *part_set=nullptr)
 Parses the mesh file into a mesh node and a mesh atlas. More...
 
template<typename RootMesh_ >
void parse (RootMeshNode< RootMesh_ > &root_mesh_node, MeshAtlas< RootMesh_ > &mesh_atlas, PartitionSet *part_set=nullptr)
 Parses the mesh file into a mesh node and a mesh atlas. More...
 
void read_root_markup ()
 Reads the root markup from the input stream and analyses it. More...
 

Protected Attributes

bool _have_root_markup
 Did we read the root markup yet? More...
 
MeshType _mesh_type
 
String _mesh_type_string
 The parsed mesh type. More...
 
std::deque< std::shared_ptr< Xml::Scanner > > _scanners
 Our Xml scanner objects. More...
 
int _shape_dim
 
ShapeType _shape_type
 
std::deque< std::shared_ptr< std::stringstream > > _streams
 Our internally managed streams. More...
 
int _world_dim
 

Detailed Description

Mesh file reader class.

This class implements the reader which parses the XML-based FEAT mesh files into the corresponding Geometry class objects of type MeshAtlas, RootMeshNode and PartitionSet.

The basic usage is as follows:

  1. Create an object of the class MeshFileReader
  2. Add all input file streams to the object by calling the add_stream() function.
  3. Read the root markup by calling the read_root_markup() function.
  4. Create MeshAtlas and RootMeshNode objects of the corresponding mesh- and shape-type.
  5. Parse the file contents into the corresponding MeshAtlas, RootMeshNode and PartitionSet objects by calling the parse() function.

For more details on meshes, see the related doxygen page FEAT Mesh File Format.

Author
Peter Zajac

Definition at line 1323 of file mesh_file_reader.hpp.

Member Enumeration Documentation

◆ MeshType

mesh type enumeration

Enumerator
unknown 

unknown mesh type

conformal 

conformal mesh type

Definition at line 1327 of file mesh_file_reader.hpp.

◆ ShapeType

shape type enumeration

Enumerator
unknown 

unknown shape type

simplex 

simplex shape type

hypercube 

hypercube shape type

Definition at line 1336 of file mesh_file_reader.hpp.

Constructor & Destructor Documentation

◆ MeshFileReader() [1/2]

FEAT::Geometry::MeshFileReader::MeshFileReader ( )
inlineexplicit

default constructor

Definition at line 1367 of file mesh_file_reader.hpp.

◆ MeshFileReader() [2/2]

FEAT::Geometry::MeshFileReader::MeshFileReader ( std::istream &  is)
inlineexplicit

Input-Stream constructor.

Parameters
[in]isThe input stream that is to be parsed.

Definition at line 1383 of file mesh_file_reader.hpp.

References _scanners.

◆ ~MeshFileReader()

virtual FEAT::Geometry::MeshFileReader::~MeshFileReader ( )
inlinevirtual

virtual destructor

Definition at line 1399 of file mesh_file_reader.hpp.

References _scanners, and _streams.

Member Function Documentation

◆ add_mesh_file() [1/2]

void FEAT::Geometry::MeshFileReader::add_mesh_file ( const Dist::Comm comm,
const String filename 
)
inline

Adds a single mesh file to the list of streams to be parsed.

Parameters
[in]commThe communicator to be used for parallel file I/O.
[in]filenameThe mesh filename that is to be parsed.

Definition at line 1495 of file mesh_file_reader.hpp.

References add_mesh_files().

Referenced by add_mesh_file().

◆ add_mesh_file() [2/2]

void FEAT::Geometry::MeshFileReader::add_mesh_file ( const String filename)
inline

Adds a single mesh file to the list of streams to be parsed.

Parameters
[in]filenameThe mesh filename that is to be parsed.

Definition at line 1508 of file mesh_file_reader.hpp.

References add_mesh_file(), and FEAT::Dist::Comm::world().

◆ add_mesh_files() [1/2]

void FEAT::Geometry::MeshFileReader::add_mesh_files ( const Dist::Comm comm,
const std::deque< String > &  filenames,
String  dirpath = "" 
)
inline

Adds a list of mesh files to the list of streams to be parsed.

Parameters
[in]commThe communicator to be used for parallel file I/O.
[in]filenamesA list of mesh filenames that are to be parsed.
[in]dirpathThe path in which the mesh files are located.
Platform dependend code branching:
windows uses backslash as path separator

Definition at line 1431 of file mesh_file_reader.hpp.

References _have_root_markup, _streams, add_stream(), FEAT::DistFileIO::read_common(), and XASSERTM.

Referenced by add_mesh_file(), add_mesh_files(), and FEAT::Control::Domain::PartiDomainControl< DomainLevel_ >::create().

◆ add_mesh_files() [2/2]

void FEAT::Geometry::MeshFileReader::add_mesh_files ( const std::deque< String > &  filenames,
String  dirpath = "" 
)
inline

Adds a list of mesh files to the list of streams to be parsed.

Parameters
[in]filenamesA list of mesh filenames that are to be parsed.
[in]dirpathThe path in which the mesh files are located.

Definition at line 1480 of file mesh_file_reader.hpp.

References add_mesh_files(), and FEAT::Dist::Comm::world().

◆ add_stream()

void FEAT::Geometry::MeshFileReader::add_stream ( std::istream &  is)
inline

Adds an input stream to the list of streams to be parsed.

Parameters
[in]isThe input stream that is to be added to the list.

Definition at line 1411 of file mesh_file_reader.hpp.

References _have_root_markup, _scanners, and XASSERTM.

Referenced by add_mesh_files().

◆ get_mesh_type()

MeshType FEAT::Geometry::MeshFileReader::get_mesh_type ( ) const
inline

Returns the mesh-type from the root markup node.

Note
This function can only be called after calling the read_root_markup() function as it will always return MeshType::unknown otherwise.
Returns
The mesh-type from the root markup node.

Definition at line 1539 of file mesh_file_reader.hpp.

◆ get_meshtype_string()

const String & FEAT::Geometry::MeshFileReader::get_meshtype_string ( ) const
inline

Returns the mesh-type string from the root markup node.

Note
This function can only be called after calling the read_root_markup() function as it will always return an empty string otherwise.
Returns
The mesh-type string from the root markup node.

Definition at line 1524 of file mesh_file_reader.hpp.

References _mesh_type_string.

◆ get_shape_dim()

int FEAT::Geometry::MeshFileReader::get_shape_dim ( ) const
inline

Returns the shape-dimension from the root markup node.

Note
This function can only be called after calling the read_root_markup() function as it will always return 0 otherwise.
Returns
The shape-dimension from the root markup node.

Definition at line 1569 of file mesh_file_reader.hpp.

◆ get_shape_type()

ShapeType FEAT::Geometry::MeshFileReader::get_shape_type ( ) const
inline

Returns the shape-type from the root markup node.

Note
This function can only be called after calling the read_root_markup() function as it will always return ShapeType::unknown otherwise.
Returns
The shape-type from the root markup node.

Definition at line 1554 of file mesh_file_reader.hpp.

◆ get_world_dim()

int FEAT::Geometry::MeshFileReader::get_world_dim ( ) const
inline

Returns the world-dimension from the root markup node.

Note
This function can only be called after calling the read_root_markup() function as it will always return 0 otherwise.
Returns
The world-dimension from the root markup node.

Definition at line 1584 of file mesh_file_reader.hpp.

◆ parse() [1/3]

template<typename RootMesh_ >
std::unique_ptr< RootMeshNode< RootMesh_ > > FEAT::Geometry::MeshFileReader::parse ( MeshAtlas< RootMesh_ > &  mesh_atlas,
PartitionSet part_set = nullptr 
)
inline

Parses the mesh file into a mesh node and a mesh atlas.

Parameters
[in,out]mesh_atlasA transient reference to the mesh atlas into which charts are to be added. Is also used to search for charts for mesh parts.
[in,out]part_setA transient pointer to the partition set that partitions are added to. May be nullptr, if the partitions are to be ignored.
Returns
A unique pointer to the root mesh node containing the mesh and the mesh parts. This mesh node is automatically linked to the given mesh atlas.

Definition at line 1757 of file mesh_file_reader.hpp.

References FEAT::Geometry::RootMeshNode< RootMesh_ >::make_unique(), and parse().

◆ parse() [2/3]

template<typename RootMesh_ >
void FEAT::Geometry::MeshFileReader::parse ( MeshNodeLinker< RootMesh_ > &  linker,
RootMeshNode< RootMesh_ > &  root_mesh_node,
MeshAtlas< RootMesh_ > &  mesh_atlas,
PartitionSet part_set = nullptr 
)
inline

Parses the mesh file into a mesh node and a mesh atlas.

Parameters
[in,out]linkerA transient reference to the linker that the post-parse tasks are to be added to.
[in,out]root_mesh_nodeA transient reference to the root mesh node into which the mesh and the mesh parts are to be added.
[in,out]mesh_atlasA transient reference to the mesh atlas into which charts are to be added. Is also used to search for charts for mesh parts.
[in,out]part_setA transient pointer to the partition set that partitions are added to. May be nullptr, if the partitions are to be ignored.

Definition at line 1692 of file mesh_file_reader.hpp.

References _have_root_markup, _scanners, and read_root_markup().

Referenced by FEAT::Control::Domain::PartiDomainControl< DomainLevel_ >::create(), and parse().

◆ parse() [3/3]

template<typename RootMesh_ >
void FEAT::Geometry::MeshFileReader::parse ( RootMeshNode< RootMesh_ > &  root_mesh_node,
MeshAtlas< RootMesh_ > &  mesh_atlas,
PartitionSet part_set = nullptr 
)
inline

Parses the mesh file into a mesh node and a mesh atlas.

Parameters
[in,out]root_mesh_nodeA transient reference to the root mesh node into which the mesh and the mesh parts are to be added.
[in,out]mesh_atlasA transient reference to the mesh atlas into which charts are to be added. Is also used to search for charts for mesh parts.
[in,out]part_setA transient pointer to the partition set that partitions are added to. May be nullptr, if the partitions are to be ignored.

Definition at line 1726 of file mesh_file_reader.hpp.

References FEAT::Geometry::MeshNodeLinker< RootMesh_ >::execute(), and parse().

◆ read_root_markup()

void FEAT::Geometry::MeshFileReader::read_root_markup ( )
inline

Member Data Documentation

◆ _have_root_markup

bool FEAT::Geometry::MeshFileReader::_have_root_markup
protected

Did we read the root markup yet?

Definition at line 1352 of file mesh_file_reader.hpp.

Referenced by add_mesh_files(), add_stream(), parse(), and read_root_markup().

◆ _mesh_type

MeshType FEAT::Geometry::MeshFileReader::_mesh_type
protected

Definition at line 1357 of file mesh_file_reader.hpp.

◆ _mesh_type_string

String FEAT::Geometry::MeshFileReader::_mesh_type_string
protected

The parsed mesh type.

Definition at line 1354 of file mesh_file_reader.hpp.

Referenced by get_meshtype_string(), and read_root_markup().

◆ _scanners

std::deque<std::shared_ptr<Xml::Scanner> > FEAT::Geometry::MeshFileReader::_scanners
protected

Our Xml scanner objects.

Definition at line 1350 of file mesh_file_reader.hpp.

Referenced by MeshFileReader(), ~MeshFileReader(), add_stream(), parse(), and read_root_markup().

◆ _shape_dim

int FEAT::Geometry::MeshFileReader::_shape_dim
protected

Definition at line 1361 of file mesh_file_reader.hpp.

◆ _shape_type

ShapeType FEAT::Geometry::MeshFileReader::_shape_type
protected

Definition at line 1359 of file mesh_file_reader.hpp.

◆ _streams

std::deque<std::shared_ptr<std::stringstream> > FEAT::Geometry::MeshFileReader::_streams
protected

Our internally managed streams.

Definition at line 1348 of file mesh_file_reader.hpp.

Referenced by ~MeshFileReader(), and add_mesh_files().

◆ _world_dim

int FEAT::Geometry::MeshFileReader::_world_dim
protected

Definition at line 1363 of file mesh_file_reader.hpp.


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