dune-vtk 2.12
Loading...
Searching...
No Matches
Dune::Vtk::VtkReader< G, GC, FT > Class Template Reference

File-Reader for Vtk unstructured .vtu files. More...

#include <dune/vtk/vtkreader.hh>

Inheritance diagram for Dune::Vtk::VtkReader< G, GC, FT >:
Inheritance graph

Classes

struct  DataArrayAttributes
 

Public Types

using Grid = G
 Type of the grid to construct.
 
using GridCreator = GC
 Type of the associated grid creator.
 
using FieldType = FT
 Type of the components of the data to extract from the file.
 
using GlobalCoordinate = typename GridCreator::GlobalCoordinate
 Type of global world coordinates.
 
template<class Context , class Range >
using GridFunction = typename Vtk::AssociatedGridFunction< GridCreator, Range, Context >::type
 

Public Member Functions

template<class... Args, std::enable_if_t< std::is_constructible< GridCreator, Args... >::value, int > = 0>
 VtkReader (Args &&... args)
 Constructor. Creates a new GridCreator with the passed factory.
 
 VtkReader (GridCreator &creator)
 Constructor. Stores the references in a non-destroying shared_ptr.
 
 VtkReader (GridCreator &&creator)
 Constructor. Stores the references in a non-destroying shared_ptr.
 
 VtkReader (std::shared_ptr< GridCreator > creator)
 Constructor. Stores the shared_ptr.
 
void read (std::string const &filename, bool fillCreator=true)
 Read the grid from file with filename into the GridCreator.
 
GridCreator & gridCreator ()
 Obtains the creator of the reader.
 
std::unique_ptr< Grid > createGrid () const
 
template<class Range = DynamicVector<FieldType>>
GridFunction< Vtk::PointContext, Range > getPointData (std::string const &name) const
 
std::vector< DataArrayAttributes > getPointDataAttributes () const
 
template<class Range = DynamicVector<FieldType>>
GridFunction< Vtk::CellContext, Range > getCellData (std::string const &name) const
 
std::vector< DataArrayAttributes > getCellDataAttributes () const
 
std::vector< std::string > const & pieces () const
 Return the filenames of parallel pieces.
 
template<class FloatType , class HeaderType >
void readCellDataAppended (MetaType< FloatType >, MetaType< HeaderType >, std::ifstream &input, std::string id)
 
template<class FloatType , class HeaderType >
void readPointDataAppended (MetaType< FloatType >, MetaType< HeaderType >, std::ifstream &input, std::string id)
 
template<class FloatType , class HeaderType >
void readPointsAppended (MetaType< FloatType >, MetaType< HeaderType >, std::ifstream &input)
 
template<class HeaderType >
void readCellsAppended (MetaType< HeaderType >, std::ifstream &input)
 
void readSerialFileFromStream (std::ifstream &input, bool create=true)
 Read the grid from an input stream, referring to a .vtu file, into the GridFactory factory_.
 
void readParallelFileFromStream (std::ifstream &input, int rank, int size, bool create=true)
 Read the grid from and input stream, referring to a .pvtu file, into the GridFactory factory_.
 
void fillGridCreator (bool insertPieces=true)
 

Static Public Member Functions

template<class... Args>
static std::unique_ptr< Grid > createGridFromFile (std::string const &filename, Args &&... args)
 
template<class... Args>
static void fillFactory (GridFactory< Grid > &factory, std::string const &filename, Args &&... args)
 

Static Protected Member Functions

template<class... Args>
static std::unique_ptr< Grid > createGridFromFileImpl (std::string const &filename, Args &&... args)
 
template<class... Args>
static void fillFactoryImpl (GridFactory< Grid > &, std::string const &, Args &&...)
 

Detailed Description

template<class G, class GC = Vtk::ContinuousGridCreator<G>, class FT = double>
class Dune::Vtk::VtkReader< G, GC, FT >

File-Reader for Vtk unstructured .vtu files.

Reads .vtu files and constructs a grid from the cells stored in the file Additionally, stored data can be read.

NOTE: Assumption on the file structure: Each XML tag must be on a separate line.

Template Parameters
GThe type of the grid to construct.
GCGridCreator policy type to control what to pass to a grid factory with data given from the file. [ContinuousGridCreator]
FTType of the components of the data to extract from the file [default: double]

Member Typedef Documentation

◆ FieldType

template<class G , class GC = Vtk::ContinuousGridCreator<G>, class FT = double>
using Dune::Vtk::VtkReader< G, GC, FT >::FieldType = FT

Type of the components of the data to extract from the file.

◆ GlobalCoordinate

