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

VTK input output for Rectilinear Meshes. More...

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

Public Member Functions

 VTKRectilinearGrid ()
 
 VTKRectilinearGrid (const std::string &, const std::string &)
 
 VTKRectilinearGrid (const std::string &, const std::string &, VTKFormat, int, int)
 
 VTKRectilinearGrid (const std::string &, const std::string &, VTKFormat, int, int, int)
 
 VTKRectilinearGrid (const std::string &, const std::string &, VTKFormat, int, int, int, int)
 
 VTKRectilinearGrid (const std::string &, const std::string &, VTKFormat, int, int, int, int, int, int)
 
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 (int, int)
 
void setDimensions (int, int, int)
 
void setDimensions (int, int, int, int)
 
void setDimensions (int, int, int, int, int, int)
 
void setGeomData (VTKField &&field)
 
template<class T >
void setGeomData (VTKRectilinearField, std::vector< T > &)
 
void setGeomData (VTKRectilinearField, VTKBaseStreamer *=nullptr)
 
template<class T >
void setGeomData (VTKRectilinearField, VTKBaseStreamer *=nullptr)
 
void setGlobalDimensions (int, int)
 
void setGlobalDimensions (int, int, int)
 
void setGlobalIndex (const std::vector< extension2D_t > &)
 
void setGlobalIndex (const std::vector< extension3D_t > &)
 
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
 
- 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

int m_dimensions
 
extension3D_t m_globalIndex
 
extension3D_t m_localIndex
 
std::vector< extension3D_t > m_procIndex
 
- 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 Rectilinear Meshes.

VTKRectilinearGrid provides methods to read and write parallel and serial rectlinear meshes and data. The class is agnostic with respect to the container used for the data and provides an interface through the CRTP mechanism. The numbering of nodes start with 0. Different numbering scheme is not supported.

Definition at line 495 of file VTK.hpp.

Constructor & Destructor Documentation

◆ VTKRectilinearGrid() [1/6]

bitpit::VTKRectilinearGrid::VTKRectilinearGrid ( )

Default constructor. Allocates three geometry fields called "x_Coord", "y_Coord" and "z_Coord".

Definition at line 46 of file VTKRectilinear.cpp.

◆ VTKRectilinearGrid() [2/6]

bitpit::VTKRectilinearGrid::VTKRectilinearGrid ( const std::string & dir,
const std::string & name )

Constructor for parallel 3D grid. Calls default constructor and sets provided input information.

Parameters
[in]dirdirectory of VTK file with final "/"
[in]namename of VTK without suffix

Definition at line 76 of file VTKRectilinear.cpp.

◆ VTKRectilinearGrid() [3/6]

bitpit::VTKRectilinearGrid::VTKRectilinearGrid ( const std::string & dir,
const std::string & name,
VTKFormat codex,
int n1,
int n2,
int m1,
int m2,
int l1,
int l2 )

Constructor for parallel 3D grid. Calls default constructor and sets provided input information.

Parameters
[in]dirdirectory of VTK file with final "/"
[in]namename of VTK without suffix
[in]codexcodex of data [VTKFormat::ASCII/VTKFormatAPPENDED]
[in]n1min node index in first direction
[in]n2max node index in first direction
[in]m1min node index in second direction
[in]m2max node index in second direction
[in]l1min node index in third direction
[in]l2max node index in third direction

Definition at line 95 of file VTKRectilinear.cpp.

◆ VTKRectilinearGrid() [4/6]

bitpit::VTKRectilinearGrid::VTKRectilinearGrid ( const std::string & dir,
const std::string & name,
VTKFormat codex,
int n,
int m,
int l )

Constructor for serial 3D grids. Min index is set automatically to zero. Calls default constructor and sets provided input information.

Parameters
[in]dirdirectory of VTK file with final "/"
[in]namename of VTK without suffix
[in]codexcodex of data [VTKFormat::ASCII/VTKFormatAPPENDED]
[in]nnumber of nodes in first direction
[in]mnumber of nodes in second direction
[in]lnumber of nodes in third direction

Definition at line 115 of file VTKRectilinear.cpp.

◆ VTKRectilinearGrid() [5/6]

bitpit::VTKRectilinearGrid::VTKRectilinearGrid ( const std::string & dir,
const std::string & name,
VTKFormat codex,
int n1,
int n2,
int m1,
int m2 )

Constructor for parallel 2D grid. Calls default constructor and sets provided input information.

Parameters
[in]dirdirectory of VTK file with final "/"
[in]namename of VTK without suffix
[in]codexcodex of data [VTKFormat::ASCII/VTKFormatAPPENDED]
[in]n1min node index in first direction
[in]n2max node index in first direction
[in]m1min node index in second direction
[in]m2max node index in second direction

Definition at line 135 of file VTKRectilinear.cpp.

◆ VTKRectilinearGrid() [6/6]

bitpit::VTKRectilinearGrid::VTKRectilinearGrid ( const std::string & dir,
const std::string & name,
VTKFormat codex,
int n,
int m )

Constructor for serial 2D grid. Calls default constructor and sets provided input information.

Parameters
[in]dirdirectory of VTK file with final "/"
[in]namename of VTK without suffix
[in]codexcodex of data [VTKFormat::ASCII/VTKFormatAPPENDED]
[in]nnumber of nodes in first direction
[in]mnumber of nodes in second direction

Definition at line 153 of file VTKRectilinear.cpp.

Member Function Documentation

◆ calcFieldComponents()

uint8_t bitpit::VTKRectilinearGrid::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 558 of file VTKRectilinear.cpp.

