Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

SPARK Namespace Reference

Definition of global functions and classes used in the SPARK simulation environment. More...


Classes

class  TRuntimeControls
 Wrapper class for all the runtime control information required to initialize a TProblem object in order to make a simulation run. More...

class  TGlobalSettings
 Class acts as repository of global control settings defined at the problem level. More...

class  TComponentSettings
 Class acts as repository of settings defined for each component. More...

class  TPreferenceSettings
 Wrapper class to store and manipulate information required to initialize the settings for the solution methods for each component. More...

class  TProblem
 Representation of a problem object in the SPARK solver. More...

class  TProblem::TState
 Interface class defining the methods used to save and restore the state of the problem using the TProblem::Save() and TProblem::Restore() methods. More...

class  TComponent
 Class that solves the set of DAE equations generated by setupcpp. More...

class  XAssertion
 Base class for all SPARK exceptions. More...

class  XDimension
 Indicates that a runtime error occured due to mismatched dimension. More...

class  XOutOfRange
 Indicates that a runtime error occured due to an out of range access operation on a container. More...

class  XMemory
 Indicates that a runtime error occured because memory could not be allocated. More...

class  XInitialization
 Indicates that a runtime error occured while initializing an object. More...

class  XIO
 Indicates that a runtime error occured while performing an IO operation. More...

class  XTimeStep
 Indicates that a runtime error occured while adapting the time step. More...

class  XStepper
 Inidicates that stepping to the next step failed. More...

class  TObject
 Class used to represent an instance of an inverse. More...

class  TInverse
 Class that defines the callbacks for an inverse. More...


Functions to manage the SPARK solving environment

void Start (const char *sessionName, const char *runLogFilename, const char *errorLogFilename, const char *debugLogFilename, bool verbose=true) throw (SPARK::XInitialization)
 Starts the SPARK solving environment.

void End ()
 Terminates the SPARK solving environment.

void ExitWithError (SPARK::ExitCodes ec, const std::string &callingSub, const std::string &msg, const SPARK::TProblem *problem=0)
 Terminates program execution with exit code.


Utility functions

char * GetFileName (unsigned argc, char *argv[], const char *extension) throw (SPARK::XInitialization)
 Returns the pointer to the first string in the argv[] that has the specified extension. If cannot find file with desired extension, returns 0.

void Log (std::ostream &os, const char *strFileName, const char *strSenderName, const char *strMsg, const SPARK::TProblem *problem=0)
 Writes a message to the specified log file.

void Log (std::ostream &os, const SPARK::TInverse *sender, unsigned line, const char *strMsg)
 Writes a message to the specified log file from a static callback file in a SPARK atomic class.

void Log (std::ostream &os, const SPARK::TObject *sender, unsigned line, const char *strMsg)
 Writes a message to the specified log file from a non-static callback file in a SPARK atomic class.


Access methods

const char * GetProgramName ()
 Returns the name of the program as specified during the call to SPARK::Start().

const char * GetBaseName ()
 Returns the base name of the program name (i.e., the program name witout path and without any extension).

const char * GetVersion ()
 Returns the version of the solver library being used.

std::ostream & GetRunLog ()
 Returns the output stream for the run log.

std::ostream & GetErrorLog ()
 Returns the output stream for the error log.

const char * GetRunLogFilename ()
 Returns the name of the run log file as specified during the call to SPARK::Start().

const char * GetErrorLogFilename ()
 Returns the name of the error log file as specified during the call to SPARK::Start().

const char * GetDebugLogFilename ()
 Returns the name of the debug log file as specified during the call to SPARK::Start().


Enumerations

enum  ExitCodes {
  ExitCode_OK = 0,
  ExitCode_ERROR_IO = 100,
  ExitCode_ERROR_LEX_SCAN = 101,
  ExitCode_ERROR_URL = 102,
  ExitCode_ERROR_OUT_OF_MEMORY = 120,
  ExitCode_ERROR_NULL_POINTER = 121,
  ExitCode_ERROR_COMMAND_LINE = 130,
  ExitCode_ERROR_INVALID_RUN_CONTROLS = 131,
  ExitCode_ERROR_INVALID_PREFERENCES = 132,
  ExitCode_ERROR_INVALID_PROBLEM = 133,
  ExitCode_ERROR_EXIT_SPARK_FACTORY = 140,
  ExitCode_ERROR_RUNTIME_ERROR = 150,
  ExitCode_ERROR_INVALID_VARIABLE_NAME = 151,
  ExitCode_ERROR_INVALID_FEATURE = 152,
  ExitCode_ERROR_NUMERICAL = 160
}
 Exit codes returned by the SPARK solver. More...

enum  CallbackTypes {
  CallbackType_EVALUATE = 0,
  CallbackType_PREDICT,
  CallbackType_CONSTRUCT,
  CallbackType_DESTRUCT,
  CallbackType_PREPARE_STEP,
  CallbackType_ROLLBACK,
  CallbackType_COMMIT,
  CallbackType_CHECK_INTEGRATION_STEP,
  CallbackType_STATIC_CONSTRUCT,
  CallbackType_STATIC_DESTRUCT,
  CallbackType_STATIC_PREPARE_STEP,
  CallbackType_STATIC_ROLLBACK,
  CallbackType_STATIC_COMMIT,
  CallbackType_STATIC_CHECK_INTEGRATION_STEP,
  CALLBACKTYPES_L,
  CallbackType_NONE = CALLBACKTYPES_L
}
 Enum for callback types. More...

enum  ProtoTypes {
  ProtoType_MODIFIER = 0,
  ProtoType_NON_MODIFIER,
  ProtoType_PREDICATE,
  ProtoType_STATIC_NON_MODIFIER,
  ProtoType_STATIC_PREDICATE,
  PROTOTYPES_L,
  ProtoType_NONE = PROTOTYPES_L
}
 Enum for callback prototypes. More...

enum  ReturnTypes {
  ReturnType_VALUE = 0,
  ReturnType_RESIDUAL,
  RETURNTYPES_L,
  ReturnType_NONE = RETURNTYPES_L
}
 Enum for return types from modifier callbacks. More...

enum  VariableTypes {
  VariableType_GLOBAL_TIME = 0,
  VariableType_GLOBAL_TIME_STEP,
  VariableType_PARAMETER,
  VariableType_INPUT,
  VariableType_UNKNOWN,
  VARIABLETYPES_L,
  VariableType_NONE = VARIABLETYPES_L
}
 Enum for the various variable types in the problem. More...

enum  RequestTypes {
  RequestType_ABORT = 0,
  RequestType_STOP,
  RequestType_SET_STOP_TIME,
  RequestType_REPORT,
  RequestType_SNAPSHOT,
  RequestType_SET_MEETING_POINT,
  RequestType_CLEAR_MEETING_POINTS,
  RequestType_RESTART,
  RequestType_SET_TIME_STEP,
  RequestType_SET_DYNAMIC_STEPPER,
  REQUESTTYPES_L,
  RequestType_NONE = REQUESTTYPES_L
}


Detailed Description

Definition of global functions and classes used in the SPARK simulation environment.

Enumeration Type Documentation

enum SPARK::ExitCodes
 

Exit codes returned by the SPARK solver.

Enumeration values:
ExitCode_OK  successful simulation
ExitCode_ERROR_IO  error caused by writing to or reading from a file
ExitCode_ERROR_LEX_SCAN  see exit(YY_EXIT_FAILURE) calls in lex_yy.c
ExitCode_ERROR_URL  error caused by URL engine
ExitCode_ERROR_OUT_OF_MEMORY  cannot allocate memory at run-time
ExitCode_ERROR_NULL_POINTER  null pointer accessed somewhere
ExitCode_ERROR_COMMAND_LINE  syntax problem
ExitCode_ERROR_INVALID_RUN_CONTROLS  problem in the "*.run" file
ExitCode_ERROR_INVALID_PREFERENCES  problem in the "*.prf" file
ExitCode_ERROR_INVALID_PROBLEM  problem description is invalid
ExitCode_ERROR_EXIT_SPARK_FACTORY  generated by runtime loader
ExitCode_ERROR_RUNTIME_ERROR  generic runtime error ususally caused by container, adpators, iterators
ExitCode_ERROR_INVALID_VARIABLE_NAME  accessing variable by invalid name
ExitCode_ERROR_INVALID_FEATURE  trying to use a not yet supported feature
ExitCode_ERROR_NUMERICAL  cannot converge after MaxIterations, singularity, division by zero...

enum SPARK::CallbackTypes
 

Enum for callback types.

Enumeration values:
CallbackType_EVALUATE  Specifies an EVALUATE callback.
CallbackType_PREDICT  Specifies a PREDICT callback.
CallbackType_CONSTRUCT  Specifies a CONSTRUCT callback.
CallbackType_DESTRUCT  Specifies a DESTRUCT callback.
CallbackType_PREPARE_STEP  Specifies a PREPARE_STEP callback.
CallbackType_ROLLBACK  Specifies a ROLLBACK callback.
CallbackType_COMMIT  Specifies a COMMIT callback.
CallbackType_CHECK_INTEGRATION_STEP  Specifies a CHECK_INTEGRATION_STEP callback for CLASSTYPE=INTEGRATOR only.
CallbackType_STATIC_CONSTRUCT  Specifies a STATIC_CONSTRUCT callback.
CallbackType_STATIC_DESTRUCT  Specifies a STATIC_DESTRUCT callback.
CallbackType_STATIC_PREPARE_STEP  Specifies a STATIC_PREPARE_STEP callback.
CallbackType_STATIC_ROLLBACK  Specifies a STATIC_ROLLBACk callback.
CallbackType_STATIC_COMMIT  Specifies a STATIC_COMMIT callback.
CallbackType_STATIC_CHECK_INTEGRATION_STEP  Specifies a STATIC_CHECK_INTEGRATION_STEP callback for CLASSTYPE=INTEGRATOR only.
CALLBACKTYPES_L  Number of different callback types.
CallbackType_NONE  Default value for non-initialized CallbackTypes variables.

