Lattice Microbes 2.5
This is for whole cell modeling
Loading...
Searching...
No Matches
lm::io::hdf5::SimulationFile Class Reference

A representation of the simulation that is used to input or output from an HDF5 file. More...

#include <SimulationFile.h>

Classes

struct  ReplicateHandles
 A handle for the different replicates that may be stored in the HDF5 file. More...

Public Member Functions

 SimulationFile (const string filename)
 Create a SimulationFile with the specified filename.
 SimulationFile (const char *filename)
 Create a SimulationFile with the specified filename.
virtual ~SimulationFile ()
 Destroy the SimulationFile.
virtual void close ()
 Close the file.
virtual void flush ()
 Flush the current buffered data to the file.
virtual string checkpoint ()
 Create the current checkpoint to the HDF5 file.
virtual map< string, string > getParameters ()
 Get all the parameters from the current replicate.
virtual string getParameter (string key, string defaultValue="")
 Get the specified parameter from the current replicate.
virtual void setParameter (string key, string value)
 Set the specified parameter to the value.
virtual void getReactionModel (lm::io::ReactionModel *reactionModel)
 Pops the reaction model from the HDF5 file.
virtual void setReactionModel (lm::io::ReactionModel *reactionModel)
 Pushes the reaction model into the HDF5 file.
virtual void getDiffusionModel (lm::io::DiffusionModel *diffusionModel)
 Pops the diffusion model from the HDF5 file.
virtual void getDiffusionModelLattice (lm::io::DiffusionModel *diffusionModel, byte *lattice, size_t latticeMaxSize, byte *latticeSites, size_t latticeSitesMaxSize)
 Pops the diffusion lattice from the HDF5 file.
virtual void getDiffusionModelLattice (lm::io::DiffusionModel *diffusionModel, lm::rdme::Lattice *lattice)
 Pops the diffusion lattice from the HDF5 file.
virtual void setDiffusionModel (lm::io::DiffusionModel *diffusionModel)
 Pushes the diffusion model into the HDF5 file.
virtual void setDiffusionModelLattice (lm::io::DiffusionModel *m, uint8_t *lattice, uint8_t *latticeSites)
 Pushes the diffusion lattice into the HDF5 file.
virtual void setDiffusionModelLattice (lm::io::DiffusionModel *m, uint32_t *lattice, uint8_t *latticeSites)
 Pushes the diffusion lattice into the HDF5 file.
virtual void setDiffusionModelLattice (lm::io::DiffusionModel *m, lm::rdme::ByteLattice *lattice)
 Pushes the diffusion lattice into the HDF5 file.
virtual void setDiffusionModelLattice (lm::io::DiffusionModel *m, lm::rdme::IntLattice *lattice)
 Pushes the diffusion lattice into the HDF5 file.
virtual void setSpatialModel (lm::io::SpatialModel *model)
 Pushes the spacial model (i.e. obstacles) into the HDF5 file.
virtual void getSpatialModel (lm::io::SpatialModel *model)
 Pops the spacial model (i.e. obstacles) from the HDF5 file.
virtual bool replicateExists (unsigned int replicate)
 Checks if the specified replicate exists.
virtual void openReplicate (unsigned int replicate)
 Opens the specified replicate for reading.
virtual void appendSpeciesCounts (unsigned int replicate, lm::io::SpeciesCounts *speciesCounts)
 Appends the species counts in the various sites into the replicate.
virtual void appendLattice (unsigned int replicate, lm::io::Lattice *lattice, byte *latticeData, size_t latticeDataSize)
 Appends the lattice to the current replicate.
virtual void appendLattice_U32LE (unsigned int replicate, lm::io::Lattice *lattice, uint32_t *latticeData, size_t latticeDataSize)
virtual void arbitraryH5 (byte *ptr)
virtual void arbitraryH5Lookup (byte *in, byte *&out, size_t &out_sz)
virtual void appendSites (unsigned int replicate, lm::io::Lattice *lattice, uint8_t *siteData, size_t siteDataSize)
virtual void appendParameterValues (unsigned int replicate, lm::io::ParameterValues *parameterValues)
 Adds all the parameter values to the replicate.
