libSplash
Public Member Functions | List of all members
splash::SerialDataCollector Class Reference

#include <SerialDataCollector.hpp>

Inheritance diagram for splash::SerialDataCollector:
Inheritance graph
[legend]
Collaboration diagram for splash::SerialDataCollector:
Collaboration graph
[legend]

Public Member Functions

 SerialDataCollector (uint32_t maxFileHandles)
 
virtual ~SerialDataCollector ()
 
void open (const char *filename, FileCreationAttr &attr) throw (DCException)
 
void close ()
 
int32_t getMaxID ()
 
void getMPISize (Dimensions &mpiSize)
 
void getEntryIDs (int32_t *ids, size_t *count) throw (DCException)
 
void getEntriesForID (int32_t id, DCEntry *entries, size_t *count) throw (DCException)
 
void write (int32_t id, const CollectionType &type, uint32_t ndims, const Selection select, const char *name, const void *data) throw (DCException)
 
void append (int32_t id, const CollectionType &type, size_t count, const char *name, const void *data) throw (DCException)
 
void append (int32_t id, const CollectionType &type, size_t count, size_t offset, size_t striding, const char *name, const void *data) throw (DCException)
 
void remove (int32_t id) throw (DCException)
 
void remove (int32_t id, const char *name) throw (DCException)
 
void createReference (int32_t srcID, const char *srcName, int32_t dstID, const char *dstName) throw (DCException)
 
void createReference (int32_t srcID, const char *srcName, int32_t dstID, const char *dstName, Dimensions count, Dimensions offset, Dimensions stride) throw (DCException)
 
AttributeInfo readGlobalAttributeInfo (int32_t id, const char *name, Dimensions *mpiPosition=NULL) throw (DCException)
 
void readGlobalAttribute (const char *name, void *data, Dimensions *mpiPosition=NULL) throw (DCException)
 
void writeGlobalAttribute (const CollectionType &type, const char *name, const void *data) throw (DCException)
 
void writeGlobalAttribute (const CollectionType &type, const char *name, uint32_t ndims, const Dimensions dims, const void *data) throw (DCException)
 
AttributeInfo readAttributeInfo (int32_t id, const char *dataName, const char *attrName, Dimensions *mpiPosition=NULL) throw (DCException)
 
void readAttribute (int32_t id, const char *dataName, const char *attrName, void *data, Dimensions *mpiPosition=NULL) throw (DCException)
 
void writeAttribute (int32_t id, const CollectionType &type, const char *dataName, const char *attrName, const void *data) throw (DCException)
 
void writeAttribute (int32_t id, const CollectionType &type, const char *dataName, const char *attrName, uint32_t ndims, const Dimensions dims, const void *data) throw (DCException)
 
void read (int32_t id, const char *name, Dimensions &sizeRead, void *data) throw (DCException)
 
void read (int32_t id, const char *name, const Dimensions dstBuffer, const Dimensions dstOffset, Dimensions &sizeRead, void *data) throw (DCException)
 
CollectionTypereadMeta (int32_t id, const char *name, const Dimensions dstBuffer, const Dimensions dstOffset, Dimensions &sizeRead) throw (DCException)
 
- Public Member Functions inherited from splash::DataCollector
virtual ~DataCollector ()
 

Additional Inherited Members

- Public Types inherited from splash::DataCollector
enum  FileAccType { FAT_CREATE, FAT_READ, FAT_READ_MERGED, FAT_WRITE }
 
typedef struct splash::DataCollector::_FileCreationAttr FileCreationAttr
 
typedef struct splash::DataCollector::_DCEntry DCEntry
 
- Static Public Member Functions inherited from splash::DataCollector
static void initFileCreationAttr (FileCreationAttr &attr)
 

Detailed Description

Realizes a DataCollector which creates an HDF5 file for each MPI process.

See DataCollector interface for function documentation.

Definition at line 45 of file SerialDataCollector.hpp.

Constructor & Destructor Documentation

◆ SerialDataCollector()

splash::SerialDataCollector::SerialDataCollector ( uint32_t  maxFileHandles)

Constructor

Parameters
maxFileHandlesMaximum number of concurrently opened file handles (0=unlimited).

Definition at line 107 of file SerialDataCollector.cpp.

Here is the call graph for this function:

◆ ~SerialDataCollector()

splash::SerialDataCollector::~SerialDataCollector ( )
virtual

Destructor

Definition at line 134 of file SerialDataCollector.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ append() [1/2]

