54 Dprintf((
"==================== continuous step BEGIN %.15g",
Time));
56 double Step_StartTime =
Time;
68 Dprintf((
" Step length = %g ",
Time - Step_StartTime ));
69 Dprintf((
"==================== continuous step END %.15g",
Time));
77 Dprintf((
"SetMethod(%s, %s)", name));
90 Dprintf((
"IntegrationMethod::Iterate()"));
116 Dprintf((
"IntegrationMethod::Summarize()"));
132 Dprintf((
"IntegrationMethod::Prepare()"));
177 Dprintf((
"IntegrationMethod::StateCond()"));
200 char *Name =
new char[strlen(name) + 1];
206 MthLstPtr =
new std::list < IntegrationMethod * >;
211 if (strcmp((*ItList)->method_name,
method_name) == 0) {
223 Dprintf((
"destructor[IntegrationMethod]"));
241 std::list<IntegrationMethod*>::iterator it;
242 std::list<IntegrationMethod*>::iterator end_it;
244 Dprintf((
"IntegrationMethod::SearchMethod(\"%s\")", name));
249 if(strcmp((*it)->method_name,name)==0) {
263 Dprintf((
"IntegrationMethod::TurnOff()"));
273 Dprintf((
"IntegrationMethod::Resize(%lu)", (
long unsigned)size));
274 for(std::list<Memory*>::iterator it=
MList.begin(); it!=
MList.end(); ++it) {
284 Dprintf((
"IntegrationMethod::PrepareStep()"));
357 Dprintf((
"IntegrationMethod::Memory::Resize(%lu)",(
long unsigned)cs));
366 arr =
new double[cs];
378 Dprintf((
"##### reallocation to mem_size=%lu",(
long unsigned)
mem_size));
388 arr(NULL), mem_size(0), ListPtr(PtrList)
403 ListPtr->erase(it_list);
414 Dprintf((
"constructor[MultiStepMethod](%s, %s)", name, slave_name));
416 SlaveName=
new char[strlen(slave_name)+1];
428 Dprintf((
"destructor[MultiStepMethod]"));
452 Dprintf((
"MultiStepMethod::PrepareStep()"));
465 Dprintf((
"MultiStepMethod::TurnOff()"));
476 Dprintf((
"SetStarter(%s, %s)", name, slave_name));
489 Dprintf((
"SetStarter(%s)", slave_name));
495 SlaveName=
new char[strlen(slave_name)+1];
505 Dprintf((
"GetStarter(%s)", name));
521 Dprintf((
"constructor[StatusIntegrationMethod]: \"%s\"", name));
530 Dprintf((
"StatusMethod::TurnOff()"));
541 Dprintf((
"StatusMethod::PrepareStep()"));
559 Dprintf((
"StatusMethod::StatusResize(%lu)", (
long unsigned)size));
560 for(std::list<Memory*>::iterator it=
StatusMList.begin();
580 di[i]=(*ip)->GetDiff();
581 si[i]=(*ip)->GetState();
585 sp!=status_end_it; ++sp, i++)
587 xi[i]=(*sp)->GetState();
605 (*ip)->SetDiff(di[i]);
606 (*ip)->SetState(si[i]);
610 sp!=status_end_it; ++sp, i++)
612 (*sp)->SetState(xi[i]);
632 (*ip)->SetOldDiff(di[i]);
633 (*ip)->SetOldState(si[i]);
637 sp!=status_end_it; ++sp, i++)
639 (*sp)->SetOldState(xi[i]);
static const size_t page_size
std::list< Memory * >::iterator it_list
virtual ~Memory()
free dynamic data, remove object from list of memories
Memory(const Memory &)=delete
virtual void Resize(size_t cs)
change size of array to cs, content will be undefined!
std::list< Memory * > * ListPtr
IntegrationMethod - Abstract base class for integration methods.
virtual void Resize(size_t size)
resize all the memories to the given size
static std::list< Memory * > * PtrMList
static IntegrationMethod * CurrentMethodPtr
pointer to the method currently used "rke" is a predefined method (historical reasons,...
static void Summarize(void)
set up new state after execution of integration step
virtual void Integrate(void)=0
virtual void TurnOff(void)
turn off integration method: flush memories etc...
static void Iterate(void)
compute new values of state blocks in model without integrators
virtual ~IntegrationMethod()
destroy integration method (remove from list)
static bool IsEndStepEvent
static int GetErrNo(void)
static bool Prepare(void)
initialize integration step
static void InitStep(double step_frag)
initialize step
static IntegrationMethod * SearchMethod(const char *name)
search method in the list of registrated methods
static std::list< IntegrationMethod * > * MthLstPtr
static bool StateCond(void)
check on changes of state conditions
virtual bool PrepareStep(void)
prepare object for integration step
static bool IsConditionFlag(void)
static void SetMethod(const char *name)
set method which will be used
static void SetOptStep(double opt_step)
static void StepSim(void)
step of numerical integration method
std::list< Memory * > MList
static void SetStepSize(double step_size)
std::list< IntegrationMethod * >::iterator ItList
static void FunCall(double step_frag)
static iterator End(void)
static iterator Begin(void)
std::list< Integrator * >::iterator iterator
base for multi-step integration method
MultiStepMethod(const char *name, const char *slave_name)
initialize multistep method
SingleStepMethod * Slave_Ptr
SingleStepMethod * SlavePtr(void)
return pointer to the starting method (initialize it also)
static const char * GetStarter(const char *name)
obtain the name of the starting method of given method
static void SetStarter(const char *name, const char *slave_name)
set starting method for given multi-step method
virtual void TurnOff(void) override
turn off integration method and its slave (starter)
virtual bool PrepareStep(void) override
prepare the object for the step of integration
~MultiStepMethod()
free dynamic data
base for single-step integration methods
void SetStartMode(bool start_mode)
static iterator Begin(void)
std::list< Status * >::iterator iterator
static iterator End(void)
static void StoreState(Memory &di, Memory &si, StatusMemory &xi)
store state of integrators and status variables
StatusMethod(const StatusMethod &)=delete
std::list< Memory * > StatusMList
static std::list< Memory * > * PtrStatusMList
virtual void StatusResize(size_t size)
resize status memories to the given size
static void RestoreState(double dthlf, Memory &di, Memory &si, StatusMemory &xi)
restore state of integrators and status variables
virtual void TurnOff(void) override
turn off integration method: flush memories etc...
static void GoToState(Memory &di, Memory &si, StatusMemory &xi)
move startpoint to given state
virtual bool PrepareStep(void) override
prepare object for integration step
Internal header file for SIMLIB/C++.
#define SIMLIB_internal_error()
#define _SetTime(t, x)
macro for simple assignement to internal time variables
Implementation of class CalendarList interface is static - using global functions in SQS namespace.
const double & Time
model time (is NOT the block)
EULER euler("euler")
Euler method.
ABM4 abm4("abm4", "rkf5")
Adams-Bashforth-Moulton, 4th order.
const double & NextTime
next-event time
bool SIMLIB_DynamicFlag
in dynamic section
bool SIMLIB_ConditionFlag
void SIMLIB_error(const enum _ErrEnum N)
print error message and abort program
RKF5 rkf5("rkf5")
Runge-Kutta-Fehlberg, 5th order.
double SIMLIB_OptStep
optimal step
RKF3 rkf3("rkf3")
Runge-Kutta-Fehlberg, 3rd order.
RKE rke("rke")
Runge-Kutta-England, 4th order?
bool SIMLIB_ContractStepFlag
requests shorter step
FW fw("fw")
Fowler-Warten (Warning: needs testing, do not use)
void SIMLIB_Dynamic()
performs evaluation of integrators and status blocks
bool SIMLIB_ResetStatus
flag set if there is a need for integration method restart
double min(double a, double b)
double max(double a, double b)
RKF8 rkf8("rkf8")
Runge-Kutta-Fehlberg, 8th order.
double SIMLIB_MinStep
minimal step
double SIMLIB_MaxStep
max. step
double SIMLIB_ContractStep
requested step size
double SIMLIB_StepStartTime
last step time
double SIMLIB_StepSize
actual step
double SIMLIB_DeltaTime
Time-SIMLIB_StepStartTime.
Adams-Bashforth-Moulton 4th order.
Runge-Kutta-England method (default)
Runge-Kutta-Fehlberg 3rd order.
Runge-Kutta-Fehlberg 5th order.
Runge-Kutta-Fehlberg 8th order.
Main SIMLIB/C++ interface.