Developer Documentation
OpenVolumeMesh::IO::FileManager Class Reference

Read/Write mesh data from/to files. More...

#include <Type-OpenVolumeMesh/libs/OpenVolumeMesh/src/OpenVolumeMesh/FileManager/FileManager.hh>

Public Member Functions

 FileManager ()
 Default constructor. More...
 
 ~FileManager ()
 Default destructor. More...
 
void setVerbosityLevel (int _level)
 set minimum level for errors that are printed to std::cerr More...
 
template<class MeshT >
bool readStream (std::istream &_istream, MeshT &_mesh, bool _topologyCheck=true, bool _computeBottomUpIncidences=true) const
 Read a mesh from an std::istream. More...
 
template<class MeshT >
bool readFile (const std::string &_filename, MeshT &_mesh, bool _topologyCheck=true, bool _computeBottomUpIncidences=true) const
 Read a mesh from a file. More...
 
template<class MeshT >
void writeStream (std::ostream &_ostream, const MeshT &_mesh) const
 Write a mesh to an std::ostream. More...
 
template<class MeshT >
bool writeFile (const std::string &_filename, const MeshT &_mesh) const
 Write a mesh to a file. More...
 
bool isHexahedralMesh (const std::string &_filename) const
 Test whether given file contains a hexahedral mesh. More...
 
bool isTetrahedralMesh (const std::string &_filename) const
 Test whether given file contains a tetrahedral mesh. More...
 

Private Member Functions

template<class MeshT >
void readProperty (std::istream &_iff, MeshT &_mesh) const
 
template<class PropT , class MeshT >
void generateGenericProperty (const std::string &_entity_t, const std::string &_name, std::istream &_iff, MeshT &_mesh) const
 
template<typename EntityTag , class MeshT >
void writeProps (std::ostream &_ostream, const MeshT &_mesh) const
 
template<class IteratorT >
void writeProps (std::ostream &_ostr, const IteratorT &_begin, const IteratorT &_end, std::string const &_entityType) const
 
void trimString (std::string &_string) const
 
void extractQuotedText (std::string &_string) const
 
bool getCleanLine (std::istream &ifs, std::string &_string, bool _skipEmptyLines=true) const
 

Private Attributes

int verbosity_level_ = 3
 

Detailed Description

Read/Write mesh data from/to files.

Todo:
Implement binary file support

Definition at line 54 of file FileManager.hh.

Constructor & Destructor Documentation

◆ FileManager()

OpenVolumeMesh::IO::FileManager::FileManager ( )

Default constructor.

Definition at line 55 of file FileManager.cc.

◆ ~FileManager()

OpenVolumeMesh::IO::FileManager::~FileManager ( )

Default destructor.

Definition at line 61 of file FileManager.cc.

Member Function Documentation

◆ extractQuotedText()

void OpenVolumeMesh::IO::FileManager::extractQuotedText ( std::string &  _string) const
private

Definition at line 82 of file FileManager.cc.

◆ generateGenericProperty()

template<class PropT , class MeshT >
void OpenVolumeMesh::IO::FileManager::generateGenericProperty ( const std::string &  _entity_t,
const std::string &  _name,
std::istream &  _iff,
MeshT _mesh 
) const
private

Definition at line 426 of file FileManagerT_impl.hh.

◆ getCleanLine()

bool OpenVolumeMesh::IO::FileManager::getCleanLine ( std::istream &  ifs,
std::string &  _string,
bool  _skipEmptyLines = true 
) const
private

Definition at line 97 of file FileManager.cc.

◆ isHexahedralMesh()

bool OpenVolumeMesh::IO::FileManager::isHexahedralMesh ( const std::string &  _filename) const

Test whether given file contains a hexahedral mesh.

Definition at line 134 of file FileManager.cc.

◆ isTetrahedralMesh()

bool OpenVolumeMesh::IO::FileManager::isTetrahedralMesh ( const std::string &  _filename) const

Test whether given file contains a tetrahedral mesh.

