dune-vtk 2.12
Loading...
Searching...
No Matches
Dune::Vtk::UnstructuredGridWriter< GridView, DataCollector > Class Template Reference

File-Writer for VTK .vtu files. More...

#include <dune/vtk/writers/unstructuredgridwriter.hh>

Inheritance diagram for Dune::Vtk::UnstructuredGridWriter< GridView, DataCollector >:
Inheritance graph

Public Types

using GridView = GV
 
using DataCollector = DC
 

Public Member Functions

virtual std::string write (std::string const &fn, std::optional< std::string > dir={}) const override
 Write the attached data to the file.
 
template<class Function >
VtkWriterBase & addPointData (Function &&fct, const Vtk::FieldInfo &info)
 Attach point data to the writer.
 
template<class Function , class R = RangeType<ResolveRef_t<Function>,Domain>>
VtkWriterBase & addPointData (Function &&fct, std::string name, int size=dimRange< R >())
 
VtkWriterBase & addPointData (const std::shared_ptr< VTKFunction< GridView > const > &fct)
 
VtkWriterBase & addPointData (const Vtk::GridFunction< GridView > &fct)
 
template<class Function >
VtkWriterBase & addCellData (Function &&fct, const Vtk::FieldInfo &info)
 Attach cell data to the writer.
 
template<class Function , class R = RangeType<ResolveRef_t<Function>,Domain>>
VtkWriterBase & addCellData (Function &&fct, std::string name, int size=dimRange< R >())
 
VtkWriterBase & addCellData (const std::shared_ptr< VTKFunction< GridView > const > &fct)
 
VtkWriterBase & addCellData (const Vtk::GridFunction< GridView > &fct)
 
void setFormat (Vtk::FormatTypes format)
 
void setDatatype (Vtk::DataTypes datatype)
 Sets the global datatype used for coordinates and other global float values.
 
void setHeadertype (Vtk::DataTypes datatype)
 Sets the integer type used in binary data headers.
 
void setCompressor (Vtk::CompressorTypes compressor, int level=-1)
 

Protected Types

enum  PositionTypes { POINT_DATA , CELL_DATA }
 
using VtkFunction = Dune::Vtk::GridFunction< GridView >
 
using Domain = typename GridView::template Codim< 0 >::Entity::Geometry::GlobalCoordinate
 

Protected Member Functions

void writeData (std::ofstream &out, std::vector< pos_type > &offsets, VtkFunction const &fct, PositionTypes type, std::optional< std::size_t > timestep={}) const
 
void writeDataAppended (std::ofstream &out, std::vector< std::uint64_t > &blocks) const
 
void writePoints (std::ofstream &out, std::vector< pos_type > &offsets, std::optional< std::size_t > timestep={}) const
 
void writeAppended (std::ofstream &out, std::vector< pos_type > const &offsets) const
 
template<class HeaderType , class FloatType >
std::uint64_t writeValuesAppended (std::ofstream &out, std::vector< FloatType > const &values) const
 
template<class T >
void writeValuesAscii (std::ofstream &out, std::vector< T > const &values) const
 
void writeHeader (std::ofstream &out, std::string const &type) const
 
std::string getNames (std::vector< VtkFunction > const &data) const
 Return PointData/CellData attributes for the name of the first scalar/vector/tensor DataArray.
 
std::string getEndian () const
 
std::string getFileExtension () const
 
Vtk::FormatTypes getFormat () const
 
Vtk::DataTypes getDatatype () const
 
auto comm () const
 

Protected Attributes

Vtk::CompressorTypes compressor_ = Vtk::CompressorTypes::NONE
 
std::size_t const block_size = 1024*32
 
int compression_level = -1
 

Friends

template<class >
class TimeseriesWriter
 

Detailed Description

template<class GridView, class DataCollector = ContinuousDataCollector<GridView>>
class Dune::Vtk::UnstructuredGridWriter< GridView, DataCollector >

File-Writer for VTK .vtu files.

Requirement:

Member Typedef Documentation

◆ DataCollector

template<class GV , class DC >
using Dune::Vtk::VtkWriterBase< GV, DC >::DataCollector = DC
inherited

◆ Domain

template<class GV , class DC >
using Dune::Vtk::VtkWriterBase< GV, DC >::Domain = typename GridView::template Codim<0>::Entity::Geometry::GlobalCoordinate
protectedinherited

◆ GridView

