NuTo
Numerics Tool
Public Member Functions | List of all members
NuTo::Visualize::DataArray< TDataType > Class Template Reference

collects data for a vtk <DataArray> and writes it in ascii or raw binary appended format More...

#include <DataArray.h>

Public Member Functions

 DataArray (std::string name, int numComponents, std::vector< TDataType > &&data)
 
std::string VtkTypeString () const
 
int Offset () const
 
void WriteCommonHeader (std::ostream &file) const
 writes the header for both ascii and binary format including "name", "NumberOfComponents" and "type" More...
 
void WriteAscii (std::ostream &file) const
 writes to ascii including the common header, "type" and the actual data More...
 
void WriteBinaryHeader (std::ostream &file, int *offset) const
 writes the binary header including the common header, "type", "offset" and calculates the new offset More...
 
void WriteBinaryData (std::ofstream &file) const
 writes the data in uncompressed raw binary More...
 
template<>
std::string VtkTypeString () const
 
template<>
std::string VtkTypeString () const
 
template<>
std::string VtkTypeString () const
 
template<>
std::string VtkTypeString () const
 

Detailed Description

template<typename TDataType>
class NuTo::Visualize::DataArray< TDataType >

collects data for a vtk <DataArray> and writes it in ascii or raw binary appended format

Constructor & Destructor Documentation

template<typename TDataType>
DataArray::DataArray ( std::string  name,
int  numComponents,
std::vector< TDataType > &&  data 
)
Parameters
name"name" attribute
numComponents"NumberOfComponents" attribute
datadata as a xvalue. You'll have to std::move() the data in here.

Member Function Documentation

template<typename TDataType >
int DataArray::Offset ( ) const
Returns
calculates the byte offset in the raw binary appended format via offset = headerSize (usually 8) + #data * sizeof(data)
template<typename TDataType>
std::string NuTo::Visualize::DataArray< TDataType >::VtkTypeString ( ) const
Returns
matching vtk type string to <typename tdatatype>="">
template<>
std::string NuTo::Visualize::DataArray< double >::VtkTypeString ( ) const
template<>
std::string NuTo::Visualize::DataArray< float >::VtkTypeString ( ) const
template<>
std::string NuTo::Visualize::DataArray< unsigned >::VtkTypeString ( ) const
template<>
std::string NuTo::Visualize::DataArray< uint8_t >::VtkTypeString ( ) const
template<typename TDataType >
void DataArray::WriteAscii ( std::ostream &  file) const

writes to ascii including the common header, "type" and the actual data

Parameters
fileoutstream to write into
template<typename TDataType >
void DataArray::WriteBinaryData ( std::ofstream &  file) const

writes the data in uncompressed raw binary

Parameters
filefile to write the raw binary
template<typename TDataType >
void DataArray::WriteBinaryHeader ( std::ostream &  file,
int *  offset 
) const

writes the binary header including the common header, "type", "offset" and calculates the new offset

Parameters
fileoutstream to write into
offset"offset" attribute that gets updated with the current offset
Remarks
By using the * syntax it is clear (from the callers side) that offset is changed [called with &int]
template<typename TDataType >
void DataArray::WriteCommonHeader ( std::ostream &  file) const

writes the header for both ascii and binary format including "name", "NumberOfComponents" and "type"

Parameters
fileoutstream to write into

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