Definition at line 181 of file FileManager.cc.

◆ readFile()

template<class MeshT >
bool OpenVolumeMesh::IO::FileManager::readFile ( const std::string &  _filename,
MeshT _mesh,
bool  _topologyCheck = true,
bool  _computeBottomUpIncidences = true 
) const

Read a mesh from a file.

Returns true if the file was successfully read. The mesh is stored in parameter _mesh. If something goes wrong, this function returns false.

Parameters
_filenameThe file that is to be read
_meshA reference to an OpenVolumeMesh instance
_topologyCheckPass true if you want to perform a topology check each time an entity is added (slower performance)
_computeBottomUpIncidencesPass true if you want the file manager to directly compute the bottom-up incidences for the mesh. (Note: These are needed for some iterators to work, see documentation)

Definition at line 344 of file FileManagerT_impl.hh.

◆ readProperty()

template<class MeshT >
void OpenVolumeMesh::IO::FileManager::readProperty ( std::istream &  _iff,
MeshT _mesh 
) const
private

Definition at line 365 of file FileManagerT_impl.hh.

◆ readStream()

template<class MeshT >
bool OpenVolumeMesh::IO::FileManager::readStream ( std::istream &  _istream,
MeshT _mesh,
bool  _topologyCheck = true,
bool  _computeBottomUpIncidences = true 
) const

Read a mesh from an std::istream.

Returns true if the file was successfully read. The mesh is stored in parameter _mesh. If something goes wrong, this function returns false.

Parameters
_istreamThe stream to read the mesh from
_meshA reference to an OpenVolumeMesh instance
_topologyCheckPass true if you want to perform a topology check each time an entity is added (slower performance)
_computeBottomUpIncidencesPass true if you want the file manager to directly compute the bottom-up incidences for the mesh. (Note: These are needed for some iterators to work, see documentation)

Definition at line 62 of file FileManagerT_impl.hh.

◆ setVerbosityLevel()

void OpenVolumeMesh::IO::FileManager::setVerbosityLevel ( int  _level)
inline

set minimum level for errors that are printed to std::cerr

Parameters
_level0: no output; 1: only errors; 2: warnings/info

Definition at line 68 of file FileManager.hh.

◆ trimString()

void OpenVolumeMesh::IO::FileManager::trimString ( std::string &  _string) const
private

Definition at line 67 of file FileManager.cc.

◆ writeFile()

template<class MeshT >
bool OpenVolumeMesh::IO::FileManager::writeFile ( const std::string &  _filename,
const MeshT _mesh 
) const

Write a mesh to a file.

Returns true if the file was successfully written. The mesh is passed as parameter _mesh. If something goes wrong, this function returns false.

Parameters
_filenameThe file that is to be stored
_meshA const reference to an OpenVolumeMesh instance

Definition at line 550 of file FileManagerT_impl.hh.

◆ writeProps() [1/2]

template<class IteratorT >
void OpenVolumeMesh::IO::FileManager::writeProps ( std::ostream &  _ostr,
const IteratorT &  _begin,
const IteratorT &  _end,
std::string const &  _entityType 
) const
private

Definition at line 576 of file FileManagerT_impl.hh.

◆ writeProps() [2/2]

template<typename EntityTag , class MeshT >
void OpenVolumeMesh::IO::FileManager::writeProps ( std::ostream &  _ostream,
const MeshT _mesh 
) const
private

Definition at line 566 of file FileManagerT_impl.hh.

◆ writeStream()

template<class MeshT >
void OpenVolumeMesh::IO::FileManager::writeStream ( std::ostream &  _ostream,
const MeshT _mesh 
) const

Write a mesh to an std::ostream.

Parameters
_ostreamThe stream to write the mesh to
_meshA const reference to an OpenVolumeMesh instance

Definition at line 464 of file FileManagerT_impl.hh.

Member Data Documentation

◆ verbosity_level_

int OpenVolumeMesh::IO::FileManager::verbosity_level_ = 3
private

Definition at line 175 of file FileManager.hh.


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