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

#include <CLyapTask.h>

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

Public Member Functions

const C_FLOAT64averageDivergence () const
 
 CLyapTask (const CCopasiContainer *pParent=NULL)
 
virtual CCopasiMethodcreateMethod (const int &type) const
 
const CVector< C_FLOAT64 > & exponents () const
 
virtual bool initialize (const OutputFlag &of, COutputHandler *pOutputHandler, std::ostream *pOstream)
 
bool methodCallback (const C_FLOAT64 &percentage, bool onlyProgress)
 
size_t modelVariablesInResult () const
 
size_t numberOfExponentsCalculated () const
 
void printResult (std::ostream *ostream) const
 
virtual bool process (const bool &useInitialValues)
 
virtual bool restore ()
 
bool resultAvailable () const
 
bool resultHasDivergence () const
 
virtual bool setMethodType (const int &type)
 
const C_FLOAT64sumOfExponents () const
 
 ~CLyapTask ()
 
- Public Member Functions inherited from CCopasiTask
 CCopasiTask (const std::string &name="NoName", const CCopasiContainer *pParent=NULL, const std::string &type="Task")
 
 CCopasiTask (const Type &taskType, const CCopasiContainer *pParent=NULL, const std::string &type="Task")
 
 CCopasiTask (const CCopasiTask &src, const CCopasiContainer *pParent=NULL)
 
void cleanup ()
 
CProcessReportgetCallBack () const
 
const CDescriptiongetDescription () const
 
virtual const std::string & getKey () const
 
CCopasiMethodgetMethod ()
 
const CCopasiMethodgetMethod () const
 
COutputHandlergetOutputHandler () const
 
const OutputFlaggetOutputMode () const
 
CCopasiProblemgetProblem ()
 
const CCopasiProblemgetProblem () const
 
CReportgetReport ()
 
const CResultgetResult () const
 
CCopasiParameterGroupgetSliders ()
 
Type getType () const
 
const bool & isScheduled () const
 
const bool & isUpdateModel () const
 
virtual void output (const COutputInterface::Activity &activity)
 
virtual void separate (const COutputInterface::Activity &activity)
 
virtual bool setCallBack (CProcessReport *pCallBack)
 
void setScheduled (const bool &scheduled)
 
void setType (const Type &type)
 
void setUpdateModel (const bool &updateModel)
 
virtual bool updateMatrices ()
 
virtual ~CCopasiTask ()
 
- Public Member Functions inherited from CCopasiContainer
virtual bool add (CCopasiObject *pObject, const bool &adopt=true)
 
 CCopasiContainer (const std::string &name, const CCopasiContainer *pParent=NULL, const std::string &type="CN", const unsigned C_INT32 &flag=CCopasiObject::Container)
 
 CCopasiContainer (const CCopasiContainer &src, const CCopasiContainer *pParent=NULL)
 
virtual std::string getChildObjectUnits (const CCopasiObject *pObject) const
 
virtual const CObjectInterfacegetObject (const CCopasiObjectName &cn) const
 
virtual const objectMapgetObjects () const
 
virtual std::string getUnits () const
 
virtual const CCopasiObjectgetValueObject () const
 
virtual bool remove (CCopasiObject *pObject)
 
virtual ~CCopasiContainer ()
 
- Public Member Functions inherited from CCopasiObject
void addDirectDependency (const CCopasiObject *pObject)
 
 CCopasiObject (const CCopasiObject &src, const CCopasiContainer *pParent=NULL)
 
void clearDirectDependencies ()
 
void clearRefresh ()
 
bool dependsOn (DataObjectSet candidates, const DataObjectSet &context=DataObjectSet()) const
 
void getAllDependencies (DataObjectSet &dependencies, const DataObjectSet &context) const
 
virtual CCopasiObjectName getCN () const
 
virtual const DataObjectSetgetDirectDependencies (const DataObjectSet &context=DataObjectSet()) const
 
CCopasiContainergetObjectAncestor (const std::string &type) const
 
CCopasiDataModelgetObjectDataModel ()
 
const CCopasiDataModelgetObjectDataModel () const
 
virtual std::string getObjectDisplayName (bool regular=true, bool richtext=false) const
 
const std::string & getObjectName () const
 
CCopasiContainergetObjectParent () const
 
const std::string & getObjectType () const
 
virtual const
CObjectInterface::ObjectSet
getPrerequisites () const
 
virtual RefreshgetRefresh () const
 
UpdateMethodgetUpdateMethod () const
 
virtual voidgetValuePointer () const
 
