COPASI API  4.16.103
Public Member Functions | Private Attributes | List of all members
CScanItemLinear Class Reference

#include <CScanMethod.h>

Inheritance diagram for CScanItemLinear:
Inheritance graph
[legend]
Collaboration diagram for CScanItemLinear:
Collaboration graph
[legend]

Public Member Functions

 CScanItemLinear (CCopasiParameterGroup *si, const bool &continueFromCurrentState)
 
virtual bool isValidScanItem (const bool &continueFromCurrentState)
 
virtual void step ()
 
virtual ~CScanItemLinear ()
 
- Public Member Functions inherited from CScanItem
size_t getNumSteps () const
 
const CCopasiObjectgetObject () const
 
bool isFinished () const
 
virtual bool isNesting () const
 
void reset ()
 
void restoreValue () const
 
void storeValue ()
 
virtual ~CScanItem ()
 

Private Attributes

C_FLOAT64 mFaktor
 
bool mLog
 
C_FLOAT64 mMax
 
C_FLOAT64 mMin
 

Additional Inherited Members

- Static Public Member Functions inherited from CScanItem
static CScanItemcreateScanItemFromParameterGroup (CCopasiParameterGroup *si, CRandom *rg, const bool &continueFromCurrentState)
 
- Protected Member Functions inherited from CScanItem
 CScanItem (CCopasiParameterGroup *si, const bool &continueFromCurrentState)
 
- Protected Attributes inherited from CScanItem
bool mFlagFinished
 
size_t mIndex
 
bool mIsStateVariable
 
size_t mNumSteps
 
CCopasiObjectmpInitialObject
 
CCopasiObjectmpObject
 
C_FLOAT64 mStoreValue
 

Detailed Description

Definition at line 112 of file CScanMethod.h.

Constructor & Destructor Documentation

CScanItemLinear::CScanItemLinear ( CCopasiParameterGroup si,
const bool &  continueFromCurrentState 
)

Definition at line 209 of file CScanMethod.cpp.

References CCopasiParameterGroup::getValue(), mFaktor, mLog, mMax, mMin, CScanItem::mNumSteps, CCopasiParameter::Value::pBOOL, and CCopasiParameter::Value::pDOUBLE.

210  :
211  CScanItem(si, continueFromCurrentState),
212  mLog(false)
213 {
214  mLog = * si->getValue("log").pBOOL;
215  mMin = * si->getValue("Minimum").pDOUBLE;
216  mMax = * si->getValue("Maximum").pDOUBLE;
217 
218  if (mLog)
219  {
220  mMin = log(mMin);
221  mMax = log(mMax);
222  }
223 
224  mFaktor = (mMax - mMin) / mNumSteps;
225 
226  //TODO: log scanning of negative values?
227 }
C_FLOAT64 mMax
Definition: CScanMethod.h:115
C_FLOAT64 mMin
Definition: CScanMethod.h:115
size_t mNumSteps
Definition: CScanMethod.h:39
const CCopasiParameter::Value & getValue(const std::string &name) const
C_FLOAT64 mFaktor
Definition: CScanMethod.h:115
virtual CScanItemLinear::~CScanItemLinear ( )
inlinevirtual

Definition at line 121 of file CScanMethod.h.

121 {};

Member Function Documentation

bool CScanItemLinear::isValidScanItem ( const bool &  continueFromCurrentState)
virtual

perform checks. This is used in the method::isValidProblem() method. It returns false for an invalid ScanItem and generates a CCopasiMessage

Parameters
constbool & continueFromCurrentState

Reimplemented from CScanItem.

Definition at line 248 of file CScanMethod.cpp.

References CCopasiMessage::ERROR, CScanItem::isValidScanItem(), max, mFaktor, and mLog.

249 {
250  if (!CScanItem::isValidScanItem(continueFromCurrentState)) return false;
251 
252  if (mLog)
253  {
255  {
256  //not a valid range for log
257  CCopasiMessage(CCopasiMessage::ERROR, "Only positive values for min and max are possible for a logarithmic scan.");
258  return false;
259  }
260  }
261 
262  return true;
263 }
virtual bool isValidScanItem(const bool &continueFromCurrentState)
C_FLOAT64 mFaktor
Definition: CScanMethod.h:115
#define max(a, b)
Definition: f2c.h:176
void CScanItemLinear::step ( )
virtual

Implements CScanItem.

Definition at line 229 of file CScanMethod.cpp.

References C_FLOAT64, mFaktor, CScanItem::mFlagFinished, CScanItem::mIndex, mLog, mMin, CScanItem::mNumSteps, CScanItem::mpInitialObject, CScanItem::mpObject, and CCopasiObject::setObjectValue().

230 {
231  //do something ...
232  C_FLOAT64 Value = mMin + mIndex * mFaktor;
233 
234  if (mLog)
235  Value = exp(Value);
236 
237  //the index
238  if (mIndex > mNumSteps)
239  mFlagFinished = true;
240 
241  if (mpObject) mpObject->setObjectValue(Value);
242 
244 
245  ++mIndex;
246 }
void setObjectValue(const C_FLOAT64 &value)
CCopasiObject * mpInitialObject
Definition: CScanMethod.h:42
C_FLOAT64 mMin
Definition: CScanMethod.h:115
size_t mNumSteps
Definition: CScanMethod.h:39
bool mFlagFinished
Definition: CScanMethod.h:48
size_t mIndex
Definition: CScanMethod.h:46
#define C_FLOAT64
Definition: copasi.h:92
C_FLOAT64 mFaktor
Definition: CScanMethod.h:115
CCopasiObject * mpObject
Definition: CScanMethod.h:41

Member Data Documentation

C_FLOAT64 CScanItemLinear::mFaktor
private

Definition at line 115 of file CScanMethod.h.

Referenced by CScanItemLinear(), isValidScanItem(), and step().

bool CScanItemLinear::mLog
private

Definition at line 116 of file CScanMethod.h.

Referenced by CScanItemLinear(), isValidScanItem(), and step().

C_FLOAT64 CScanItemLinear::mMax
private

Definition at line 115 of file CScanMethod.h.

Referenced by CScanItemLinear().

C_FLOAT64 CScanItemLinear::mMin
private

Definition at line 115 of file CScanMethod.h.

Referenced by CScanItemLinear(), and step().


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