IBAMR  IBAMR version 0.19.
Classes | Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
SAMRAI::tbox::MemoryDatabase Class Reference

#include <tbox/MemoryDatabase.h>

Inheritance diagram for SAMRAI::tbox::MemoryDatabase:
Inheritance graph
[legend]

Classes

struct  KeyData
 

Public Types

enum  DataType {
  SAMRAI_INVALID, SAMRAI_DATABASE, SAMRAI_BOOL, SAMRAI_CHAR,
  SAMRAI_INT, SAMRAI_COMPLEX, SAMRAI_DOUBLE, SAMRAI_FLOAT,
  SAMRAI_STRING, SAMRAI_BOX
}
 

Public Member Functions

 MemoryDatabase (const std::string &name)
 
virtual ~MemoryDatabase ()
 
virtual bool create (const std::string &name)
 
virtual bool open (const std::string &name)
 
virtual bool close ()
 
virtual std::string getName () const
 
virtual bool keyExists (const std::string &key)
 
virtual Array< std::string > getAllKeys ()
 
virtual enum DataType getArrayType (const std::string &key)
 Return the type of data associated with the key. More...
 
virtual int getArraySize (const std::string &key)
 
virtual bool isDatabase (const std::string &key)
 
virtual Pointer< DatabaseputDatabase (const std::string &key)
 
virtual Pointer< DatabasegetDatabase (const std::string &key)
 
virtual bool isBool (const std::string &key)
 
virtual void putBool (const std::string &key, const bool &data)
 
virtual void putBoolArray (const std::string &key, const Array< bool > &data)
 
virtual void putBoolArray (const std::string &key, const bool *const data, const int nelements)
 
virtual bool getBool (const std::string &key)
 
virtual bool getBoolWithDefault (const std::string &key, const bool &defaultvalue)
 
virtual Array< boolgetBoolArray (const std::string &key)
 
virtual void getBoolArray (const std::string &key, bool *data, const int nelements)
 
virtual bool isDatabaseBox (const std::string &key)
 
virtual void putDatabaseBox (const std::string &key, const DatabaseBox &data)
 
virtual void putDatabaseBoxArray (const std::string &key, const Array< DatabaseBox > &data)
 
virtual void putDatabaseBoxArray (const std::string &key, const DatabaseBox *const data, const int nelements)
 
virtual DatabaseBox getDatabaseBox (const std::string &key)
 
virtual DatabaseBox getDatabaseBoxWithDefault (const std::string &key, const DatabaseBox &defaultvalue)
 
virtual Array< DatabaseBoxgetDatabaseBoxArray (const std::string &key)
 
virtual void getDatabaseBoxArray (const std::string &key, DatabaseBox *data, const int nelements)
 
virtual bool isChar (const std::string &key)
 
virtual void putChar (const std::string &key, const char &data)
 
virtual void putCharArray (const std::string &key, const Array< char > &data)
 
virtual void putCharArray (const std::string &key, const char *const data, const int nelements)
 
virtual char getChar (const std::string &key)
 
virtual char getCharWithDefault (const std::string &key, const char &defaultvalue)
 
virtual Array< char > getCharArray (const std::string &key)
 
virtual void getCharArray (const std::string &key, char *data, const int nelements)
 
virtual bool isComplex (const std::string &key)
 
virtual void putComplex (const std::string &key, const dcomplex &data)
 
virtual void putComplexArray (const std::string &key, const Array< dcomplex > &data)
 
virtual void putComplexArray (const std::string &key, const dcomplex *const data, const int nelements)
 
virtual dcomplex getComplex (const std::string &key)
 
virtual dcomplex getComplexWithDefault (const std::string &key, const dcomplex &defaultvalue)
 
virtual Array< dcomplexgetComplexArray (const std::string &key)
 
virtual void getComplexArray (const std::string &key, dcomplex *data, const int nelements)
 
virtual bool isDouble (const std::string &key)
 
virtual void putDouble (const std::string &key, const double &data)
 
virtual void putDoubleArray (const std::string &key, const Array< double > &data)
 
virtual void putDoubleArray (const std::string &key, const double *const data, const int nelements)
 
virtual double getDouble (const std::string &key)
 
virtual double getDoubleWithDefault (const std::string &key, const double &defaultvalue)
 
virtual Array< doublegetDoubleArray (const std::string &key)
 
virtual void getDoubleArray (const std::string &key, double *data, const int nelements)
 
virtual bool isFloat (const std::string &key)
 
virtual void putFloat (const std::string &key, const float &data)
 
virtual void putFloatArray (const std::string &key, const Array< float > &data)
 
virtual void putFloatArray (const std::string &key, const float *const data, const int nelements)
 
virtual float getFloat (const std::string &key)
 
virtual float getFloatWithDefault (const std::string &key, const float &defaultvalue)
 
virtual Array< float > getFloatArray (const std::string &key)
 
virtual void getFloatArray (const std::string &key, float *data, const int nelements)
 
virtual bool isInteger (const std::string &key)
 
virtual void putInteger (const std::string &key, const int &data)
 
virtual void putIntegerArray (const std::string &key, const Array< int > &data)
 
virtual void putIntegerArray (const std::string &key, const int *const data, const int nelements)
 
virtual int getInteger (const std::string &key)
 
virtual int getIntegerWithDefault (const std::string &key, const int &defaultvalue)
 
virtual Array< intgetIntegerArray (const std::string &key)
 
virtual void getIntegerArray (const std::string &key, int *data, const int nelements)
 
virtual bool isString (const std::string &key)
 
virtual void putString (const std::string &key, const std::string &data)
 
virtual void putStringArray (const std::string &key, const Array< std::string > &data)
 
virtual void putStringArray (const std::string &key, const std::string *const data, const int nelements)
 
virtual std::string getString (const std::string &key)
 
virtual std::string getStringWithDefault (const std::string &key, const std::string &defaultvalue)
 