virtual void setFirstPassageTimes (unsigned int replicate, lm::io::FirstPassageTimes *speciesCounts)
 Adds all the first passage times to the replicate.
virtual vector< double > getLatticeTimes (unsigned int replicate)
 Get the timestep times for the replicate.
virtual void getLattice (unsigned int replicate, unsigned int latticeIndex, lm::rdme::Lattice *lattice)
 Get the lattice for the replicate.
virtual void closeReplicate (unsigned int replicate)
 Close the specified replicate.
virtual void closeAllReplicates ()
 Close all the replicates.
std::map< uint32_t, uintgetParticleCounts (unsigned int replicate, unsigned int latticeIndex)
std::map< double, vector< int > > getSpeciesCounts (unsigned int replicate)
vector< double > getSpeciesCountTimes (unsigned int replicate)
std::map< uint, string > getSpeciesNames ()
std::map< uint, string > getSiteTypeNames ()

Static Public Member Functions

static bool isValidFile (const string filename)
 Check that the HDF5 file is valid.
static bool isValidFile (const char *filename)
 Check that the HDF5 file is valid.
static void create (const string filename)
 Create an HDF5 file.
static void create (const char *filename)
 Create an HDF5 file.
static void create (const string filename, unsigned int numberSpecies)
 Create an HDF5 file with the specified number of species.
static void create (const char *filename, unsigned int numberSpecies)
 Create an HDF5 file with the specified number of species.
static void create (const char *filename, bool initializeModel, unsigned int numberSpecies=0)
 Create an HDF5 file and initialize the model with an optional number of species.

Static Public Attributes

static const uint MIN_VERSION = 2
static const uint CURRENT_VERSION = 4
static const uint MAX_REACTION_RATE_CONSTANTS = 10
static const uint MAX_SHAPE_PARAMETERS = 10

Protected Member Functions

void writeParticleLattice_U8LE (const char *path, uint8_t *data, unsigned int x, unsigned int y, unsigned int z, unsigned int w)
void writeParticleLattice_U32LE (hid_t handle, const char *path, unsigned int *data, unsigned int x, unsigned int y, unsigned int z, unsigned int w)
void write3DLattice_U8LE (const char *path, uint8_t *data, unsigned int x, unsigned int y, unsigned int z)
void appendToDataset (H5MetaData *header, byte *data)
void makeNewDataset (H5MetaData *header, byte *data)
void appendDsToGroup (H5MetaData *header, byte *data)
void readDataset (H5Lookup *req, byte *&data, size_t &sz)
void readAttr (H5Lookup *req, byte *&data, size_t &sz)
virtual void open ()
virtual void openGroups ()
virtual void loadParameters ()
virtual void loadModel ()
virtual ReplicateHandlesopenReplicateHandles (unsigned int replicate)
virtual ReplicateHandlescreateReplicateHandles (string replicateString)
virtual void closeReplicateHandles (ReplicateHandles *handles)

Static Protected Member Functions

static herr_t parseParameter (hid_t location_id, const char *attr_name, const H5A_info_t *ainfo, void *op_data)

Protected Attributes

string filename
hid_t file
unsigned int version
hid_t parametersGroup
hid_t modelGroup
hid_t simulationsGroup
map< string, string > parameterMap
bool modelLoaded
unsigned int numberSpecies
map< unsigned int, ReplicateHandles * > openReplicates

Detailed Description

A representation of the simulation that is used to input or output from an HDF5 file.

Constructor & Destructor Documentation

◆ SimulationFile() [1/2]

lm::io::hdf5::SimulationFile::SimulationFile ( const string filename)

Create a SimulationFile with the specified filename.

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

◆ SimulationFile() [2/2]

lm::io::hdf5::SimulationFile::SimulationFile ( const char * filename)

Create a SimulationFile with the specified filename.

Here is the call graph for this function:

◆ ~SimulationFile()

lm::io::hdf5::SimulationFile::~SimulationFile ( )
virtual

Destroy the SimulationFile.