void splash::SerialDataCollector::append ( int32_t  id,
const CollectionType type,
size_t  count,
const char *  name,
const void *  buf 
)
throw (DCException
)
virtual

Appends 1-dimensional data in a HDF5 file.

The target dataset is created if necessary. If it already exists, data is appended to the end.

Parameters
idID for iteration.
typeType information for data.
countNumber of elements to append.
nameName for the dataset to create/append.
bufBuffer to append.

Implements splash::DataCollector.

Definition at line 552 of file SerialDataCollector.cpp.

Here is the caller graph for this function:

◆ append() [2/2]

void splash::SerialDataCollector::append ( int32_t  id,
const CollectionType type,
size_t  count,
size_t  offset,
size_t  stride,
const char *  name,
const void *  buf 
)
throw (DCException
)
virtual

Appends 1-dimensional data in a HDF5 file using striding.

The target dataset is created if necessary. If it already exists, data is appended to the end. The data is read using striding from source buffer buf.

Parameters
idid for fileentry. e.g. iteration
typeType information for data.
countNumber of elements to append.
offsetOffset in elements to start reading from in buf.
strideStriding to be used for reading from buf, 1 means 'no striding'. buf must contain at least (striding * count) elements.
nameName for the dataset to create/append.
bufBuffer to append.

Implements splash::DataCollector.

Definition at line 559 of file SerialDataCollector.cpp.

◆ close()

void splash::SerialDataCollector::close ( )
virtual

Closes open files and releases internal buffers.

Must be called by user when finished writing/reading data.

Implements splash::DataCollector.

Definition at line 167 of file SerialDataCollector.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createReference() [1/2]

void splash::SerialDataCollector::createReference ( int32_t  srcID,
const char *  srcName,
int32_t  dstID,
const char *  dstName 
)
throw (DCException
)
virtual

Creates an object reference to an existing dataset in the same HDF5 file.

Parameters
srcIDID of the iteration holding the source dataset.
srcNameName of the existing source dataset.
dstIDID of the simulation iteration holding the created reference dataset. If this group does not exist, it is created.
dstNameName of the created reference.

Implements splash::DataCollector.

Definition at line 642 of file SerialDataCollector.cpp.

◆ createReference() [2/2]

void splash::SerialDataCollector::createReference ( int32_t  srcID,
const char *  srcName,
int32_t  dstID,
const char *  dstName,
Dimensions  count,
Dimensions  offset,
Dimensions  stride 
)
throw (DCException
)
virtual

Creates a dataset region reference to an existing dataset in the same HDF5 file.

Parameters
srcIDID of the iteration holding the source dataset.
srcNameName of the existing source dataset.
dstIDID of the simulation iteration holding the created reference dataset. If this group does not exist, it is created.
dstNameName of the created reference.
countNumber of elements referenced from the source dataset.
offsetOffset in elements in the source dataset.
strideStriding in elements in the source dataset.

Implements splash::DataCollector.

Definition at line 692 of file SerialDataCollector.cpp.

◆ getEntriesForID()

void splash::SerialDataCollector::getEntriesForID ( int32_t  id,
DCEntry entries,
size_t *  count 
)
throw (DCException
)
virtual

Returns all datasets for an ID. The caller must ensure that there is enough space in entries to hold count elements.

Parameters
idID for iteration.
entriesPointer to an array with at least count elements, can be NULL.
countReturns the number of elements in entries, can be NULL.

Implements splash::DataCollector.

Definition at line 791 of file SerialDataCollector.cpp.

Here is the call graph for this function:

◆ getEntryIDs()

void splash::SerialDataCollector::getEntryIDs ( int32_t *  ids,
size_t *  count 
)
throw (DCException
)
virtual

Returns all IDs in an opened file. The caller must ensure that there is enough space in ids to hold count elements.

Parameters
idsPointer to an array with at least count entries, can be NULL.
countReturns the number of entries in ids, can be NULL.

Implements splash::DataCollector.

Definition at line 755 of file SerialDataCollector.cpp.

Here is the caller graph for this function:

◆ getMaxID()

int32_t splash::SerialDataCollector::getMaxID ( )
virtual
Returns
Returns highest iteration ID.

Implements splash::DataCollector.

Definition at line 745 of file SerialDataCollector.cpp.

◆ getMPISize()

void splash::SerialDataCollector::getMPISize ( Dimensions mpiSize)
virtual

Returns the MPI topology used for creating files.

Parameters
mpiSizeContains MPI topology.

Implements splash::DataCollector.

