A base class for VTK input output. More...
Public Member Functions | |
VTK () | |
VTK (const std::string &, const std::string &) | |
template<class T > | |
VTKField & | addData (const std::string &, std::vector< T > &) |
VTKField & | addData (const std::string &, VTKBaseStreamer *=nullptr) |
template<class T > | |
VTKField & | addData (const std::string &, VTKFieldType, VTKLocation, std::vector< T > &) |
template<class T > | |
VTKField & | addData (const std::string &, VTKFieldType, VTKLocation, VTKBaseStreamer *=nullptr) |
VTKField & | addData (VTKField &&field) |
void | disableData (const std::string &) |
void | enableData (const std::string &) |
const VTKField * | findData (const std::string &name) const |
const VTKField * | findGeomData (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 () |
virtual void | readMetaInformation ()=0 |
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 | setGeomData (VTKField &&field) |
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 |
virtual void | writeCollection (const std::string &outputName, const std::string &collectionName) const =0 |
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 | |
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 () |
virtual uint8_t | calcFieldComponents (const VTKField &) const =0 |
virtual uint64_t | calcFieldEntries (const VTKField &) const =0 |
virtual uint64_t | calcFieldSize (const VTKField &) const =0 |
void | checkAllFields () |
FileHandler | createCollectionHandler (const std::string &collectionName) const |
virtual std::string | getCollectionExtension () const |
VTKField * | getData (std::size_t id) |
const VTKField * | getData (std::size_t id) const |
virtual std::string | getExtension () const =0 |
std::vector< std::string > | getFieldNames (const std::vector< VTKField > &fields) const |
VTKField * | getGeomData (std::size_t id) |
const VTKField * | getGeomData (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 |
virtual void | writeMetaInformation () const =0 |
void | writePDataArray (std::fstream &, const VTKField &) const |
Protected Attributes | |
uint64_t | m_cells |
std::vector< VTKField > | m_data |
VTKFormat | m_dataCodex |
FileHandler | m_fh |
VTKFormat | m_geomCodex |
std::vector< VTKField > | m_geometry |
std::string | m_headerType |
VTKNativeStreamer | m_nativeStreamer |
uint64_t | m_points |
uint16_t | m_procs |
uint16_t | m_rank |
A base class for VTK input output.
VTK provides all basic methods for reading and writing VTK files. ASCII and APPENDED mode are supported.
bitpit::VTK::VTK | ( | ) |
bitpit::VTK::VTK | ( | const std::string & | dir, |
const std::string & | name ) |
|
protected |
|
protected |
|
protected |
VTKField & bitpit::VTK::addData | ( | const std::string & | name, |
std::vector< T > & | data ) |
VTKField & bitpit::VTK::addData | ( | const std::string & | name, |
VTKBaseStreamer * | streamer = nullptr ) |
Add user data for input or output. Codification will be set according to default value [appended] or to value set by VTK::setDataCodex( VTKFormat ) or VTK::setCodex( VTKFormat )
[in] | name | name of field |
[in] | streamer | data streamer |
VTKField & bitpit::VTK::addData | ( | const std::string & | name, |
VTKFieldType | comp, | ||
VTKLocation | loc, | ||
std::vector< T > & | data ) |
Add user data for input or output. Codification will be set according to default value [appended] or to value set by VTK::setDataCodex( VTKFormat ) or VTK::setCodex( VTKFormat )
T | type of std::vector<> |
[in] | name | name of field |
[in] | comp | type of data field [ VTKFieldType::SCALAR/VECTOR/TENSOR ] |
[in] | loc | location of data [VTKLocation::CELL/VTKLocationPOINT] |
[in] | data | data |
VTKField & bitpit::VTK::addData | ( | const std::string & | name, |
VTKFieldType | comp, | ||
VTKLocation | loc, | ||
VTKBaseStreamer * | streamer = nullptr ) |
Add user data for input or output. Codification will be set according to default value [appended] or to value set by VTK::setDataCodex( VTKFormat ) or VTK::setCodex( VTKFormat )
T | type of data to be written or read |
[in] | name | name of field |
[in] | comp | type of data field [ VTKFieldType::SCALAR/VECTOR/TENSOR ] |
[in] | loc | location of data [VTKLocation::CELL/VTKLocationPOINT] |
[in] | streamer | data streamer |
Add user data for input or output. Codification will be set according to default value [appended] or to value set by VTK::setDataCodex( VTKFormat ) or VTK::setCodex( VTKFormat )
[in] | field | is the field that will be added |
|
protected |
|
protectedpure virtual |
Implemented in bitpit::VTKUnstructuredGrid, and bitpit::VTKRectilinearGrid.
|
protectedpure virtual |
Implemented in bitpit::VTKUnstructuredGrid, and bitpit::VTKRectilinearGrid.
|
protectedpure virtual |
Implemented in bitpit::VTKUnstructuredGrid, and bitpit::VTKRectilinearGrid.
|
protected |
|
protected |
void bitpit::VTK::disableData | ( | const std::string & | name | ) |
void bitpit::VTK::enableData | ( | const std::string & | name | ) |
const VTKField * bitpit::VTK::findData | ( | const std::string & | name | ) | const |
const VTKField * bitpit::VTK::findGeomData | ( | const std::string & | name | ) | const |
|
protectedvirtual |
int bitpit::VTK::getCounter | ( | ) | const |
|
protected |
|
protected |
std::vector< VTKField >::const_iterator bitpit::VTK::getDataBegin | ( | ) | const |
std::size_t bitpit::VTK::getDataCount | ( | ) | const |
std::vector< VTKField >::const_iterator bitpit::VTK::getDataEnd | ( | ) | const |
std::string bitpit::VTK::getDirectory | ( | ) | const |
|
protectedpure virtual |
Implemented in bitpit::VTKUnstructuredGrid, and bitpit::VTKRectilinearGrid.
|
protected |
|
protected |
|
protected |
std::vector< VTKField >::const_iterator bitpit::VTK::getGeomDataBegin | ( | ) | const |
std::size_t bitpit::VTK::getGeomDataCount | ( | ) | const |
std::vector< VTKField >::const_iterator bitpit::VTK::getGeomDataEnd | ( | ) | const |
const std::string & bitpit::VTK::getHeaderType | ( | ) | const |
std::string bitpit::VTK::getName | ( | ) | const |
bool bitpit::VTK::hasData | ( | const std::string & | name | ) | const |
void bitpit::VTK::incrementCounter | ( | ) |
|
protected |
|
protected |
void bitpit::VTK::read | ( | ) |
void bitpit::VTK::readData | ( | ) |
|
protected |
|
protected |
|
pure virtual |
Implemented in bitpit::VTKUnstructuredGrid, and bitpit::VTKRectilinearGrid.
void bitpit::VTK::removeData | ( | const std::string & | name | ) |
void bitpit::VTK::setCodex | ( | VTKFormat | cod | ) |
void bitpit::VTK::setCounter | ( | int | counter = 0 | ) |
void bitpit::VTK::setDataCodex | ( | VTKFormat | cod | ) |
void bitpit::VTK::setDirectory | ( | const std::string & | dir | ) |
void bitpit::VTK::setGeomCodex | ( | VTKFormat | cod | ) |
void bitpit::VTK::setGeomData | ( | VTKField && | field | ) |
Set the specified geometry field.
[in] | field | is the field that will be set |
Implemented in bitpit::VTKUnstructuredGrid, and bitpit::VTKRectilinearGrid.
void bitpit::VTK::setHeaderType | ( | const std::string & | st | ) |
void bitpit::VTK::setName | ( | const std::string & | name | ) |
set name for VTK file
[in] | name | file name without suffix |
void bitpit::VTK::setNames | ( | const std::string & | dir, |
const std::string & | name ) |
void bitpit::VTK::setParallel | ( | uint16_t | procs, |
uint16_t | rank ) |
int bitpit::VTK::unsetCounter | ( | ) |
void bitpit::VTK::write | ( | const std::string & | name, |
VTKWriteMode | writeMode, | ||
double | time ) |
Writes entire VTK file (headers and data).
[in] | name | filename to be set for this output only |
[in] | writeMode | if writeMode == VTKWriteMode::DEFAULT the default write setting will be used according to setCounter(); if writeMode == VTKWriteMode::NO_SERIES no time stamp will be added and the counter will not be increased; if writeMode == VTKWriteMode::NO_INCREMENT the output file will have the same time stamp like the previous one ; |
[in] | time | is the time associated with the file |
void bitpit::VTK::write | ( | const std::string & | name, |
VTKWriteMode | writeMode = VTKWriteMode::NO_INCREMENT ) |
Writes entire VTK file (headers and data).
[in] | name | filename to be set for this output only |
[in] | writeMode | if writeMode == VTKWriteMode::DEFAULT the default write setting will be used according to setCounter(); if writeMode == VTKWriteMode::NO_SERIES no time stamp will be added and the counter will not be increased; if writeMode == VTKWriteMode::NO_INCREMENT the output file will have the same time stamp like the previous one ; |
void bitpit::VTK::write | ( | VTKWriteMode | writeMode, |
double | time ) |
Writes entire VTK file (headers and data).
[in] | writeMode | if writeMode == VTKWriteMode::DEFAULT the default write setting will be used according to setCounter(); if writeMode == VTKWriteMode::NO_SERIES no time stamp will be added and the counter will not be increased; if writeMode == VTKWriteMode::NO_INCREMENT the output file will have the same time stamp like the previous one ; |
[in] | time | is the time associated with the file |
void bitpit::VTK::write | ( | VTKWriteMode | writeMode = VTKWriteMode::DEFAULT | ) |
Writes entire VTK file (headers and data).
[in] | writeMode | if writeMode == VTKWriteMode::DEFAULT the default write setting will be used according to setCounter(); if writeMode == VTKWriteMode::NO_SERIES no time stamp will be added and the counter will not be increased; if writeMode == VTKWriteMode::NO_INCREMENT the output file will have the same time stamp like the previous one ; |
void bitpit::VTK::writeCollection | ( | ) | const |
void bitpit::VTK::writeCollection | ( | const std::string & | outputName | ) | const |
|
pure virtual |
Implemented in bitpit::VTKUnstructuredGrid, and bitpit::VTKRectilinearGrid.
|
protected |
|
protected |
|
protected |
|
protectedpure virtual |
Implemented in bitpit::VTKUnstructuredGrid, and bitpit::VTKRectilinearGrid.
|
protected |
void bitpit::VTK::writeTimeSeries | ( | const std::string & | outputName, |
const std::string & | seriesName, | ||
double | time ) const |
Writes time series file.
If the file doesn't exists or if this is the first data set of the series (i.e., the counter is equal to zero), the time series will be written from scratch and will contain only the current data set. Otherwise, the existing time series will be inspected and the current data set will be either added at the end of the series or will it will replace the entry with the same file name it such an entry exists.
outputName | filename to be set for this output only |
seriesName | series filename to be set for this output only |
time | is the time associated with the data set |
void bitpit::VTK::writeTimeSeries | ( | const std::string & | outputName, |
double | time ) const |
Writes time series file.
If the file doesn't exists or if this is the first data set of the series (i.e., the counter is equal to zero), the time series will be written from scratch and will contain only the current data set. Otherwise, the existing time series will be inspected and the current data set will be either added at the end of the series or will it will replace the entry with the same file name it such an entry exists.
outputName | filename to be set for this output only |
time | is the time associated with the data set |
void bitpit::VTK::writeTimeSeries | ( | double | time | ) | const |
Writes time series file.
If the file doesn't exists or if this is the first data set of the series (i.e., the counter is equal to zero), the time series will be written from scratch and will contain only the current data set. Otherwise, the existing time series will be inspected and the current data set will be either added at the end of the series or will it will replace the entry with the same file name it such an entry exists.
time | is the time associated with the data set |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |