#include "constants.h"
#include "config.h"
#include "stdarg.h"
Go to the source code of this file.
Defines | |
#define | boolean int |
#define | true 1 |
#define | false 0 |
#define | NOT_TIME_DEPENDENT false |
#define | TIME_DEPENDENT true |
Enumerations | |
enum | PluginCategory { LOAD_PLUGIN = 0, KERNEL_PLUGIN = 1, GREEN_PLUGIN = 2, DATAOUT_PLUGIN = 3, POSTPROCESS_PLUGIN = 4, LOADHISTORY_PLUGIN = 5, CRUSTALDECAY_PLUGIN = 6 } |
enum | FieldName { X_FIELD = 0, Y_FIELD = 1, Z_FIELD = 2, ADD_FIELD = 3 } |
enum | ExitCode { ERROR_MSG = -1, NOERROR = 0 } |
Functions | |
void | crusde_error (const char *format,...) |
Prints error message to stderr, exists CrusDe with code ERROR_MSG. | |
void | crusde_debug (const char *format,...) |
Prints debug messages to stderr if compiled with -DDEBUG. | |
void | crusde_warning (const char *format,...) |
Prints warning message to stderr. | |
void | crusde_info (const char *format,...) |
Prints information message to stdout. | |
double * | crusde_register_param_double (const char *param_name, PluginCategory) |
Register double parameter that is required by a plug-in. | |
double * | crusde_register_optional_param_double (const char *param_name, PluginCategory, double) |
Register optional double parameter for a plug-in. | |
char ** | crusde_register_param_string (const char *param_name, PluginCategory) |
Register string parameter that is required by a plug-in, e.g. if you need a file name. | |
char ** | crusde_register_optional_param_string (const char *param_name, PluginCategory, char *) |
Register optional string parameter for a plug-in, e.g. if you want to allow for an optional output file. | |
void | crusde_register_output_field (int *position, FieldName) |
Request space in the output array. This allocates necessary memory for your results. | |
int | crusde_get_size_x () |
X, Easting dimension of the spatial grid. | |
int | crusde_get_size_y () |
Y, Northing dimension of the spatial grid. | |
int | crusde_get_size_t () |
Basically the number of time steps to be modeled. | |
int | crusde_get_gridsize () |
get size of spatial grid defined in XML model file | |
int | crusde_get_min_x () |
Minimum X value, i.e. Western limit of the region of interest. | |
int | crusde_get_min_y () |
Minimum Y value, i.e. Southern limit of the region of interest. | |
int | crusde_get_dimensions () |
total number of output dimensions | |
int | crusde_get_displacement_dimensions () |
displacement dimensions that are modeled, e.g. X, Z or X,Y or Z only | |
int | crusde_model_time () |
return current model time | |
int | crusde_get_timesteps () |
returns total number of time steps | |
int | crusde_model_step () |
return current model step, i.e. number of iterations done (temporally) | |
int | crusde_stepsize () |
Time increment with each model step. | |
int | crusde_get_x_index () |
Index of X-displacement value in output array. | |
int | crusde_get_y_index () |
Index of y-displacement value in output array. | |
int | crusde_get_z_index () |
Index of Z-displacement value in output array. | |
const char * | crusde_get_observation_file () |
const char * | crusde_get_out_file () |
Returns the name of the result file as defined in the XML model file. | |
int | crusde_get_green_at (double **res, int x, int y) |
Get value of Green's function at a specific coordinate. | |
double | crusde_get_load_at (int x, int y) |
Get value of Load function at Point p(x,y). | |
double | crusde_get_load_history_at (int t) |
Get value of Load History function at time t. | |
double | crusde_get_crustal_decay_at (int t) |
Get value of Crustal Decay function at time t. | |
void | crusde_set_result (double **) |
hand model result to Simulation Core | |
double ** | crusde_get_result () |
retrieve model result from Simulation Core | |
void | crusde_set_quadrant (int) |
Set Coordinate system quadrant (1-4) that we're currently working in. | |
int | crusde_get_quadrant () |
Get Coordinate system quadrant (1-4) that we're currently working in. | |
void | crusde_exit (ExitCode code) |
Gracefully terminates CrusDe, i.e. shuts down the whole system before exiting with ExitCode 'code'. | |
int | crusde_get_current_load_component () |
Returns the current load function id such that the load plugins can set the parameter pointers to the respective array index. | |
void | crusde_set_current_load_component (int) |
Update currend load component id. | |
int | crusde_get_number_of_loads () |
Get total number of load functions defined in the XML model file. | |
void | crusde_set_operator_space (int, int) |
Operator can set the spatial dimensions it works on. | |
void | crusde_get_operator_space (int *, int *) |
Read model dimensions, i.e. Region of Interest. | |
boolean | crusde_crustal_decay_given () |
Has a crustal decay function been defined? | |
boolean | crusde_load_history_given () |
Has a load history function been defined? | |
green_exec_function | crusde_request_green_plugin (char *plugin) |
A Green's function plugin can request the run time function of another Green's function plug-in to reuse its functionality. | |
load_exec_function | crusde_request_load_plugin (char *plugin) |
A Load function plugin can request the run time function of another Load function plug-in to reuse its functionality. | |
run_function | crusde_request_kernel_plugin (char *plugin) |
An Operator/Kernel plugin can request the run time function of another operator/kernel plug-in to reuse its functionality. | |
run_function | crusde_request_postprocessor_plugin (char *plugin) |
A Postprocessor plugin can request the run time function of another Postprocessor plug-in to reuse its functionality. | |
loadhistory_exec_function | crusde_request_loadhistory_plugin (char *plugin) |
A Load history function plugin can request the run time function of another Load history function plug-in to reuse its functionality. | |
crustaldecay_exec_function | crusde_request_crustaldecay_plugin (char *plugin) |
A Crustal decay function plugin can request the run time function of another Crustal decay function plug-in to reuse its functionality. |
#define boolean int |
#define false 0 |
#define NOT_TIME_DEPENDENT false |
#define TIME_DEPENDENT true |
#define true 1 |
enum ExitCode |
enum FieldName |
enum PluginCategory |
boolean crusde_crustal_decay_given | ( | ) |
Has a crustal decay function been defined?
References LoadFunction::crustalDecayGiven(), SimulationCore::instance(), and SimulationCore::loadFunction().
Referenced by run().
void crusde_debug | ( | const char * | format, | |
... | ||||
) |
Prints debug messages to stderr if compiled with -DDEBUG.
This function prints a debug message to stderr if CrusDe was compiled with flag -DDEBUG; else nothing is printed; hence debug statements can stay with the code. It is strongly recommended to use this function that works exactly like printf, instead of printf. This way the output of CrusDe is not cluttered with tests and development messages.
format | A formatted string following the sprintf conventions | |
... | Elipsis containing the values to be plugged into the format string |
Referenced by crusde_register_optional_param_double(), crusde_register_optional_param_string(), crusde_register_param_double(), crusde_register_param_string(), ExperimentManager::ExperimentManager(), InputHandler::getAttributeValue(), InputHandler::getAttributeValueByName(), InputHandler::getGreenJobMap(), InputHandler::getLoadFunctionList(), init(), InputHandler::initParamsFromDOM(), Plugin::load(), LoadPlugin::load(), LoadHistoryPlugin::load(), GreenPlugin::load(), DataOutPlugin::load(), CrustalDecayPlugin::load(), Plugin::Plugin(), PluginManager::PluginManager(), read_alma_output(), InputHandler::readCommandline(), XMLHandler::readXML(), run(), DataOutPlugin::setModelData(), Plugin::unload(), XMLHandler::writeXML(), XMLHandler::XMLHandler(), CrustalDecayPlugin::~CrustalDecayPlugin(), DataOutPlugin::~DataOutPlugin(), GreenPlugin::~GreenPlugin(), InputHandler::~InputHandler(), LoadHistoryPlugin::~LoadHistoryPlugin(), LoadPlugin::~LoadPlugin(), Plugin::~Plugin(), XMLCore::~XMLCore(), and XMLHandler::~XMLHandler().
void crusde_error | ( | const char * | format, | |
... | ||||
) |
Prints error message to stderr, exists CrusDe with code ERROR_MSG.
This function prints an error message to stderr. It works exactly like printf, hence complex message printing is possible. The simulation run will be terminated by calling crusde_exist with the error code ERROR_MSG.
format | A formatted string following the sprintf conventions | |
... | Elipsis containing the values to be plugged into the format string |
References crusde_exit(), and ERROR_MSG.
Referenced by PluginManager::deleteEntry(), InputHandler::getGreenJobMap(), init(), InputHandler::init(), InputHandler::initParamsFromDOM(), SimulationCore::installPlugin(), SimulationCore::instance(), main(), ParamWrapper::newDouble(), ParamWrapper::newString(), InputHandler::readCommandline(), XMLHandler::readXML(), SimulationCore::registerParam(), and ParamWrapper::setValue().
void crusde_exit | ( | ExitCode | code | ) |
Gracefully terminates CrusDe, i.e. shuts down the whole system before exiting with ExitCode 'code'.
References SimulationCore::instance(), and SimulationCore::terminate().
Referenced by crusde_error(), init(), and read_alma_output().
double crusde_get_crustal_decay_at | ( | int | t | ) |
Get value of Crustal Decay function at time t.
t | Time for which the crustal decay function value is sought. |
References LoadFunction::getCrustalDecayValueAt(), SimulationCore::instance(), and SimulationCore::loadFunction().
Referenced by run().
int crusde_get_current_load_component | ( | ) |
Returns the current load function id such that the load plugins can set the parameter pointers to the respective array index.
References SimulationCore::getLoadFunctionComponent(), and SimulationCore::instance().
Referenced by clear(), get_value_at(), init(), register_parameter(), and set_history_function().
int crusde_get_dimensions | ( | ) |
total number of output dimensions
References SimulationCore::getDimensions(), and SimulationCore::instance().
int crusde_get_displacement_dimensions | ( | ) |
displacement dimensions that are modeled, e.g. X, Z or X,Y or Z only
References SimulationCore::displacementDimensions(), and SimulationCore::instance().
Referenced by init().
int crusde_get_green_at | ( | double ** | result, | |
int | x, | |||
int | y | |||
) |
Get value of Green's function at a specific coordinate.
result | pointer to array to which the Green's function (possibly for 3 spatial dimensions) is written | |
x,y | spatial coordinates for which the Green's function is requested |
References GreensFunction::getValueArrayAt(), SimulationCore::greensFunction(), and SimulationCore::instance().
Referenced by run().
int crusde_get_gridsize | ( | ) |
get size of spatial grid defined in XML model file
References SimulationCore::gridSize(), and SimulationCore::instance().
Referenced by get_value_at(), and init().
double crusde_get_load_at | ( | int | x, | |
int | y | |||
) |
Get value of Load function at Point p(x,y).
x,y | X,Y coordinates of grid point at which the load value is sought. |
References LoadFunction::getValueAt(), SimulationCore::instance(), and SimulationCore::loadFunction().
Referenced by run().
double crusde_get_load_history_at | ( | int | t | ) |
Get value of Load History function at time t.
t | Time for which the load history value is sought. |
References LoadFunction::getHistoryValueAt(), SimulationCore::instance(), and SimulationCore::loadFunction().
Referenced by run().
int crusde_get_min_x | ( | ) |
Minimum X value, i.e. Western limit of the region of interest.
References SimulationCore::instance(), and SimulationCore::minX().
Referenced by get_value_at(), and init().
int crusde_get_min_y | ( | ) |
Minimum Y value, i.e. Southern limit of the region of interest.
References SimulationCore::instance(), and SimulationCore::minY().
Referenced by get_value_at(), and init().
int crusde_get_number_of_loads | ( | ) |
Get total number of load functions defined in the XML model file.
References SimulationCore::getNumberOfLoadComponents(), and SimulationCore::instance().
Referenced by run().
const char* crusde_get_observation_file | ( | ) |
void crusde_get_operator_space | ( | int * | nx, | |
int * | ny | |||
) |
Read model dimensions, i.e. Region of Interest.
*nx | pointer to memory slot to which the number of fields in X direction is to be written | |
*ny | pointer to memory slot to which the number of fields in Y direction is to be written |
References SimulationCore::getOperatorSpaceX(), SimulationCore::getOperatorSpaceY(), and SimulationCore::instance().
const char* crusde_get_out_file | ( | ) |
Returns the name of the result file as defined in the XML model file.
References SimulationCore::instance(), and SimulationCore::outFile().
Referenced by init().
int crusde_get_quadrant | ( | ) |
Get Coordinate system quadrant (1-4) that we're currently working in.
References SimulationCore::getQuadrant(), and SimulationCore::instance().
Referenced by get_value_at().
double** crusde_get_result | ( | ) |
retrieve model result from Simulation Core
References SimulationCore::getModelData(), and SimulationCore::instance().
Referenced by run().
int crusde_get_size_t | ( | ) |
Basically the number of time steps to be modeled.
References SimulationCore::instance(), and SimulationCore::sizeT().
Referenced by init().
int crusde_get_size_x | ( | ) |
X, Easting dimension of the spatial grid.
References SimulationCore::instance(), and SimulationCore::sizeX().
Referenced by init().
int crusde_get_size_y | ( | ) |
Y, Northing dimension of the spatial grid.
References SimulationCore::instance(), and SimulationCore::sizeY().
Referenced by init().
int crusde_get_timesteps | ( | ) |
returns total number of time steps
References SimulationCore::getTimesteps(), and SimulationCore::instance().
Referenced by init().
int crusde_get_x_index | ( | ) |
Index of X-displacement value in output array.
References SimulationCore::instance(), and SimulationCore::xIndex().
int crusde_get_y_index | ( | ) |
Index of y-displacement value in output array.
References SimulationCore::instance(), and SimulationCore::yIndex().
int crusde_get_z_index | ( | ) |
Index of Z-displacement value in output array.
References SimulationCore::instance(), and SimulationCore::zIndex().
void crusde_info | ( | const char * | format, | |
... | ||||
) |
Prints information message to stdout.
This function prints an information message to stdout. It works exactly like printf, hence complex message printing is possible. The simulation run will be continued.
format | A formatted string following the sprintf conventions | |
... | Elipsis containing the values to be plugged into the format string |
References SimulationCore::instance().
Referenced by SimulationCore::addGreenPlugin(), SimulationCore::exec(), InputHandler::getLoadFunctionList(), InputHandler::getPostProcessorNameList(), SimulationCore::init(), init(), main(), InputHandler::readCommandline(), register_output_fields(), Plugin::registerParameter(), and run().
boolean crusde_load_history_given | ( | ) |
Has a load history function been defined?
References SimulationCore::instance(), SimulationCore::loadFunction(), and LoadFunction::loadHistoryGiven().
Referenced by run().
int crusde_model_step | ( | ) |
return current model step, i.e. number of iterations done (temporally)
References SimulationCore::instance(), and SimulationCore::modelStep().
Referenced by run().
int crusde_model_time | ( | ) |
return current model time
References SimulationCore::instance(), and SimulationCore::modelTime().
Referenced by run().
double* crusde_register_optional_param_double | ( | const char * | name, | |
PluginCategory | category, | |||
double | default_value | |||
) |
Register optional double parameter for a plug-in.
Use this function if your parameter is optional. Be sure to define sensible Parameter names that convey some context of the actual parameter, e.g., 'E' for Young's modulus or 'g' for gravitational acceleration. Keep in mind that the 'name' is case sensitive.
name | Name of the parameter (defines how the parameter has to show up in the XML model file) | |
category | Elipsis containing the values to be plugged into the format string | |
default_value | Obviously the value that this parameter is set to if it's not defined in the input file |
References crusde_debug(), SimulationCore::instance(), ParamWrapper::newDouble(), SimulationCore::registerParam(), and ParamWrapper::setOptional().
char** crusde_register_optional_param_string | ( | const char * | name, | |
PluginCategory | category, | |||
char * | default_value | |||
) |
Register optional string parameter for a plug-in, e.g. if you want to allow for an optional output file.
Use this function if your parameter is optional. Be sure to define sensible Parameter names that convey some context of the actual parameter, e.g., 'load_file' for a file that defines the surface load, or 'result' for the result file. Keep in mind that the 'name' is case sensitive.
name | Name of the parameter (defines how the parameter has to show up in the XML model file) | |
category | Elipsis containing the values to be plugged into the format string | |
default_value | Obviously the value that this parameter is set to if it's not defined in the input file |
References crusde_debug(), SimulationCore::instance(), ParamWrapper::newString(), SimulationCore::registerParam(), and ParamWrapper::setOptional().
Referenced by register_parameter().
void crusde_register_output_field | ( | int * | position, | |
FieldName | field | |||
) |
Request space in the output array. This allocates necessary memory for your results.
CrusDe manages your memory this way and also assures that your results make it into the output data at the specified position. E.g., if the 'position' you get from CrusDe is 5 you will find your results in column 5 of an ascii table or in the 5th index of a netCDF file.
position | pointer to memory slot to which the output array position will be written. has to show up in the XML model file) | |
field | claim one of the standard fields (e.g. deformation in X/Y/Z direction; or an additional, user defined field) |
References SimulationCore::instance(), and SimulationCore::registerOutputField().
Referenced by register_output_fields().
double* crusde_register_param_double | ( | const char * | name, | |
PluginCategory | category | |||
) |
Register double parameter that is required by a plug-in.
Use this function if your parameter is not optional. Be sure to define sensible Parameter names that convey some context of the actual parameter, e.g., 'E' for Young's modulus or 'g' for gravitational acceleration. Keep in mind that the 'name' is case sensitive.
name | Name of the parameter (defines how the parameter has to show up in the XML model file) | |
category | Elipsis containing the values to be plugged into the format string |
References crusde_debug(), SimulationCore::instance(), ParamWrapper::newDouble(), SimulationCore::registerParam(), and ParamWrapper::setOptional().
Referenced by register_parameter().
char** crusde_register_param_string | ( | const char * | name, | |
PluginCategory | category | |||
) |
Register string parameter that is required by a plug-in, e.g. if you need a file name.
Use this function if your parameter is optional. Be sure to define sensible Parameter names that convey some context of the actual parameter, e.g., 'load_file' for a file that defines the surface load, or 'result' for the result file. Keep in mind that the 'name' is case sensitive.
name | Name of the parameter (defines how the parameter has to show up in the XML model file) | |
category | Elipsis containing the values to be plugged into the format string |
References crusde_debug(), SimulationCore::instance(), ParamWrapper::newString(), SimulationCore::registerParam(), and ParamWrapper::setOptional().
Referenced by register_parameter().
crustaldecay_exec_function crusde_request_crustaldecay_plugin | ( | char * | plugin | ) |
A Crustal decay function plugin can request the run time function of another Crustal decay function plug-in to reuse its functionality.
plugin | Name of the Crustal Decay function to be re-used as defined in Plugin Manager, e.g. "exponential" |
References SimulationCore::abort(), SimulationCore::addCrustalDecayPlugin(), and SimulationCore::instance().
green_exec_function crusde_request_green_plugin | ( | char * | plugin | ) |
A Green's function plugin can request the run time function of another Green's function plug-in to reuse its functionality.
This function implements the concept of plug-in reuse. By allowing access to the run-function of a plugin of the same category, a new plugin can build on existing functionality. Instead of having to reimplement fundamental behavior, CrusDe allows to request an executing function and loads the respective plugin in the background. The reusing plugin does not have to worry about having to remember all the correct parameters for the respective plug-in. CrusDe assures that the input file is being checked for those values and that the values make it into the plugin registry and to the plugin.
plugin | Name of the Green's function to be re-used as defined in Plugin Manager, e.g. "elastic halfspace (pinel)" |
References SimulationCore::abort(), SimulationCore::addGreenPlugin(), and SimulationCore::instance().
Referenced by request_plugins().
run_function crusde_request_kernel_plugin | ( | char * | plugin | ) |
An Operator/Kernel plugin can request the run time function of another operator/kernel plug-in to reuse its functionality.
plugin | Name of the operator to be re-used as defined in Plugin Manager, e.g. "fast 2d convolution" |
References SimulationCore::abort(), SimulationCore::addKernelPlugin(), and SimulationCore::instance().
Referenced by request_plugins().
load_exec_function crusde_request_load_plugin | ( | char * | plugin | ) |
A Load function plugin can request the run time function of another Load function plug-in to reuse its functionality.
plugin | Name of the Load function to be re-used as defined in Plugin Manager, e.g. "irregular load" |
References SimulationCore::abort(), SimulationCore::addLoadPlugin(), and SimulationCore::instance().
loadhistory_exec_function crusde_request_loadhistory_plugin | ( | char * | plugin | ) |
A Load history function plugin can request the run time function of another Load history function plug-in to reuse its functionality.
plugin | Name of the Load history function to be re-used as defined in Plugin Manager, e.g. "sinusoidal" |
References SimulationCore::abort(), SimulationCore::addLoadHistoryPlugin(), and SimulationCore::instance().
run_function crusde_request_postprocessor_plugin | ( | char * | plugin | ) |
A Postprocessor plugin can request the run time function of another Postprocessor plug-in to reuse its functionality.
plugin | Name of the postprocessor to be re-used as defined in Plugin Manager |
References SimulationCore::abort(), SimulationCore::addPostprocessorPlugin(), and SimulationCore::instance().
void crusde_set_current_load_component | ( | int | id | ) |
Update currend load component id.
References SimulationCore::instance(), and SimulationCore::setLoadFunctionComponent().
Referenced by run().
void crusde_set_operator_space | ( | int | nx, | |
int | ny | |||
) |
Operator can set the spatial dimensions it works on.
This is useful if somebody wants to temporarily store and ACCESS spatial results - arrays are stored linearily.
nx | Number of fields in the X direction, i.e., easting | |
ny | Number of fields in the Y direction, i.e., northing |
References SimulationCore::instance(), and SimulationCore::setOperatorSpace().
Referenced by init().
void crusde_set_quadrant | ( | int | q | ) |
Set Coordinate system quadrant (1-4) that we're currently working in.
CrusDe is inherently cartesian in nature, if a Green's function, for example, operates in a Cyllindrical world, it might be necessary to know which quadrant we're in to correctly determine the direction cosine.
References SimulationCore::instance(), and SimulationCore::setQuadrant().
Referenced by run().
void crusde_set_result | ( | double ** | result | ) |
hand model result to Simulation Core
References SimulationCore::instance(), and SimulationCore::setModelData().
Referenced by run().
int crusde_stepsize | ( | ) |
Time increment with each model step.
References SimulationCore::instance(), and SimulationCore::stepSize().
Referenced by init().
void crusde_warning | ( | const char * | format, | |
... | ||||
) |
Prints warning message to stderr.
This function prints a warning message to stderr. It works exactly like printf, hence complex message printing is possible. The simulation run will be continued.
format | A formatted string following the sprintf conventions | |
... | Elipsis containing the values to be plugged into the format string |
Referenced by ExperimentManager::addEntry(), PluginManager::addToDB(), ExperimentManager::deleteEntry(), Plugin::getCategory(), InputHandler::getLoadFunctionList(), SimulationCore::getRegisteredParameters(), init(), Plugin::init(), InputHandler::init(), InputHandler::initParamsFromDOM(), SimulationCore::installPlugin(), InputHandler::jobExists(), GreensFunction::load(), read_alma_output(), XMLHandler::readXML(), SimulationCore::registerOutputField(), Plugin::registerParameter(), run(), XMLCore::XMLCore(), XMLCore::~XMLCore(), and XMLHandler::~XMLHandler().