enum SPARK::ProtoTypes
 

Enum for callback prototypes.

Enumeration values:
ProtoType_MODIFIER  Prototype used by modifier callbacks (e.g., evaluate and predict).
ProtoType_NON_MODIFIER  Prototype used by non-modifier callbacks (e.g., construct, destruct, ...).
ProtoType_PREDICATE  Prototype used by predicate callbacks (e.g., check_integration_step, ...).
ProtoType_STATIC_NON_MODIFIER  Prototype used by static non-modifier callbacks (e.g., static_construct, ...).
ProtoType_STATIC_PREDICATE  Prototype used by static predicate callbacks (e.g., static_check_integration_step, ...).
PROTOTYPES_L  Number of different prototype types.
ProtoType_NONE  Default value for non-initialized ProtoTypes variables.

enum SPARK::ReturnTypes
 

Enum for return types from modifier callbacks.

Enumeration values:
ReturnType_VALUE  Indicates that scalar value written to the target TVariable object is the variable value.
ReturnType_RESIDUAL  Indicates that scalar value written to the target TVariable object is the residual value of the function matched with this variable.
RETURNTYPES_L  Number of different return types.
ReturnType_NONE  Default value for non-initialized ReturnTypes variables.

enum SPARK::VariableTypes
 

Enum for the various variable types in the problem.

Enumeration values:
VariableType_GLOBAL_TIME  Refers to the LINK tagged with the GLOBAL_TIME keyword.
VariableType_GLOBAL_TIME_STEP  Refers to the LINK tagged with the GLOBAL_TIME_TIME keyword.
VariableType_PARAMETER  Refers to the LINKs specified with the PARAMETER keyword.
VariableType_INPUT  Refers to the LINKs specified with the INPUT keyword.
VariableType_UNKNOWN  Refers to the LINKs specified with none of the above keywords.
VARIABLETYPES_L  Number of different variable types.
VariableType_NONE  Default value for non-initialized VariableTypes variables.

enum SPARK::RequestTypes
 

Enum for the various atomic class requests

The values are specified by the following bit masks that can be combined using the bitwise OR ( | ) operator.

Enumeration values:
RequestType_ABORT  Refers to a SPARK::TDispatcher::abort() request (see macro REQUEST__ABORT in spark.h).
RequestType_STOP  Refers to a SPARK::TDispatcher::stop() request (see macro REQUEST__STOP in spark.h).
RequestType_SET_STOP_TIME  Refers to a SPARK::TDispatcher::set_stop_time() request (see macro REQUEST__SET_STOP_TIME in spark.h).
RequestType_REPORT  Refers to a SPARK::TDispatcher::report() request (see macro REQUEST__REPORT in spark.h).
RequestType_SNAPSHOT  Refers to a SPARK::TDispatcher::snapshot() request (see macro REQUEST__SNAPSHOT in spark.h).
RequestType_SET_MEETING_POINT  Refers to a SPARK::TDispatcher::set_meeting_point() request (see macro REQUEST__SET_MEETING_POINT in spark.h).
RequestType_CLEAR_MEETING_POINTS  Refers to a SPARK::TDispatcher::clear_meeting_points() request (see macro REQUEST__CLEAR_MEETING_POINTS in spark.h).
RequestType_RESTART  Refers to a SPARK::TDispatcher::restart() request (see macro REQUEST__RESTART in spark.h).
RequestType_SET_TIME_STEP  Refers to a SPARK::TDispatcher::set_time_step() request (see macro REQUEST__SET_TIME_STEP in spark.h).
RequestType_SET_DYNAMIC_STEPPER  Refers to a SPARK::TDispatcher::set_dynamic_stepper() request (see macro REQUEST__SET_DYNAMIC_STEPPER in spark.h).
REQUESTTYPES_L  Number of different request types.
RequestType_NONE  Default value for an invalid request type.


Function Documentation

void Start const char *  sessionName,
const char *  runLogFilename,
const char *  errorLogFilename,
const char *  debugLogFilename,
bool  verbose = true
throw (SPARK::XInitialization)
 

