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

Mesh file writer class. More...

#include <mesh_file_writer.hpp>

Public Member Functions

 MeshFileWriter (std::ostream &os, bool indent=true)
 Creates a writer for a given output stream. More...
 
virtual ~MeshFileWriter ()
 virtual destructor More...
 
template<typename RootMesh_ >
void write (const RootMeshNode< RootMesh_ > *mesh_node, const MeshAtlas< RootMesh_ > *mesh_atlas=nullptr, const PartitionSet *part_set=nullptr, bool skip_internal_meshparts=true)
 Writes a full domain to the file. More...
 
template<typename RootMesh_ >
void write_atlas (const MeshAtlas< RootMesh_ > &mesh_atlas)
 Writes all charts of an atlas into the file. More...
 
template<typename RootMesh_ >
void write_chart (const Atlas::ChartBase< RootMesh_ > &chart, const String &name)
 Writes a chart into the file. More...
 
template<typename Shape_ , int num_coords_, typename Coord_ >
void write_mesh (const ConformalMesh< Shape_, num_coords_, Coord_ > &mesh)
 Writes a (root) mesh into the file. More...
 
template<typename Mesh_ >
void write_meshpart (const MeshPart< Mesh_ > &meshpart, const String &parent_name, const String &part_name, const String &chart_name)
 Writes a mesh-part into the file. More...
 
void write_only (const PartitionSet &part_set)
 
void write_partition (const Partition &partition)
 Writes a partition to the file. More...
 
void write_partition_set (const PartitionSet &part_set)
 Writes all partitions of a partition set to the file. More...
 

Protected Member Functions

void _pop_indent ()
 decreases the current indent by two spaces More...
 
void _push_indent ()
 increases the current indent by two spaces More...
 
template<typename Data_ >
void _write_attribute (const AttributeSet< Data_ > &attr, const String &name)
 Writes an attribute of a mesh part into the file. More...
 
template<int num_coords_, typename Coord_ >
void _write_vertex_set (const VertexSet< num_coords_, Coord_ > &vertex_set)
 Writes a vertex-set of a mesh into the file. More...
 

Protected Attributes

bool _indent
 specifies whether indentation is to be used More...
 
std::ostream & _os
 the output stream to write to More...
 
String _sindent
 the current indentation string More...
 

Detailed Description

Mesh file writer class.

This class implements a writer which can export objects of type MeshAtlas, RootMeshNode and PartitionSet (and all of their sub-objects) into the XML-based FEAT mesh file format.

Author
Peter Zajac

Definition at line 125 of file mesh_file_writer.hpp.

Constructor & Destructor Documentation

◆ MeshFileWriter()

FEAT::Geometry::MeshFileWriter::MeshFileWriter ( std::ostream &  os,
bool  indent = true 
)
inlineexplicit

Creates a writer for a given output stream.

Parameters
[in]osThe output stream to write to.
[in]indentSpecifies whether indentation is to be used. Can be set to false to decrease the final file size.

Definition at line 180 of file mesh_file_writer.hpp.

References _indent, and _sindent.

◆ ~MeshFileWriter()

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

virtual destructor

Definition at line 189 of file mesh_file_writer.hpp.

Member Function Documentation

◆ _pop_indent()

void FEAT::Geometry::MeshFileWriter::_pop_indent ( )
inlineprotected

decreases the current indent by two spaces

Definition at line 163 of file mesh_file_writer.hpp.

References _indent, and _sindent.

Referenced by _write_attribute(), _write_vertex_set(), write(), write_mesh(), write_meshpart(), and write_partition().

◆ _push_indent()

void FEAT::Geometry::MeshFileWriter::_push_indent ( )
inlineprotected

increases the current indent by two spaces

Definition at line 156 of file mesh_file_writer.hpp.

References _indent, and _sindent.

Referenced by _write_attribute(), _write_vertex_set(), write(), write_mesh(), write_meshpart(), and write_partition().

◆ _write_attribute()

template<typename Data_ >
void FEAT::Geometry::MeshFileWriter::_write_attribute ( const AttributeSet< Data_ > &  attr,
const String name 
)
inlineprotected

Writes an attribute of a mesh part into the file.

Parameters
[in]attrThe attribute that is to be exported.
[in]nameThe name of the attribute.

Definition at line 476 of file mesh_file_writer.hpp.

References _os, _pop_indent(), _push_indent(), _sindent, FEAT::Geometry::AttributeSet< DataType_ >::get_dimension(), and FEAT::Geometry::AttributeSet< DataType_ >::get_num_values().

Referenced by write_meshpart().

◆ _write_vertex_set()

template<int num_coords_, typename Coord_ >
void FEAT::Geometry::MeshFileWriter::_write_vertex_set ( const VertexSet< num_coords_, Coord_ > &  vertex_set)
inlineprotected

Writes a vertex-set of a mesh into the file.

Parameters
[in]vertex_set

Definition at line 450 of file mesh_file_writer.hpp.

References _os, _pop_indent(), _push_indent(), _sindent, and FEAT::Geometry::VertexSet< num_coords_, Coord_ >::get_num_vertices().

Referenced by write_mesh().

◆ write()

template<typename RootMesh_ >
void FEAT::Geometry::MeshFileWriter::write ( const RootMeshNode< RootMesh_ > *  mesh_node,
const MeshAtlas< RootMesh_ > *  mesh_atlas = nullptr,
const PartitionSet part_set = nullptr,
bool  skip_internal_meshparts = true 
)
inline