Here is the call graph for this function:

Member Function Documentation

◆ appendDsToGroup()

void lm::io::hdf5::SimulationFile::appendDsToGroup ( H5MetaData * header,
byte * data )
protected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ appendLattice()

void lm::io::hdf5::SimulationFile::appendLattice ( unsigned int replicate,
lm::io::Lattice * lattice,
byte * latticeData,
size_t latticeDataSize )
virtual

Appends the lattice to the current replicate.

Parameters
replicateReplicate number
latticeLattice to add to replicate
latticeDataThe actual data of the lattice
latticeDataSizeThe size of the lattice
Here is the call graph for this function:

◆ appendLattice_U32LE()

void lm::io::hdf5::SimulationFile::appendLattice_U32LE ( unsigned int replicate,
lm::io::Lattice * lattice,
uint32_t * latticeData,
size_t latticeDataSize )
virtual
Here is the call graph for this function:

◆ appendParameterValues()

void lm::io::hdf5::SimulationFile::appendParameterValues ( unsigned int replicate,
lm::io::ParameterValues * parameterValues )
virtual

Adds all the parameter values to the replicate.

Parameters
replicateReplicate number
parameterValuesActual values to store
Here is the call graph for this function:

◆ appendSites()

void lm::io::hdf5::SimulationFile::appendSites ( unsigned int replicate,
lm::io::Lattice * lattice,
uint8_t * siteData,
size_t siteDataSize )
virtual
Here is the call graph for this function:

◆ appendSpeciesCounts()

void lm::io::hdf5::SimulationFile::appendSpeciesCounts ( unsigned int replicate,
lm::io::SpeciesCounts * speciesCounts )
virtual

Appends the species counts in the various sites into the replicate.

Parameters
replicateReplicate number
speciesCountsProtocol buffers object with species counts in lattice
Here is the call graph for this function:

◆ appendToDataset()

void lm::io::hdf5::SimulationFile::appendToDataset ( H5MetaData * header,
byte * data )
protected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ arbitraryH5()

void lm::io::hdf5::SimulationFile::arbitraryH5 ( byte * ptr)
virtual
Here is the call graph for this function:

◆ arbitraryH5Lookup()

void lm::io::hdf5::SimulationFile::arbitraryH5Lookup ( byte * in,
byte *& out,
size_t & out_sz )
virtual
Here is the call graph for this function:

◆ checkpoint()

string lm::io::hdf5::SimulationFile::checkpoint ( )
virtual

Create the current checkpoint to the HDF5 file.

Parameters
checkpointFilenameName of the new checkpoint file
Here is the call graph for this function:

◆ close()

void lm::io::hdf5::SimulationFile::close ( )
virtual

Close the file.

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

◆ closeAllReplicates()

void lm::io::hdf5::SimulationFile::closeAllReplicates ( )
virtual

Close all the replicates.

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

◆ closeReplicate()

void lm::io::hdf5::SimulationFile::closeReplicate ( unsigned int replicate)
virtual

Close the specified replicate.

Parameters
replicateReplicate number
Here is the call graph for this function:

◆ closeReplicateHandles()

void lm::io::hdf5::SimulationFile::closeReplicateHandles ( ReplicateHandles * handles)
protectedvirtual
Here is the caller graph for this function:

◆ create() [1/5]

void lm::io::hdf5::SimulationFile::create ( const char * filename)
static

Create an HDF5 file.

Here is the call graph for this function:

◆ create() [2/5]

void lm::io::hdf5::SimulationFile::create ( const char * filename,
bool initializeModel,
unsigned int numberSpecies = 0 )
static

Create an HDF5 file and initialize the model with an optional number of species.

◆ create() [3/5]

void lm::io::hdf5::SimulationFile::create ( const char * filename,
unsigned int numberSpecies )
static

Create an HDF5 file with the specified number of species.

Here is the call graph for this function:

◆ create() [4/5]

void lm::io::hdf5::SimulationFile::create ( const string filename)
static

Create an HDF5 file.

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

◆ create() [5/5]