Definition at line 750 of file SerialDataCollector.cpp.

Here is the call graph for this function:

◆ open()

void splash::SerialDataCollector::open ( const char *  filename,
FileCreationAttr attr 
)
throw (DCException
)
virtual

Opens one or multiple files.

Parameters
filenameName of the file(s) to open (the common part without index identifiers).
attrStruct passing several parameters on how to access files.

Implements splash::DataCollector.

Definition at line 139 of file SerialDataCollector.cpp.

Here is the call graph for this function:

◆ read() [1/2]

void splash::SerialDataCollector::read ( int32_t  id,
const char *  name,
Dimensions sizeRead,
void *  buf 
)
throw (DCException
)
virtual

Reads data from HDF5 file. If data is to be read (instead of only its size in the file), the destination buffer (buf) must be allocated already.

Parameters
idID for iteration.
nameName for the dataset.
sizeReadReturns the size of the data in the file.
bufBuffer to read from file, can be NULL.

Implements splash::DataCollector.

Definition at line 480 of file SerialDataCollector.cpp.

◆ read() [2/2]

void splash::SerialDataCollector::read ( int32_t  id,
const char *  name,
const Dimensions  dstBuffer,
const Dimensions  dstOffset,
Dimensions sizeRead,
void *  buf 
)
throw (DCException
)
virtual

Reads data from HDF5 file. If data is to be read (instead of only its size in the file), the destination buffer (buf) must be allocated already.

Parameters
idID for iteration.
nameName for the dataset.
dstBufferSize of the buffer buf to read to.
dstOffsetOffset in destination buffer to read to.
sizeReadReturns the size of the data in the file.
bufBuffer to read from file, can be NULL.

Implements splash::DataCollector.

Definition at line 489 of file SerialDataCollector.cpp.

◆ readAttribute()

void splash::SerialDataCollector::readAttribute ( int32_t  id,
const char *  dataName,
const char *  attrName,
void *  buf,
Dimensions mpiPosition = NULL 
)
throw (DCException
)
virtual

Reads an attribute from a single dataset.

Parameters
idID for iteration.
dataNameName of the dataset in group id to read attribute from. If dataName is NULL, the attribute is read from the iteration group.
attrNameName of the attribute.
bufBuffer to read attribute to.
mpiPositionPointer to Dimensions class. Identifies MPI-position-specific file while in FAT_READ_MERGED mode. Use NULL to read from default file index.

Implements splash::DataCollector.

Definition at line 370 of file SerialDataCollector.cpp.

◆ readAttributeInfo()

AttributeInfo splash::SerialDataCollector::readAttributeInfo ( int32_t  id,
const char *  dataName,
const char *  attrName,
Dimensions mpiPosition = NULL 
)
throw (DCException
)
virtual

Reads attribute meta data from a single dataset.

Parameters
idID for iteration.
dataNameName of the dataset in group id to read attribute from. If dataName is NULL, the attribute is read from the iteration group.
attrNameName of the attribute.
mpiPositionPointer to Dimensions class. Identifies MPI-position-specific file while in FAT_READ_MERGED mode. Use NULL to read from default file index.
Returns
Pointer to heap allocated DCAttributeInfo instance or NULL if not found. Must be freed by the caller.

Implements splash::DataCollector.

Definition at line 347 of file SerialDataCollector.cpp.

Here is the caller graph for this function:

◆ readGlobalAttribute()

void splash::SerialDataCollector::readGlobalAttribute ( const char *  name,
void *  buf,
Dimensions mpiPosition = NULL 
)
throw (DCException
)
virtual

Reads global attribute from HDF5 file.

Parameters
nameName for the attribute.
bufBuffer to read attribute to.
mpiPositionPointer to Dimensions class. Identifies MPI-position-specific custom group. Use NULL to read from default group.

Implements splash::DataCollector.

Definition at line 287 of file SerialDataCollector.cpp.

◆ readGlobalAttributeInfo()

AttributeInfo splash::SerialDataCollector::readGlobalAttributeInfo ( int32_t  id,
const char *  name,
Dimensions mpiPosition = NULL 
)
throw (DCException
)
virtual

Reads global attribute meta information from HDF5 file.

Parameters
idID for iteration.
nameName for the attribute.
mpiPositionPointer to Dimensions class. Identifies MPI-position-specific custom group. Use NULL to read from default group.
Returns
Pointer to heap allocated DCAttributeInfo instance or NULL if not found. Must be freed by the caller.

Implements splash::DataCollector.