template<class G , class GC = Vtk::ContinuousGridCreator<G>, class FT = double>
using Dune::Vtk::VtkReader< G, GC, FT >::GlobalCoordinate = typename GridCreator::GlobalCoordinate

Type of global world coordinates.

◆ Grid

template<class G , class GC = Vtk::ContinuousGridCreator<G>, class FT = double>
using Dune::Vtk::VtkReader< G, GC, FT >::Grid = G

Type of the grid to construct.

◆ GridCreator

template<class G , class GC = Vtk::ContinuousGridCreator<G>, class FT = double>
using Dune::Vtk::VtkReader< G, GC, FT >::GridCreator = GC

Type of the associated grid creator.

◆ GridFunction

template<class G , class GC = Vtk::ContinuousGridCreator<G>, class FT = double>
template<class Context , class Range >
using Dune::Vtk::VtkReader< G, GC, FT >::GridFunction = typename Vtk::AssociatedGridFunction<GridCreator, Range, Context>::type

Constructor & Destructor Documentation

◆ VtkReader() [1/4]

template<class G , class GC = Vtk::ContinuousGridCreator<G>, class FT = double>
template<class... Args, std::enable_if_t< std::is_constructible< GridCreator, Args... >::value, int > = 0>
Dune::Vtk::VtkReader< G, GC, FT >::VtkReader ( Args &&...  args)
inlineexplicit

Constructor. Creates a new GridCreator with the passed factory.

Parameters
args...Either pass a GridFactory by reference or shared_ptr, or a list of arguments passed to the constructor of a Dune::GridFactory (typically and empty parameter list). See the constructor of GridCreatorInterface and the GridCreator passed to this reader.

◆ VtkReader() [2/4]

template<class G , class GC = Vtk::ContinuousGridCreator<G>, class FT = double>
Dune::Vtk::VtkReader< G, GC, FT >::VtkReader ( GridCreator &  creator)
inlineexplicit

Constructor. Stores the references in a non-destroying shared_ptr.

◆ VtkReader() [3/4]

template<class G , class GC = Vtk::ContinuousGridCreator<G>, class FT = double>
Dune::Vtk::VtkReader< G, GC, FT >::VtkReader ( GridCreator &&  creator)
inlineexplicit

Constructor. Stores the references in a non-destroying shared_ptr.

◆ VtkReader() [4/4]

template<class G , class GC = Vtk::ContinuousGridCreator<G>, class FT = double>
Dune::Vtk::VtkReader< G, GC, FT >::VtkReader ( std::shared_ptr< GridCreator >  creator)
inlineexplicit

Constructor. Stores the shared_ptr.

Member Function Documentation

◆ createGrid()

template<class G , class GC = Vtk::ContinuousGridCreator<G>, class FT = double>
std::unique_ptr< Grid > Dune::Vtk::VtkReader< G, GC, FT >::createGrid ( ) const
inline

Construct the actual grid using the GridCreator [[expects: read_ == true]]

◆ createGridFromFile()

template<class Grid , class FilerReaderImp >
template<class... Args>
static std::unique_ptr< Grid > Dune::Vtk::FileReader< Grid, FilerReaderImp >::createGridFromFile ( std::string const &  filename,
Args &&...  args 
)
inlinestaticinherited

Reads the grid from a file with filename and returns a unique_ptr to the created grid. Redirects to concrete implementation of derived class.

◆ createGridFromFileImpl()

template<class Grid , class FilerReaderImp >
template<class... Args>
static std::unique_ptr< Grid > Dune::Vtk::FileReader< Grid, FilerReaderImp >::createGridFromFileImpl ( std::string const &  filename,
Args &&...  args 
)
inlinestaticprotectedinherited

◆ fillFactory()

template<class Grid , class FilerReaderImp >
template<class... Args>
static void Dune::Vtk::FileReader< Grid, FilerReaderImp >::fillFactory ( GridFactory< Grid > &  factory,
std::string const &  filename,
Args &&...  args 
)
inlinestaticinherited

Reads the grid from a file with filename into a grid-factory. Redirects to concrete implementation of derived class.

◆ fillFactoryImpl()

template<class Grid , class FilerReaderImp >
template<class... Args>
static void Dune::Vtk::FileReader< Grid, FilerReaderImp >::fillFactoryImpl ( GridFactory< Grid > &  ,
std::string const &  ,
Args &&  ... 
)
inlinestaticprotectedinherited

◆ fillGridCreator()

template<class Grid , class Creator , class Field >
void Dune::Vtk::VtkReader< Grid, Creator, Field >::fillGridCreator ( bool  insertPieces = true)

Insert all internal data to the GridCreator NOTE: requires an aforegoing call to read()

◆ getCellData()