void lm::io::hdf5::SimulationFile::create ( const string filename,
unsigned int numberSpecies )
static

Create an HDF5 file with the specified number of species.

Here is the call graph for this function:

◆ createReplicateHandles()

SimulationFile::ReplicateHandles * lm::io::hdf5::SimulationFile::createReplicateHandles ( string replicateString)
protectedvirtual
Here is the call graph for this function:
Here is the caller graph for this function:

◆ flush()

void lm::io::hdf5::SimulationFile::flush ( )
virtual

Flush the current buffered data to the file.

Here is the call graph for this function:

◆ getDiffusionModel()

void lm::io::hdf5::SimulationFile::getDiffusionModel ( lm::io::DiffusionModel * diffusionModel)
virtual

Pops the diffusion model from the HDF5 file.

Parameters
diffusionModelMemory at which to place the diffusionModel

◆ getDiffusionModelLattice() [1/2]

void lm::io::hdf5::SimulationFile::getDiffusionModelLattice ( lm::io::DiffusionModel * diffusionModel,
byte * lattice,
size_t latticeMaxSize,
byte * latticeSites,
size_t latticeSitesMaxSize )
virtual

Pops the diffusion lattice from the HDF5 file.

Parameters
diffusionModelMemoryfrom which to get the lattice
latticeMemory in which to place lattice
latticeMaxSizeTotal size of the lattice (i.e. number of bytes)
latticeSitesActual lattice site data in byte format
latticeSitesMaxSizeMax size of a lattice site (i.e. number of particles it can contain)

◆ getDiffusionModelLattice() [2/2]

void lm::io::hdf5::SimulationFile::getDiffusionModelLattice ( lm::io::DiffusionModel * diffusionModel,
lm::rdme::Lattice * lattice )
virtual

Pops the diffusion lattice from the HDF5 file.

Parameters
diffusionModelMemoryfrom which to get the lattice
latticeMemory at which to place the lattice
Here is the call graph for this function:

◆ getLattice()

void lm::io::hdf5::SimulationFile::getLattice ( unsigned int replicate,
unsigned int latticeIndex,
lm::rdme::Lattice * lattice )
virtual

Get the lattice for the replicate.

Parameters
replicateReplicate number
latticeIndexSeems to be unused...
latticeThe lattice object in which to store the data
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getLatticeTimes()

vector< double > lm::io::hdf5::SimulationFile::getLatticeTimes ( unsigned int replicate)
virtual

Get the timestep times for the replicate.

Parameters
replicateReplicate number
Returns
A set of timestep times
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getParameter()

string lm::io::hdf5::SimulationFile::getParameter ( string key,
string defaultValue = "" )
virtual

Get the specified parameter from the current replicate.

Here is the caller graph for this function:

◆ getParameters()

map< string, string > lm::io::hdf5::SimulationFile::getParameters ( )
virtual

Get all the parameters from the current replicate.

◆ getParticleCounts()

std::map< uint32_t, uint > lm::io::hdf5::SimulationFile::getParticleCounts ( unsigned int replicate,
unsigned int latticeIndex )
Here is the call graph for this function:

◆ getReactionModel()

void lm::io::hdf5::SimulationFile::getReactionModel ( lm::io::ReactionModel * reactionModel)
virtual

Pops the reaction model from the HDF5 file.

Parameters
reactionModelMemory at which to place the reactionModel

◆ getSiteTypeNames()

std::map< uint, string > lm::io::hdf5::SimulationFile::getSiteTypeNames ( )
Here is the call graph for this function:

◆ getSpatialModel()

void lm::io::hdf5::SimulationFile::getSpatialModel ( lm::io::SpatialModel * model)
virtual

Pops the spacial model (i.e. obstacles) from the HDF5 file.

Parameters
modelThe model in which to store the object

◆ getSpeciesCounts()

std::map< double, vector< int > > lm::io::hdf5::SimulationFile::getSpeciesCounts ( unsigned int replicate)
Here is the call graph for this function:

◆ getSpeciesCountTimes()

vector< double > lm::io::hdf5::SimulationFile::getSpeciesCountTimes ( unsigned int replicate)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSpeciesNames()

