Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
bitpit::VTKUnstructuredGrid Class Reference

VTK input output for Unstructured Meshes. More...

Inheritance diagram for bitpit::VTKUnstructuredGrid:
Inheritance graph
[legend]
Collaboration diagram for bitpit::VTKUnstructuredGrid:
Collaboration graph
[legend]

Classes

class  HomogeneousInfoStreamer
 

Public Member Functions

 VTKUnstructuredGrid (const std::string &, const std::string &, VTKElementType elementType=VTKElementType::UNDEFINED)
 
 VTKUnstructuredGrid (VTKElementType elementType=VTKElementType::UNDEFINED)
 
uint64_t calcConnectivityEntries () const
 
uint8_t calcFieldComponents (const VTKField &) const override
 
uint64_t calcFieldEntries (const VTKField &) const override
 
uint64_t calcFieldSize (const VTKField &) const override
 
void readMetaInformation () override
 
void setDimensions (uint64_t, uint64_t, uint64_t nconn=0, uint64_t nfacestream=0)
 
void setGeomData (VTKField &&field)
 
template<class T >
void setGeomData (VTKUnstructuredField, std::vector< T > &)
 
void setGeomData (VTKUnstructuredField, VTKBaseStreamer *=nullptr)
 
template<class T >
void setGeomData (VTKUnstructuredField, VTKBaseStreamer *=nullptr)
 
void writeCollection (const std::string &outputName, const std::string &collectionName) const override
 
void writeMetaInformation () const override
 
- Public Member Functions inherited from bitpit::VTK
 VTK ()
 
 VTK (const std::string &, const std::string &)
 
template<class T >
VTKFieldaddData (const std::string &, std::vector< T > &)
 
VTKFieldaddData (const std::string &, VTKBaseStreamer *=nullptr)
 
template<class T >
VTKFieldaddData (const std::string &, VTKFieldType, VTKLocation, std::vector< T > &)
 
template<class T >
VTKFieldaddData (const std::string &, VTKFieldType, VTKLocation, VTKBaseStreamer *=nullptr)
 
VTKFieldaddData (VTKField &&field)
 
void disableData (const std::string &)
 
void enableData (const std::string &)
 
const VTKFieldfindData (const std::string &name) const
 
const VTKFieldfindGeomData (const std::string &name) const
 
int getCounter () const
 
std::vector< VTKField >::const_iterator getDataBegin () const
 
std::size_t getDataCount () const
 
std::vector< VTKField >::const_iterator getDataEnd () const
 
std::string getDirectory () const
 
std::vector< VTKField >::const_iterator getGeomDataBegin () const
 
std::size_t getGeomDataCount () const
 
std::vector< VTKField >::const_iterator getGeomDataEnd () const
 
const std::string & getHeaderType () const
 
std::string getName () const
 
bool hasData (const std::string &) const
 
void incrementCounter ()
 
void read ()
 
void readData ()
 
void removeData (const std::string &)
 
void setCodex (VTKFormat)
 
void setCounter (int c_=0)
 
void setDataCodex (VTKFormat)
 
void setDirectory (const std::string &)
 
void setGeomCodex (VTKFormat)
 
void setHeaderType (const std::string &)
 
void setName (const std::string &)
 
void setNames (const std::string &, const std::string &)
 
void setParallel (uint16_t, uint16_t)
 
int unsetCounter ()
 
void write (const std::string &, VTKWriteMode writeMode, double time)
 
void write (const std::string &, VTKWriteMode writeMode=VTKWriteMode::NO_INCREMENT)
 
void write (VTKWriteMode writeMode, double time)
 
void write (VTKWriteMode writeMode=VTKWriteMode::DEFAULT)
 
void writeCollection () const
 
void writeCollection (const std::string &outputName) const
 
void writeTimeSeries (const std::string &outputName, const std::string &seriesName, double time) const
 
void writeTimeSeries (const std::string &outputName, double time) const
 
void writeTimeSeries (double time) const
 

Protected Member Functions

std::string getExtension () const override
 
uint64_t readConnectivityEntries ()
 
uint64_t readFaceStreamEntries ()
 
void setElementType (VTKElementType)
 
- Protected Member Functions inherited from bitpit::VTK
VTKField_findData (const std::string &name)
 
int _findFieldIndex (const std::string &name, const std::vector< VTKField > &fields) const
 
VTKField_findGeomData (const std::string &name)
 
void calcAppendedOffsets ()
 
void checkAllFields ()
 
FileHandler createCollectionHandler (const std::string &collectionName) const
 
virtual std::string getCollectionExtension () const
 
VTKFieldgetData (std::size_t id)
 
const VTKFieldgetData (std::size_t id) const
 
std::vector< std::string > getFieldNames (const std::vector< VTKField > &fields) const
 
VTKFieldgetGeomData (std::size_t id)
 
const VTKFieldgetGeomData (std::size_t id) const
 
bool isAppendedActive () const
 
bool isASCIIActive () const
 
bool readDataArray (std::fstream &, VTKField &) const
 
void readDataHeader (std::fstream &)
 
void writeData ()
 
void writeDataArray (std::fstream &, const VTKField &) const
 
void writeDataHeader (std::fstream &, bool parallel=false) const
 
void writePDataArray (std::fstream &, const VTKField &) const
 

Protected Attributes

VTKElementType m_elementType
 
HomogeneousInfoStreamer m_homogeneousInfoStreamer
 
uint64_t m_nConnectivityEntries
 
uint64_t m_nFaceStreamEntries
 
- Protected Attributes inherited from bitpit::VTK
uint64_t m_cells
 
std::vector< VTKFieldm_data
 
VTKFormat m_dataCodex
 
FileHandler m_fh
 
VTKFormat m_geomCodex
 
std::vector< VTKFieldm_geometry
 
std::string m_headerType
 
VTKNativeStreamer m_nativeStreamer
 
uint64_t m_points
 
uint16_t m_procs
 
uint16_t m_rank
 

Detailed Description

VTK input output for Unstructured Meshes.

VTKUnstructuredGrid provides methods to read and write parallel and serial unstructured meshes and data. The class is agnostic with respect to the container used for the data and provides an interface through the CRTP mechanism.

Definition at line 433 of file VTK.hpp.

Constructor & Destructor Documentation

◆ VTKUnstructuredGrid() [1/2]

bitpit::VTKUnstructuredGrid::VTKUnstructuredGrid ( VTKElementType elementType = VTKElementType::UNDEFINED)

Default constructor. Allocates four geometry fields called "Points"(Float64), "offsets"(Int32), "types"(Int32) and "connectivity"(Int32).

Parameters
[in]elementTypeType of elements in the grid

Definition at line 133 of file VTKUnstructured.cpp.

◆ VTKUnstructuredGrid() [2/2]

bitpit::VTKUnstructuredGrid::VTKUnstructuredGrid ( const std::string & dir,
const std::string & name,
VTKElementType elementType = VTKElementType::UNDEFINED )

Constructor. sets input parameters and calls default constructor

Parameters
[in]dirDirectory of vtk file with final "/"
[in]nameName of vtk file without suffix
[in]elementTypeType of elements in the grid

Definition at line 176 of file VTKUnstructured.cpp.

Member Function Documentation

◆ calcConnectivityEntries()

uint64_t bitpit::VTKUnstructuredGrid::calcConnectivityEntries ( ) const

Returns the size of the connectivity information

Returns
size of connectivity

Definition at line 632 of file VTKUnstructured.cpp.

◆ calcFieldComponents()

uint8_t bitpit::VTKUnstructuredGrid::calcFieldComponents ( const VTKField & field) const
overridevirtual

Calculates the compnents of a field

Parameters
[in]fieldfield
Returns
size of the field

Implements bitpit::VTK.

Definition at line 705 of file VTKUnstructured.cpp.

◆ calcFieldEntries()

uint64_t bitpit::VTKUnstructuredGrid::calcFieldEntries ( const VTKField & field) const
overridevirtual

Calculates the number of entries of a field

Parameters
[in]fieldfield
Returns
size of the field

Implements bitpit::VTK.

Definition at line 656 of file VTKUnstructured.cpp.

◆ calcFieldSize()

uint64_t bitpit::VTKUnstructuredGrid::calcFieldSize ( const VTKField & field) const
overridevirtual

Calculates the size (in bytes) of a field

Parameters
[in]fieldfield
Returns
size of the field

Implements bitpit::VTK.

Definition at line 642 of file VTKUnstructured.cpp.

◆ getExtension()

std::string bitpit::VTKUnstructuredGrid::getExtension ( ) const
overrideprotectedvirtual

Gets the extension of the VTK file.

Returns
The extension of the VTK file.

Implements bitpit::VTK.

Definition at line 758 of file VTKUnstructured.cpp.

◆ readConnectivityEntries()

uint64_t bitpit::VTKUnstructuredGrid::readConnectivityEntries ( )
protected

Reads "type" information of existing grid and calculates the correspondng connectivity size.

Returns
size of the connectivity information

Definition at line 289 of file VTKUnstructured.cpp.

◆ readFaceStreamEntries()

uint64_t bitpit::VTKUnstructuredGrid::readFaceStreamEntries ( )
protected

Reading the total number of entries in the face stream of the vtu file

Returns
total number of faces entries

Definition at line 370 of file VTKUnstructured.cpp.

◆ readMetaInformation()

void bitpit::VTKUnstructuredGrid::readMetaInformation ( )
overridevirtual

Reads meta data of VTU file (grid size, data fields, codex, position of data within file). Calls setDimension.

Implements bitpit::VTK.

Definition at line 564 of file VTKUnstructured.cpp.

◆ setDimensions()

void bitpit::VTKUnstructuredGrid::setDimensions ( uint64_t ncells,
uint64_t npoints,
uint64_t nconn = 0,
uint64_t nfacestream = 0 )

Sets the size of the unstructured grid.

If VTKUnstructuredGrid::setElementType(VTKElelementType) has been called the size of the connectivity can be omitted and the connectivity size will be calculated within the method.

When writing a parallel mesh, even if there is just a single process that needs to write the face stream information, than all the processes need to write the face stream as well (even the processes whose local cells don't require the face steam). It's up to the caller of this function to ensure that all processes will provide the correct size of the face stream.

Parameters
[in]ncellsnumber of cells
[in]npointsnumber of points
[in]nconnsize of the connectivity information;
[in]nfacestreamsize of the face stream information;

Definition at line 227 of file VTKUnstructured.cpp.

◆ setElementType()

void bitpit::VTKUnstructuredGrid::setElementType ( VTKElementType elementType)
protected

Tell VTKUnstructuredGrid that grid is made homogeously of one element type; Consequently type and offset information are handled directly in class and need not to be provided via interface

Parameters
[in]elementTypeType of elements in the grid

Definition at line 187 of file VTKUnstructured.cpp.

◆ setGeomData() [1/4]

void bitpit::VTK::setGeomData ( VTKField && field)

Set the specified geometry field.

Parameters
[in]fieldis the field that will be set

Implements bitpit::VTK.

Definition at line 341 of file VTK.cpp.

◆ setGeomData() [2/4]

template<class T >
void bitpit::VTKUnstructuredGrid::setGeomData ( VTKUnstructuredField fieldEnum,
std::vector< T > & data )

Associates the NativeStreamer to a geometrical field

Template Parameters
Ttype of std::vector<>
Parameters
[in]fieldEnumwhich geometrical field
[in]datastd::vector containing the data

Definition at line 94 of file VTK.tpp.

◆ setGeomData() [3/4]

void bitpit::VTKUnstructuredGrid::setGeomData ( VTKUnstructuredField fieldEnum,
VTKBaseStreamer * streamer = nullptr )

Associates streamer to a geometrical field

Parameters
[in]fieldEnumwhich geometrical field
[in]streamerVTKBaseStreamer

Definition at line 276 of file VTKUnstructured.cpp.

◆ setGeomData() [4/4]

template<class T >
void bitpit::VTKUnstructuredGrid::setGeomData ( VTKUnstructuredField fieldEnum,
VTKBaseStreamer * streamer = nullptr )

Associates streamer to a geometrical field

Template Parameters
Ttype of data to be written or read
Parameters
[in]fieldEnumwhich geometrical field
[in]streamerpointer to data streamer

Definition at line 114 of file VTK.tpp.

◆ writeCollection()

void bitpit::VTKUnstructuredGrid::writeCollection ( const std::string & outputName,
const std::string & collectionName ) const
overridevirtual

Writes collection file for parallel output.

Parameters
outputNamefilename to be set for this output only
collectionNamecollection filename to be set for this output only

Implements bitpit::VTK.

Definition at line 501 of file VTKUnstructured.cpp.

◆ writeMetaInformation()

void bitpit::VTKUnstructuredGrid::writeMetaInformation ( ) const
overridevirtual

Writes entire VTU but the data.

Implements bitpit::VTK.

Definition at line 441 of file VTKUnstructured.cpp.

Member Data Documentation

◆ m_elementType

VTKElementType bitpit::VTKUnstructuredGrid::m_elementType
protected

type of element mesh is made of

Definition at line 453 of file VTK.hpp.

◆ m_homogeneousInfoStreamer

HomogeneousInfoStreamer bitpit::VTKUnstructuredGrid::m_homogeneousInfoStreamer
protected

streamer if unstructured grid is of homogenous type

Definition at line 454 of file VTK.hpp.

◆ m_nConnectivityEntries

uint64_t bitpit::VTKUnstructuredGrid::m_nConnectivityEntries
protected

size of the connectivity information

Definition at line 451 of file VTK.hpp.

◆ m_nFaceStreamEntries

uint64_t bitpit::VTKUnstructuredGrid::m_nFaceStreamEntries
protected

size of the face stream information

Definition at line 452 of file VTK.hpp.


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