template<class GV , class DC >
using Dune::Vtk::VtkWriterBase< GV, DC >::GridView = GV
inherited

◆ VtkFunction

template<class GV , class DC >
using Dune::Vtk::VtkWriterBase< GV, DC >::VtkFunction = Dune::Vtk::GridFunction<GridView>
protectedinherited

Member Enumeration Documentation

◆ PositionTypes

template<class GV , class DC >
enum Dune::Vtk::VtkWriterBase::PositionTypes
protectedinherited
Enumerator
POINT_DATA 
CELL_DATA 

Member Function Documentation

◆ addCellData() [1/4]

template<class GV , class DC >
VtkWriterBase & Dune::Vtk::VtkWriterBase< GV, DC >::addCellData ( const std::shared_ptr< VTKFunction< GridView > const > &  fct)
inlineinherited

◆ addCellData() [2/4]

template<class GV , class DC >
VtkWriterBase & Dune::Vtk::VtkWriterBase< GV, DC >::addCellData ( const Vtk::GridFunction< GridView > &  fct)
inlineinherited

◆ addCellData() [3/4]

template<class GV , class DC >
template<class Function >
VtkWriterBase & Dune::Vtk::VtkWriterBase< GV, DC >::addCellData ( Function &&  fct,
const Vtk::FieldInfo &  info 
)
inlineinherited

Attach cell data to the writer.

Attach a global function to the writer that will be evaluated at cell centers. The global function must be assignable to the function wrapper Vtk::GridFunction. Additional argument for output datatype and number of components can be passed. See Vtk::GridFunction Constructor for possible arguments.

Parameters
fctA GridFunction or Dune::VTKFunction
infoAdditional arguments, like name, numComponents, dataType or rangeType

◆ addCellData() [4/4]

template<class GV , class DC >
template<class Function , class R = RangeType<ResolveRef_t<Function>,Domain>>
VtkWriterBase & Dune::Vtk::VtkWriterBase< GV, DC >::addCellData ( Function &&  fct,
std::string  name,
int  size = dimRange<R>() 
)
inlineinherited

◆ addPointData() [1/4]

template<class GV , class DC >
VtkWriterBase & Dune::Vtk::VtkWriterBase< GV, DC >::addPointData ( const std::shared_ptr< VTKFunction< GridView > const > &  fct)
inlineinherited

◆ addPointData() [2/4]

template<class GV , class DC >
VtkWriterBase & Dune::Vtk::VtkWriterBase< GV, DC >::addPointData ( const Vtk::GridFunction< GridView > &  fct)
inlineinherited

◆ addPointData() [3/4]

template<class GV , class DC >
template<class Function >
VtkWriterBase & Dune::Vtk::VtkWriterBase< GV, DC >::addPointData ( Function &&  fct,
const Vtk::FieldInfo &  info 
)
inlineinherited

Attach point data to the writer.

Attach a global function to the writer that will be evaluated at grid points (vertices and higher order points). The global function must be assignable to the function wrapper Vtk::GridFunction. Additional argument for output datatype and number of components can be passed. See Vtk::GridFunction Constructor for possible arguments.

Parameters
fctA GridFunction or Dune::VTKFunction
infAdditional arguments, like name, numComponents, dataType or rangeType

◆ addPointData() [4/4]

template<class GV , class DC >
template<class Function , class R = RangeType<ResolveRef_t<Function>,Domain>>
VtkWriterBase & Dune::Vtk::VtkWriterBase< GV, DC >::addPointData ( Function &&  fct,
std::string  name,
int  size = dimRange<R>() 
)
inlineinherited

◆ comm()

template<class GV , class DC >
auto Dune::Vtk::VtkWriterBase< GV, DC >::comm ( ) const
inlineprotectedinherited

◆ getDatatype()

template<class GV , class DC >
Vtk::DataTypes Dune::Vtk::VtkWriterBase< GV, DC >::getDatatype ( ) const
inlineprotectedinherited

◆ getEndian()

template<class GV , class DC >
std::string Dune::Vtk::VtkWriterBase< GV, DC >::getEndian ( ) const
inlineprotectedinherited

◆ getFileExtension()

template<class GV , class DC >
std::string Dune::Vtk::VtkWriterBase< GV, DC >::getFileExtension ( ) const
inlineprotectedinherited

◆ getFormat()

template<class GV , class DC >
Vtk::FormatTypes Dune::Vtk::VtkWriterBase< GV, DC >::getFormat ( ) const
inlineprotectedinherited