bool hasCircularDependencies (DataObjectSet &candidates, DataObjectSet &verified, const DataObjectSet &context) const
 
bool hasUpdateMethod () const
 
bool isArray () const
 
bool isContainer () const
 
bool isDataModel () const
 
bool isMatrix () const
 
bool isNameVector () const
 
bool isNonUniqueName () const
 
virtual bool isPrerequisiteForContext (const CObjectInterface *pObject, const CMath::SimulationContextFlag &context, const CObjectInterface::ObjectSet &changedObjects) const
 
bool isReference () const
 
bool isRoot () const
 
bool isSeparator () const
 
bool isStaticString () const
 
bool isValueBool () const
 
bool isValueDbl () const
 
bool isValueInt () const
 
bool isValueInt64 () const
 
bool isValueString () const
 
bool isVector () const
 
virtual bool mustBeDeleted (const DataObjectSet &deletedObjects) const
 
virtual void print (std::ostream *ostream) const
 
void removeDirectDependency (const CCopasiObject *pObject)
 
void setDirectDependencies (const DataObjectSet &directDependencies)
 
bool setObjectName (const std::string &name)
 
virtual bool setObjectParent (const CCopasiContainer *pParent)
 
void setObjectValue (const C_FLOAT64 &value)
 
void setObjectValue (const C_INT32 &value)
 
void setObjectValue (const bool &value)
 
template<class CType >
void setRefresh (CType *pType, void(CType::*method)(void))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const C_FLOAT64 &))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const C_INT32 &))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const bool &))
 
virtual ~CCopasiObject ()
 
- Public Member Functions inherited from CObjectInterface
 CObjectInterface ()
 
virtual ~CObjectInterface ()
 

Private Member Functions

void calculationsBeforeOutput ()
 
void cleanup ()
 
void initObjects ()
 

Private Attributes

C_FLOAT64 mAverageDivergence
 
CVector< C_FLOAT64mExponents
 
size_t mhProcess
 
C_FLOAT64 mIntervalDivergence
 
CVector< C_FLOAT64mLocalExponents
 
size_t mModelVariablesInResult
 
size_t mNumExponentsCalculated
 
C_FLOAT64 mPercentage
 
CLyapMethodmpLyapMethod
 
CLyapProblemmpLyapProblem
 
bool mResultAvailable
 
bool mResultHasDivergence
 
C_FLOAT64 mSumOfExponents
 
C_FLOAT64 mSumOfLocalExponents
 
std::vector
< CCopasiObjectReference
< C_FLOAT64 > * > 
mvExpRef
 
std::vector
< CCopasiObjectReference
< C_FLOAT64 > * > 
mvLocExpRef
 

Friends

class CLyapWolfMethod
 

Additional Inherited Members

- Public Types inherited from CCopasiTask
enum  eOutputFlagBase {
  INITIALIZE = 0x01, STREAM = 0x02, FINISH = 0x04, REPORT = 0x10,
  PLOT = 0x20, TIME_SERIES = 0x40
}
 
enum  OutputFlag {
  NO_OUTPUT = 0, OUTPUT_BEFORE = INITIALIZE, OUTPUT_AFTER = FINISH, OUTPUT = REPORT | PLOT | STREAM,
  OUTPUT_SE = REPORT | PLOT | INITIALIZE | STREAM | FINISH, OUTPUT_UI = REPORT | PLOT | TIME_SERIES | INITIALIZE | STREAM | FINISH, ONLY_TIME_SERIES = TIME_SERIES | INITIALIZE | STREAM | FINISH
}
 
enum  Type {
  steadyState = 0, timeCourse, scan, fluxMode,
  optimization, parameterFitting, mca, lyap,
  tssAnalysis, sens, moieties, crosssection,
  lna, unset
}
 
- Public Types inherited from CCopasiContainer
typedef std::multimap
< std::string, CCopasiObject * > 
objectMap
 
- Public Types inherited from CCopasiObject
typedef std::set< const
CCopasiObject * > 
DataObjectSet
 
typedef std::vector< Refresh * > DataUpdateSequence
 
- Public Types inherited from CObjectInterface
typedef std::set< const
CObjectInterface * > 
ObjectSet
 
typedef std::vector
< CObjectInterface * > 
UpdateSequence
 
- Static Public Member Functions inherited from CCopasiTask
static bool isValidMethod (const unsigned int &method, const unsigned int *validMethods)
 
- Static Public Member Functions inherited from CCopasiObject
static std::vector< Refresh * > buildUpdateSequence (const DataObjectSet &objects, const DataObjectSet &uptoDateObjects, const DataObjectSet &context=DataObjectSet())
 
static void setRenameHandler (CRenameHandler *rh)
 
- Public Attributes inherited from CCopasiTask
std::string Error
 
std::string Warning
 
- Static Public Attributes inherited from CCopasiTask
static const std::string TypeName []
 
static const unsigned int ValidMethods []
 
static const char * XMLType []
 
- Static Public Attributes inherited from CCopasiContainer
static const std::vector
< CCopasiContainer * > 
EmptyList
 
- Protected Types inherited from CCopasiObject
enum  Flag {
  Container = 0x1, Vector = 0x2, Matrix = 0x4, NameVector = 0x8,
  Reference = 0x10, ValueBool = 0x20, ValueInt = 0x40, ValueInt64 = 0x80,
  ValueDbl = 0x100, NonUniqueName = 0x200, StaticString = 0x400, ValueString = 0x800,
  Separator = 0x1000, ModelEntity = 0x2000, Array = 0x4000, DataModel = 0x8000,
  Root = 0x10000, Gui = 0x20000
}
 
- Protected Member Functions inherited from CCopasiContainer
template<class CType >
CCopasiObjectaddMatrixReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
 
template<class CType >
CCopasiObjectaddObjectReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
 
template<class CType >
CCopasiObjectaddVectorReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
 
void initObjects ()
 
- Protected Member Functions inherited from CCopasiObject
 CCopasiObject ()
 
 CCopasiObject (const std::string &name, const CCopasiContainer *pParent=NULL, const std::string &type="CN", const unsigned C_INT32 &flag=0)
 
- Protected Attributes inherited from CCopasiTask
CDescription mDescription
 
OutputFlag mDoOutput
 
std::string mKey
 
unsigned C_INT32 mOutputCounter
 
CProcessReportmpCallBack
 
CStatempInitialState
 
CCopasiMethodmpMethod
 
COutputHandlermpOutputHandler
 
CCopasiProblemmpProblem
 
CCopasiParameterGroupmpSliders
 
CReport mReport
 
CResult mResult
 
bool mScheduled
 
Type mType
 
bool mUpdateModel
 
- Protected Attributes inherited from CCopasiContainer
objectMap mObjects
 
- Static Protected Attributes inherited from CCopasiObject
static CRenameHandlersmpRenameHandler = NULL
 

Detailed Description

Definition at line 38 of file CLyapTask.h.

Constructor & Destructor Documentation

CLyapTask::CLyapTask ( const CCopasiContainer pParent = NULL)

Default constructor

Parameters
constCCopasiContainer * pParent (default: NULL)

Definition at line 52 of file CLyapTask.cpp.

References CCopasiContainer::add(), CLyapMethod::createMethod(), initObjects(), CCopasiMethod::lyapWolf, CCopasiTask::mpMethod, and CCopasiTask::mpProblem.

52  :
54  //mTimeSeriesRequested(true),
55  //mTimeSeries(),
56  mpLyapProblem(NULL),
57  mpLyapMethod(NULL),
59  mExponents(),
60  mSumOfExponents(0.0),
63  mAverageDivergence(0.0),
64  mResultAvailable(false),
65  mResultHasDivergence(false),
67 {
68  mpProblem = new CLyapProblem(this);
69  mpMethod =
71  this->add(mpMethod, true);
72 
73  initObjects();
74 }
CCopasiMethod * mpMethod
Definition: CCopasiTask.h:239
CVector< C_FLOAT64 > mLocalExponents
Definition: CLyapTask.h:58
CCopasiTask(const std::string &name="NoName", const CCopasiContainer *pParent=NULL, const std::string &type="Task")
void initObjects()
Definition: CLyapTask.cpp:84
CCopasiProblem * mpProblem
Definition: CCopasiTask.h:234
C_FLOAT64 mIntervalDivergence
Definition: CLyapTask.h:67
CVector< C_FLOAT64 > mExponents
Definition: CLyapTask.h:59
static CLyapMethod * createMethod(CCopasiMethod::SubType subType=CCopasiMethod::lyapWolf)
Definition: CLyapMethod.cpp:58
C_FLOAT64 mSumOfLocalExponents
Definition: CLyapTask.h:62
size_t mModelVariablesInResult
Definition: CLyapTask.h:84
C_FLOAT64 mSumOfExponents
Definition: CLyapTask.h:61
virtual bool add(CCopasiObject *pObject, const bool &adopt=true)
bool mResultAvailable
Definition: CLyapTask.h:82
C_FLOAT64 mAverageDivergence
Definition: CLyapTask.h:72
CLyapProblem * mpLyapProblem
Definition: CLyapTask.h:48
bool mResultHasDivergence
Definition: CLyapTask.h:83
CLyapMethod * mpLyapMethod
Definition: CLyapTask.h:53
CLyapTask::~CLyapTask ( )

Destructor

Definition at line 76 of file CLyapTask.cpp.

References cleanup().

77 {
78  cleanup();
79 }
void cleanup()
Definition: CLyapTask.cpp:81

Member Function Documentation

const C_FLOAT64& CLyapTask::averageDivergence ( ) const
inline

Definition at line 135 of file CLyapTask.h.

References mAverageDivergence.

Referenced by CQLyapResultWidget::loadFromBackend().

136  {return mAverageDivergence;}
C_FLOAT64 mAverageDivergence
Definition: CLyapTask.h:72
void CLyapTask::calculationsBeforeOutput ( )
private

this does calculations that need to be done before output: sum of exponents, divergence, ...

Definition at line 278 of file CLyapTask.cpp.

References C_INT32, CLyapProblem::getExponentNumber(), mExponents, mLocalExponents, mpLyapProblem, mSumOfExponents, and mSumOfLocalExponents.

Referenced by methodCallback(), and process().

279 {
280  mSumOfExponents = 0;
282 
284 
285  for (i = 0; i < imax; ++i)
286  {
289  }
290 }
CVector< C_FLOAT64 > mLocalExponents
Definition: CLyapTask.h:58
#define C_INT32
Definition: copasi.h:90
CVector< C_FLOAT64 > mExponents
Definition: CLyapTask.h:59
const unsigned C_INT32 & getExponentNumber() const
C_FLOAT64 mSumOfLocalExponents
Definition: CLyapTask.h:62
C_FLOAT64 mSumOfExponents
Definition: CLyapTask.h:61
CLyapProblem * mpLyapProblem
Definition: CLyapTask.h:48
void CLyapTask::cleanup ( )
private

cleanup()

Definition at line 81 of file CLyapTask.cpp.

Referenced by ~CLyapTask().

82 {}
CCopasiMethod * CLyapTask::createMethod ( const int &  type) const
virtual

Create a method of the specified type to solve the task. It is the duty of the caller to release the CCopasiMethod.

Parameters
constCCopasiMethod::SubType & type
Returns
CCopasiMethod *

Reimplemented from CCopasiTask.

Definition at line 253 of file CLyapTask.cpp.

References CLyapMethod::createMethod().

Referenced by setMethodType().

254 {
256 
257  return CLyapMethod::createMethod(Type);
258 }
static CLyapMethod * createMethod(CCopasiMethod::SubType subType=CCopasiMethod::lyapWolf)
Definition: CLyapMethod.cpp:58
const CVector<C_FLOAT64>& CLyapTask::exponents ( ) const
inline

Definition at line 126 of file CLyapTask.h.

References mExponents.

Referenced by CQLyapResultWidget::loadFromBackend().

127  {return mExponents;}
CVector< C_FLOAT64 > mExponents
Definition: CLyapTask.h:59
bool CLyapTask::initialize ( const OutputFlag of,
COutputHandler pOutputHandler,
std::ostream *  pOstream 
)
virtual

Initialize the task. If an ostream is given this ostream is used instead of the target specified in the report. This allows nested tasks to share the same output device.

Parameters
constOutputFlag & of
COutputHandler* pOutputHandler
std::ostream* pOstream (default: NULL)
Returns
bool success

Reimplemented from CCopasiTask.

Definition at line 125 of file CLyapTask.cpp.

References CVectorCore< CType >::array(), CLyapProblem::getExponentNumber(), CCopasiTask::initialize(), CCopasiMethod::isValidProblem(), LYAP_NUM_REF, mExponents, mLocalExponents, mpLyapMethod, mpLyapProblem, CCopasiTask::mpMethod, CCopasiTask::mpProblem, mvExpRef, mvLocExpRef, CVector< CType >::resize(), and CLyapMethod::setProblem().

128 {
129  assert(mpProblem && mpMethod);
130 
131  mpLyapProblem = dynamic_cast<CLyapProblem *>(mpProblem);
132  assert(mpLyapProblem);
133 
134  mpLyapMethod = dynamic_cast<CLyapMethod *>(mpMethod);
135  assert(mpLyapMethod);
136 
138 
139  bool success = mpMethod->isValidProblem(mpProblem);
140 
141  size_t nnn;
142 
145  else
146  nnn = LYAP_NUM_REF;
147 
148  mLocalExponents.resize(nnn);
149  mExponents.resize(nnn);
150 
151  //update object references because the object may have been
152  //moved by the resize above
153  size_t i;
154 
155  for (i = 0; i < LYAP_NUM_REF; ++i)
156  {
157  mvExpRef[i]->setReference(mExponents.array()[i]);
158  mvLocExpRef[i]->setReference(mLocalExponents.array()[i]);
159  }
160 
161  if (!CCopasiTask::initialize(of, pOutputHandler, pOstream)) success = false;
162 
163  //mTimeSeriesRequested = mpLyapProblem->timeSeriesRequested();
164 
165  return success;
166 }
CCopasiMethod * mpMethod
Definition: CCopasiTask.h:239
void setProblem(CLyapProblem *problem)
CVector< C_FLOAT64 > mLocalExponents
Definition: CLyapTask.h:58
virtual bool initialize(const OutputFlag &of, COutputHandler *pOutputHandler, std::ostream *pOstream)
void resize(size_t size, const bool &copy=false)
Definition: CVector.h:301
std::vector< CCopasiObjectReference< C_FLOAT64 > * > mvLocExpRef
Definition: CLyapTask.h:80
virtual bool isValidProblem(const CCopasiProblem *pProblem)
CCopasiProblem * mpProblem
Definition: CCopasiTask.h:234
std::vector< CCopasiObjectReference< C_FLOAT64 > * > mvExpRef
Definition: CLyapTask.h:79
CVector< C_FLOAT64 > mExponents
Definition: CLyapTask.h:59
const unsigned C_INT32 & getExponentNumber() const
CType * array()
Definition: CVector.h:139
#define LYAP_NUM_REF
Definition: CLyapTask.cpp:50
CLyapProblem * mpLyapProblem
Definition: CLyapTask.h:48
CLyapMethod * mpLyapMethod
Definition: CLyapTask.h:53
void CLyapTask::initObjects ( )
private

Definition at line 84 of file CLyapTask.cpp.

References CCopasiContainer::addObjectReference(), CCopasiContainer::addVectorReference(), CVectorCore< CType >::array(), LYAP_NUM_REF, mAverageDivergence, mExponents, mIntervalDivergence, mLocalExponents, mSumOfExponents, mSumOfLocalExponents, mvExpRef, mvLocExpRef, CVector< CType >::resize(), and CCopasiObject::ValueDbl.

Referenced by CLyapTask().

