libROM  v1.0
Data-driven physical simulation library
 All Classes Functions Variables Enumerations
Public Types | Public Member Functions | List of all members
CAROM::Database Class Referenceabstract

#include <Database.h>

Inheritance diagram for CAROM::Database:
CAROM::HDFDatabase

Public Types

enum  formats { HDF5 }
 Implemented database file formats. Add to this enum each time a new database format is implemented.
 

Public Member Functions

 Database ()
 Default constructor.
 
virtual ~Database ()
 Destructor.
 
virtual bool create (const std::string &file_name)=0
 Creates a new database file with the supplied name. More...
 
virtual bool open (const std::string &file_name, const std::string &type)=0
 Opens an existing database file with the supplied name. More...
 
virtual bool close ()=0
 Closes the currently open database file. More...
 
void putInteger (const std::string &key, int data)
 Writes an integer associated with the supplied key to currently open database file. More...
 
virtual void putIntegerArray (const std::string &key, const int *const data, int nelements)=0
 Writes an array of integers associated with the supplied key to the currently open database file. More...
 
void putDouble (const std::string &key, double data)
 Writes a double associated with the supplied key to currently open database file. More...
 
virtual void putDoubleArray (const std::string &key, const double *const data, int nelements)=0
 Writes an array of doubles associated with the supplied key to the currently open database file. More...
 
void getInteger (const std::string &key, int &data)
 Reads an integer associated with the supplied key from the currently open database file. More...
 
virtual void getIntegerArray (const std::string &key, int *data, int nelements)=0
 Reads an array of integers associated with the supplied key from the currently open database file. More...
 
void getDouble (const std::string &key, double &data)
 Reads a double associated with the supplied key from the currently open database file. More...
 
virtual void getDoubleArray (const std::string &key, double *data, int nelements)=0
 Reads an array of doubles associated with the supplied key from the currently open database file. More...
 
virtual void getDoubleArray (const std::string &key, double *data, int nelements, int block_size, int stride)=0
 Reads an array of doubles associated with the supplied key from the currently open database file. More...
 

Detailed Description

Class Database is an abstract base class that provides basic ability to write to and read from a file. It's capabilities are limited to what the SVD algorithm needs to read and write its basis vectors.

Member Function Documentation

virtual bool CAROM::Database::close ( )
pure virtual

Closes the currently open database file.

Returns
True if the file close was successful.

Implemented in CAROM::HDFDatabase.

virtual bool CAROM::Database::create ( const std::string &  file_name)
pure virtual

Creates a new database file with the supplied name.

Parameters
[in]file_nameName of database file to create.
Returns
True if file create was successful.

Implemented in CAROM::HDFDatabase.

void CAROM::Database::getDouble ( const std::string &  key,
double &  data 
)
inline

Reads a double associated with the supplied key from the currently open database file.

Parameters
[in]keyThe key associated with the value to be read.
[out]dataThe double value read.
virtual void CAROM::Database::getDoubleArray ( const std::string &  key,
double *  data,
int  nelements 
)
pure virtual

Reads an array of doubles associated with the supplied key from the currently open database file.

Parameters
[in]keyThe key associated with the array of values to be read.
[out]dataThe allocated array of double values to be read.
[in]nelementsThe number of doubles in the array.

Implemented in CAROM::HDFDatabase.

virtual void CAROM::Database::getDoubleArray ( const std::string &  key,
double *  data,
int  nelements,
int  block_size,
int  stride 
)
pure virtual

Reads an array of doubles associated with the supplied key from the currently open database file.

Parameters
[in]keyThe key associated with the array of values to be read.
[out]dataThe allocated array of double values to be read.
[in]nelementsThe number of doubles in the array.
[in]block_sizeThe block size to read from the HDF5 dataset.
[in]strideThe stride to read from the HDF5 dataset.

Implemented in CAROM::HDFDatabase.

void CAROM::Database::getInteger ( const std::string &  key,
int &  data 
)
inline

Reads an integer associated with the supplied key from the currently open database file.

Parameters
[in]keyThe key associated with the value to be read.
[out]dataThe integer value read.
virtual void CAROM::Database::getIntegerArray ( const std::string &  key,
int *  data,
int  nelements 
)
pure virtual

Reads an array of integers associated with the supplied key from the currently open database file.

Parameters
[in]keyThe key associated with the array of values to be read.
[out]dataThe allocated array of integer values to be read.
[in]nelementsThe number of integers in the array.

Implemented in CAROM::HDFDatabase.

virtual bool CAROM::Database::open ( const std::string &  file_name,
const std::string &  type 
)
pure virtual

Opens an existing database file with the supplied name.

Parameters
[in]file_nameName of existing database file to open.
[in]typeRead/write type ("r"/"wr")
Returns
True if file open was successful.

Implemented in CAROM::HDFDatabase.

void CAROM::Database::putDouble ( const std::string &  key,
double  data 
)
inline

Writes a double associated with the supplied key to currently open database file.

Parameters
[in]keyThe key associated with the value to be written.
[in]dataThe double value to be written.
virtual void CAROM::Database::putDoubleArray ( const std::string &  key,
const double *const  data,
int  nelements 
)
pure virtual

Writes an array of doubles associated with the supplied key to the currently open database file.

Parameters
[in]keyThe key associated with the array of values to be written.
[in]dataThe array of double values to be written.
[in]nelementsThe number of doubles in the array.

Implemented in CAROM::HDFDatabase.

void CAROM::Database::putInteger ( const std::string &  key,
int  data 
)
inline

Writes an integer associated with the supplied key to currently open database file.

Parameters
[in]keyThe key associated with the value to be written.
[in]dataThe integer value to be written.
virtual void CAROM::Database::putIntegerArray ( const std::string &  key,
const int *const  data,
int  nelements 
)
pure virtual

Writes an array of integers associated with the supplied key to the currently open database file.

Parameters
[in]keyThe key associated with the array of values to be written.
[in]dataThe array of integer values to be written.
[in]nelementsThe number of integers in the array.

Implemented in CAROM::HDFDatabase.


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