template<class G , class GC = Vtk::ContinuousGridCreator<G>, class FT = double>
template<class Range = DynamicVector<FieldType>>
GridFunction< Vtk::CellContext, Range > Dune::Vtk::VtkReader< G, GC, FT >::getCellData ( std::string const &  name) const
inline

Construct a grid-function representing the cell-data with the given name [[expects: read_ == true]]

◆ getCellDataAttributes()

template<class G , class GC = Vtk::ContinuousGridCreator<G>, class FT = double>
std::vector< DataArrayAttributes > Dune::Vtk::VtkReader< G, GC, FT >::getCellDataAttributes ( ) const
inline

Return a vector of DataArrayAttributes for all CELL_DATA blocks [[expects: read_ == true]]

◆ getPointData()

template<class G , class GC = Vtk::ContinuousGridCreator<G>, class FT = double>
template<class Range = DynamicVector<FieldType>>
GridFunction< Vtk::PointContext, Range > Dune::Vtk::VtkReader< G, GC, FT >::getPointData ( std::string const &  name) const
inline

Construct a grid-function representing the point-data with the given name [[expects: read_ == true]]

◆ getPointDataAttributes()

template<class G , class GC = Vtk::ContinuousGridCreator<G>, class FT = double>
std::vector< DataArrayAttributes > Dune::Vtk::VtkReader< G, GC, FT >::getPointDataAttributes ( ) const
inline

Return a vector of DataArrayAttributes for all POINT_DATA blocks [[expects: read_ == true]]

◆ gridCreator()

template<class G , class GC = Vtk::ContinuousGridCreator<G>, class FT = double>
GridCreator & Dune::Vtk::VtkReader< G, GC, FT >::gridCreator ( )
inline

Obtains the creator of the reader.

◆ pieces()

template<class G , class GC = Vtk::ContinuousGridCreator<G>, class FT = double>
std::vector< std::string > const & Dune::Vtk::VtkReader< G, GC, FT >::pieces ( ) const
inline

Return the filenames of parallel pieces.

◆ read()

template<class Grid , class Creator , class Field >
void Dune::Vtk::VtkReader< Grid, Creator, Field >::read ( std::string const &  filename,
bool  fillCreator = true 
)

Read the grid from file with filename into the GridCreator.

This function fills internal data containers representing the information from the passed file.

Parameters
filenameThe name of the input file
fillCreatorIf false, only fill internal data structures, if true, pass the internal data to the GridCreator. [true]

◆ readCellDataAppended()

template<class G , class GC = Vtk::ContinuousGridCreator<G>, class FT = double>
template<class FloatType , class HeaderType >
void Dune::Vtk::VtkReader< G, GC, FT >::readCellDataAppended ( MetaType< FloatType >  ,
MetaType< HeaderType >  ,
std::ifstream &  input,
std::string  id 
)

◆ readCellsAppended()

template<class G , class GC = Vtk::ContinuousGridCreator<G>, class FT = double>
template<class HeaderType >
void Dune::Vtk::VtkReader< G, GC, FT >::readCellsAppended ( MetaType< HeaderType >  ,
std::ifstream &  input 
)

◆ readParallelFileFromStream()

template<class Grid , class Creator , class Field >
void Dune::Vtk::VtkReader< Grid, Creator, Field >::readParallelFileFromStream ( std::ifstream &  input,
int  rank,
int  size,
bool  create = true 
)

Read the grid from and input stream, referring to a .pvtu file, into the GridFactory factory_.

Parameters
inputA STL input stream to read the VTK file from.
createIf false, only fill internal data structures, if true, also create the grid. [true]

◆ readPointDataAppended()

template<class G , class GC = Vtk::ContinuousGridCreator<G>, class FT = double>
template<class FloatType , class HeaderType >
void Dune::Vtk::VtkReader< G, GC, FT >::readPointDataAppended ( MetaType< FloatType >  ,
MetaType< HeaderType >  ,
std::ifstream &  input,
std::string  id 
)

◆ readPointsAppended()

template<class G , class GC = Vtk::ContinuousGridCreator<G>, class FT = double>
template<class FloatType , class HeaderType >
void Dune::Vtk::VtkReader< G, GC, FT >::readPointsAppended ( MetaType< FloatType >  ,
MetaType< HeaderType >  ,
std::ifstream &  input 
)

◆ readSerialFileFromStream()

template<class Grid , class Creator , class Field >
void Dune::Vtk::VtkReader< Grid, Creator, Field >::readSerialFileFromStream ( std::ifstream &  input,
bool  create = true 
)

Read the grid from an input stream, referring to a .vtu file, into the GridFactory factory_.

Advanced read methods

Parameters
inputA STL input stream to read the VTK file from.
createIf false, only fill internal data structures, if true, also create the grid. [true]

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