virtual Array< std::string > getStringArray (const std::string &key)
 
virtual void getStringArray (const std::string &key, std::string *data, const int nelements)
 
virtual std::string getName ()
 Returns the name of this database.
More...
 
bool keyAccessed (const std::string &key)
 
virtual void printClassData (std::ostream &os=pout)
 
void printUnusedKeys (std::ostream &os=pout) const
 
void printDefaultKeys (std::ostream &os=pout) const
 
void getScalar (const std::string &key, bool &scalar)
 
void getScalar (const std::string &key, char &scalar)
 
void getScalar (const std::string &key, dcomplex &scalar)
 
void getScalar (const std::string &key, float &scalar)
 
void getScalar (const std::string &key, double &scalar)
 
void getScalar (const std::string &key, int &scalar)
 
void putScalar (const std::string &key, const bool scalar)
 
void putScalar (const std::string &key, const char scalar)
 
void putScalar (const std::string &key, const dcomplex scalar)
 
void putScalar (const std::string &key, const float scalar)
 
void putScalar (const std::string &key, const double scalar)
 
void putScalar (const std::string &key, const int scalar)
 
void getArray (const std::string &key, Array< bool > &array)
 
void getArray (const std::string &key, Array< char > &array)
 
void getArray (const std::string &key, Array< dcomplex > &array)
 
void getArray (const std::string &key, Array< float > &array)
 
void getArray (const std::string &key, Array< double > &array)
 
void getArray (const std::string &key, Array< int > &array)
 
void putArray (const std::string &key, const Array< bool > array)
 
void putArray (const std::string &key, const Array< char > array)
 
void putArray (const std::string &key, const Array< dcomplex > array)
 
void putArray (const std::string &key, const Array< float > array)
 
void putArray (const std::string &key, const Array< double > array)
 
void putArray (const std::string &key, const Array< int > array)
 

Private Member Functions

 MemoryDatabase (const MemoryDatabase &)
 
void operator= (const MemoryDatabase &)
 
bool deleteKeyIfFound (const std::string &key)
 
KeyDatafindKeyData (const std::string &key)
 
KeyDatafindKeyDataOrExit (const std::string &key)
 
void printDatabase (std::ostream &os, const int indent, const int toprint) const
 

Static Private Member Functions

static void indentStream (std::ostream &os, const int indent)
 

Private Attributes

std::string d_database_name
 
List< KeyDatad_keyvalues
 

Detailed Description

Class MemoryDatabase stores (key,value) pairs in a hierarchical database. Each value may be another database, boolean, box, character, complex, double, float, integer, or string. Note that boxes are stored using the toolbox box class that can store boxes of any dimension in the same data structure.

See the Database class documentation for a description of the generic database interface.

The memory database is used for storing input (a "deck") in memory; the derived class InputDatabase use for this purpose; InputDatabase is kept around for historical reasons and the name is a bit more clear than "memory" database but this class is very generic. The Parser is really the class that process the input; it parses the input file into a database.

Note that the memory database will attempt to promote numerical types where appropriate. The promotion chain is int -> float -> double -> complex. For example, an integer key will be promoted to a complex value if isComplex() or getComplex() is called. Double values will also be truncated to floats (with loss of information) if a float call is made on a double value.

It is assumed that all processors will access the database in the same manner. Thus, all error messages are output to pout instead of perr.

Member Enumeration Documentation

◆ DataType

Enumerated type indicating what type of values is stored in a database entry. Returned from getType() method.

Note: The SAMRAI_ prefix is needed since some poorly written packages do "#define CHAR" etc.

Enumerator
SAMRAI_INVALID 
SAMRAI_DATABASE 
SAMRAI_BOOL 
SAMRAI_CHAR 
SAMRAI_INT 
SAMRAI_COMPLEX 
SAMRAI_DOUBLE 
SAMRAI_FLOAT 
SAMRAI_STRING 
SAMRAI_BOX 

Constructor & Destructor Documentation

◆ MemoryDatabase() [1/2]

SAMRAI::tbox::MemoryDatabase::MemoryDatabase ( const std::string &  name)

The memory database constructor creates an empty database with the specified name.

◆ ~MemoryDatabase()

virtual SAMRAI::tbox::MemoryDatabase::~MemoryDatabase ( )
virtual

The memory database destructor deallocates the data in the database.

◆ MemoryDatabase() [2/2]

SAMRAI::tbox::MemoryDatabase::MemoryDatabase ( const MemoryDatabase )
private

Member Function Documentation

◆ create()

virtual bool SAMRAI::tbox::MemoryDatabase::create ( const std::string &  name)
virtual

Create a new database file.

Returns true if successful.

Parameters
namename of database. Normally a filename.

Implements SAMRAI::tbox::Database.

◆ open()

virtual bool SAMRAI::tbox::MemoryDatabase::open ( const std::string &  name)
virtual

Open an existing database file.

Returns true if successful.

Parameters
namename of database. Normally a filename.

Implements SAMRAI::tbox::Database.

◆ close()

virtual bool SAMRAI::tbox::MemoryDatabase::close ( )
virtual

Close the database.

Returns true if successful.

If the database is currently open then close it. This should flush all data to the file (if the database is on disk).

Implements SAMRAI::tbox::Database.

◆ getName() [1/2]

virtual std::string SAMRAI::tbox::MemoryDatabase::getName ( ) const
virtual

Return string name of memory database object.

◆ keyExists()

virtual bool SAMRAI::tbox::MemoryDatabase::keyExists ( const std::string &  key)
virtual

Return true if the specified key exists in the database and false otherwise.

Implements SAMRAI::tbox::Database.

◆ getAllKeys()

virtual Array<std::string> SAMRAI::tbox::MemoryDatabase::getAllKeys ( )
virtual

Return all keys in the database.

Implements SAMRAI::tbox::Database.

◆ getArrayType()

virtual enum DataType SAMRAI::tbox::MemoryDatabase::getArrayType ( const std::string &  key)
virtual

If the key does not exist, then INVALID is returned

Parameters
keyKey name in database.

Implements SAMRAI::tbox::Database.

◆ getArraySize()

virtual int SAMRAI::tbox::MemoryDatabase::getArraySize ( const std::string &  key)
virtual

Return the size of the array associated with the key. If the key does not exist, then zero is returned.

Implements SAMRAI::tbox::Database.

◆ isDatabase()

virtual bool SAMRAI::tbox::MemoryDatabase::isDatabase ( const std::string &  key)
virtual

Return whether the specified key represents a database entry. If the key does not exist, then false is returned.

Implements SAMRAI::tbox::Database.

◆ putDatabase()

virtual Pointer<Database> SAMRAI::tbox::MemoryDatabase::putDatabase ( const std::string &  key)
virtual

Create a new database with the specified key name. If the key already exists in the database, then the old key record is deleted and the new one is silently created in its place.

Implements SAMRAI::tbox::Database.

◆ getDatabase()

virtual Pointer<Database> SAMRAI::tbox::MemoryDatabase::getDatabase ( const std::string &  key)
virtual

Get the database with the specified key name. If the specified key does not exist in the database or it is not a database, then an error message is printed and the program exits.

Implements SAMRAI::tbox::Database.

◆ isBool()

virtual bool SAMRAI::tbox::MemoryDatabase::isBool ( const std::string &  key)
virtual

Return whether the specified key represents a boolean entry. If the key does not exist, then false is returned.

Implements SAMRAI::tbox::Database.

◆ putBool()

virtual void SAMRAI::tbox::MemoryDatabase::putBool ( const std::string &  key,
const bool data 
)
virtual

Create a boolean scalar entry in the database with the specified key name. If the key already exists in the database, then the old key record is deleted and the new one is silently created in its place.

Reimplemented from SAMRAI::tbox::Database.

◆ putBoolArray() [1/2]

virtual void SAMRAI::tbox::MemoryDatabase::putBoolArray ( const std::string &  key,
const Array< bool > &  data 
)
virtual

Create a boolean array entry in the database with the specified key name. If the key already exists in the database, then the old key record is deleted and the new one is silently created in its place.

Reimplemented from SAMRAI::tbox::Database.

◆ putBoolArray() [2/2]

virtual void SAMRAI::tbox::MemoryDatabase::putBoolArray ( const std::string &  key,
const bool *const  data,
const int  nelements 
)
virtual

Create a boolean array entry in the database with the specified key name. If the key already exists in the database, then the old key record is deleted and the new one is silently created in its place.

Implements SAMRAI::tbox::Database.

◆ getBool()

virtual bool SAMRAI::tbox::MemoryDatabase::getBool ( const std::string &  key)
virtual

Get a boolean entry in the database with the specified key name. If the specified key does not exist in the database or is not a boolean scalar, then an error message is printed and the program exits.

Reimplemented from SAMRAI::tbox::Database.

◆ getBoolWithDefault()

virtual bool SAMRAI::tbox::MemoryDatabase::getBoolWithDefault ( const std::string &  key,
const bool defaultvalue 
)
virtual

Get a boolean entry in the database with the specified key name. If the specified key does not exist in the database, then the default value is returned. If the key exists but is not a boolean scalar, then an error message is printed and the program exits.

Reimplemented from SAMRAI::tbox::Database.

◆ getBoolArray() [1/2]

virtual Array<bool> SAMRAI::tbox::MemoryDatabase::getBoolArray ( const std::string &  key)
virtual

Get a boolean entry from the database with the specified key name. If the specified key does not exist in the database or is not a boolean array, then an error message is printed and the program exits.

Implements SAMRAI::tbox::Database.

◆ getBoolArray() [2/2]

virtual void SAMRAI::tbox::MemoryDatabase::getBoolArray ( const std::string &  key,
bool data,
const int  nelements 
)
virtual

Get a boolean entry from the database with the specified key name. If the specified key does not exist in the database or is not a boolean array, then an error message is printed and the program exits. The specified number of elements must match exactly the number of elements in the array in the database.

Reimplemented from SAMRAI::tbox::Database.

◆ isDatabaseBox()

virtual bool SAMRAI::tbox::MemoryDatabase::isDatabaseBox ( const std::string &  key)
virtual

Return whether the specified key represents a box entry. If the key does not exist, then false is returned.

Implements SAMRAI::tbox::Database.

◆ putDatabaseBox()

virtual void SAMRAI::tbox::MemoryDatabase::putDatabaseBox ( const std::string &  key,
const DatabaseBox data 
)
virtual

Create a box scalar entry in the database with the specified key name. If the key already exists in the database, then the old key record is deleted and the new one is silently created in its place.

Reimplemented from SAMRAI::tbox::Database.

◆ putDatabaseBoxArray() [1/2]

virtual void SAMRAI::tbox::MemoryDatabase::putDatabaseBoxArray ( const std::string &  key,
const Array< DatabaseBox > &  data 
)
virtual

Create a box array entry in the database with the specified key name. If the key already exists in the database, then the old key record is deleted and the new one is silently created in its place.

Reimplemented from SAMRAI::tbox::Database.

◆ putDatabaseBoxArray() [2/2]

virtual void SAMRAI::tbox::MemoryDatabase::putDatabaseBoxArray ( const std::string &  key,
const DatabaseBox *const  data,
const int  nelements 
)
virtual

Create a box array entry in the database with the specified key name. If the key already exists in the database, then the old key record is deleted and the new one is silently created in its place.

Implements SAMRAI::tbox::Database.

◆ getDatabaseBox()

virtual DatabaseBox SAMRAI::tbox::MemoryDatabase::getDatabaseBox ( const std::string &  key)
virtual

Get a box entry in the database with the specified key name. If the specified key does not exist in the database or is not a box scalar, then an error message is printed and the program exits.