std::map< uint, string > lm::io::hdf5::SimulationFile::getSpeciesNames ( )
Here is the call graph for this function:

◆ isValidFile() [1/2]

bool lm::io::hdf5::SimulationFile::isValidFile ( const char * filename)
static

Check that the HDF5 file is valid.

Here is the call graph for this function:

◆ isValidFile() [2/2]

bool lm::io::hdf5::SimulationFile::isValidFile ( const string filename)
static

Check that the HDF5 file is valid.

Here is the caller graph for this function:

◆ loadModel()

void lm::io::hdf5::SimulationFile::loadModel ( )
protectedvirtual
Here is the caller graph for this function:

◆ loadParameters()

void lm::io::hdf5::SimulationFile::loadParameters ( )
protectedvirtual
Here is the call graph for this function:
Here is the caller graph for this function:

◆ makeNewDataset()

void lm::io::hdf5::SimulationFile::makeNewDataset ( H5MetaData * header,
byte * data )
protected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ open()

void lm::io::hdf5::SimulationFile::open ( )
protectedvirtual
Here is the call graph for this function:
Here is the caller graph for this function:

◆ openGroups()

void lm::io::hdf5::SimulationFile::openGroups ( )
protectedvirtual
Here is the caller graph for this function:

◆ openReplicate()

void lm::io::hdf5::SimulationFile::openReplicate ( unsigned int replicate)
virtual

Opens the specified replicate for reading.

Parameters
replicateReplicate number
Here is the call graph for this function:

◆ openReplicateHandles()

SimulationFile::ReplicateHandles * lm::io::hdf5::SimulationFile::openReplicateHandles ( unsigned int replicate)
protectedvirtual
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parseParameter()

herr_t lm::io::hdf5::SimulationFile::parseParameter ( hid_t location_id,
const char * attr_name,
const H5A_info_t * ainfo,
void * op_data )
staticprotected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ readAttr()

void lm::io::hdf5::SimulationFile::readAttr ( H5Lookup * req,
byte *& data,
size_t & sz )
protected
Here is the caller graph for this function:

◆ readDataset()

void lm::io::hdf5::SimulationFile::readDataset ( H5Lookup * req,
byte *& data,
size_t & sz )
protected
Here is the caller graph for this function:

◆ replicateExists()

bool lm::io::hdf5::SimulationFile::replicateExists ( unsigned int replicate)
virtual

Checks if the specified replicate exists.

Parameters
replicateReplicate number
Returns
true/false

◆ setDiffusionModel()

void lm::io::hdf5::SimulationFile::setDiffusionModel ( lm::io::DiffusionModel * diffusionModel)
virtual

Pushes the diffusion model into the HDF5 file.

Parameters
diffusionModelMemory from which to place the diffusionModel

◆ setDiffusionModelLattice() [1/4]

void lm::io::hdf5::SimulationFile::setDiffusionModelLattice ( lm::io::DiffusionModel * m,
lm::rdme::ByteLattice * lattice )
virtual

Pushes the diffusion lattice into the HDF5 file.

Parameters
diffusionModelMemory from which to get the lattice
latticeMemory from which to place the lattice
Here is the call graph for this function:

◆ setDiffusionModelLattice() [2/4]

void lm::io::hdf5::SimulationFile::setDiffusionModelLattice ( lm::io::DiffusionModel * m,
lm::rdme::IntLattice * lattice )
virtual

Pushes the diffusion lattice into the HDF5 file.

Parameters
diffusionModelMemory from which to get the lattice
latticeMemory from which to place the lattice
Here is the call graph for this function:

◆ setDiffusionModelLattice() [3/4]

void lm::io::hdf5::SimulationFile::setDiffusionModelLattice ( lm::io::DiffusionModel * m,
uint32_t * lattice,
uint8_t * latticeSites )
virtual

Pushes the diffusion lattice into the HDF5 file.

Parameters
diffusionModelMemoryfrom which to get the lattice
latticeMemory from which to place the lattice - uint32_t particle lattice
latticeSitesMemory from which to place lattice contents
Here is the call graph for this function:

