libSplash
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
splash::DataCollector Class Referenceabstract
Inheritance diagram for splash::DataCollector:
Inheritance graph
[legend]

Classes

struct  _DCEntry
 
struct  _FileCreationAttr
 

Public Types

enum  FileAccType { FAT_CREATE, FAT_READ, FAT_READ_MERGED, FAT_WRITE }
 
typedef struct splash::DataCollector::_FileCreationAttr FileCreationAttr
 
typedef struct splash::DataCollector::_DCEntry DCEntry
 

Public Member Functions

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

Static Public Member Functions

static void initFileCreationAttr (FileCreationAttr &attr)
 

Detailed Description

Definition at line 61 of file DataCollector.hpp.

Member Typedef Documentation

◆ DCEntry

Information on a specific dataset in a HDF5 file.

◆ FileCreationAttr

Attributes passed when calling DataCollector#open

Member Enumeration Documentation

◆ FileAccType

flags for opening files

Definition at line 68 of file DataCollector.hpp.

Constructor & Destructor Documentation

◆ ~DataCollector()

virtual splash::DataCollector::~DataCollector ( )
inlinevirtual

Destructor

Definition at line 141 of file DataCollector.hpp.

Here is the call graph for this function:

Member Function Documentation

◆ append() [1/2]

virtual void splash::DataCollector::append ( int32_t  id,
const CollectionType type,
size_t  count,
const char *  name,
const void *  buf 
)
pure 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.

Implemented in splash::SerialDataCollector, and splash::IParallelDataCollector.

Here is the caller graph for this function:

◆ append() [2/2]

virtual void splash::DataCollector::append ( int32_t  id,
const CollectionType type,
size_t  count,
size_t  offset,
size_t  stride,
const char *  name,
const void *  buf 
)
pure 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.

Implemented in splash::SerialDataCollector, and splash::IParallelDataCollector.

◆ close()

virtual void splash::DataCollector::close ( )
pure virtual

Closes open files and releases internal buffers.

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

Implemented in splash::SerialDataCollector, and splash::ParallelDataCollector.

Here is the caller graph for this function:

◆ createReference() [1/2]

virtual void splash::DataCollector::createReference ( int32_t  srcID,
const char *  srcName,
int32_t  dstID,
const char *  dstName 
)
pure 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.

Implemented in splash::SerialDataCollector, and splash::ParallelDataCollector.

Here is the caller graph for this function:

◆ createReference() [2/2]

virtual void splash::DataCollector::createReference ( int32_t  srcID,
const char *  srcName,
int32_t  dstID,
const char *  dstName,
Dimensions  count,
Dimensions  offset,
Dimensions  stride 
)
pure 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.

Implemented in splash::SerialDataCollector.

◆ getEntriesForID()

virtual void splash::DataCollector::getEntriesForID ( int32_t  id,
DCEntry entries,
size_t *  count 
)
pure 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.

Implemented in splash::SerialDataCollector, and splash::ParallelDataCollector.

Here is the caller graph for this function:

◆ getEntryIDs()

virtual void splash::DataCollector::getEntryIDs ( int32_t *  ids,
size_t *  count 
)
pure 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.

Implemented in splash::SerialDataCollector, and splash::ParallelDataCollector.

Here is the caller graph for this function:

◆ getMaxID()

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

Implemented in splash::SerialDataCollector, and splash::ParallelDataCollector.

Here is the caller graph for this function:

◆ getMPISize()

virtual void splash::DataCollector::getMPISize ( Dimensions mpiSize)
pure virtual

Returns the MPI topology used for creating files.

Parameters
mpiSizeContains MPI topology.

Implemented in splash::SerialDataCollector, and splash::ParallelDataCollector.

Here is the caller graph for this function:

◆ initFileCreationAttr()

static void splash::DataCollector::initFileCreationAttr ( FileCreationAttr attr)
inlinestatic

Initializes FileCreationAttr with default values. (compression = false, access type = FAT_CREATE, position = (0, 0, 0), size = (1, 1, 1))

Parameters
attrfile attributes to initialize

Definition at line 130 of file DataCollector.hpp.

Here is the call graph for this function:

◆ open()

virtual void splash::DataCollector::open ( const char *  filename,
FileCreationAttr attr 
)
pure 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.

Implemented in splash::SerialDataCollector, and splash::ParallelDataCollector.

Here is the caller graph for this function:

◆ read() [1/2]

virtual void splash::DataCollector::read ( int32_t  id,
const char *  name,
Dimensions sizeRead,
void *  buf 
)
pure 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.

