COPASI API  4.40.278
CRootFinder Class Reference

#include <CRootFinder.h>

Classes

class  Eval
 
class  EvalTemplate
 

Public Types

enum  ReturnStatus { NotFound = 0 , RootFound = 1 , NotAdvanced = -1 , InvalidInterval = -2 }
 
enum  RootMasking { NONE = 0 , DISCRETE = 1 , CONTINUOUS = 2 , ALL = 3 }
 

Public Member Functions

C_FLOAT64 brentRootValue (const C_FLOAT64 &time)
 
ReturnStatus checkRoots (const C_FLOAT64 &timeLeft, const C_FLOAT64 &timeRight, const RootMasking &rootMasking)
 
 CRootFinder ()
 
 CRootFinder (const CRootFinder &src)
 
const C_FLOAT64getRootError () const
 
const C_FLOAT64getRootTime () const
 
const CVectorCore< C_FLOAT64 > & getRootValues () const
 
const CVectorCore< C_INT > & getToggledRoots () const
 
void initialize (Eval *pRootValueCalculator, const C_FLOAT64 &relativeTolerance, const CVectorCore< C_INT > &rootMask)
 
void restart ()
 
virtual ~CRootFinder ()
 

Private Member Functions

void calculateCurrentRoots (const C_FLOAT64 &time)
 
bool findToggledRoots (C_FLOAT64 &rootTime)
 

Private Attributes

CBrent::EvalmpBrentRootValueCalculator
 
EvalmpRootValueCalculator
 
C_FLOAT64 mRelativeTolerance
 
C_FLOAT64 mRootError
 
CVectorCore< C_INTmRootMask
 
RootMasking mRootMasking
 
CVector< C_FLOAT64mRootsCurrent
 
CVector< C_FLOAT64mRootsLeft
 
CVector< C_FLOAT64mRootsRight
 
C_FLOAT64 mTimeCurrent
 
C_FLOAT64 mTimeLeft
 
C_FLOAT64 mTimeRight
 
CVector< C_INTmToggledRootsCurrent
 
CVector< C_INTmToggledRootsLeft
 
bool mToggledRootsLeftValid
 

Member Enumeration Documentation

◆ ReturnStatus

Enumerator
NotFound 
RootFound 
NotAdvanced 
InvalidInterval 

◆ RootMasking

Enumerator
NONE 
DISCRETE 
CONTINUOUS 
ALL 

Constructor & Destructor Documentation

◆ CRootFinder() [1/2]

CRootFinder::CRootFinder ( )

Default Constructor

References brentRootValue(), and mpBrentRootValueCalculator.

◆ CRootFinder() [2/2]

CRootFinder::CRootFinder ( const CRootFinder src)

◆ ~CRootFinder()

CRootFinder::~CRootFinder ( )
virtual

Destructor

References mpBrentRootValueCalculator, and pdelete.

Member Function Documentation

◆ brentRootValue()

C_FLOAT64 CRootFinder::brentRootValue ( const C_FLOAT64 time)

Callback function for the one dimensional Brent method

Parameters
constC_FLOAT64 & time
Returns
C_FLOAT64 rootValue

References CVectorCore< CType >::begin(), C_FLOAT64, C_INT, calculateCurrentRoots(), CVectorCore< CType >::end(), mRootMask, mRootMasking, mRootsCurrent, mRootsLeft, and mRootsRight.

Referenced by CRootFinder().

◆ calculateCurrentRoots()

void CRootFinder::calculateCurrentRoots ( const C_FLOAT64 time)
private

References mRootsCurrent, and mTimeCurrent.

Referenced by brentRootValue(), and checkRoots().

◆ checkRoots()

CRootFinder::ReturnStatus CRootFinder::checkRoots ( const C_FLOAT64 timeLeft,
const C_FLOAT64 timeRight,
const RootMasking rootMasking 
)

Check for roots in the interval [timeLeft, timeRight]. If a root is found true is returned and the time is returned in timeRoot, otherwise timeRoot is set to timeRight

Parameters
constC_FLOAT64 & timeLeft
constC_FLOAT64 & timeRight
constRootMasking & rootMasking
Returns
bool ReturnStatus