◆ getNames()

template<class GV , class DC >
std::string Dune::Vtk::VtkWriterBase< GV, DC >::getNames ( std::vector< VtkFunction > const &  data) const
protectedinherited

Return PointData/CellData attributes for the name of the first scalar/vector/tensor DataArray.

◆ setCompressor()

template<class GV , class DC >
void Dune::Vtk::VtkWriterBase< GV, DC >::setCompressor ( Vtk::CompressorTypes  compressor,
int  level = -1 
)
inlineinherited

Sets the compressor type used in binary data headers, Additionally a compression level can be passed with level = -1 means: default compression level. Level must be in [0-9]

◆ setDatatype()

template<class GV , class DC >
void Dune::Vtk::VtkWriterBase< GV, DC >::setDatatype ( Vtk::DataTypes  datatype)
inlineinherited

Sets the global datatype used for coordinates and other global float values.

◆ setFormat()

template<class GV , class DC >
void Dune::Vtk::VtkWriterBase< GV, DC >::setFormat ( Vtk::FormatTypes  format)
inlineinherited

◆ setHeadertype()

template<class GV , class DC >
void Dune::Vtk::VtkWriterBase< GV, DC >::setHeadertype ( Vtk::DataTypes  datatype)
inlineinherited

Sets the integer type used in binary data headers.

◆ write()

template<class GV , class DC >
std::string Dune::Vtk::VtkWriterBase< GV, DC >::write ( std::string const &  fn,
std::optional< std::string >  dir = {} 
) const
overridevirtualinherited

Write the attached data to the file.

Parameters
fnFilename of the VTK file. May contain a directory and any file extension.
dirThe optional parameter specifies the directory of the partition files for parallel writes.
Returns
File name that is actually written.

Implements Dune::Vtk::FileWriter.

◆ writeAppended()

template<class GV , class DC >
void Dune::Vtk::VtkWriterBase< GV, DC >::writeAppended ( std::ofstream &  out,
std::vector< pos_type > const &  offsets 
) const
protectedinherited

◆ writeData()

template<class GV , class DC >
void Dune::Vtk::VtkWriterBase< GV, DC >::writeData ( std::ofstream &  out,
std::vector< pos_type > &  offsets,
VtkFunction const &  fct,
PositionTypes  type,
std::optional< std::size_t >  timestep = {} 
) const
protectedinherited

◆ writeDataAppended()

template<class GV , class DC >
void Dune::Vtk::VtkWriterBase< GV, DC >::writeDataAppended ( std::ofstream &  out,
std::vector< std::uint64_t > &  blocks 
) const
protectedinherited

◆ writeHeader()

template<class GV , class DC >
void Dune::Vtk::VtkWriterBase< GV, DC >::writeHeader ( std::ofstream &  out,
std::string const &  type 
) const
protectedinherited

◆ writePoints()

template<class GV , class DC >
void Dune::Vtk::VtkWriterBase< GV, DC >::writePoints ( std::ofstream &  out,
std::vector< pos_type > &  offsets,
std::optional< std::size_t >  timestep = {} 
) const
protectedinherited

◆ writeValuesAppended()

template<class GV , class DC >
template<class HeaderType , class FloatType >
std::uint64_t Dune::Vtk::VtkWriterBase< GV, DC >::writeValuesAppended ( std::ofstream &  out,
std::vector< FloatType > const &  values 
) const
protectedinherited

◆ writeValuesAscii()

template<class GV , class DC >
template<class T >
void Dune::Vtk::VtkWriterBase< GV, DC >::writeValuesAscii ( std::ofstream &  out,
std::vector< T > const &  values 
) const
protectedinherited

Friends And Related Symbol Documentation

◆ TimeseriesWriter

template<class GridView , class DataCollector = ContinuousDataCollector<GridView>>
template<class >
friend class TimeseriesWriter
friend

Member Data Documentation

◆ block_size

template<class GV , class DC >
std::size_t const Dune::Vtk::VtkWriterBase< GV, DC >::block_size = 1024*32
protectedinherited

◆ compression_level

template<class GV , class DC >
int Dune::Vtk::VtkWriterBase< GV, DC >::compression_level = -1
protectedinherited

◆ compressor_

template<class GV , class DC >
Vtk::CompressorTypes Dune::Vtk::VtkWriterBase< GV, DC >::compressor_ = Vtk::CompressorTypes::NONE
protectedinherited

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