Writes a full domain to the file.

Parameters
[in]mesh_nodeA transient pointer to the root mesh node whose mesh and child mesh-parts are to be exported. May be nullptr if no mesh or mesh-parts are to be exported.
[in]mesh_atlasA transient pointer to the mesh atlas whose charts are to be exported. May be nullptr if no charts are to be exported.
[in]part_setA transient pointer to the partition set whose partitions are to be exported. May be nullptr if no partitions are to be exported.
[in]skip_internal_meshpartsSpecifies whether internal mesh-parts (e.g. comm halos or partition patches) are to be exported or not. Defaults to true, i.e. internal mesh parts are not exported by default.

Definition at line 373 of file mesh_file_writer.hpp.

References _os, _pop_indent(), _push_indent(), FEAT::Geometry::MeshNode< RootMesh_, ThisMesh_ >::find_mesh_part(), FEAT::Geometry::MeshNode< RootMesh_, ThisMesh_ >::find_mesh_part_chart_name(), FEAT::Geometry::MeshNode< RootMesh_, ThisMesh_ >::get_mesh(), FEAT::Geometry::MeshNode< RootMesh_, ThisMesh_ >::get_mesh_part_names(), write_atlas(), write_mesh(), write_meshpart(), and write_partition_set().

◆ write_atlas()

template<typename RootMesh_ >
void FEAT::Geometry::MeshFileWriter::write_atlas ( const MeshAtlas< RootMesh_ > &  mesh_atlas)
inline

Writes all charts of an atlas into the file.

Parameters
[in]mesh_atlasA transient reference to the atlas whose charts are to be exported.

Definition at line 221 of file mesh_file_writer.hpp.

References FEAT::Geometry::MeshAtlas< Mesh_ >::find_mesh_chart(), FEAT::Geometry::MeshAtlas< Mesh_ >::get_chart_names(), write_chart(), and XASSERTM.

Referenced by write().

◆ write_chart()

template<typename RootMesh_ >
void FEAT::Geometry::MeshFileWriter::write_chart ( const Atlas::ChartBase< RootMesh_ > &  chart,
const String name 
)
inline

Writes a chart into the file.

Parameters
[in]chartA transient reference to the chart to be exported.
[in]nameThe name of the chart.

Definition at line 203 of file mesh_file_writer.hpp.

References _indent, _os, and _sindent.

Referenced by write_atlas().

◆ write_mesh()

template<typename Shape_ , int num_coords_, typename Coord_ >
void FEAT::Geometry::MeshFileWriter::write_mesh ( const ConformalMesh< Shape_, num_coords_, Coord_ > &  mesh)
inline

Writes a (root) mesh into the file.

Parameters
[in]meshA transient reference to the (root) mesh to be exported.

Definition at line 243 of file mesh_file_writer.hpp.

References _os, _pop_indent(), _push_indent(), _sindent, _write_vertex_set(), FEAT::Geometry::ConformalMesh< Shape_, num_coords_, Coord_ >::get_num_entities(), and FEAT::Geometry::ConformalMesh< Shape_, num_coords_, Coord_ >::get_vertex_set().

Referenced by write().

◆ write_meshpart()

template<typename Mesh_ >
void FEAT::Geometry::MeshFileWriter::write_meshpart ( const MeshPart< Mesh_ > &  meshpart,
const String parent_name,
const String part_name,
const String chart_name 
)
inline

Writes a mesh-part into the file.

Parameters
[in]meshpartA transient reference to the mesh-part to be exported.
[in]parent_nameThe name of the parent of the mesh-part.
[in]part_nameThe name of the mesh-part
[in]chart_nameThe name of the chart of the mesh-part.

Definition at line 276 of file mesh_file_writer.hpp.

References _os, _pop_indent(), _push_indent(), _sindent, _write_attribute(), FEAT::Geometry::MeshPart< MeshType_ >::get_mesh_attributes(), FEAT::Geometry::MeshPart< MeshType_ >::get_num_entities(), and FEAT::Geometry::MeshPart< MeshType_ >::has_topology().

Referenced by write().

◆ write_only()

void FEAT::Geometry::MeshFileWriter::write_only ( const PartitionSet part_set)
inline

Definition at line 434 of file mesh_file_writer.hpp.

◆ write_partition()

◆ write_partition_set()

void FEAT::Geometry::MeshFileWriter::write_partition_set ( const PartitionSet part_set)
inline

Writes all partitions of a partition set to the file.

Parameters
[in]part_setA transient reference to the partition set whose partitions are to be exported.

Definition at line 347 of file mesh_file_writer.hpp.

References write_partition().

Referenced by write().

Member Data Documentation

◆ _indent

bool FEAT::Geometry::MeshFileWriter::_indent
protected

specifies whether indentation is to be used

Definition at line 131 of file mesh_file_writer.hpp.

Referenced by MeshFileWriter(), _pop_indent(), _push_indent(), and write_chart().

◆ _os

std::ostream& FEAT::Geometry::MeshFileWriter::_os
protected

the output stream to write to

Definition at line 129 of file mesh_file_writer.hpp.

Referenced by _write_attribute(), _write_vertex_set(), write(), write_chart(), write_mesh(), write_meshpart(), and write_partition().

◆ _sindent

String FEAT::Geometry::MeshFileWriter::_sindent
protected

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