References CVectorCore< CType >::begin(), C_FLOAT64, C_INT, calculateCurrentRoots(), CVectorCore< CType >::end(), CBrent::findRoot(), InvalidInterval, mpBrentRootValueCalculator, mRelativeTolerance, mRootError, mRootMask, mRootMasking, mRootsCurrent, mRootsLeft, mRootsRight, mTimeCurrent, mTimeLeft, mTimeRight, mToggledRootsCurrent, mToggledRootsLeft, mToggledRootsLeftValid, NotAdvanced, NotFound, CMath::NoToggle, RootFound, and CMath::ToggleBoth.

Referenced by CStochasticRungeKuttaRI5::internalStep().

◆ findToggledRoots()

bool CRootFinder::findToggledRoots ( C_FLOAT64 rootTime)
private

◆ getRootError()

const C_FLOAT64 & CRootFinder::getRootError ( ) const

Retrieve the error of the last successful root calculation

References mRootError.

Referenced by CLsodaMethod2::destroyRootMask(), and CStochasticRungeKuttaRI5::destroyRootMask().

◆ getRootTime()

const C_FLOAT64 & CRootFinder::getRootTime ( ) const

Retrieve the time when the root was found

Returns
const C_FLOAT64 & rootTime

References mTimeCurrent.

Referenced by CStochasticRungeKuttaRI5::internalStep().

◆ getRootValues()

const CVectorCore< C_FLOAT64 > & CRootFinder::getRootValues ( ) const

Retrieve the values of the roots

Returns
const CVectorCore< C_FLOAT64 > & rootValues

References mRootsCurrent.

Referenced by CLsodaMethod2::start(), and CStochasticRungeKuttaRI5::start().

◆ getToggledRoots()

const CVectorCore< C_INT > & CRootFinder::getToggledRoots ( ) const

Retrieve the information on which roots have been found

Returns
const CVectorCore< C_INT > & toggledRoots

References mToggledRootsCurrent.

Referenced by CLsodaMethod2::start(), and CStochasticRungeKuttaRI5::start().

◆ initialize()

void CRootFinder::initialize ( CRootFinder::Eval pRootValueCalculator,
const C_FLOAT64 relativeTolerance,
const CVectorCore< C_INT > &  rootMask 
)

◆ restart()

void CRootFinder::restart ( )

Restart the root finder in case the systems state has changed

References mTimeLeft, and mTimeRight.

Referenced by initialize(), CStochasticRungeKuttaRI5::internalStep(), and CStochasticRungeKuttaRI5::stateChange().

Member Data Documentation

◆ mpBrentRootValueCalculator

CBrent::Eval* CRootFinder::mpBrentRootValueCalculator
private

Pointer to method used for function evaluations for the Brent root finding method.

Referenced by checkRoots(), CRootFinder(), and ~CRootFinder().

◆ mpRootValueCalculator

Eval* CRootFinder::mpRootValueCalculator
private

Referenced by initialize().

◆ mRelativeTolerance

C_FLOAT64 CRootFinder::mRelativeTolerance
private

Referenced by checkRoots(), and initialize().

◆ mRootError

C_FLOAT64 CRootFinder::mRootError
private

◆ mRootMask

CVectorCore< C_INT > CRootFinder::mRootMask
private

◆ mRootMasking

RootMasking CRootFinder::mRootMasking
private

◆ mRootsCurrent

CVector< C_FLOAT64 > CRootFinder::mRootsCurrent
private

◆ mRootsLeft

CVector< C_FLOAT64 > CRootFinder::mRootsLeft
private

◆ mRootsRight

CVector< C_FLOAT64 > CRootFinder::mRootsRight
private

◆ mTimeCurrent

C_FLOAT64 CRootFinder::mTimeCurrent
private

◆ mTimeLeft

C_FLOAT64 CRootFinder::mTimeLeft
private

Referenced by checkRoots(), and restart().

◆ mTimeRight

C_FLOAT64 CRootFinder::mTimeRight
private

Referenced by checkRoots(), and restart().

◆ mToggledRootsCurrent

CVector< C_INT > CRootFinder::mToggledRootsCurrent
private

◆ mToggledRootsLeft

CVector< C_INT > CRootFinder::mToggledRootsLeft
private

Referenced by checkRoots(), and initialize().

◆ mToggledRootsLeftValid

bool CRootFinder::mToggledRootsLeftValid
private

Referenced by checkRoots(), and initialize().


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