Definition at line 271 of file SerialDataCollector.cpp.

◆ readMeta()

CollectionType * splash::SerialDataCollector::readMeta ( int32_t  id,
const char *  name,
const Dimensions  dstBuffer,
const Dimensions  dstOffset,
Dimensions sizeRead 
)
throw (DCException
)
virtual

Reads meta data from HDF5 file.

Parameters
idID of iteration.
nameName of the dataset.
dstBufferSize of the dataset.
dstOffsetOffset in destination dataset.
sizeReadReturns the size of the data in the file.
Returns
The CollectionType of the dataset as a heap allocated object. The object must be freed by the caller at the end of the object's lifetime.

Implements splash::DataCollector.

Definition at line 505 of file SerialDataCollector.cpp.

◆ remove() [1/2]

void splash::SerialDataCollector::remove ( int32_t  id)
throw (DCException
)
virtual

Removes a simulation iteration from the HDF5 file.

Recursively removes all datasets and attributes within the iteration.

Parameters
idID to remove.

Implements splash::DataCollector.

Definition at line 589 of file SerialDataCollector.cpp.

Here is the call graph for this function:

◆ remove() [2/2]

void splash::SerialDataCollector::remove ( int32_t  id,
const char *  name 
)
throw (DCException
)
virtual

Removes a dataset from a HDF5 file.

Parameters
idID holding the dataset to be removed.
nameName of the dataset to be removed.

Implements splash::DataCollector.

Definition at line 618 of file SerialDataCollector.cpp.

Here is the call graph for this function:

◆ write()

void splash::SerialDataCollector::write ( int32_t  id,
const CollectionType type,
uint32_t  ndims,
const Selection  select,
const char *  name,
const void *  buf 
)
throw (DCException
)
virtual

Writes data to HDF5 file.

Parameters
idID for iteration.
typeType information for data.
ndimsNumber of dimensions (1-3).
selectSelection in src buffer
nameName for the dataset.
bufBuffer for writing.

Implements splash::DataCollector.

Definition at line 520 of file SerialDataCollector.cpp.

Here is the caller graph for this function:

◆ writeAttribute() [1/2]

void splash::SerialDataCollector::writeAttribute ( int32_t  id,
const CollectionType type,
const char *  dataName,
const char *  attrName,
const void *  buf 
)
throw (DCException
)
virtual

Writes an attribute to a single dataset.

Parameters
idID for iteration.
typeType information for data.
dataNameName of the dataset in group id to write attribute to. If dataName is NULL, the attribute is written for the iteration group. If the path dataName does not yet exist, missing groups will be created.
attrNameName of the attribute.
bufBuffer to be written as attribute.

Implements splash::DataCollector.

Definition at line 394 of file SerialDataCollector.cpp.

◆ writeAttribute() [2/2]

void splash::SerialDataCollector::writeAttribute ( int32_t  id,
const CollectionType type,
const char *  dataName,
const char *  attrName,
uint32_t  ndims,
const Dimensions  dims,
const void *  buf 
)
throw (DCException
)
virtual

Writes an attribute to a single dataset.

Parameters
idID for iteration.
typeType information for data.
dataNameName of the dataset in group id to write attribute to. If dataName is NULL, the attribute is written for the iteration group.
attrNameName of the attribute.
ndimsNumber of dimensions (1-3)
dimsNumber of elements
bufBuffer to be written as attribute.

Implements splash::DataCollector.

Definition at line 406 of file SerialDataCollector.cpp.

◆ writeGlobalAttribute() [1/2]

void splash::SerialDataCollector::writeGlobalAttribute ( const CollectionType type,
const char *  name,
const void *  buf 
)
throw (DCException
)
virtual

Writes global attribute to HDF5 file (default group).

Parameters
typeType information for data.
nameName of the attribute.
bufBuffer to be written as attribute.

Implements splash::DataCollector.

Definition at line 309 of file SerialDataCollector.cpp.

◆ writeGlobalAttribute() [2/2]

void splash::SerialDataCollector::writeGlobalAttribute ( const CollectionType type,
const char *  name,
uint32_t  ndims,
const Dimensions  dims,
const void *  buf 
)
throw (DCException
)
virtual

Writes global attribute to HDF5 file (default group).

Parameters
typeType information for data.
nameName of the attribute.
ndimsNumber of dimensions (1-3)
dimsNumber of elements
bufBuffer to be written as attribute.

Implements splash::DataCollector.

Definition at line 318 of file SerialDataCollector.cpp.


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