85 {
86  size_t i;
87 
89 
90  for (i = 0; i < LYAP_NUM_REF; ++i) mExponents[i] = 0.0;
91 
92  mvExpRef.resize(LYAP_NUM_REF);
93 
94  mLocalExponents.resize(LYAP_NUM_REF);
95 
96  for (i = 0; i < LYAP_NUM_REF; ++i) mLocalExponents[i] = 0.0;
97 
98  mvLocExpRef.resize(LYAP_NUM_REF);
99 
102 
103  for (i = 0; i < LYAP_NUM_REF; ++i)
104  {
105  std::ostringstream sss;
106  sss << "Exponent " << i + 1;
107  mvExpRef[i] = dynamic_cast<CCopasiObjectReference<C_FLOAT64> *>
109  assert(mvExpRef[i]);
110 
111  std::ostringstream sss2;
112  sss2 << "Local exponent " << i + 1;
115  assert(mvLocExpRef[i]);
116  }
117 
120  //addObjectReference("Local divergence", mDivergence, CCopasiObject::ValueDbl);
123 }
CVector< C_FLOAT64 > mLocalExponents
Definition: CLyapTask.h:58
void resize(size_t size, const bool &copy=false)
Definition: CVector.h:301
std::vector< CCopasiObjectReference< C_FLOAT64 > * > mvLocExpRef
Definition: CLyapTask.h:80
C_FLOAT64 mIntervalDivergence
Definition: CLyapTask.h:67
std::vector< CCopasiObjectReference< C_FLOAT64 > * > mvExpRef
Definition: CLyapTask.h:79
CVector< C_FLOAT64 > mExponents
Definition: CLyapTask.h:59
C_FLOAT64 mSumOfLocalExponents
Definition: CLyapTask.h:62
CType * array()
Definition: CVector.h:139
C_FLOAT64 mSumOfExponents
Definition: CLyapTask.h:61
#define LYAP_NUM_REF
Definition: CLyapTask.cpp:50
CCopasiObject * addVectorReference(const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
C_FLOAT64 mAverageDivergence
Definition: CLyapTask.h:72
CCopasiObject * addObjectReference(const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
bool CLyapTask::methodCallback ( const C_FLOAT64 percentage,
bool  onlyProgress 
)

This is called by the method to generate the output and update the progress bar. The parameter is the percentage for the progress bar. The return value is the return value of the progress bar handler (and determines if the calculation will be stopped). If onlyProgess is true, no output is done.

Definition at line 260 of file CLyapTask.cpp.

References calculationsBeforeOutput(), COutputInterface::DURING, mhProcess, CCopasiTask::mpCallBack, mPercentage, CCopasiTask::output(), and CProcessReport::progressItem().

Referenced by CLyapWolfMethod::calculate().

261 {
262  if (!onlyProgress)
263  {
266  }
267 
268  mPercentage = percentage;
269 
270  if (mpCallBack)
271  {
273  }
274 
275  return true;
276 }
CProcessReport * mpCallBack
Definition: CCopasiTask.h:249
virtual void output(const COutputInterface::Activity &activity)
virtual bool progressItem(const size_t &handle)
size_t mhProcess
Definition: CLyapTask.h:76
C_FLOAT64 mPercentage
Definition: CLyapTask.h:75
void calculationsBeforeOutput()
Definition: CLyapTask.cpp:278
size_t CLyapTask::modelVariablesInResult ( ) const

how many independent variables had the model at the time of the last calculation?

Definition at line 330 of file CLyapTask.cpp.

References mModelVariablesInResult.

Referenced by CQLyapResultWidget::loadFromBackend().

331 {
333 }
size_t mModelVariablesInResult
Definition: CLyapTask.h:84
size_t CLyapTask::numberOfExponentsCalculated ( ) const

Definition at line 335 of file CLyapTask.cpp.

References mNumExponentsCalculated.

Referenced by CQLyapResultWidget::loadFromBackend().

336 {
338 }
size_t mNumExponentsCalculated
Definition: CLyapTask.h:85
void CLyapTask::printResult ( std::ostream *  ostream) const

This functionality is expected from CLyapProblem but has to be implmented here for the moment. This is called from the corresponding method of the problem

Definition at line 292 of file CLyapTask.cpp.

References C_INT32, CLyapProblem::divergenceRequested(), CLyapProblem::getExponentNumber(), mAverageDivergence, mExponents, and mpLyapProblem.

Referenced by CLyapProblem::printResult(), and CQLyapResultWidget::saveToFile().

293 {
294  std::ostream & os = *ostream;
295 
296  // CCopasiTimeVariable CPUTime = const_cast<COptProblem *>(this)->mCPUTime.getElapsedTime();
297  // os << " CPU Time [s]:\t"
298  // << CCopasiTimeVariable::LL2String(CPUTime.getSeconds(), 1) << "."
299  // << CCopasiTimeVariable::LL2String(CPUTime.getMilliSeconds(true), 3) << std::endl;
300 
301  os << "Lyapunov Exponents:" << std::endl;
302 
303  if (!mpLyapProblem) //this means that task was not yet executed
304  {
305  os << "No results available." << std::endl;
306  return;
307  }
308 
309  unsigned C_INT32 i, imax = mpLyapProblem->getExponentNumber();
310 
311  for (i = 0; i < imax; ++i)
312  os << mExponents[i] << " ";
313 
314  os << std::endl;
315 
317  os << std::endl << "Average divergence: " << mAverageDivergence << std::endl;
318 }
#define C_INT32
Definition: copasi.h:90
CVector< C_FLOAT64 > mExponents
Definition: CLyapTask.h:59
const unsigned C_INT32 & getExponentNumber() const
bool divergenceRequested() const
C_FLOAT64 mAverageDivergence
Definition: CLyapTask.h:72
CLyapProblem * mpLyapProblem
Definition: CLyapTask.h:48
bool CLyapTask::process ( const bool &  useInitialValues)
virtual

Process the task with or without initializing to the initial state.

Parameters
constbool & useInitialValues
Returns
bool success

Reimplemented from CCopasiTask.

Definition at line 168 of file CLyapTask.cpp.

References CProcessReport::addItem(), COutputInterface::AFTER, CModel::applyInitialValues(), COutputInterface::BEFORE, C_FLOAT64, CLyapMethod::calculate(), calculationsBeforeOutput(), CLyapProblem::divergenceRequested(), COutputInterface::DURING, CProcessReport::finishItem(), CLyapProblem::getExponentNumber(), CCopasiException::getMessage(), CCopasiProblem::getModel(), CState::getNumIndependent(), CModel::getState(), mhProcess, mModelVariablesInResult, mNumExponentsCalculated, CCopasiTask::mpCallBack, mPercentage, mpLyapMethod, mpLyapProblem, mResultAvailable, mResultHasDivergence, CCopasiTask::output(), CProcessReport::setName(), and CModel::updateSimulatedValues().

169 {
170  if (useInitialValues)
172 
174 
175  // bool flagProceed = true;
176  mPercentage = 0;
177 
178  if (mpCallBack)
179  {
180  mpCallBack->setName("performing lyapunov exponent calculation...");
181  C_FLOAT64 hundred = 100;
182  mhProcess = mpCallBack->addItem("Completion",
183  mPercentage,
184  &hundred);
185  }
186 
187  try
188  {
190  }
191  catch (CCopasiException & Exception)
192  {
193  //mpLyapProblem->getModel()->setState(*mpCurrentState);
195 
198 
200 
202 
203  throw CCopasiException(Exception.getMessage());
204  }
205 
207 
210 
211  mResultAvailable = true;
215 
216  return true;
217 }
const CCopasiMessage & getMessage() const
virtual bool setName(const std::string &name)
void updateSimulatedValues(const bool &updateMoieties)
Definition: CModel.cpp:1851
CProcessReport * mpCallBack
Definition: CCopasiTask.h:249
virtual void output(const COutputInterface::Activity &activity)
void applyInitialValues()
Definition: CModel.cpp:1236
size_t mhProcess
Definition: CLyapTask.h:76
C_FLOAT64 mPercentage
Definition: CLyapTask.h:75
size_t addItem(const std::string &name, const std::string &value, const std::string *pEndValue=NULL)
size_t getNumIndependent() const
Definition: CState.cpp:342
virtual bool finishItem(const size_t &handle)
const unsigned C_INT32 & getExponentNumber() const
size_t mNumExponentsCalculated
Definition: CLyapTask.h:85
#define C_FLOAT64
Definition: copasi.h:92
virtual bool calculate()=0
size_t mModelVariablesInResult
Definition: CLyapTask.h:84
bool divergenceRequested() const
bool mResultAvailable
Definition: CLyapTask.h:82
const CState & getState() const
Definition: CModel.cpp:1771
CLyapProblem * mpLyapProblem
Definition: CLyapTask.h:48
void calculationsBeforeOutput()
Definition: CLyapTask.cpp:278
bool mResultHasDivergence
Definition: CLyapTask.h:83
CLyapMethod * mpLyapMethod
Definition: CLyapTask.h:53
CModel * getModel() const
bool CLyapTask::restore ( )
virtual

Perform neccessary cleaup procedures

Reimplemented from CCopasiTask.

Definition at line 219 of file CLyapTask.cpp.

References CCopasiProblem::getModel(), CModel::getState(), CCopasiTask::mpProblem, CCopasiTask::mUpdateModel, CCopasiTask::restore(), CModel::setInitialState(), CModel::updateInitialValues(), and CModel::updateSimulatedValues().

220 {
221  bool success = CCopasiTask::restore();
222 
223  if (mUpdateModel)
224  {
225  CModel * pModel = mpProblem->getModel();
226 
227  //TODO
228  //pModel->setState(*mpCurrentState);
229  pModel->updateSimulatedValues(true);
230  pModel->setInitialState(pModel->getState());
231  pModel->updateInitialValues();
232  }
233 
234  return success;
235 }
void setInitialState(const CState &state)
Definition: CModel.cpp:1774
void updateSimulatedValues(const bool &updateMoieties)
Definition: CModel.cpp:1851
CCopasiProblem * mpProblem
Definition: CCopasiTask.h:234
bool mUpdateModel
Definition: CCopasiTask.h:223
bool updateInitialValues()
Definition: CModel.cpp:1461
Definition: CModel.h:50
const CState & getState() const
Definition: CModel.cpp:1771
virtual bool restore()
CModel * getModel() const
bool CLyapTask::resultAvailable ( ) const

Definition at line 320 of file CLyapTask.cpp.

References mResultAvailable.

Referenced by CQLyapResultWidget::loadFromBackend().

321 {
322  return mResultAvailable;
323 }
bool mResultAvailable
Definition: CLyapTask.h:82
bool CLyapTask::resultHasDivergence ( ) const

was divergence requested for the last calculation?

Definition at line 325 of file CLyapTask.cpp.

References mResultHasDivergence.

Referenced by CQLyapResultWidget::loadFromBackend().

326 {
327  return mResultHasDivergence;
328 }
bool mResultHasDivergence
Definition: CLyapTask.h:83
bool CLyapTask::setMethodType ( const int &  type)
virtual

Set the method type applied to solve the task

Parameters
constCCopasiMethod::SubType & type
Returns
bool success

Reimplemented from CCopasiTask.

Definition at line 237 of file CLyapTask.cpp.

References CCopasiContainer::add(), createMethod(), CCopasiMethod::getSubType(), CLyapMethod::isValidSubType(), CCopasiTask::mpMethod, and pdelete.

238 {
240 
241  if (!CLyapMethod::isValidSubType(Type)) return false;
242 
243  if (mpMethod->getSubType() == Type) return true;
244 
245  pdelete(mpMethod);
246  mpMethod = createMethod(Type);
247  this->add(mpMethod, true);
248 
249  return true;
250 }
CCopasiMethod * mpMethod
Definition: CCopasiTask.h:239
#define pdelete(p)
Definition: copasi.h:215
virtual CCopasiMethod * createMethod(const int &type) const
Definition: CLyapTask.cpp:253
const CCopasiMethod::SubType & getSubType() const
static bool isValidSubType(const CCopasiMethod::SubType &subType)
Definition: CLyapMethod.cpp:48
virtual bool add(CCopasiObject *pObject, const bool &adopt=true)
const C_FLOAT64& CLyapTask::sumOfExponents ( ) const
inline

Definition at line 132 of file CLyapTask.h.

References mSumOfExponents.

Referenced by CQLyapResultWidget::loadFromBackend().

133  {return mSumOfExponents;}
C_FLOAT64 mSumOfExponents
Definition: CLyapTask.h:61

Friends And Related Function Documentation

friend class CLyapWolfMethod
friend

Definition at line 40 of file CLyapTask.h.

Member Data Documentation

C_FLOAT64 CLyapTask::mAverageDivergence
private

Divergence averaged over the whole integration time

Definition at line 72 of file CLyapTask.h.

Referenced by averageDivergence(), CLyapWolfMethod::calculate(), initObjects(), printResult(), and CLyapWolfMethod::start().

CVector<C_FLOAT64> CLyapTask::mExponents
private
size_t CLyapTask::mhProcess
private

Definition at line 76 of file CLyapTask.h.

Referenced by methodCallback(), and process().

C_FLOAT64 CLyapTask::mIntervalDivergence
private

Divergence averaged over the last orthonormalization interval

Definition at line 67 of file CLyapTask.h.

Referenced by CLyapWolfMethod::calculate(), initObjects(), and CLyapWolfMethod::start().

CVector<C_FLOAT64> CLyapTask::mLocalExponents
private

Vectors with the result

Definition at line 58 of file CLyapTask.h.

Referenced by CLyapWolfMethod::calculate(), calculationsBeforeOutput(), initialize(), initObjects(), and CLyapWolfMethod::start().

size_t CLyapTask::mModelVariablesInResult
private

Definition at line 84 of file CLyapTask.h.

Referenced by modelVariablesInResult(), and process().

size_t CLyapTask::mNumExponentsCalculated
private

Definition at line 85 of file CLyapTask.h.

Referenced by numberOfExponentsCalculated(), and process().

C_FLOAT64 CLyapTask::mPercentage
private

Definition at line 75 of file CLyapTask.h.

Referenced by methodCallback(), and process().

CLyapMethod* CLyapTask::mpLyapMethod
private

A pointer to the trajectory method

Definition at line 53 of file CLyapTask.h.

Referenced by initialize(), and process().

CLyapProblem* CLyapTask::mpLyapProblem
private

A pointer to the trajectory Problem

Definition at line 48 of file CLyapTask.h.

Referenced by calculationsBeforeOutput(), initialize(), printResult(), and process().

bool CLyapTask::mResultAvailable
private

Definition at line 82 of file CLyapTask.h.

Referenced by process(), and resultAvailable().

bool CLyapTask::mResultHasDivergence
private

Definition at line 83 of file CLyapTask.h.

Referenced by process(), and resultHasDivergence().

C_FLOAT64 CLyapTask::mSumOfExponents
private

Definition at line 61 of file CLyapTask.h.

Referenced by calculationsBeforeOutput(), initObjects(), and sumOfExponents().

C_FLOAT64 CLyapTask::mSumOfLocalExponents
private

Definition at line 62 of file CLyapTask.h.

Referenced by calculationsBeforeOutput(), and initObjects().

std::vector<CCopasiObjectReference<C_FLOAT64> *> CLyapTask::mvExpRef
private

Definition at line 79 of file CLyapTask.h.

Referenced by initialize(), and initObjects().

std::vector<CCopasiObjectReference<C_FLOAT64> *> CLyapTask::mvLocExpRef
private

Definition at line 80 of file CLyapTask.h.

Referenced by initialize(), and initObjects().


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