Alsvinn  0.5.3
The fast FVM simulator with UQ support
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
alsfvm::io::HDF5Writer Class Reference

The HDF5Writer class writes output to HDF5 format. More...

#include <alsfvm/io/HDF5Writer.hpp>

Inheritance diagram for alsfvm::io::HDF5Writer:
alsfvm::io::Writer alsfvm::io::HDF5MPIWriter

Public Member Functions

 HDF5Writer (const std::string &basefileName)
 HDF5Writer constructs a new HDF5Writer. More...
 
virtual ~HDF5Writer ()
 
virtual void write (const volume::Volume &conservedVariables, const grid::Grid &grid, const simulator::TimestepInformation &timestepInformation) override
 write writes the data to disk More...
 
- Public Member Functions inherited from alsfvm::io::Writer
virtual ~Writer ()
 
virtual void finalize (const grid::Grid &grid, const simulator::TimestepInformation &timestepInformation)
 This method should be called at the end of the simulation. More...
 
void addAttributes (const std::string &nameOfAttributes, const boost::property_tree::ptree &attributes)
 

Protected Member Functions

void writeGrid (hid_t object, const grid::Grid &grid)
 
void writeTimeGroup (hid_t object, const simulator::TimestepInformation &timestepInformation)
 
void writeVolume (const volume::Volume &volume, hid_t file, hid_t accessList=H5P_DEFAULT)
 writeVolume takes each variable of the volume and writes it More...
 
void writeMemory (const volume::Volume &volume, size_t index, const std::string &name, hid_t file, hid_t accessList=H5P_DEFAULT)
 writeMemory writes a memory area to disk More...
 
virtual std::unique_ptr< HDF5ResourcecreateDatasetForMemory (const volume::Volume &volume, size_t index, const std::string &name, hid_t file)
 createDatasetForMemroy creates a dataset for the given memory More...
 
void writeMemoryToDataset (const volume::Volume &volume, size_t index, const std::string &name, hid_t dataset, hid_t accessList=H5P_DEFAULT)
 createDatasetForMemroy creates a dataset for the given memory More...
 
void writeString (hid_t object, const std::string &name, const std::string &value)
 writeString writes the string as an attribute to the given object More...
 
void writeFloats (hid_t object, const std::string &name, const std::vector< float > &values)
 writeFloats writes the vector of floats as an attribute More...
 
void writeIntegers (hid_t object, const std::string &name, const std::vector< int > &values)
 writeIntegerss writes the vector of integers as an attribute More...
 

Protected Attributes

size_t snapshotNumber
 
const std::string basefileName
 
- Protected Attributes inherited from alsfvm::io::Writer
std::map< std::string, boost::property_tree::ptree > attributesMap
 

Additional Inherited Members

- Static Public Member Functions inherited from alsfvm::io::Writer
static std::string getClassName ()
 

Detailed Description

The HDF5Writer class writes output to HDF5 format.

Note
This class writes the output as VizSchema4, see https://ice.txcorp.com/trac/vizschema/wiki/WikiStart
The output can easily be opened in Visit and Paraview (but need new paraview version)

Constructor & Destructor Documentation

◆ HDF5Writer()

alsfvm::io::HDF5Writer::HDF5Writer ( const std::string &  basefileName)

HDF5Writer constructs a new HDF5Writer.

Parameters
basefileNamethe basefilename to use (this could be eg. "some_simulation".
Note
Timestep information will be added to the filename, as well as proper extension (.h5).

◆ ~HDF5Writer()

virtual alsfvm::io::HDF5Writer::~HDF5Writer ( )
inlinevirtual

Member Function Documentation

◆ createDatasetForMemory()

std::unique_ptr< HDF5Resource > alsfvm::io::HDF5Writer::createDatasetForMemory ( const volume::Volume volume,
size_t  index,
const std::string &  name,
hid_t  file 
)
protectedvirtual

createDatasetForMemroy creates a dataset for the given memory

Parameters
volumethe volume to read from
indexthe index of the memory area to read from
namethe name of the memory (variable name)
filethe file to write to

Reimplemented in alsfvm::io::HDF5MPIWriter.

◆ write()

void alsfvm::io::HDF5Writer::write ( const volume::Volume conservedVariables,
const grid::Grid grid,
const simulator::TimestepInformation timestepInformation 
)
overridevirtual

write writes the data to disk

Parameters
conservedVariablesthe conservedVariables to write
gridthe grid currently used (includes whole domain, in case of mpi)
timestepInformation

Implements alsfvm::io::Writer.

Reimplemented in alsfvm::io::HDF5MPIWriter.

◆ writeFloats()

void alsfvm::io::HDF5Writer::writeFloats ( hid_t  object,
const std::string &  name,
const std::vector< float > &  values 
)
protected

writeFloats writes the vector of floats as an attribute

Parameters
objectthe object to write to
namethe name of the attribute
valuesthe values to write

◆ writeGrid()

void alsfvm::io::HDF5Writer::writeGrid ( hid_t  object,
const grid::Grid grid 
)
protected

Writes the grid to the file in VizSchema format

Parameters
objectthe object to write the grid to
gridthe grid to use
Note
This function creates a new group in object named "grid"

◆ writeIntegers()

void alsfvm::io::HDF5Writer::writeIntegers ( hid_t  object,
const std::string &  name,
const std::vector< int > &  values 
)
protected

writeIntegerss writes the vector of integers as an attribute

Parameters
objectthe object to write to
namethe name of the attribute
valuesthe values to write

◆ writeMemory()

void alsfvm::io::HDF5Writer::writeMemory ( const volume::Volume volume,
size_t  index,
const std::string &  name,
hid_t  file,
hid_t  accessList = H5P_DEFAULT 
)
protected

writeMemory writes a memory area to disk

Parameters
volumethe volume to read from
indexthe index of the memory area to read from
namethe name of the memory (variable name)
filethe file to write to
accessListused for parallel hdf5

◆ writeMemoryToDataset()

void alsfvm::io::HDF5Writer::writeMemoryToDataset ( const volume::Volume volume,
size_t  index,
const std::string &  name,
hid_t  dataset,
hid_t  accessList = H5P_DEFAULT 
)
protected

createDatasetForMemroy creates a dataset for the given memory

Parameters
volumethe volume to read from
indexthe index of the memory area to read from
namethe name of the memory (variable name)
datasetthe dataset to write to
accessListthe accesslist to used (used for parallel hdf5)

◆ writeString()

void alsfvm::io::HDF5Writer::writeString ( hid_t  object,
const std::string &  name,
const std::string &  value 
)
protected

writeString writes the string as an attribute to the given object

Parameters
objectthe id of the (opened) object to write to
namethe name of the attribute
valuethe string value

◆ writeTimeGroup()

void alsfvm::io::HDF5Writer::writeTimeGroup ( hid_t  object,
const simulator::TimestepInformation timestepInformation 
)
protected

◆ writeVolume()

void alsfvm::io::HDF5Writer::writeVolume ( const volume::Volume volume,
hid_t  file,
hid_t  accessList = H5P_DEFAULT 
)
protected

writeVolume takes each variable of the volume and writes it

Parameters
volumethe volume to read from
filethe file to write to
accessListused for parallel hdf5

Member Data Documentation

◆ basefileName

const std::string alsfvm::io::HDF5Writer::basefileName
protected

◆ snapshotNumber

size_t alsfvm::io::HDF5Writer::snapshotNumber
protected

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