◆ setDiffusionModelLattice() [4/4]

void lm::io::hdf5::SimulationFile::setDiffusionModelLattice ( lm::io::DiffusionModel * m,
uint8_t * lattice,
uint8_t * latticeSites )
virtual

Pushes the diffusion lattice into the HDF5 file.

Parameters
diffusionModelMemoryfrom which to get the lattice
latticeMemory from which to place the lattice - uint8_t particle lattice
latticeSitesMemory from which to place lattice contents
Here is the call graph for this function:

◆ setFirstPassageTimes()

void lm::io::hdf5::SimulationFile::setFirstPassageTimes ( unsigned int replicate,
lm::io::FirstPassageTimes * speciesCounts )
virtual

Adds all the first passage times to the replicate.

Parameters
replicateReplicate number
speciesCountsActual passage times to store
Here is the call graph for this function:

◆ setParameter()

void lm::io::hdf5::SimulationFile::setParameter ( string key,
string value )
virtual

Set the specified parameter to the value.

◆ setReactionModel()

void lm::io::hdf5::SimulationFile::setReactionModel ( lm::io::ReactionModel * reactionModel)
virtual

Pushes the reaction model into the HDF5 file.

Parameters
reactionModelMemory from which to place the reactionModel
Here is the caller graph for this function:

◆ setSpatialModel()

void lm::io::hdf5::SimulationFile::setSpatialModel ( lm::io::SpatialModel * model)
virtual

Pushes the spacial model (i.e. obstacles) into the HDF5 file.

Parameters
modelThe model object

◆ write3DLattice_U8LE()

void lm::io::hdf5::SimulationFile::write3DLattice_U8LE ( const char * path,
uint8_t * data,
unsigned int x,
unsigned int y,
unsigned int z )
protected
Here is the caller graph for this function:

◆ writeParticleLattice_U32LE()

void lm::io::hdf5::SimulationFile::writeParticleLattice_U32LE ( hid_t handle,
const char * path,
unsigned int * data,
unsigned int x,
unsigned int y,
unsigned int z,
unsigned int w )
protected
Here is the caller graph for this function:

◆ writeParticleLattice_U8LE()

void lm::io::hdf5::SimulationFile::writeParticleLattice_U8LE ( const char * path,
uint8_t * data,
unsigned int x,
unsigned int y,
unsigned int z,
unsigned int w )
protected
Here is the caller graph for this function:

Member Data Documentation

◆ CURRENT_VERSION

const uint lm::io::hdf5::SimulationFile::CURRENT_VERSION = 4
static

◆ file

hid_t lm::io::hdf5::SimulationFile::file
protected

◆ filename

string lm::io::hdf5::SimulationFile::filename
protected

◆ MAX_REACTION_RATE_CONSTANTS

const uint lm::io::hdf5::SimulationFile::MAX_REACTION_RATE_CONSTANTS = 10
static

◆ MAX_SHAPE_PARAMETERS

const uint lm::io::hdf5::SimulationFile::MAX_SHAPE_PARAMETERS = 10
static

◆ MIN_VERSION

const uint lm::io::hdf5::SimulationFile::MIN_VERSION = 2
static

◆ modelGroup

hid_t lm::io::hdf5::SimulationFile::modelGroup
protected

◆ modelLoaded

bool lm::io::hdf5::SimulationFile::modelLoaded
protected

◆ numberSpecies

unsigned int lm::io::hdf5::SimulationFile::numberSpecies
protected

◆ openReplicates

map<unsigned int,ReplicateHandles *> lm::io::hdf5::SimulationFile::openReplicates
protected

◆ parameterMap

map<string,string> lm::io::hdf5::SimulationFile::parameterMap
protected

◆ parametersGroup

hid_t lm::io::hdf5::SimulationFile::parametersGroup
protected

◆ simulationsGroup

hid_t lm::io::hdf5::SimulationFile::simulationsGroup
protected

◆ version

unsigned int lm::io::hdf5::SimulationFile::version
protected

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