3.5-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
Public Types | Public Member Functions | List of all members
Dumux::VTKReader Class Reference

A vtk file reader using tinyxml2 as xml backend. More...

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

Description

A vtk file reader using tinyxml2 as xml backend.

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 contructor 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> >

the cell / point data type for point data read from a grid file

Member Enumeration Documentation

◆ DataType

enum class Dumux::VTKReader::DataType
strong

The data array types.

Enumerator
cellData 
pointData 

Constructor & Destructor Documentation

◆ VTKReader()

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

The contructor creates a tinyxml2::XMLDocument from file.

Member Function Documentation

◆ hasData()

bool Dumux::VTKReader::hasData ( const std::string &  name,
const DataType type 
) const
inline

Reviews data from the vtk file to check if there is a data array with a specified name.

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

read data from the vtk file to a container, e.g. std::vector<double>

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

Read a grid from a vtk/vtu/vtp file, ignoring cell and point data.

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

Read a grid from a vtk/vtu/vtp file, ignoring cell and point data.

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 (emtpy) 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

Read a grid from a vtk/vtu/vtp file, reading all cell and point data.

Note
the factory will be needed outside to interpret the data via the factory's insertion indices
Parameters
factorythe (emtpy) 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: