version 3.9-dev
Dumux::VTKReader Class Reference

A vtk file reader using tinyxml2 as xml backend.

#include <dumux/io/vtk/vtkreader.hh>

Public Types

enum class  DataType { cellData , pointData }
 The data array types. More...
 
using Data = std::unordered_map< std::string, std::vector< double > >
 the cell / point data type for point data read from a grid file More...
 

Public Member Functions

 VTKReader (const std::string &fileName)
 The constructor creates a tinyxml2::XMLDocument from file. More...
 
bool hasData (const std::string &name, const DataType &type) const
 Reviews data from the vtk file to check if there is a data array with a specified name. More...
 
template<class Container >
Container readData (const std::string &name, const DataType &type) const
 read data from the vtk file to a container, e.g. std::vector<double> More...
 
template<class Grid >
std::unique_ptr< Grid > readGrid (bool verbose=false) const
 Read a grid from a vtk/vtu/vtp file, ignoring cell and point data. More...
 
template<class Grid >
std::unique_ptr< Grid > readGrid (Dune::GridFactory< Grid > &factory, bool verbose=false) const
 Read a grid from a vtk/vtu/vtp file, ignoring cell and point data. More...
 
template<class Grid >
std::unique_ptr< Grid > readGrid (Dune::GridFactory< Grid > &factory, Data &cellData, Data &pointData, bool verbose=false) const
 Read a grid from a vtk/vtu/vtp file, reading all cell and point data. More...
 

Member Typedef Documentation

◆ Data

using Dumux::VTKReader::Data = std::unordered_map<std::string, std::vector<double> >

Member Enumeration Documentation

◆ DataType

enum class Dumux::VTKReader::DataType
strong
Enumerator
cellData 
pointData 

Constructor & Destructor Documentation

◆ VTKReader()

Dumux::VTKReader::VTKReader ( const std::string &  fileName)
inlineexplicit

Member Function Documentation

◆ hasData()

bool Dumux::VTKReader::hasData ( const std::string &  name,
const DataType type 
) const
inline
Parameters
namethe name attribute of the data array to read
typethe data array type

◆ readData()

template<class Container >
Container Dumux::VTKReader::readData ( const std::string &  name,
const DataType type 
) const
inline
Template Parameters
Containera container type that has begin(), end(), push_back(), e.g. std::vector<>
Parameters
namethe name attribute of the data array to read
typethe data array type

◆ readGrid() [1/3]

template<class Grid >
std::unique_ptr< Grid > Dumux::VTKReader::readGrid ( bool  verbose = false) const
inline
Parameters
verboseif the output should be verbose

◆ readGrid() [2/3]

template<class Grid >
std::unique_ptr< Grid > Dumux::VTKReader::readGrid ( Dune::GridFactory< Grid > &  factory,
bool  verbose = false 
) const
inline
Note
use this signature if the factory might be needed outside to interpret the data via the factory's insertion indices
Parameters
verboseif the output should be verbose
factorythe (empty) grid factory

◆ readGrid() [3/3]

template<class Grid >
std::unique_ptr< Grid > Dumux::VTKReader::readGrid ( Dune::GridFactory< Grid > &  factory,
Data cellData,
Data pointData,
bool  verbose = false 
) const
inline
Note
the factory will be needed outside to interpret the data via the factory's insertion indices
Parameters
factorythe (empty) grid factory
cellDatathe cell data arrays to be filled
pointDatathe point data arrays to be filled
verboseif the output should be verbose

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