IFEM  90A354
Public Member Functions | List of all members
HDF5Writer Class Reference

Write data to a HDF5 file. More...

#include <HDF5Writer.h>

Inheritance diagram for HDF5Writer:
Inheritance graph
[legend]
Collaboration diagram for HDF5Writer:
Collaboration graph
[legend]

Public Member Functions

 HDF5Writer (const std::string &name, const ProcessAdm &adm, bool append=false)
 The constructor opens a named HDF5-file. More...
 
virtual ~HDF5Writer ()
 Empty destructor.
 
virtual int getLastTimeLevel ()
 Returns the last time level stored in the HDF5 file.
 
virtual void openFile (int level)
 Opens the file at a given time level. More...
 
virtual void closeFile (int level)
 Closes the file. More...
 
virtual void writeVector (int level, const DataEntry &entry)
 Writes a vector to file. More...
 
virtual void writeSIM (int level, double time, const DataEntry &entry, bool geometryUpdated, const std::string &prefix)
 Writes data from a SIM to file. More...
 
virtual void writeNodalForces (int level, const DataEntry &entry)
 Writes nodal forces to file. More...
 
virtual void writeKnotspan (int level, const DataEntry &entry, const std::string &prefix)
 Writes knot span field to file. More...
 
virtual void writeBasis (int level, const DataEntry &entry, const std::string &prefix)
 Writes a basis to file. More...
 
virtual bool writeTimeInfo (int level, double time)
 Writes time stepping info to file. More...
 
virtual bool writeLog (const std::string &data, const std::string &name)
 Write a log to output file. More...
 
- Public Member Functions inherited from DataWriter
virtual ~DataWriter ()
 Empty destructor.
 
const std::string & getName () const
 Returns the name of the file.
 
- Public Member Functions inherited from HDF5Base
 HDF5Base (const std::string &name, const ProcessAdm &adm)
 The constructor opens a named HDF5-file. More...
 
virtual ~HDF5Base ()
 The destructor closes the file.
 

Additional Inherited Members

- Protected Member Functions inherited from DataWriter
 DataWriter (const std::string &name, const ProcessAdm &adm, const char *defaultExt=nullptr)
 Protected constructor as this is a purely virtual class.
 
- Protected Member Functions inherited from HDF5Base
bool openFile (unsigned int flag)
 Opens the HDF5 file. More...
 
void closeFile ()
 Closes the HDF5 file.
 
- Protected Attributes inherited from DataWriter
std::string m_name
 File name.
 
int m_size
 Number of MPI nodes (processors)
 
int m_rank
 MPI rank (processor ID)
 
- Protected Attributes inherited from HDF5Base
std::string m_hdf5_name
 The file name of the HDF5 file.
 

Detailed Description

Write data to a HDF5 file.

The HDF5 writer writes data to a HDF5 file. It supports parallel I/O.

Constructor & Destructor Documentation

◆ HDF5Writer()

HDF5Writer::HDF5Writer ( const std::string &  name,
const ProcessAdm adm,
bool  append = false 
)

The constructor opens a named HDF5-file.

Parameters
[in]nameThe name (without extension) of the data file
[in]admThe process administrator
[in]appendWhether to append to or overwrite an existing file

References DataWriter::m_name.

Member Function Documentation

◆ closeFile()

void HDF5Writer::closeFile ( int  level)
virtual

Closes the file.

Parameters
[in]levelLevel we just wrote to the file

Implements DataWriter.

◆ openFile()

void HDF5Writer::openFile ( int  level)
virtual

Opens the file at a given time level.

Parameters
[in]levelThe requested time level

Implements DataWriter.

References HDF5_SANITY_LIMIT, DataWriter::m_name, and HDF5Base::openFile().

◆ writeBasis()

void HDF5Writer::writeBasis ( int  level,
const DataEntry entry,
const std::string &  prefix 
)
virtual

Writes a basis to file.

Parameters
[in]levelThe time level to write the basis at
[in]entryThe DataEntry describing the basis
[in]prefixPrefix for basis

Implements DataWriter.

References SIMbase::getName(), DataExporter::L2G_NODE, and DataExporter::REDUNDANT.

Referenced by writeSIM().

◆ writeKnotspan()

void HDF5Writer::writeKnotspan ( int  level,
const DataEntry entry,
const std::string &  prefix 
)
virtual

