Singleton class SimulationCore. More...
#include <SimulationCore.h>
Public Member Functions | |
~SimulationCore () | |
Destructor. | |
void | exec () |
void | init () |
void | terminate () |
void | abort (string msg) |
GreensFunction * | greensFunction () |
LoadFunction * | loadFunction () |
DataOutPlugin * | dataOutPlugin () |
unsigned int | getLoadFunctionComponent () |
void | setLoadFunctionComponent (unsigned int i) |
unsigned int | getNumberOfLoadComponents () |
void | registerParam (ParamWrapper *param, const char *name, PluginCategory category) |
const char * | outFile () |
int | sizeX () |
int | sizeY () |
int | sizeT () |
int | gridSize () |
int | minX () |
int | minY () |
int | modelTime () |
int | modelStep () |
int | stepSize () |
int | xIndex () |
int | yIndex () |
int | zIndex () |
int | getDimensions () |
int | getTimesteps () |
int | displacementDimensions () |
int | getQuadrant () |
void | setQuadrant (int) |
void | setModelData (double **) |
double ** | getModelData () |
void | runExperimentManager () |
void | runPluginManager () |
void | installPlugin (string) |
PluginManager * | pluginManager () |
list< string > | getRegisteredParameters (PluginCategory cat) |
void | deleteRegistrees () |
list< string > | getRequestedNames () |
void | deleteRequests () |
int | getOperatorSpaceX () |
int | getOperatorSpaceY () |
void | setOperatorSpace (int, int) |
bool | operatorSpaceIsSet () |
string | getPluginFilename (string, string) throw (DatabaseError) |
void | registerOutputField (int *output_index, FieldName field) |
string | currentJob () |
void | setQuiet (bool) |
bool | isQuiet () |
green_exec_function | addGreenPlugin (string plugin) throw (FileNotFound, runtime_error) |
load_exec_function | addLoadPlugin (string plugin) throw (FileNotFound, runtime_error) |
run_function | addKernelPlugin (string plugin) throw (FileNotFound, runtime_error) |
run_function | addPostprocessorPlugin (string plugin) throw (FileNotFound, runtime_error) |
loadhistory_exec_function | addLoadHistoryPlugin (string plugin) throw (FileNotFound, runtime_error) |
crustaldecay_exec_function | addCrustalDecayPlugin (string plugin) throw (FileNotFound, runtime_error) |
Static Public Member Functions | |
static SimulationCore * | instance (int argc, char **argv) throw () |
static SimulationCore * | instance () throw () |
Static Public Attributes | |
static s_parameters | s_params = {} |
public struct keeping the command line arguments | |
Private Member Functions | |
SimulationCore (int argc, char **argv) throw (SeriousException) | |
hidden constructor, the SimulationCore shall be a singleton | |
SimulationCore (const SimulationCore &x) | |
hidden copy constructor - we do not want to accidentially copy objects | |
SimulationCore const & | operator= (SimulationCore const &rvalue) |
hidden assignment operator - we do not want to accidentially copy objects | |
Private Attributes | |
InputHandler * | com_port |
ExperimentManager * | exp_man |
PluginManager * | plugin_man |
Plugin * | pl_kernel |
DataOutPlugin * | pl_out |
GreensFunction * | greens_function |
LoadFunction * | load_function |
unsigned int | load_function_component |
int | x_west |
int | x_east |
int | y_south |
int | y_north |
int | gridsize |
int | modelstep |
int | modeltime |
int | num_timesteps |
int | num_timeincrement |
int | stepsize |
int | quadrant |
int | dimensions |
int | x_index |
int | y_index |
int | z_index |
map< int *, int > | add_field_map |
double ** | model_data |
list< Plugin * >::iterator | pl_iter |
list< Plugin * > | requested_plugin_list |
list< Plugin * > | pl_list_postprocess |
string | root_dir |
int | operator_space_x |
int | operator_space_y |
bool | operator_space_set |
unsigned int | num_load_components |
bool | quiet |
Static Private Attributes | |
static SimulationCore * | pSimulationCore = 0 |
static Singleton initialisieren |
Singleton class SimulationCore.
The SimulationCore is implemented following the Singleton Design Pattern, wich makes sure one and only one instance of the class SimulationCore will exist during an application run. This makes sense for various reasons. The most important is certainly that a SimulationCore is the application.
The main() function will get a pointer to this class by calling the instance(int, char**) function. Its main function is to build, init, run and terminate all parts of the application at the right time. The SimulationCore also keeps the simulation clock.
SimulationCore::SimulationCore | ( | int | argc, | |
char ** | argv | |||
) | throw (SeriousException) [private] |
hidden constructor, the SimulationCore shall be a singleton
References DIR_SEP, EXPERIMENT_DB, EXPERIMENT_DIR, PLUGIN_DB, and PLUGIN_DIR.
Referenced by instance().
SimulationCore::SimulationCore | ( | const SimulationCore & | x | ) | [private] |
hidden copy constructor - we do not want to accidentially copy objects
SimulationCore::~SimulationCore | ( | ) |
Destructor.
References com_port, greens_function, load_function, pl_kernel, and pl_out.
void SimulationCore::abort | ( | string | msg | ) |
Referenced by crusde_request_crustaldecay_plugin(), crusde_request_green_plugin(), crusde_request_kernel_plugin(), crusde_request_load_plugin(), crusde_request_loadhistory_plugin(), crusde_request_postprocessor_plugin(), init(), LoadFunction::load(), GreensFunction::load(), registerOutputField(), and terminate().
crustaldecay_exec_function SimulationCore::addCrustalDecayPlugin | ( | string | plugin | ) | throw (FileNotFound, runtime_error) |
References CrustalDecayPlugin::getValueFunction(), CrustalDecayPlugin::load(), and Plugin::registerParameter().
Referenced by crusde_request_crustaldecay_plugin().
green_exec_function SimulationCore::addGreenPlugin | ( | string | plugin | ) | throw (FileNotFound, runtime_error) |
References crusde_info(), GreenPlugin::getArrayFunction(), GreenPlugin::load(), Plugin::registerOutputFields(), and Plugin::registerParameter().
Referenced by crusde_request_green_plugin().
run_function SimulationCore::addKernelPlugin | ( | string | plugin | ) | throw (FileNotFound, runtime_error) |
References Plugin::getRunFunction(), Plugin::load(), and Plugin::registerParameter().
Referenced by crusde_request_kernel_plugin().
loadhistory_exec_function SimulationCore::addLoadHistoryPlugin | ( | string | plugin | ) | throw (FileNotFound, runtime_error) |
References LoadHistoryPlugin::getValueFunction(), LoadHistoryPlugin::load(), and Plugin::registerParameter().
Referenced by crusde_request_loadhistory_plugin().
load_exec_function SimulationCore::addLoadPlugin | ( | string | plugin | ) | throw (FileNotFound, runtime_error) |
References LoadPlugin::getValueFunction(), LoadPlugin::load(), and Plugin::registerParameter().
Referenced by crusde_request_load_plugin().
run_function SimulationCore::addPostprocessorPlugin | ( | string | plugin | ) | throw (FileNotFound, runtime_error) |
References Plugin::getRunFunction(), Plugin::load(), and Plugin::registerParameter().
Referenced by crusde_request_postprocessor_plugin().
string SimulationCore::currentJob | ( | ) |
References greens_function, and GreensFunction::job().
DataOutPlugin* SimulationCore::dataOutPlugin | ( | ) | [inline] |
References pl_out.
void SimulationCore::deleteRegistrees | ( | ) |
deletes all parameters of a specific category
cat | plugin category |
References s_parameters::crustaldecay, s_parameters::datahandler, s_parameters::green, s_parameters::kernel, s_parameters::load, s_parameters::loadhistory, and s_parameters::postprocessor.
Referenced by PluginManager::addEntry().
void SimulationCore::deleteRequests | ( | ) |
References pl_iter, and requested_plugin_list.
Referenced by PluginManager::addEntry().
int SimulationCore::displacementDimensions | ( | ) |
References x_index, y_index, and z_index.
Referenced by crusde_get_displacement_dimensions().
void SimulationCore::exec | ( | ) |
go!go!go!
References ExperimentManager::addEntry(), com_port, crusde_info(), exp_man, InputHandler::getExperiment(), greens_function, GreensFunction::isLastJob(), GreensFunction::job(), modelstep, modeltime, GreensFunction::nextJob(), num_timeincrement, num_timesteps, outFile(), pl_iter, pl_kernel, pl_list_postprocess, pl_out, Plugin::run(), and GreensFunction::setFirstJob().
Referenced by main().
int SimulationCore::getDimensions | ( | ) |
References dimensions.
Referenced by crusde_get_dimensions().
unsigned int SimulationCore::getLoadFunctionComponent | ( | ) |
returns the id of the load component we are currently working with
References load_function_component.
Referenced by crusde_get_current_load_component(), LoadFunction::crustalDecayGiven(), LoadFunction::getCrustalDecayValueAt(), LoadFunction::getHistoryValueAt(), getRegisteredParameters(), LoadFunction::getValueAt(), LoadFunction::loadHistoryGiven(), and registerParam().
double ** SimulationCore::getModelData | ( | ) |
References model_data.
Referenced by crusde_get_result().
unsigned int SimulationCore::getNumberOfLoadComponents | ( | ) |
returns total number of load components, id's start at zero!
References num_load_components.
Referenced by crusde_get_number_of_load_components(), and crusde_get_number_of_loads().
int SimulationCore::getOperatorSpaceX | ( | ) |
References operator_space_x.
Referenced by crusde_get_operator_space().
int SimulationCore::getOperatorSpaceY | ( | ) |
References operator_space_y.
Referenced by crusde_get_operator_space().
string SimulationCore::getPluginFilename | ( | string | category, | |
string | name | |||
) | throw (DatabaseError) |
References backpack.
int SimulationCore::getQuadrant | ( | ) |
References quadrant.
Referenced by crusde_get_quadrant().
list< string > SimulationCore::getRegisteredParameters | ( | PluginCategory | category | ) |
cat | Plugin category |
References crusde_warning(), s_parameters::crustaldecay, CRUSTALDECAY_PLUGIN, s_parameters::datahandler, DATAOUT_PLUGIN, getLoadFunctionComponent(), s_parameters::green, GREEN_PLUGIN, s_parameters::kernel, KERNEL_PLUGIN, s_parameters::load, LOAD_PLUGIN, s_parameters::loadhistory, LOADHISTORY_PLUGIN, POSTPROCESS_PLUGIN, and s_parameters::postprocessor.
Referenced by PluginManager::addToDB().
list< string > SimulationCore::getRequestedNames | ( | ) |
References pl_iter, and requested_plugin_list.
Referenced by PluginManager::addToDB().
int SimulationCore::getTimesteps | ( | ) |
References num_timesteps.
Referenced by crusde_get_timesteps().
GreensFunction* SimulationCore::greensFunction | ( | ) | [inline] |
References greens_function.
Referenced by crusde_get_green_at().
int SimulationCore::gridSize | ( | ) |
References gridsize.
Referenced by crusde_get_gridsize().
void SimulationCore::init | ( | ) |
References abort(), com_port, crusde_info(), exp_man, PluginManager::getFilename(), InputHandler::getGreenJobMap(), InputHandler::getGridSize(), InputHandler::getKernelPlugin(), InputHandler::getLoadFunctionList(), InputHandler::getOutputPlugin(), InputHandler::getPostProcessorNameList(), InputHandler::getRegion(), InputHandler::getTimeIncrement(), InputHandler::getTimeSteps(), greens_function, gridsize, LoadFunction::init(), GreensFunction::init(), Plugin::init(), DatabaseManager::init(), InputHandler::init(), InputHandler::initParamsFromDOM(), DataOutPlugin::load(), Plugin::load(), LoadFunction::load(), GreensFunction::load(), load_function, num_timeincrement, num_timesteps, operatorSpaceIsSet(), pl_iter, pl_kernel, pl_list_postprocess, pl_out, plugin_man, GreensFunction::registerOutputFields(), Plugin::registerParameter(), LoadFunction::registerParameter(), GreensFunction::registerParameter(), requested_plugin_list, Plugin::requestPlugins(), LoadFunction::requestPlugins(), GreensFunction::requestPlugins(), x_east, x_west, y_north, and y_south.
Referenced by main().
void SimulationCore::installPlugin | ( | string | plugin | ) |
References PluginManager::addEntry(), crusde_error(), crusde_warning(), DatabaseManager::init(), plugin_man, and pSimulationCore.
Referenced by InputHandler::readCommandline().
static SimulationCore* SimulationCore::instance | ( | ) | throw () [inline, static] |
SimulationCore::instance returns the only existing instance
References pSimulationCore.
Referenced by PluginManager::addEntry(), ExperimentManager::addEntry(), PluginManager::addToDB(), crusde_crustal_decay_given(), crusde_exit(), crusde_get_crustal_decay_at(), crusde_get_current_load_component(), crusde_get_dimensions(), crusde_get_displacement_dimensions(), crusde_get_green_at(), crusde_get_gridsize(), crusde_get_load_at(), crusde_get_load_history_at(), crusde_get_min_x(), crusde_get_min_y(), crusde_get_number_of_load_components(), crusde_get_number_of_loads(), crusde_get_operator_space(), crusde_get_out_file(), crusde_get_quadrant(), crusde_get_result(), crusde_get_size_t(), crusde_get_size_x(), crusde_get_size_y(), crusde_get_timesteps(), crusde_get_x_index(), crusde_get_y_index(), crusde_get_z_index(), crusde_info(), crusde_load_history_given(), crusde_model_step(), crusde_model_time(), crusde_register_optional_param_double(), crusde_register_optional_param_string(), crusde_register_output_field(), crusde_register_param_double(), crusde_register_param_string(), crusde_request_crustaldecay_plugin(), crusde_request_green_plugin(), crusde_request_kernel_plugin(), crusde_request_load_plugin(), crusde_request_loadhistory_plugin(), crusde_request_postprocessor_plugin(), crusde_set_current_load_component(), crusde_set_operator_space(), crusde_set_quadrant(), crusde_set_result(), crusde_stepsize(), LoadFunction::crustalDecayGiven(), InputHandler::getCrustalDecayPlugin(), LoadFunction::getCrustalDecayValueAt(), InputHandler::getGreenJobMap(), InputHandler::getGreenPlugin(), LoadFunction::getHistoryValueAt(), InputHandler::getKernelPlugin(), InputHandler::getLoadHistoryPlugin(), InputHandler::getLoadPlugin(), InputHandler::getOutputPlugin(), LoadFunction::getValueAt(), LoadFunction::init(), InputHandler::init(), LoadFunction::load(), GreensFunction::load(), LoadFunction::loadHistoryGiven(), main(), InputHandler::readCommandline(), LoadFunction::registerOutputFields(), registerParam(), LoadFunction::registerParameter(), LoadFunction::release(), LoadFunction::requestPlugins(), and LoadFunction::unload().
static SimulationCore* SimulationCore::instance | ( | int | argc, | |
char ** | argv | |||
) | throw () [inline, static] |
SimulationCore::instance initializes singleton object in case it does not exist. returns the only existing instance
References crusde_error(), pSimulationCore, and SimulationCore().
bool SimulationCore::isQuiet | ( | ) |
returns a flag for quiet, i.e. no output to commandline, runs
References quiet.
LoadFunction* SimulationCore::loadFunction | ( | ) | [inline] |
References load_function.
Referenced by crusde_crustal_decay_given(), crusde_get_crustal_decay_at(), crusde_get_load_at(), crusde_get_load_history_at(), and crusde_load_history_given().
int SimulationCore::minX | ( | ) |
References x_west.
Referenced by crusde_get_min_x().
int SimulationCore::minY | ( | ) |
References y_south.
Referenced by crusde_get_min_y().
int SimulationCore::modelStep | ( | ) |
References modelstep.
Referenced by crusde_model_step().
int SimulationCore::modelTime | ( | ) |
References modeltime.
Referenced by crusde_model_time().
SimulationCore const& SimulationCore::operator= | ( | SimulationCore const & | rvalue | ) | [private] |
hidden assignment operator - we do not want to accidentially copy objects
bool SimulationCore::operatorSpaceIsSet | ( | ) |
References operator_space_set.
Referenced by init().
const char * SimulationCore::outFile | ( | ) |
References com_port, and InputHandler::getResultFileName().
Referenced by crusde_get_out_file(), and exec().
PluginManager * SimulationCore::pluginManager | ( | ) |
void SimulationCore::registerOutputField | ( | int * | output_index, | |
FieldName | field | |||
) |
References abort(), ADD_FIELD, add_field_map, crusde_warning(), dimensions, X_FIELD, x_index, Y_FIELD, y_index, Z_FIELD, and z_index.
Referenced by crusde_register_output_field().
void SimulationCore::registerParam | ( | ParamWrapper * | param, | |
const char * | name, | |||
PluginCategory | category | |||
) |
stick parameter that's being registered by a plug-in into the parameter registry
References crusde_error(), s_parameters::crustaldecay, CRUSTALDECAY_PLUGIN, s_parameters::datahandler, DATAOUT_PLUGIN, getLoadFunctionComponent(), s_parameters::green, GREEN_PLUGIN, instance(), s_parameters::kernel, KERNEL_PLUGIN, s_parameters::load, LOAD_PLUGIN, s_parameters::loadhistory, LOADHISTORY_PLUGIN, POSTPROCESS_PLUGIN, s_parameters::postprocessor, and s_params.
Referenced by crusde_register_optional_param_double(), crusde_register_optional_param_string(), crusde_register_param_double(), and crusde_register_param_string().
void SimulationCore::runExperimentManager | ( | ) |
References exp_man, DatabaseManager::init(), pSimulationCore, and ExperimentManager::run().
Referenced by InputHandler::readCommandline().
void SimulationCore::runPluginManager | ( | ) |
References DatabaseManager::init(), plugin_man, pSimulationCore, and PluginManager::run().
Referenced by InputHandler::readCommandline().
void SimulationCore::setLoadFunctionComponent | ( | unsigned int | id | ) |
sets value of the load component that is currently to be worked with to given id keeps also track of the total number of load components (max id == number of load components)
References load_function_component, and num_load_components.
Referenced by crusde_set_current_load_component(), LoadFunction::init(), LoadFunction::load(), LoadFunction::registerOutputFields(), LoadFunction::registerParameter(), LoadFunction::release(), LoadFunction::requestPlugins(), and LoadFunction::unload().
void SimulationCore::setModelData | ( | double ** | result | ) |
References model_data, pl_out, and DataOutPlugin::setModelData().
Referenced by crusde_set_result().
void SimulationCore::setOperatorSpace | ( | int | nx, | |
int | ny | |||
) |
References operator_space_set, operator_space_x, and operator_space_y.
Referenced by crusde_set_operator_space().
void SimulationCore::setQuadrant | ( | int | q | ) |
References quadrant.
Referenced by crusde_set_quadrant().
void SimulationCore::setQuiet | ( | bool | flag | ) |
sets a flag for quiet, i.e. no output to commandline, runs
References quiet.
Referenced by InputHandler::init(), and InputHandler::readCommandline().
int SimulationCore::sizeT | ( | ) |
References num_timesteps.
Referenced by crusde_get_size_t().
int SimulationCore::sizeX | ( | ) |
References gridsize, x_east, and x_west.
Referenced by crusde_get_size_x().
int SimulationCore::sizeY | ( | ) |
References gridsize, y_north, and y_south.
Referenced by crusde_get_size_y().
int SimulationCore::stepSize | ( | ) |
References stepsize.
Referenced by crusde_stepsize().
void SimulationCore::terminate | ( | ) |
References abort(), greens_function, load_function, pl_iter, pl_kernel, pl_list_postprocess, pl_out, pSimulationCore, Plugin::release(), LoadFunction::release(), GreensFunction::release(), requested_plugin_list, Plugin::unload(), LoadFunction::unload(), and GreensFunction::unload().
Referenced by ExperimentManager::addEntry(), crusde_exit(), and main().
int SimulationCore::xIndex | ( | ) |
References x_index.
Referenced by crusde_get_x_index().
int SimulationCore::yIndex | ( | ) |
References y_index.
Referenced by crusde_get_y_index().
int SimulationCore::zIndex | ( | ) |
References z_index.
Referenced by crusde_get_z_index().
map<int*, int> SimulationCore::add_field_map [private] |
Referenced by registerOutputField().
InputHandler* SimulationCore::com_port [private] |
hard-wired input handler, no plugin
Referenced by exec(), init(), outFile(), and ~SimulationCore().
int SimulationCore::dimensions [private] |
Referenced by getDimensions(), and registerOutputField().
ExperimentManager* SimulationCore::exp_man [private] |
hard-wired experiment Manager, no plugin
Referenced by exec(), init(), and runExperimentManager().
GreensFunction* SimulationCore::greens_function [private] |
Green's Function plug in, one factor for convolution
Referenced by currentJob(), exec(), greensFunction(), init(), terminate(), and ~SimulationCore().
int SimulationCore::gridsize [private] |
Referenced by gridSize(), init(), sizeX(), and sizeY().
LoadFunction* SimulationCore::load_function [private] |
Load function, holds all loads and histories
Referenced by init(), loadFunction(), terminate(), and ~SimulationCore().
unsigned int SimulationCore::load_function_component [private] |
Referenced by getLoadFunctionComponent(), and setLoadFunctionComponent().
double** SimulationCore::model_data [private] |
Referenced by getModelData(), and setModelData().
int SimulationCore::modelstep [private] |
the model step. an integer that is increased with each timestep
Referenced by exec(), and modelStep().
int SimulationCore::modeltime [private] |
the model time. an integer that is increased with each timestep
Referenced by exec(), and modelTime().
unsigned int SimulationCore::num_load_components [private] |
Referenced by getNumberOfLoadComponents(), and setLoadFunctionComponent().
int SimulationCore::num_timeincrement [private] |
int SimulationCore::num_timesteps [private] |
maximum number of timesteps we want to simulate
Referenced by exec(), getTimesteps(), init(), and sizeT().
bool SimulationCore::operator_space_set [private] |
Referenced by operatorSpaceIsSet(), and setOperatorSpace().
int SimulationCore::operator_space_x [private] |
Referenced by getOperatorSpaceX(), and setOperatorSpace().
int SimulationCore::operator_space_y [private] |
Referenced by getOperatorSpaceY(), and setOperatorSpace().
list<Plugin*>::iterator SimulationCore::pl_iter [private] |
Referenced by deleteRequests(), exec(), getRequestedNames(), init(), and terminate().
Plugin* SimulationCore::pl_kernel [private] |
Plug-in instance taking care on the simulation kernel
Referenced by exec(), init(), terminate(), and ~SimulationCore().
list<Plugin*> SimulationCore::pl_list_postprocess [private] |
buffer for all the postprocessor plugins that might be loaded
Referenced by exec(), init(), and terminate().
DataOutPlugin* SimulationCore::pl_out [private] |
Plug-in instance handling data output
Referenced by dataOutPlugin(), exec(), init(), setModelData(), terminate(), and ~SimulationCore().
PluginManager* SimulationCore::plugin_man [private] |
hard-wired plugin Manager, no plugin ;)
Referenced by init(), installPlugin(), pluginManager(), and runPluginManager().
SimulationCore * SimulationCore::pSimulationCore = 0 [static, private] |
static Singleton initialisieren
pointer to the only instance of SimulationCore
Referenced by installPlugin(), instance(), runExperimentManager(), runPluginManager(), and terminate().
int SimulationCore::quadrant [private] |
Referenced by getQuadrant(), and setQuadrant().
bool SimulationCore::quiet [private] |
Referenced by isQuiet(), and setQuiet().
list<Plugin*> SimulationCore::requested_plugin_list [private] |
buffer for all the plugins that will be loaded by other plugins. they only have to be kept in memory so the function pointer stay valid. but noone else will ever need to access them individually, only as a group to perform Plugin functions
Referenced by deleteRequests(), getRequestedNames(), init(), and terminate().
string SimulationCore::root_dir [private] |
s_parameters SimulationCore::s_params = {} [static] |
public struct keeping the command line arguments
Referenced by InputHandler::initParamsFromDOM(), and registerParam().
int SimulationCore::stepsize [private] |
time increment with each model step
Referenced by stepSize().
int SimulationCore::x_east [private] |
int SimulationCore::x_index [private] |
Referenced by displacementDimensions(), registerOutputField(), and xIndex().
int SimulationCore::x_west [private] |
int SimulationCore::y_index [private] |
Referenced by displacementDimensions(), registerOutputField(), and yIndex().
int SimulationCore::y_north [private] |
int SimulationCore::y_south [private] |
int SimulationCore::z_index [private] |
Referenced by displacementDimensions(), registerOutputField(), and zIndex().