Implemented in splash::SerialDataCollector, and splash::ParallelDataCollector.

Here is the caller graph for this function:

◆ read() [2/2]

virtual void splash::DataCollector::read ( int32_t  id,
const char *  name,
const Dimensions  dstBuffer,
const Dimensions  dstOffset,
Dimensions sizeRead,
void *  buf 
)
pure 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.

Implemented in splash::SerialDataCollector, and splash::ParallelDataCollector.

◆ readAttribute()

virtual void splash::DataCollector::readAttribute ( int32_t  id,
const char *  dataName,
const char *  attrName,
void *  buf,
Dimensions mpiPosition = NULL 
)
pure 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.

Implemented in splash::SerialDataCollector, and splash::ParallelDataCollector.

Here is the caller graph for this function:

◆ readAttributeInfo()

virtual AttributeInfo splash::DataCollector::readAttributeInfo ( int32_t  id,
const char *  dataName,
const char *  attrName,
Dimensions mpiPosition = NULL 
)
pure 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.

Implemented in splash::SerialDataCollector, and splash::ParallelDataCollector.

Here is the caller graph for this function:

◆ readGlobalAttribute()

virtual void splash::DataCollector::readGlobalAttribute ( const char *  name,
void *  buf,
Dimensions mpiPosition = NULL 
)
pure 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.

Implemented in splash::SerialDataCollector, and splash::IParallelDataCollector.

Here is the caller graph for this function:

◆ readGlobalAttributeInfo()

virtual AttributeInfo splash::DataCollector::readGlobalAttributeInfo ( int32_t  id,
const char *  name,
Dimensions mpiPosition = NULL 
)
pure 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.

Implemented in splash::SerialDataCollector, and splash::ParallelDataCollector.

Here is the caller graph for this function:

◆ readMeta()

virtual CollectionType* splash::DataCollector::readMeta ( int32_t  id,
const char *  name,
const Dimensions  dstBuffer,
const Dimensions  dstOffset,
Dimensions sizeRead 
)
pure 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.

Implemented in splash::SerialDataCollector, and splash::ParallelDataCollector.

Here is the caller graph for this function:

◆ remove() [1/2]

virtual void splash::DataCollector::remove ( int32_t  id)
pure virtual

Removes a simulation iteration from the HDF5 file.

Recursively removes all datasets and attributes within the iteration.

Parameters
idID to remove.

Implemented in splash::SerialDataCollector, and splash::ParallelDataCollector.

◆ remove() [2/2]

virtual void splash::DataCollector::remove ( int32_t  id,
const char *  name 
)
pure virtual

Removes a dataset from a HDF5 file.

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

Implemented in splash::SerialDataCollector, and splash::ParallelDataCollector.

◆ write()

virtual void splash::DataCollector::write ( int32_t  id,
const CollectionType type,
uint32_t  ndims,
const Selection  select,
const char *  name,
const void *  buf 
)
pure 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.

Implemented in splash::SerialDataCollector, splash::ParallelDataCollector, and splash::IParallelDataCollector.

Here is the caller graph for this function:

◆ writeAttribute() [1/2]

virtual void splash::DataCollector::writeAttribute ( int32_t  id,
const CollectionType type,
const char *  dataName,
const char *  attrName,
const void *  buf 
)
pure 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.

Implemented in splash::SerialDataCollector, and splash::ParallelDataCollector.

Here is the caller graph for this function:

◆ writeAttribute() [2/2]

virtual void splash::DataCollector::writeAttribute ( int32_t  id,
const CollectionType type,
const char *  dataName,
const char *  attrName,
uint32_t  ndims,
const Dimensions  dims,
const void *  buf 
)
pure 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.

Implemented in splash::SerialDataCollector, and splash::ParallelDataCollector.

◆ writeGlobalAttribute() [1/2]

virtual void splash::DataCollector::writeGlobalAttribute ( const CollectionType type,
const char *  name,
const void *  buf 
)
pure virtual

Writes global attribute to HDF5 file (default group).

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

Implemented in splash::SerialDataCollector, and splash::IParallelDataCollector.

Here is the caller graph for this function:

◆ writeGlobalAttribute() [2/2]

virtual void splash::DataCollector::writeGlobalAttribute ( const CollectionType type,
const char *  name,
uint32_t  ndims,
const Dimensions  dims,
const void *  buf 
)
pure 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.

Implemented in splash::SerialDataCollector, and splash::IParallelDataCollector.


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