Writes knot span field to file.

Parameters
[in]levelThe time level to write the data at
[in]entryThe DataEntry describing the field
[in]prefixPrefix for field

Implements DataWriter.

References utl::matrix< T >::cols(), SIMbase::extractPatchElmRes(), utl::matrix< T >::fillRow(), SIMbase::getLocalPatchIndex(), SIMbase::getName(), SIMbase::getNoPatches(), SIMadmin::getProcessAdm(), ProcessAdm::getProcId(), utl::matrix< T >::getRow(), ProcessAdm::isParallel(), utl::vector< T >::ptr(), and utl::vector< T >::size().

◆ writeLog()

bool HDF5Writer::writeLog ( const std::string &  data,
const std::string &  name 
)
virtual

Write a log to output file.

Parameters
dataText to write
nameName of log

Implements DataWriter.

◆ writeNodalForces()

void HDF5Writer::writeNodalForces ( int  level,
const DataEntry entry 
)
virtual

Writes nodal forces to file.

Parameters
[in]levelThe time level to write the data at
[in]entryThe DataEntry describing the data to write

Implements DataWriter.

References GlbForceVec::getForce(), SIMbase::getNodeCoord(), DataWriter::m_rank, utl::vector< T >::ptr(), GlbForceVec::size(), and utl::vector< T >::size().

◆ writeSIM()

void HDF5Writer::writeSIM ( int  level,
double  time,
const DataEntry entry,
bool  geometryUpdated,
const std::string &  prefix 
)
virtual

Writes data from a SIM to file.

Parameters
[in]levelThe time level to write the data at
[in]timeCurrent time
[in]entryThe DataEntry describing the data to write
[in]geometryUpdatedWhether or not geometries should be written
[in]prefixField name prefix

If prefix is non-empty and we are asked to dump secondary solutions, we assume they come from different projections

See also
SIMbase::project

Implements DataWriter.

References utl::vector< T >::begin(), utl::matrix< T >::cols(), ProcessAdm::dd, SIMoptions::eig, DataExporter::EIGENMODES, DataExporter::ELEMENT_MASK, utl::vector< T >::empty(), ASMbase::empty(), SIMbase::evalSecondarySolution(), ASMbase::evalSolution(), SIMbase::extractPatchElmRes(), SIMbase::extractPatchSolution(), SIMbase::fieldProjections(), IntegrandBase::getField1Name(), IntegrandBase::getField2Name(), SIMbase::getLocalPatchIndex(), IntegrandBase::getMode(), SIMbase::getName(), NormBase::getName(), SIMbase::getNoBasis(), ASMbase::getNoElms(), ASMbase::getNoFields(), NormBase::getNoFields(), IntegrandBase::getNoFields(), ASMbase::getNoNodes(), SIMbase::getNoPatches(), SIMbase::getNormIntegrand(), SIMbase::getPatch(), SIMbase::getProblem(), SIMadmin::getProcessAdm(), ProcessAdm::getProcId(), utl::matrix< T >::getRow(), DataExporter::GRID, NormBase::hasElementContributions(), ASMbase::inActive(), ASMbase::isElementActive(), DomainDecomposition::isPartitioned(), DataExporter::L2G_NODE, DataWriter::m_rank, SIMbase::mixedProblem(), DataExporter::NORMS, SIMadmin::opt, DataExporter::PRIMARY, SIMoptions::project, utl::vector< T >::ptr(), DataExporter::REDUNDANT, utl::vector< T >::resize(), utl::RETAIN, utl::matrix< T >::rows(), DataExporter::SECONDARY, utl::vector< T >::size(), utl::matrixBase< T >::size(), IntegrandBase::suppressOutput(), and writeBasis().

◆ writeTimeInfo()

bool HDF5Writer::writeTimeInfo ( int  level,
double  time 
)
virtual

Writes time stepping info to file.

Parameters
[in]levelThe time level to write the info at
[in]timeCurrent time

Implements DataWriter.

References DataWriter::m_rank.

◆ writeVector()

void HDF5Writer::writeVector ( int  level,
const DataEntry entry 
)
virtual

Writes a vector to file.

Parameters
[in]levelThe time level to write the vector at
[in]entryThe DataEntry describing the vector

Implements DataWriter.

References utl::vector< T >::ptr(), DataExporter::REDUNDANT, and utl::vector< T >::size().


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