SIMLIB/C++ 3.09
Loading...
Searching...
No Matches
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
 
 Integrator (Input i, double initvalue=0)
 constructor
 
 Integrator (Integrator &i, double initvalue=0)
 special copy constructor needed for i1(i2) connection
 
 ~Integrator ()
 destructor removes integrator from list
 
void Init (double initvalue)
 set initial value of integrator
 
void Init ()
 use preset initial value
 
void Set (double value)
 set the integrator status value (step change)
 
Integratoroperator= (double x)
 set integrator state value
 
Input SetInput (Input inp)
 set integrator input block expression
 
void Eval () override
 evaluate integrator input
 
double Value () override
 the state of integrator
 
double InputValue ()
 current input value
 
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)
 
virtual double Value ()=0
 get block output value
this method should be defined in classes derived from aContiBlock
 
- 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
 
 SimObject ()
 constructor
 
virtual ~SimObject ()
 virtual destructor
 
void * operator new (size_t size)
 allocate object, set _flags
 
void operator delete (void *ptr)
 deallocate object
 
void * operator new[] (size_t size)=delete
 
void operator delete[] (void *ptr)=delete
 
bool isAllocated () const
 
virtual std::string Name () const
 get object name
 
bool HasName () const
 
void SetName (const std::string &name)
 assign the name
 
virtual void Output () const
 print object to default output
 

Protected Member Functions

void CtrInit ()
 

Protected Attributes

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

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 ( )

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.

References dd.

◆ GetOldDiff()

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

Definition at line 1327 of file simlib.h.

References ddl.

◆ GetOldState()

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

Definition at line 1323 of file simlib.h.

References ssl.

◆ GetState()

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

Definition at line 1321 of file simlib.h.

References ss.

◆ Init() [1/2]

void simlib3::Integrator::Init ( )
inline

use preset initial value

Definition at line 1306 of file simlib.h.

References Init(), and initval.

Referenced by Init().

◆ Init() [2/2]

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

set initial value of integrator

Definition at line 222 of file intg.cc.

References initval, simlib3::SIMLIB_ResetStatus, and ss.

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

◆ InputValue()

double simlib3::Integrator::InputValue ( )
inline

current input value

Definition at line 1314 of file simlib.h.

References input, and 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.

References Set().

◆ Restore()

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

Definition at line 1319 of file simlib.h.

References dd, ddl, ss, and ssl.

◆ Save()

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

Definition at line 1318 of file simlib.h.

References dd, ddl, ss, and ssl.

◆ Set()

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

set the integrator status value (step change)

Definition at line 230 of file intg.cc.

References simlib3::SIMLIB_ResetStatus, and ss.

Referenced by operator=().

◆ SetDiff()

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

Definition at line 1324 of file simlib.h.

References dd.

◆ SetInput()

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

set integrator input block expression

Definition at line 1311 of file simlib.h.

References input, and simlib3::Input::Set().

◆ SetOldDiff()

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

Definition at line 1326 of file simlib.h.

References ddl.

◆ SetOldState()

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

Definition at line 1322 of file simlib.h.

References ssl.

◆ SetState()

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

Definition at line 1320 of file simlib.h.

References ss.

◆ 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 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(), GetDiff(), Restore(), Save(), and SetDiff().

◆ ddl

double simlib3::Integrator::ddl
private

Definition at line 1291 of file simlib.h.

Referenced by GetOldDiff(), Restore(), Save(), and SetOldDiff().

◆ 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.

Referenced by InputValue(), and SetInput().

◆ 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(), and ~Integrator().

◆ ss

double simlib3::Integrator::ss
private

Definition at line 1292 of file simlib.h.

Referenced by GetState(), Init(), Restore(), Save(), Set(), SetState(), and Value().

◆ ssl

double simlib3::Integrator::ssl
private

Definition at line 1293 of file simlib.h.

Referenced by GetOldState(), Restore(), Save(), and SetOldState().


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