SG++-Doxygen-Documentation
|
Class that allows to keep a storage of arbitrary grid points. More...
#include <GridDataBase.hpp>
Public Types | |
typedef grid_map::const_iterator | grid_map_const_iterator |
typedef grid_map::iterator | grid_map_iterator |
Public Member Functions | |
grid_map_iterator | begin () |
Return iterator to beginning. More... | |
void | clear () |
Clears database, removing all entries. More... | |
size_t | dim () const |
Returns the dimensionality of the grid points. More... | |
grid_map_iterator | end () |
Return iterator to end. More... | |
double | get (GridPoint *gi) |
Get value for grid point from database. More... | |
GridDataBase (size_t dim) | |
Standard Constructor, creating an empty database with dimensionality dim. More... | |
GridDataBase (Grid *grid, DataVector &values) | |
Constructor, copying from existing grid and values. More... | |
GridDataBase (const std::string &filename) | |
Constructor, reading from existing database. More... | |
bool | hasKey (GridPoint *gi) |
Test, whether database already contains a grid point. More... | |
void | load (const std::string filename) |
Loads database in ASCII or binary format. More... | |
void | remove (GridPoint *gi) |
Remove grid point from database. More... | |
void | save (std::string filename, char ftype=GridDataBase::ascii) |
Save database to file. More... | |
void | set (GridPoint *gi, double value) |
Store (grid point - value) pair in database. More... | |
void | setValuesFor (Grid *grid, DataVector &values) |
Set values for given grid from stored ones in database. More... | |
size_t | size () const |
Returns the number of grid points that are currently stored in the database. More... | |
std::string | toString () |
Returns std::string representation of database. More... | |
~GridDataBase () | |
Destructor. More... | |
Static Public Attributes | |
static const char | ascii = 'a' |
static const char | binary = 'b' |
Class that allows to keep a storage of arbitrary grid points.
It has the functionality of a dictionary that is used for storing and retrieving grid points. Internally, a hash_map is used.
Note: GridDataBase currently supports only to store pairs of (grid point -> double).
typedef grid_map::const_iterator sgpp::base::GridDataBase::grid_map_const_iterator |
typedef grid_map::iterator sgpp::base::GridDataBase::grid_map_iterator |
|
explicit |
Standard Constructor, creating an empty database with dimensionality dim.
dim | the dimensionality of the grid points |
sgpp::base::GridDataBase::GridDataBase | ( | Grid * | grid, |
DataVector & | values | ||
) |
Constructor, copying from existing grid and values.
grid | the grid to copy from |
values | the initial values |
References sgpp::base::HashGridStorage::getPoint(), sgpp::base::HashGridStorage::getSequenceNumber(), sgpp::base::HashGridStorage::getSize(), sgpp::base::Grid::getStorage(), and python.statsfileInfo::i.
|
explicit |
Constructor, reading from existing database.
filename | filename of database file |
References dim(), and python.datasetAnalysis::ftype.
sgpp::base::GridDataBase::~GridDataBase | ( | ) |
Destructor.
References clear().
GridDataBase::grid_map_iterator sgpp::base::GridDataBase::begin | ( | ) |
Return iterator to beginning.
Entries are of type pair<GridPoint, double>.
Referenced by dim().
void sgpp::base::GridDataBase::clear | ( | ) |
|
inline |
Returns the dimensionality of the grid points.
References ascii, begin(), end(), load(), and save().
Referenced by python.uq.dists.KDEDist.KDEDist::cov(), python.uq.dists.NatafDist.NatafDist::getDim(), GridDataBase(), load(), python.uq.dists.KDEDist.KDEDist::rvs(), and python.uq.dists.NatafDist.NatafDist::rvs().
GridDataBase::grid_map_iterator sgpp::base::GridDataBase::end | ( | ) |
double sgpp::base::GridDataBase::get | ( | GridPoint * | gi | ) |
Get value for grid point from database.
Return NULL if not existant.
gi | a grid point |
References sgpp::base::HashGridPoint::toString().
bool sgpp::base::GridDataBase::hasKey | ( | GridPoint * | gi | ) |
Test, whether database already contains a grid point.
gi | a grid point |
void sgpp::base::GridDataBase::load | ( | const std::string | filename | ) |
Loads database in ASCII or binary format.
Adds (grid point - value) mappings to current database. Overwrites existing entries. To load a new database, use GridDataBase::GridDataBase(std::string filename).
filename | name of file |
References ascii, binary, dim(), python.utils.converter::filename, python.datasetAnalysis::ftype, and sgpp::base::HashGridPoint::set().
Referenced by dim().
void sgpp::base::GridDataBase::remove | ( | GridPoint * | gi | ) |
Remove grid point from database.
Do nothing, if not in database.
gi | grid point |
Referenced by python.uq.uq_setting.UQSetting.UQSetting::cleanUp().
void sgpp::base::GridDataBase::save | ( | std::string | filename, |
char | ftype = GridDataBase::ascii |
||
) |
void sgpp::base::GridDataBase::set | ( | GridPoint * | gi, |
double | value | ||
) |
Store (grid point - value) pair in database.
gi | a grid point |
value | the value to store |
void sgpp::base::GridDataBase::setValuesFor | ( | Grid * | grid, |
DataVector & | values | ||
) |
Set values for given grid from stored ones in database.
grid | a grid |
values | the corresponding coefficient vector |
References sgpp::base::HashGridStorage::begin(), sgpp::base::HashGridStorage::end(), and sgpp::base::Grid::getStorage().
|
inline |
Returns the number of grid points that are currently stored in the database.
std::string sgpp::base::GridDataBase::toString | ( | ) |
Returns std::string representation of database.
Referenced by python.controller.LearnerEventController.LearnerEventController::__repr__(), python.controller.SolverEventController.SolverEventController::__repr__(), python.uq.learner.Learner.Learner::createMemento(), python.learner.Learner.Learner::createMemento(), and python.learner.formatter.GridFormatter.GridFormatter::serialize().
|
static |
Referenced by load().