Reimplemented from SAMRAI::tbox::Database.

◆ getDatabaseBoxWithDefault()

virtual DatabaseBox SAMRAI::tbox::MemoryDatabase::getDatabaseBoxWithDefault ( const std::string &  key,
const DatabaseBox defaultvalue 
)
virtual

Get a box entry in the database with the specified key name. If the specified key does not exist in the database, then the default value is returned. If the key exists but is not a box scalar, then an error message is printed and the program exits.

Reimplemented from SAMRAI::tbox::Database.

◆ getDatabaseBoxArray() [1/2]

virtual Array<DatabaseBox> SAMRAI::tbox::MemoryDatabase::getDatabaseBoxArray ( const std::string &  key)
virtual

Get a box entry from the database with the specified key name. If the specified key does not exist in the database or is not a box array, then an error message is printed and the program exits.

Implements SAMRAI::tbox::Database.

◆ getDatabaseBoxArray() [2/2]

virtual void SAMRAI::tbox::MemoryDatabase::getDatabaseBoxArray ( const std::string &  key,
DatabaseBox data,
const int  nelements 
)
virtual

Get a box entry from the database with the specified key name. If the specified key does not exist in the database or is not a box array, then an error message is printed and the program exits. The specified number of elements must match exactly the number of elements in the array in the database.

Reimplemented from SAMRAI::tbox::Database.

◆ isChar()

virtual bool SAMRAI::tbox::MemoryDatabase::isChar ( const std::string &  key)
virtual

Return whether the specified key represents a character entry. If the key does not exist, then false is returned.

Implements SAMRAI::tbox::Database.

◆ putChar()

virtual void SAMRAI::tbox::MemoryDatabase::putChar ( const std::string &  key,
const char &  data 
)
virtual

Create a character scalar entry in the database with the specified key name. If the key already exists in the database, then the old key record is deleted and the new one is silently created in its place.

Reimplemented from SAMRAI::tbox::Database.

◆ putCharArray() [1/2]

virtual void SAMRAI::tbox::MemoryDatabase::putCharArray ( const std::string &  key,
const Array< char > &  data 
)
virtual

Create a character array entry in the database with the specified key name. If the key already exists in the database, then the old key record is deleted and the new one is silently created in its place.

Reimplemented from SAMRAI::tbox::Database.

◆ putCharArray() [2/2]

virtual void SAMRAI::tbox::MemoryDatabase::putCharArray ( const std::string &  key,
const char *const  data,
const int  nelements 
)
virtual

Create a character array entry in the database with the specified key name. If the key already exists in the database, then the old key record is deleted and the new one is silently created in its place.

Implements SAMRAI::tbox::Database.

◆ getChar()

virtual char SAMRAI::tbox::MemoryDatabase::getChar ( const std::string &  key)
virtual

Get a character entry in the database with the specified key name. If the specified key does not exist in the database or is not an character scalar, then an error message is printed and the program exits.

Reimplemented from SAMRAI::tbox::Database.

◆ getCharWithDefault()

virtual char SAMRAI::tbox::MemoryDatabase::getCharWithDefault ( const std::string &  key,
const char &  defaultvalue 
)
virtual

Get a character entry in the database with the specified key name. If the specified key does not exist in the database, then the default value is returned. If the key exists but is not a character scalar, then an error message is printed and the program exits.

Reimplemented from SAMRAI::tbox::Database.

◆ getCharArray() [1/2]

virtual Array<char> SAMRAI::tbox::MemoryDatabase::getCharArray ( const std::string &  key)
virtual

Get a character entry from the database with the specified key name. If the specified key does not exist in the database or is not a character array, then an error message is printed and the program exits.

Implements SAMRAI::tbox::Database.

◆ getCharArray() [2/2]

virtual void SAMRAI::tbox::MemoryDatabase::getCharArray ( const std::string &  key,
char *  data,
const int  nelements 
)
virtual

Get a character entry from the database with the specified key name. If the specified key does not exist in the database or is not a character array, then an error message is printed and the program exits. The specified number of elements must match exactly the number of elements in the array in the database.

Reimplemented from SAMRAI::tbox::Database.

◆ isComplex()

virtual bool SAMRAI::tbox::MemoryDatabase::isComplex ( const std::string &  key)
virtual

Return whether the specified key represents a complex entry. If the key does not exist, then false is returned. Complex values may be promoted from integers, floats, or doubles.

Implements SAMRAI::tbox::Database.

◆ putComplex()

virtual void SAMRAI::tbox::MemoryDatabase::putComplex ( const std::string &  key,
const dcomplex data 
)
virtual

Create a complex scalar entry in the database with the specified key name. If the key already exists in the database, then the old key record is deleted and the new one is silently created in its place.

Reimplemented from SAMRAI::tbox::Database.

◆ putComplexArray() [1/2]

virtual void SAMRAI::tbox::MemoryDatabase::putComplexArray ( const std::string &  key,
const Array< dcomplex > &  data 
)
virtual

Create a complex array entry in the database with the specified key name. If the key already exists in the database, then the old key record is deleted and the new one is silently created in its place.

Reimplemented from SAMRAI::tbox::Database.

◆ putComplexArray() [2/2]

virtual void SAMRAI::tbox::MemoryDatabase::putComplexArray ( const std::string &  key,
const dcomplex *const  data,
const int  nelements 
)
virtual

Create a complex array entry in the database with the specified key name. If the key already exists in the database, then the old key record is deleted and the new one is silently created in its place.

Implements SAMRAI::tbox::Database.

◆ getComplex()

virtual dcomplex SAMRAI::tbox::MemoryDatabase::getComplex ( const std::string &  key)
virtual

Get a complex entry in the database with the specified key name. If the specified key does not exist in the database or is not a complex scalar, then an error message is printed and the program exits. Complex values may be promoted from integers, floats, or doubles.

Reimplemented from SAMRAI::tbox::Database.

◆ getComplexWithDefault()

virtual dcomplex SAMRAI::tbox::MemoryDatabase::getComplexWithDefault ( const std::string &  key,
const dcomplex defaultvalue 
)
virtual

Get a complex entry in the database with the specified key name. If the specified key does not exist in the database, then the default value is returned. If the key exists but is not a complex scalar, then an error message is printed and the program exits. Complex values may be promoted from integers, floats, or doubles.

Reimplemented from SAMRAI::tbox::Database.

◆ getComplexArray() [1/2]

virtual Array<dcomplex> SAMRAI::tbox::MemoryDatabase::getComplexArray ( const std::string &  key)
virtual

Get a complex entry from the database with the specified key name. If the specified key does not exist in the database or is not a complex array, then an error message is printed and the program exits. Complex values may be promoted from integers, floats, or doubles.

Implements SAMRAI::tbox::Database.

◆ getComplexArray() [2/2]

virtual void SAMRAI::tbox::MemoryDatabase::getComplexArray ( const std::string &  key,
dcomplex data,
const int  nelements 
)
virtual

Get a complex entry from the database with the specified key name. If the specified key does not exist in the database or is not a complex array, then an error message is printed and the program exits. The specified number of elements must match exactly the number of elements in the array in the database. Complex values may be promoted from integers, floats, or doubles.

Reimplemented from SAMRAI::tbox::Database.

◆ isDouble()

virtual bool SAMRAI::tbox::MemoryDatabase::isDouble ( const std::string &  key)
virtual

Return whether the specified key represents a double entry. If the key does not exist, then false is returned. Double values may be promoted from integers or floats.

Implements SAMRAI::tbox::Database.

◆ putDouble()

virtual void SAMRAI::tbox::MemoryDatabase::putDouble ( const std::string &  key,
const double data 
)
virtual

Create a double scalar entry in the database with the specified key name. If the key already exists in the database, then the old key record is deleted and the new one is silently created in its place.

Reimplemented from SAMRAI::tbox::Database.

◆ putDoubleArray() [1/2]

virtual void SAMRAI::tbox::MemoryDatabase::putDoubleArray ( const std::string &  key,
const Array< double > &  data 
)
virtual

Create a double array entry in the database with the specified key name. If the key already exists in the database, then the old key record is deleted and the new one is silently created in its place.

Reimplemented from SAMRAI::tbox::Database.

◆ putDoubleArray() [2/2]

virtual void SAMRAI::tbox::MemoryDatabase::putDoubleArray ( const std::string &  key,
const double *const  data,
const int  nelements 
)
virtual

Create a double array entry in the database with the specified key name. If the key already exists in the database, then the old key record is deleted and the new one is silently created in its place.

Implements SAMRAI::tbox::Database.

◆ getDouble()

virtual double SAMRAI::tbox::MemoryDatabase::getDouble ( const std::string &  key)
virtual

Get a double entry in the database with the specified key name. If the specified key does not exist in the database or is not a double scalar, then an error message is printed and the program exits. Double values may be promoted from integers or floats.

Reimplemented from SAMRAI::tbox::Database.

◆ getDoubleWithDefault()

virtual double SAMRAI::tbox::MemoryDatabase::getDoubleWithDefault ( const std::string &  key,
const double defaultvalue 
)
virtual

Get a double entry in the database with the specified key name. If the specified key does not exist in the database, then the default value is returned. If the key exists but is not a double scalar, then an error message is printed and the program exits. Double values may be promoted from integers or floats.

Reimplemented from SAMRAI::tbox::Database.

◆ getDoubleArray() [1/2]

virtual Array<double> SAMRAI::tbox::MemoryDatabase::getDoubleArray ( const std::string &  key)
virtual

Get a double entry from the database with the specified key name. If the specified key does not exist in the database or is not a double array, then an error message is printed and the program exits. Double values may be promoted from integers or floats.

Implements SAMRAI::tbox::Database.

◆ getDoubleArray() [2/2]

virtual void SAMRAI::tbox::MemoryDatabase::getDoubleArray ( const std::string &  key,
double data,
const int  nelements 
)
virtual

Get a double entry from the database with the specified key name. If the specified key does not exist in the database or is not a double array, then an error message is printed and the program exits. The specified number of elements must match exactly the number of elements in the array in the database. Double values may be promoted from integers or floats.

Reimplemented from SAMRAI::tbox::Database.

◆ isFloat()

virtual bool SAMRAI::tbox::MemoryDatabase::isFloat ( const std::string &  key)
virtual

Return whether the specified key represents a float entry. If the key does not exist, then false is returned. Float values may be promoted from integers or silently truncated from doubles.

Implements SAMRAI::tbox::Database.

◆ putFloat()

virtual void SAMRAI::tbox::MemoryDatabase::putFloat ( const std::string &  key,
const float &  data 
)
virtual

Create a float scalar entry in the database with the specified key name. If the key already exists in the database, then the old key record is deleted and the new one is silently created in its place.

Reimplemented from SAMRAI::tbox::Database.

◆ putFloatArray() [1/2]

virtual void SAMRAI::tbox::MemoryDatabase::putFloatArray ( const std::string &  key,
const Array< float > &  data 
)
virtual

Create a float array entry in the database with the specified key name. If the key already exists in the database, then the old key record is deleted and the new one is silently created in its place.

Reimplemented from SAMRAI::tbox::Database.

◆ putFloatArray() [2/2]

virtual void SAMRAI::tbox::MemoryDatabase::putFloatArray ( const std::string &  key,
const float *const  data,
const int  nelements 
)
virtual

Create a float array entry in the database with the specified key name. If the key already exists in the database, then the old key record is deleted and the new one is silently created in its place.

Implements SAMRAI::tbox::Database.

◆ getFloat()

virtual float SAMRAI::tbox::MemoryDatabase::getFloat ( const std::string &  key)
virtual