◆ calcFieldEntries()

uint64_t bitpit::VTKRectilinearGrid::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 518 of file VTKRectilinear.cpp.

◆ calcFieldSize()

uint64_t bitpit::VTKRectilinearGrid::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 504 of file VTKRectilinear.cpp.

◆ getExtension()

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

Gets the extension of the VTK file.

Returns
The extension of the VTK file.

Implements bitpit::VTK.

Definition at line 580 of file VTKRectilinear.cpp.

◆ readMetaInformation()

void bitpit::VTKRectilinearGrid::readMetaInformation ( )
overridevirtual

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

Implements bitpit::VTK.

Definition at line 166 of file VTKRectilinear.cpp.

◆ setDimensions() [1/4]

void bitpit::VTKRectilinearGrid::setDimensions ( int n,
int m )

sets the dimension for 2D serial grids.

Parameters
[in]nnumber of nodes in first direction
[in]mnumber of nodes in second direction

Definition at line 411 of file VTKRectilinear.cpp.

◆ setDimensions() [2/4]

void bitpit::VTKRectilinearGrid::setDimensions ( int n,
int m,
int l )

sets the dimension for 3D serial grids.

Parameters
[in]nnumber of nodes in first direction
[in]mnumber of nodes in second direction
[in]lnumber of nodes in third direction

Definition at line 387 of file VTKRectilinear.cpp.

◆ setDimensions() [3/4]

void bitpit::VTKRectilinearGrid::setDimensions ( int n1,
int n2,
int m1,
int m2 )

sets the dimension for 2D parallel grids.

Parameters
[in]n1min node index in first direction
[in]n2max node index in first direction
[in]m1min node index in second direction
[in]m2max node index in second direction

Definition at line 400 of file VTKRectilinear.cpp.

◆ setDimensions() [4/4]

void bitpit::VTKRectilinearGrid::setDimensions ( int n1,
int n2,
int m1,
int m2,
int l1,
int l2 )

sets the dimension for 3D parallel grids.

Parameters
[in]n1min node index in first direction
[in]n2max node index in first direction
[in]m1min node index in second direction
[in]m2max node index in second direction
[in]l1min node index in third direction
[in]l2max node index in third direction

Definition at line 357 of file VTKRectilinear.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::VTKRectilinearGrid::setGeomData ( VTKRectilinearField 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 131 of file VTK.tpp.

◆ setGeomData() [3/4]

void bitpit::VTKRectilinearGrid::setGeomData ( VTKRectilinearField fieldEnum,
VTKBaseStreamer * streamer = nullptr )

Associates streamer to a geometrical field

Parameters
[in]fieldEnumwhich geometrical field
[in]streamerVTKBaseStreamer

Definition at line 440 of file VTKRectilinear.cpp.

◆ setGeomData() [4/4]

template<class T >
void bitpit::VTKRectilinearGrid::setGeomData ( VTKRectilinearField 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]streamerVTKBaseStreamer

Definition at line 151 of file VTK.tpp.

◆ setGlobalDimensions() [1/2]

void bitpit::VTKRectilinearGrid::setGlobalDimensions ( int I,
int J )

sets the global 2D grid information for parallel output. Needs to be called by all processes

Parameters
[in]Inumer of nodes in first direction
[in]Jnumer of nodes in second direction

Definition at line 455 of file VTKRectilinear.cpp.

◆ setGlobalDimensions() [2/2]

void bitpit::VTKRectilinearGrid::setGlobalDimensions ( int I,
int J,
int K )

sets the global 3D grid information for parallel output. Needs to be called by all processes

Parameters
[in]Inumer of nodes in first direction
[in]Jnumer of nodes in second direction
[in]Knumer of nodes in third direction

Definition at line 424 of file VTKRectilinear.cpp.

◆ setGlobalIndex() [1/2]

void bitpit::VTKRectilinearGrid::setGlobalIndex ( const std::vector< extension2D_t > & loc)

sets the global 2D grid information for parallel output. Needs to be called only by rank 0.

Parameters
[in]locmin I-index, max I-index, min J-index, max J-index for each process

Definition at line 485 of file VTKRectilinear.cpp.

◆ setGlobalIndex() [2/2]

void bitpit::VTKRectilinearGrid::setGlobalIndex ( const std::vector< extension3D_t > & loc)

sets the global 3D grid information for parallel output. Needs to be called only by rank 0.

Parameters
[in]locmin I-index, max I-index, min J-index, max J-index, min K-index, max K-index for each process

Definition at line 471 of file VTKRectilinear.cpp.

◆ writeCollection()

void bitpit::VTKRectilinearGrid::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 285 of file VTKRectilinear.cpp.

◆ writeMetaInformation()

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

Writes entire VTR but the data.

Implements bitpit::VTK.

Definition at line 224 of file VTKRectilinear.cpp.

Member Data Documentation

◆ m_dimensions

int bitpit::VTKRectilinearGrid::m_dimensions
protected

dimensions of the grid [2/3]

Definition at line 501 of file VTK.hpp.

◆ m_globalIndex

extension3D_t bitpit::VTKRectilinearGrid::m_globalIndex
protected

min and max indices of global grid

Definition at line 503 of file VTK.hpp.

◆ m_localIndex

extension3D_t bitpit::VTKRectilinearGrid::m_localIndex
protected

min and max indices of local grid

Definition at line 502 of file VTK.hpp.

◆ m_procIndex

std::vector<extension3D_t> bitpit::VTKRectilinearGrid::m_procIndex
protected

global indices of each process

Definition at line 504 of file VTK.hpp.


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