Starts the SPARK solving environment.

Parameters:
sessionName Name of the simulation session (used in various output files to identify run)
runLogFilename Name of the run log file where diagnostics for each problem is sent to
errorLogFilename Name of the log file where runtime errors will be notified
debugLogFilename Name of the log file where debug informatiion is written in SPARK_DEBUG mode
verbose If true then generates session diagnostic to run log files; if false session remains silent
Examples:
multiproblem_example1.cpp, and sparksolver.cpp.

void End  ) 
 

Terminates the SPARK solving environment.

Closes all log files. Performs garbage collection for all problems loaded at runtime.

Postcondition:
The SPARK::TProblem objects that have been constructed at runtime using the SPARK::Problem::DynamicLoad() function will be automatically destructed following the call to SPARK::End().
Warning:
Never explicitly destroy a TProblem object in your code!
Examples:
multiproblem_example1.cpp, and sparksolver.cpp.

void ExitWithError SPARK::ExitCodes  ec,
const std::string &  callingSub,
const std::string &  msg,
const SPARK::TProblem problem = 0
 

Terminates program execution with exit code.

Writes out to the run log output stream the error message contained in ossErrMsg if not NULL.

Parameters:
ec is the exit code of type SPARK::ExitCodes
callingSub contains the name of the caller / owner (e.g., problem, atomic class)
msg contains the description of the error message.
problem points to the problem object that is requesting to terminate the simulation (usually the currently active problem).
Postcondition:
The simulation is terminated properly with a call to the function SPARK::End(), therefore cleaning up log files and performing garbage collection.
Note:
If ec == SPARK::ExitCode_OK , then the function returns without doing anything.
Examples:
multiproblem_example1.cpp, and sparksolver.cpp.

char* GetFileName unsigned  argc,
char *  argv[],
const char *  extension
throw (SPARK::XInitialization)
 

Returns the pointer to the first string in the argv[] that has the specified extension. If cannot find file with desired extension, returns 0.

This function is more versatile than the SPARK::StaticBuild::ParseCommandLine() and SPARK::DynamicBuild::ParseCommandLine() functions as it lets you retrieve one file at a time for the specified extension.

Note:
The string comparison againt the specified extension is case insensitive.
Exceptions:
If the desired extension is invalid, throws the SPARK::XInitialization exception.

void Log std::ostream &  os,
const char *  strFileName,
const char *  strSenderName,
const char *  strMsg,
const SPARK::TProblem problem = 0
 

Writes a message to the specified log file.

Parameters:
strFileName name of the atomic class file. Use preprocessor macro __FILE__ to pass file name automatically.
strSenderName name of the sender object. E.g., pass C-string with inverse function name.
strMsg C-string message terminated by '\0' character to be displayed in error log file.
problem pointer to the target problem (if available)

void Log std::ostream &  os,
const SPARK::TInverse sender,
unsigned  line,
const char *  strMsg
 

Writes a message to the specified log file from a static callback file in a SPARK atomic class.

Parameters:
sender pointer to the Inverse instance that sends the message
line indicates the line number in file where the message is sent from
strMsg C-string message terminated by '\n' character to be displayed in error log file.

void Log std::ostream &  os,
const SPARK::TObject sender,
unsigned  line,
const char *  strMsg
 

Writes a message to the specified log file from a non-static callback file in a SPARK atomic class.

Parameters:
sender pointer to the TObject instance that sends the message
line indicates the line number in file where the message is sent from
strMsg C-string message terminated by '\n' character to be displayed in error log file.

const char* GetProgramName  ) 
 

Returns the name of the program as specified during the call to SPARK::Start().

Returns:
program name as const char*

const char* GetBaseName  ) 
 

Returns the base name of the program name (i.e., the program name witout path and without any extension).

Returns:
base name as const char*

const char* GetVersion  ) 
 

Returns the version of the solver library being used.

Returns:
full solver version as const char*

std::ostream& GetRunLog  ) 
 

Returns the output stream for the run log.

Returns:
output stream as std::ostream&

std::ostream& GetErrorLog  ) 
 

Returns the output stream for the error log.

Returns:
output stream as std::ostream&

const char* GetRunLogFilename  ) 
 

Returns the name of the run log file as specified during the call to SPARK::Start().

Returns:
run log file name as const char*

const char* GetErrorLogFilename  ) 
 

Returns the name of the error log file as specified during the call to SPARK::Start().

Returns:
error log file name as const char*

const char* GetDebugLogFilename  ) 
 

Returns the name of the debug log file as specified during the call to SPARK::Start().

Returns:
debug log file name as const char*


Generated on 5 Nov 2003 for VisualSPARK 2.01