Get a float entry in the database with the specified key name. If the specified key does not exist in the database or is not a float scalar, then an error message is printed and the program exits. Float values may be promoted from integers or silently truncated from doubles.

Reimplemented from SAMRAI::tbox::Database.

◆ getFloatWithDefault()

virtual float SAMRAI::tbox::MemoryDatabase::getFloatWithDefault ( const std::string &  key,
const float &  defaultvalue 
)
virtual

Get a float entry in the database with the specified key name. If the specified key does not exist in the database, then the default value is returned. If the key exists but is not a float scalar, then an error message is printed and the program exits. Float values may be promoted from integers or silently truncated from doubles.

Reimplemented from SAMRAI::tbox::Database.

◆ getFloatArray() [1/2]

virtual Array<float> SAMRAI::tbox::MemoryDatabase::getFloatArray ( const std::string &  key)
virtual

Get a float entry from the database with the specified key name. If the specified key does not exist in the database or is not a float array, then an error message is printed and the program exits. Float values may be promoted from integers or silently truncated from doubles.

Implements SAMRAI::tbox::Database.

◆ getFloatArray() [2/2]

virtual void SAMRAI::tbox::MemoryDatabase::getFloatArray ( const std::string &  key,
float *  data,
const int  nelements 
)
virtual

Get a float entry from the database with the specified key name. If the specified key does not exist in the database or is not a float array, then an error message is printed and the program exits. The specified number of elements must match exactly the number of elements in the array in the database. Float values may be promoted from integers or silently truncated from doubles.

Reimplemented from SAMRAI::tbox::Database.

◆ isInteger()

virtual bool SAMRAI::tbox::MemoryDatabase::isInteger ( const std::string &  key)
virtual

Return whether the specified key represents an integer entry. If the key does not exist, then false is returned.

Implements SAMRAI::tbox::Database.

◆ putInteger()

virtual void SAMRAI::tbox::MemoryDatabase::putInteger ( const std::string &  key,
const int data 
)
virtual

Create an integer scalar entry in the database with the specified key name. If the key already exists in the database, then the old key record is deleted and the new one is silently created in its place.

Reimplemented from SAMRAI::tbox::Database.

◆ putIntegerArray() [1/2]

virtual void SAMRAI::tbox::MemoryDatabase::putIntegerArray ( const std::string &  key,
const Array< int > &  data 
)
virtual

Create an integer array entry in the database with the specified key name. If the key already exists in the database, then the old key record is deleted and the new one is silently created in its place.

Reimplemented from SAMRAI::tbox::Database.

◆ putIntegerArray() [2/2]

virtual void SAMRAI::tbox::MemoryDatabase::putIntegerArray ( const std::string &  key,
const int *const  data,
const int  nelements 
)
virtual

Create an integer array entry in the database with the specified key name. If the key already exists in the database, then the old key record is deleted and the new one is silently created in its place.

Implements SAMRAI::tbox::Database.

◆ getInteger()

virtual int SAMRAI::tbox::MemoryDatabase::getInteger ( const std::string &  key)
virtual

Get an integer entry in the database with the specified key name. If the specified key does not exist in the database or is not an integer scalar, then an error message is printed and the program exits.

Reimplemented from SAMRAI::tbox::Database.

◆ getIntegerWithDefault()

virtual int SAMRAI::tbox::MemoryDatabase::getIntegerWithDefault ( const std::string &  key,
const int defaultvalue 
)
virtual

Get an integer entry in the database with the specified key name. If the specified key does not exist in the database, then the default value is returned. If the key exists but is not an integer scalar, then an error message is printed and the program exits.

Reimplemented from SAMRAI::tbox::Database.

◆ getIntegerArray() [1/2]

virtual Array<int> SAMRAI::tbox::MemoryDatabase::getIntegerArray ( const std::string &  key)
virtual

Get an integer entry from the database with the specified key name. If the specified key does not exist in the database or is not an integer array, then an error message is printed and the program exits.

Implements SAMRAI::tbox::Database.

◆ getIntegerArray() [2/2]

virtual void SAMRAI::tbox::MemoryDatabase::getIntegerArray ( const std::string &  key,
int data,
const int  nelements 
)
virtual

Get an integer entry from the database with the specified key name. If the specified key does not exist in the database or is not an integer array, then an error message is printed and the program exits. The specified number of elements must match exactly the number of elements in the array in the database.

Reimplemented from SAMRAI::tbox::Database.

◆ isString()

virtual bool SAMRAI::tbox::MemoryDatabase::isString ( const std::string &  key)
virtual

Return whether the specified key represents a std::string entry. If the key does not exist, then false is returned.

Implements SAMRAI::tbox::Database.

◆ putString()

virtual void SAMRAI::tbox::MemoryDatabase::putString ( const std::string &  key,
const std::string &  data 
)
virtual

Create a string scalar entry in the database with the specified key name. If the key already exists in the database, then the old key record is deleted and the new one is silently created in its place.

Reimplemented from SAMRAI::tbox::Database.

◆ putStringArray() [1/2]

virtual void SAMRAI::tbox::MemoryDatabase::putStringArray ( const std::string &  key,
const Array< std::string > &  data 
)
virtual

Create a string array entry in the database with the specified key name. If the key already exists in the database, then the old key record is deleted and the new one is silently created in its place.

Reimplemented from SAMRAI::tbox::Database.

◆ putStringArray() [2/2]

virtual void SAMRAI::tbox::MemoryDatabase::putStringArray ( const std::string &  key,
const std::string *const  data,
const int  nelements 
)
virtual

Create a string array entry in the database with the specified key name. If the key already exists in the database, then the old key record is deleted and the new one is silently created in its place.

Implements SAMRAI::tbox::Database.

◆ getString()

virtual std::string SAMRAI::tbox::MemoryDatabase::getString ( const std::string &  key)
virtual

Get a string entry in the database with the specified key name. If the specified key does not exist in the database or is not an string scalar, then an error message is printed and the program exits.

Reimplemented from SAMRAI::tbox::Database.

◆ getStringWithDefault()

virtual std::string SAMRAI::tbox::MemoryDatabase::getStringWithDefault ( const std::string &  key,
const std::string &  defaultvalue 
)
virtual

Get a string entry in the database with the specified key name. If the specified key does not exist in the database, then the default value is returned. If the key exists but is not a string scalar, then an error message is printed and the program exits.

Reimplemented from SAMRAI::tbox::Database.

◆ getStringArray() [1/2]

virtual Array<std::string> SAMRAI::tbox::MemoryDatabase::getStringArray ( const std::string &  key)
virtual

Get a string entry from the database with the specified key name. If the specified key does not exist in the database or is not a string array, then an error message is printed and the program exits.

Implements SAMRAI::tbox::Database.

◆ getStringArray() [2/2]

virtual void SAMRAI::tbox::MemoryDatabase::getStringArray ( const std::string &  key,
std::string *  data,
const int  nelements 
)
virtual

Get a string entry from the database with the specified key name. If the specified key does not exist in the database or is not a string array, then an error message is printed and the program exits. The specified number of elements must match exactly the number of elements in the array in the database.

Reimplemented from SAMRAI::tbox::Database.

◆ getName() [2/2]

virtual std::string SAMRAI::tbox::MemoryDatabase::getName ( )
virtual

The name for the root of the database is the name supplied when creating it. Names for nested databases are the keyname of the database.

Parameters
osOutput stream.

Implements SAMRAI::tbox::Database.

◆ keyAccessed()

bool SAMRAI::tbox::MemoryDatabase::keyAccessed ( const std::string &  key)

Return whether the specified key has been accessed by one of the lookup member functions. If the key does not exist in the database, then false is returned.

◆ printClassData()

virtual void SAMRAI::tbox::MemoryDatabase::printClassData ( std::ostream &  os = pout)
virtual

Print the current database to the specified output stream. After each key, print whether that key came from the a file and was used, came from the file but was not used (unused), or came from a default key value (default). If no output stream is specified, then data is written to stream pout.

NOTE: under the g++ compiler libraries, printClassData has a maximum output of 4096 characters per line.

Implements SAMRAI::tbox::Database.

◆ printUnusedKeys()

void SAMRAI::tbox::MemoryDatabase::printUnusedKeys ( std::ostream &  os = pout) const

Print the database keys that were not used to the specified output stream.

◆ printDefaultKeys()

void SAMRAI::tbox::MemoryDatabase::printDefaultKeys ( std::ostream &  os = pout) const

Print the database keys that were set via default calls to the specified output stream.

◆ operator=()

void SAMRAI::tbox::MemoryDatabase::operator= ( const MemoryDatabase )
private

◆ deleteKeyIfFound()

bool SAMRAI::tbox::MemoryDatabase::deleteKeyIfFound ( const std::string &  key)
private

◆ findKeyData()

KeyData* SAMRAI::tbox::MemoryDatabase::findKeyData ( const std::string &  key)
private

◆ findKeyDataOrExit()

KeyData* SAMRAI::tbox::MemoryDatabase::findKeyDataOrExit ( const std::string &  key)
private

◆ indentStream()

static void SAMRAI::tbox::MemoryDatabase::indentStream ( std::ostream &  os,
const int  indent 
)
staticprivate

◆ printDatabase()

void SAMRAI::tbox::MemoryDatabase::printDatabase ( std::ostream &  os,
const int  indent,
const int  toprint 
) const
private

◆ getScalar() [1/6]

void SAMRAI::tbox::Database::getScalar ( const std::string &  key,
bool scalar 
)
inherited

Get a bool entry in the database with the specified key name. If the specified key does not exist in the database or is not an bool scalar, then an error message is printed and the program exits.

Parameters
keyKey name in database.
scalarReturns scalar that was read.

◆ getScalar() [2/6]

void SAMRAI::tbox::Database::getScalar ( const std::string &  key,
char &  scalar 
)
inherited

Get a char entry in the database with the specified key name. If the specified key does not exist in the database or is not an char scalar, then an error message is printed and the program exits.

Parameters
keyKey name in database.
scalarReturns scalar that was read.

◆ getScalar() [3/6]

void SAMRAI::tbox::Database::getScalar ( const std::string &  key,
dcomplex scalar 
)
inherited

Get a complex entry in the database with the specified key name. If the specified key does not exist in the database or is not an complex scalar, then an error message is printed and the program exits.

Parameters
keyKey name in database.
scalarReturns scalar that was read.

◆ getScalar() [4/6]

void SAMRAI::tbox::Database::getScalar ( const std::string &  key,
float &  scalar 
)
inherited

Get a float entry in the database with the specified key name. If the specified key does not exist in the database or is not an float scalar, then an error message is printed and the program exits.

Parameters
keyKey name in database.
scalarReturns scalar that was read.

◆ getScalar() [5/6]

void SAMRAI::tbox::Database::getScalar ( const std::string &  key,
double scalar 
)
inherited

Get a double entry in the database with the specified key name. If the specified key does not exist in the database or is not an double scalar, then an error message is printed and the program exits.

Parameters
keyKey name in database.
scalarReturns scalar that was read.

◆ getScalar() [6/6]

void SAMRAI::tbox::Database::getScalar ( const std::string &  key,
int scalar 
)
inherited

Get a integer entry in the database with the specified key name. If the specified key does not exist in the database or is not an integer scalar, then an error message is printed and the program exits.

Parameters
keyKey name in database.
scalarReturns scalar that was read.

◆ putScalar() [1/6]

void SAMRAI::tbox::Database::putScalar ( const std::string &  key,
const bool  scalar 
)
inherited

Get a bool entry from the database with the specified key name. If the specified key does not exist in the database or is not a bool array, then an error message is printed and the program exits.

Parameters
keyKey name in database.
scalarValue to put into database.

◆ putScalar() [2/6]

void SAMRAI::tbox::Database::putScalar ( const std::string &  key,
const char  scalar 
)
inherited

Get a char entry from the database with the specified key name. If the specified key does not exist in the database or is not a char array, then an error message is printed and the program exits.

Parameters
keyKey name in database.
scalarValue to put into database.

◆ putScalar() [3/6]

void SAMRAI::tbox::Database::putScalar ( const std::string &  key,
const dcomplex  scalar 
)
inherited

Get a complex entry from the database with the specified key name. If the specified key does not exist in the database or is not a complex array, then an error message is printed and the program exits.

Parameters
keyKey name in database.
scalarValue to put into database.

◆ putScalar() [4/6]

void SAMRAI::tbox::Database::putScalar ( const std::string &  key,
const float  scalar 
)
inherited

Get a float entry from the database with the specified key name. If the specified key does not exist in the database or is not a float array, then an error message is printed and the program exits.

Parameters
keyKey name in database.
scalarValue to put into database.

◆ putScalar() [5/6]

void SAMRAI::tbox::Database::putScalar ( const std::string &  key,
const double  scalar 
)
inherited

Get a double entry from the database with the specified key name. If the specified key does not exist in the database or is not a double array, then an error message is printed and the program exits.

Parameters
keyKey name in database.
scalarValue to put into database.

◆ putScalar() [6/6]

void SAMRAI::tbox::Database::putScalar ( const std::string &  key,
const int  scalar 
)
inherited

Get a integer entry from the database with the specified key name. If the specified key does not exist in the database or is not a integer array, then an error message is printed and the program exits.

Parameters
keyKey name in database.
scalarValue to put into database.

◆ getArray() [1/6]

void SAMRAI::tbox::Database::getArray ( const std::string &  key,
Array< bool > &  array 
)
inherited

Get a bool entry from the database with the specified key name. If the specified key does not exist in the database or is not a bool array, then an error message is printed and the program exits.

Parameters
keyKey name in database.
arrayReturns array that was read.

◆ getArray() [2/6]

void SAMRAI::tbox::Database::getArray ( const std::string &  key,
Array< char > &  array 
)
inherited

Get a char entry from the database with the specified key name. If the specified key does not exist in the database or is not a char array, then an error message is printed and the program exits.

Parameters
keyKey name in database.
arrayReturns array that was read.

◆ getArray() [3/6]

void SAMRAI::tbox::Database::getArray ( const std::string &  key,
Array< dcomplex > &  array 
)
inherited

Get a complex entry from the database with the specified key name. If the specified key does not exist in the database or is not a complex array, then an error message is printed and the program exits.

Parameters
keyKey name in database.
arrayReturns array that was read.

◆ getArray() [4/6]

void SAMRAI::tbox::Database::getArray ( const std::string &  key,
Array< float > &  array 
)
inherited

Get a float entry from the database with the specified key name. If the specified key does not exist in the database or is not a float array, then an error message is printed and the program exits.

Parameters
keyKey name in database.
arrayReturns array that was read.

◆ getArray() [5/6]

void SAMRAI::tbox::Database::getArray ( const std::string &  key,
Array< double > &  array 
)
inherited

Get a double entry from the database with the specified key name. If the specified key does not exist in the database or is not a double array, then an error message is printed and the program exits.

Parameters
keyKey name in database.
arrayReturns array that was read.

◆ getArray() [6/6]

void SAMRAI::tbox::Database::getArray ( const std::string &  key,
Array< int > &  array 
)
inherited

Get a integer entry from the database with the specified key name. If the specified key does not exist in the database or is not a integer array, then an error message is printed and the program exits.

Parameters
keyKey name in database.
arrayReturns array that was read.

◆ putArray() [1/6]

void SAMRAI::tbox::Database::putArray ( const std::string &  key,
const Array< bool array 
)
inherited

Create an bool array entry in the database with the specified key name. If the key already exists in the database, then the old key record is deleted and the new one is silently created in its place.

Parameters
keyKey name in database.
arrayArray to put into database.

◆ putArray() [2/6]

void SAMRAI::tbox::Database::putArray ( const std::string &  key,
const Array< char >  array 
)
inherited

Create an char array entry in the database with the specified key name. If the key already exists in the database, then the old key record is deleted and the new one is silently created in its place.

Parameters
keyKey name in database.
arrayArray to put into database.

◆ putArray() [3/6]

void SAMRAI::tbox::Database::putArray ( const std::string &  key,
const Array< dcomplex array 
)
inherited

Create an complex array entry in the database with the specified key name. If the key already exists in the database, then the old key record is deleted and the new one is silently created in its place.

Parameters
keyKey name in database.
arrayArray to put into database.

◆ putArray() [4/6]

void SAMRAI::tbox::Database::putArray ( const std::string &  key,
const Array< float >  array 
)
inherited

Create an float array entry in the database with the specified key name. If the key already exists in the database, then the old key record is deleted and the new one is silently created in its place.

Parameters
keyKey name in database.
arrayArray to put into database.

◆ putArray() [5/6]

void SAMRAI::tbox::Database::putArray ( const std::string &  key,
const Array< double array 
)
inherited

Create an double array entry in the database with the specified key name. If the key already exists in the database, then the old key record is deleted and the new one is silently created in its place.

Parameters
keyKey name in database.
arrayArray to put into database.

◆ putArray() [6/6]

void SAMRAI::tbox::Database::putArray ( const std::string &  key,
const Array< int array 
)
inherited

Create an integer array entry in the database with the specified key name. If the key already exists in the database, then the old key record is deleted and the new one is silently created in its place.

Parameters
keyKey name in database.
arrayArray to put into database.

Member Data Documentation

◆ d_database_name

std::string SAMRAI::tbox::MemoryDatabase::d_database_name
private

◆ d_keyvalues

List<KeyData> SAMRAI::tbox::MemoryDatabase::d_keyvalues
private

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