SIMLIB/C++  3.07
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
simlib3::Integrator Class Reference

block for numerical integration input is derivative, output is state More...

#include <simlib.h>

Inheritance diagram for simlib3::Integrator:
Inheritance graph
[legend]
Collaboration diagram for simlib3::Integrator:
Collaboration graph
[legend]

Public Member Functions

 Integrator ()
 constructor for special cases (arrays of integrators) Input can be set using method Integrator::Set More...
 
 Integrator (Input i, double initvalue=0)
 constructor More...
 
 Integrator (Integrator &i, double initvalue=0)
 special copy constructor needed for i1(i2) connection More...
 
 ~Integrator ()
 destructor removes integrator from list More...
 
void Init (double initvalue)
 set initial value of integrator More...
 
void Init ()
 use preset initial value More...
 
void Set (double value)
 set the integrator status value (step change) More...
 
Integratoroperator= (double x)
 set integrator state value More...
 
Input SetInput (Input inp)
 set integrator input block expression More...
 
void Eval () override
 evaluate integrator input More...
 
double Value () override
 the state of integrator More...
 
double InputValue ()
 current input value More...
 
void Save (void)
 
void Restore (void)
 
void SetState (double s)
 
double GetState (void)
 
void SetOldState (double s)
 
double GetOldState (void)
 
void SetDiff (double d)
 
double GetDiff (void)
 
void SetOldDiff (double d)
 
double GetOldDiff (void)
 
- Public Member Functions inherited from simlib3::aContiBlock
 aContiBlock ()
 
virtual void _Eval ()
 evaluate block (with loop detection) More...
 
- Public Member Functions inherited from simlib3::SimObject
bool TestAndSetFlag (bool new_value, unsigned n)
 internal method for flag manipulation is used for algebraic loop checking in continuous blocks More...
 
 SimObject ()
 constructor More...
 
virtual ~SimObject ()
 virtual destructor More...
 
void * operator new (size_t size)
 allocate object, set _flags More...
 
void operator delete (void *ptr)
 deallocate object More...
 
void * operator new[] (size_t size)=delete
 
void operator delete[] (void *ptr)=delete
 
bool isAllocated () const
 
virtual std::string Name () const
 get object name More...
 
bool HasName () const
 
void SetName (const std::string &name)
 assign the name More...
 
virtual void Output () const
 print object to default output More...
 

Protected Member Functions

void CtrInit ()
 

Protected Attributes

Input input
 input expression: f(t,y) More...
 
double initval
 initial value: y(t0) More...
 
IntegratorContainer::iterator it_list
 position in list of integrators More...
 
- Protected Attributes inherited from simlib3::aContiBlock
bool isEvaluated
 
- Protected Attributes inherited from simlib3::SimObject
unsigned _flags
 bool flags for internal use (TODO bitfield?) More...
 

Private Member Functions

Integratoroperator= (const Integrator &x)=delete
 

Private Attributes

double dd
 
double ddl
 
double ss
 
double ssl
 

Additional Inherited Members

- Public Types inherited from simlib3::SimObject
enum  _Flags { _CLEAR_ALL_FLAGS = 0, _ALLOCATED_FLAG = 1<<0, _EVAL_FLAG = 1<<1, _HAS_NAME_FLAG = 1<<2 }
 

Detailed Description

block for numerical integration input is derivative, output is state

Definition at line 1288 of file simlib.h.

Constructor & Destructor Documentation

◆ Integrator() [1/3]

simlib3::Integrator::Integrator ( )

constructor for special cases (arrays of integrators) Input can be set using method Integrator::Set

Definition at line 174 of file intg.cc.

References CtrInit(), Dprintf, initval, and simlib3::IntegratorContainer::Size().

◆ Integrator() [2/3]

simlib3::Integrator::Integrator ( Input  i,
double  initvalue = 0 
)

constructor

Parameters
iinput block expression
initvalueinitial value (optional, default=0)

Definition at line 185 of file intg.cc.

References CtrInit(), Dprintf, initval, and simlib3::IntegratorContainer::Size().

◆ Integrator() [3/3]

simlib3::Integrator::Integrator ( Integrator i,
double  initvalue = 0 
)

special copy constructor needed for i1(i2) connection

Definition at line 196 of file intg.cc.

References CtrInit(), Dprintf, initval, and simlib3::IntegratorContainer::Size().

◆ ~Integrator()

simlib3::Integrator::~Integrator ( )

destructor removes integrator from list

Definition at line 209 of file intg.cc.

