OpenFCST: The open-source Fuel Cell Simulation Toolbox
|
Here we handle general data of applications. More...
#include <application_data.h>
Public Types | |
typedef std::map< std::string, bool > | flag_map |
The typedef for the map of boolean flags. More... | |
typedef std::map< std::string, const double * > | scalar_map |
The typedef for the map of scalars. More... | |
typedef std::map< std::string, const FEVector * > | vector_map |
The typedef for the map of vectors. More... | |
typedef std::map< std::string, const std::vector< double > * > | std_vector_map |
The typedef for the map of std vectors. More... | |
Public Member Functions | |
~ApplicationData () | |
Destructor, releasing all data. More... | |
void | enter_flag (std::string name, const bool &s) |
Register a named boolean flag. More... | |
void | enter (std::string name, const double &s) |
Register a named scalar. More... | |
void | enter (std::string name, const FEVector &v) |
Register a named vector. More... | |
void | enter (std::string name, const std::vector< double > &v) |
Register a named std vector. More... | |
void | erase_flag (std::string name) |
Delete a previously registered boolean flag. More... | |
void | erase_scalar (std::string name) |
Delete a previously registered scalar. More... | |
void | erase_vector (std::string name) |
Delete a previously registered vector. More... | |
void | erase_std_vector (std::string name) |
Delete a previously registered std vector. More... | |
bool | flag_exists (const std::string &name) const |
This function returns true if a boolean flag exists (doesn't matter if the flag itself is true or false ). More... | |
bool | flag (std::string name) const |
Get read-only access to a registered boolean flag. More... | |
const double * | scalar (std::string name) const |
Get read-only access to a registered scalar. More... | |
const FEVector * | vector (std::string name) const |
Get read-only access to a registered vector. More... | |
const std::vector< double > * | std_vector (std::string name) const |
Get read-only access to a registered std vector. More... | |
void | log () const |
List all stored objects to FcstUtilities::log. More... | |
DeclException2 (ExcNotFound, char *, std::string,<< "A "<< arg1<< " with name "<< arg2<< " was not stored in this data object") | |
Exception thrown when a named scalar or vector was searched but not found. More... | |
Public Attributes | |
GrowingVectorMemory< Vector < double > > | vector_pool |
VectorMemory object for simple vectors. More... | |
GrowingVectorMemory< FEVector > | block_vector_pool |
VectorMemory object for block vectors. More... | |
Private Attributes | |
flag_map | named_flags |
A map linking names of data to actual boolean flags. More... | |
scalar_map | named_scalars |
A map linking names of data to actual scalars. More... | |
vector_map | named_vectors |
A map linking names of data to actual vectors. More... | |
std_vector_map | named_std_vectors |
A map linking names of data to actual std vectors. More... | |
Here we handle general data of applications.
It is the idea of this class that all applications inheriting from ApplicationBase share the same ApplicationData object, thus accessing the same vector pools and using the object as a means for communicating global information.
First purpose is providing vector memory objects for Vector and BlockVector objects for applications. These objects, vector_pool and block_vector_pool can be accessed directly.
Furthermore, it provides a map which allows applications to exchange data in named registers. To this end, the functions enter_flag(std::string,const bool&), enter(std::string,const double&), enter(std::string,const FEVector&), and enter(std::string,const std::vector<double>&) can be used to enter boolean flag, scalar and vector data, respectively. These data are entered as references, so the controlling application can change them at any time. All other applications sharing the same ApplicationData can access them read only through the functions flag(), scalar(), vector(), and std_vector().
typedef std::map< std::string, bool > FuelCell::ApplicationCore::ApplicationData::flag_map |
The typedef for the map of boolean flags.
typedef std::map< std::string, const double* > FuelCell::ApplicationCore::ApplicationData::scalar_map |
The typedef for the map of scalars.
typedef std::map< std::string, const std::vector<double>* > FuelCell::ApplicationCore::ApplicationData::std_vector_map |
The typedef for the map of std vectors.
typedef std::map< std::string, const FEVector* > FuelCell::ApplicationCore::ApplicationData::vector_map |
The typedef for the map of vectors.
FuelCell::ApplicationCore::ApplicationData::~ApplicationData | ( | ) |
Destructor, releasing all data.
FuelCell::ApplicationCore::ApplicationData::DeclException2 | ( | ExcNotFound | , |
char * | , | ||
std::string | , | ||
<< "A "<< arg1<< " with name "<< arg2<< " was not stored in this data object" | |||
) |
Exception thrown when a named scalar or vector was searched but not found.
void FuelCell::ApplicationCore::ApplicationData::enter | ( | std::string | name, |
const double & | s | ||
) |
Register a named scalar.
void FuelCell::ApplicationCore::ApplicationData::enter | ( | std::string | name, |
const FEVector & | v | ||
) |
Register a named vector.
void FuelCell::ApplicationCore::ApplicationData::enter | ( | std::string | name, |
const std::vector< double > & | v | ||
) |
Register a named std vector.
void FuelCell::ApplicationCore::ApplicationData::enter_flag | ( | std::string | name, |
const bool & | s | ||
) |
Register a named boolean flag.
void FuelCell::ApplicationCore::ApplicationData::erase_flag | ( | std::string | name | ) |
Delete a previously registered boolean flag.
void FuelCell::ApplicationCore::ApplicationData::erase_scalar | ( | std::string | name | ) |
Delete a previously registered scalar.
void FuelCell::ApplicationCore::ApplicationData::erase_std_vector | ( | std::string | name | ) |
Delete a previously registered std vector.
void FuelCell::ApplicationCore::ApplicationData::erase_vector | ( | std::string | name | ) |
Delete a previously registered vector.
bool FuelCell::ApplicationCore::ApplicationData::flag | ( | std::string | name | ) | const |
Get read-only access to a registered boolean flag.
bool FuelCell::ApplicationCore::ApplicationData::flag_exists | ( | const std::string & | name | ) | const |
This function returns true
if a boolean flag exists (doesn't matter if the flag itself is true
or false
).
Otherwise returns false
.
void FuelCell::ApplicationCore::ApplicationData::log | ( | ) | const |
List all stored objects to FcstUtilities::log.
const double* FuelCell::ApplicationCore::ApplicationData::scalar | ( | std::string | name | ) | const |
Get read-only access to a registered scalar.
It only offers read access and returns a null pointer, if the name has not been registered.
const std::vector<double>* FuelCell::ApplicationCore::ApplicationData::std_vector | ( | std::string | name | ) | const |
Get read-only access to a registered std vector.
It only offers read access and returns a null pointer, if the name has not been registered.
const FEVector* FuelCell::ApplicationCore::ApplicationData::vector | ( | std::string | name | ) | const |
Get read-only access to a registered vector.
It only offers read access and returns a null pointer, if the name has not been registered.
GrowingVectorMemory<FEVector> FuelCell::ApplicationCore::ApplicationData::block_vector_pool |
VectorMemory object for block vectors.
All applications should allocate their vectors here, so they can be reused and operating system memory management can be avoided.
|
private |
A map linking names of data to actual boolean flags.
|
private |
A map linking names of data to actual scalars.
|
private |
A map linking names of data to actual std vectors.
|
private |
A map linking names of data to actual vectors.
GrowingVectorMemory< Vector<double> > FuelCell::ApplicationCore::ApplicationData::vector_pool |
VectorMemory object for simple vectors.
All applications should allocate their vectors here, so they can be reused and operating system memory management can be avoided.