Cantera  3.1.0a1
Loading...
Searching...
No Matches
Storage Class Reference

A wrapper class handling storage to HDF. More...

#include <Storage.h>

Detailed Description

A wrapper class handling storage to HDF.

Acts as a thin wrapper for HighFive. The class implements methods that are intended to be called from SolutionArray.

Since
New in Cantera 3.0.
Warning
This class is an experimental part of the Cantera API and may be changed or removed without notice.

Definition at line 38 of file Storage.h.

Public Member Functions

 Storage (string fname, bool write)
 
void setCompressionLevel (int level)
 Set compression level (0..9)
 
bool hasGroup (const string &id) const
 Check whether location id represents a group.
 
bool checkGroup (const string &id, bool permissive=false)
 Check whether path location exists.
 
void deleteGroup (const string &id)
 Delete group.
 
pair< size_t, set< string > > contents (const string &id) const
 Retrieve contents of file from a specified location.
 
bool hasAttribute (const string &id, const string &attr) const
 Read attributes from a specified location.
 
AnyMap readAttributes (const string &id, bool recursive) const
 Read attributes from a specified location.
 
void writeAttributes (const string &id, const AnyMap &meta)
 Write attributes to a specified location.
 
AnyValue readData (const string &id, const string &name, size_t rows, size_t cols=npos) const
 Read dataset from a specified location.
 
void writeData (const string &id, const string &name, const AnyValue &data)
 Write dataset to a specified location.
 

Constructor & Destructor Documentation

◆ Storage()

Storage ( string  fname,
bool  write 
)

Definition at line 575 of file Storage.cpp.

◆ ~Storage()

~Storage ( )

Definition at line 581 of file Storage.cpp.

Member Function Documentation

◆ setCompressionLevel()

void setCompressionLevel ( int  level)

Set compression level (0..9)

Compression is only applied to matrix-type data; note that compression may increase file size for small data sets (compression requires setting of chunk sizes, which involves considerable overhead for metadata).

Definition at line 585 of file Storage.cpp.

◆ hasGroup()

bool hasGroup ( const string &  id) const

Check whether location id represents a group.

Definition at line 591 of file Storage.cpp.

◆ checkGroup()

bool checkGroup ( const string &  id,
bool  permissive = false 
)

Check whether path location exists.

If the location does not exist, an exception is thrown unless the permissive flag is set; in this case, the method attempts to create a new location if the file is accessed in write mode.

Parameters
idstorage location within file
permissiveif true, do not raise exceptions (default=false)
Returns
boolean indicating whether id is pre-existing

Definition at line 597 of file Storage.cpp.

◆ deleteGroup()

void deleteGroup ( const string &  id)

Delete group.

Parameters
idstorage location within file

Definition at line 603 of file Storage.cpp.

◆ contents()

pair< size_t, set< string > > contents ( const string &  id) const

Retrieve contents of file from a specified location.

Parameters
idstorage location within file
Returns
pair containing size and list of entry names of stored data set

Definition at line 609 of file Storage.cpp.

◆ hasAttribute()

bool hasAttribute ( const string &  id,
const string &  attr 
) const

Read attributes from a specified location.

Parameters
idstorage location within file
attrname of attribute to be checked

Definition at line 615 of file Storage.cpp.

◆ readAttributes()

AnyMap readAttributes ( const string &  id,
bool  recursive 
) const

Read attributes from a specified location.

Parameters
idstorage location within file
recursiveboolean indicating whether subgroups should be included
Returns
AnyMap containing attributes

Definition at line 621 of file Storage.cpp.

◆ writeAttributes()

void writeAttributes ( const string &  id,
const AnyMap meta 
)

Write attributes to a specified location.

Parameters
idstorage location within file
metaAnyMap containing attributes

Definition at line 627 of file Storage.cpp.

◆ readData()

AnyValue readData ( const string &  id,
const string &  name,
size_t  rows,
size_t  cols = npos 
) const

Read dataset from a specified location.

Parameters
idstorage location within file
namename of vector/matrix entry
rowsnumber of vector length or matrix rows
colsnumber of matrix columns, if applicable; if 0, a vector is expected, if npos, the size is detected automatically; otherwise, an exact number of columns needs to be matched.
Returns
matrix or vector containing data; implemented for types vector<double>, vector<long int>, vector<string>, vector<vector<double>>, vector<vector<long int>> and vector<vector<string>>

Definition at line 633 of file Storage.cpp.

◆ writeData()

void writeData ( const string &  id,
const string &  name,
const AnyValue data 
)

Write dataset to a specified location.

Parameters
idstorage location within file
namename of matrix entry
datavector or matrix containing data; implemented for types vector<double>, vector<long int>, vector<string> vector<vector<double>>, vector<vector<long int>> and vector<vector<string>>

Definition at line 640 of file Storage.cpp.


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