References simlib3::CantDestroyIntg, Dprintf, simlib3::IntegratorContainer::Erase(), it_list, simlib3::SIMLIB_error(), and simlib3::IntegratorContainer::Size().

Member Function Documentation

◆ CtrInit()

void simlib3::Integrator::CtrInit ( )
protected

◆ Eval()

void simlib3::Integrator::Eval ( )
overridevirtual

evaluate integrator input

Reimplemented from simlib3::aContiBlock.

Definition at line 239 of file intg.cc.

References dd, and InputValue().

◆ GetDiff()

double simlib3::Integrator::GetDiff ( void  )
inline

Definition at line 1325 of file simlib.h.

◆ GetOldDiff()

double simlib3::Integrator::GetOldDiff ( void  )
inline

Definition at line 1327 of file simlib.h.

◆ GetOldState()

double simlib3::Integrator::GetOldState ( void  )
inline

Definition at line 1323 of file simlib.h.

◆ GetState()

double simlib3::Integrator::GetState ( void  )
inline

Definition at line 1321 of file simlib.h.

◆ Init() [1/2]

void simlib3::Integrator::Init ( double  initvalue)

set initial value of integrator

Definition at line 222 of file intg.cc.

References initval, and ss.

Referenced by simlib3::Integrator3D::Init().

◆ Init() [2/2]

void simlib3::Integrator::Init ( )
inline

use preset initial value

Definition at line 1306 of file simlib.h.

References Init().

Referenced by Init().

◆ InputValue()

double simlib3::Integrator::InputValue ( )
inline

current input value

Definition at line 1314 of file simlib.h.

References simlib3::Input::Value().

Referenced by Eval().

◆ operator=() [1/2]

Integrator& simlib3::Integrator::operator= ( const Integrator x)
privatedelete

◆ operator=() [2/2]

Integrator& simlib3::Integrator::operator= ( double  x)
inline

set integrator state value

Definition at line 1309 of file simlib.h.

◆ Restore()

void simlib3::Integrator::Restore ( void  )
inline

Definition at line 1319 of file simlib.h.

◆ Save()

void simlib3::Integrator::Save ( void  )
inline

Definition at line 1318 of file simlib.h.

◆ Set()

void simlib3::Integrator::Set ( double  value)

set the integrator status value (step change)

Definition at line 230 of file intg.cc.

References ss.

◆ SetDiff()

void simlib3::Integrator::SetDiff ( double  d)
inline

Definition at line 1324 of file simlib.h.

◆ SetInput()

Input simlib3::Integrator::SetInput ( Input  inp)
inline

set integrator input block expression

Definition at line 1311 of file simlib.h.

References simlib3::Input::Set().

◆ SetOldDiff()

void simlib3::Integrator::SetOldDiff ( double  d)
inline

Definition at line 1326 of file simlib.h.

◆ SetOldState()

void simlib3::Integrator::SetOldState ( double  s)
inline

Definition at line 1322 of file simlib.h.

◆ SetState()

void simlib3::Integrator::SetState ( double  s)
inline

Definition at line 1320 of file simlib.h.

◆ Value()

double simlib3::Integrator::Value ( )
overridevirtual

the state of integrator

get integrator status (output value)

Implements simlib3::aContiBlock.

Definition at line 249 of file intg.cc.

References simlib3::SimObject::HasName(), simlib3::IntegratorContainer::ListPtr, simlib3::SimObject::Name(), simlib3::SIMLIB_create_tmp_name(), and ss.

Referenced by Sample(), simlib3::Integrator2D::Value(), and simlib3::Integrator3D::Value().

Member Data Documentation

◆ dd

double simlib3::Integrator::dd
private

Definition at line 1290 of file simlib.h.

Referenced by Eval().

◆ ddl

double simlib3::Integrator::ddl
private

Definition at line 1291 of file simlib.h.

◆ initval

double simlib3::Integrator::initval
protected

initial value: y(t0)

Definition at line 1296 of file simlib.h.

Referenced by Init(), and Integrator().

◆ input

Input simlib3::Integrator::input
protected

input expression: f(t,y)

Definition at line 1295 of file simlib.h.

◆ it_list

IntegratorContainer::iterator simlib3::Integrator::it_list
protected

position in list of integrators

Definition at line 1298 of file simlib.h.

Referenced by CtrInit(), simlib3::Status::CtrInit(), and ~Integrator().

◆ ss

double simlib3::Integrator::ss
private

Definition at line 1292 of file simlib.h.

Referenced by Init(), Set(), and Value().

◆ ssl

double simlib3::Integrator::ssl
private

Definition at line 1293 of file simlib.h.


The documentation for this class was generated from the following files: