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

#include <CTSSATask.h>

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

Public Member Functions

virtual CCopasiMethodcreateMethod (const int &type) const
 
 CTSSATask (const CCopasiContainer *pParent=NULL)
 
 CTSSATask (const CTSSATask &src, const CCopasiContainer *pParent=NULL)
 
CStategetState ()
 
const CTimeSeriesgetTimeSeries () const
 
virtual bool initialize (const OutputFlag &of, COutputHandler *pOutputHandler, std::ostream *pOstream)
 
virtual bool process (const bool &useInitialValues)
 
void processStart (const bool &useInitialValues)
 
bool processStep (const C_FLOAT64 &nextTime)
 
virtual bool restore ()
 
virtual bool setMethodType (const int &type)
 
virtual bool updateMatrices ()
 
 ~CTSSATask ()
 
- 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 ~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 ()
 

Static Public Attributes

static const unsigned int ValidMethods []
 
- 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
 

Private Member Functions

void cleanup ()
 

Private Attributes

CStatempCurrentState
 
const C_FLOAT64mpCurrentTime
 
CTSSAMethodmpTSSAMethod
 
CTSSAProblemmpTSSAProblem
 
CTimeSeries mTimeSeries
 
bool mTimeSeriesRequested
 
bool mUpdateMoieties
 

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
 
- 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 43 of file CTSSATask.h.

Constructor & Destructor Documentation

CTSSATask::CTSSATask ( const CCopasiContainer pParent = NULL)

Default constructor

Parameters
constCCopasiContainer * pParent (default: NULL)

Definition at line 61 of file CTSSATask.cpp.

References CCopasiContainer::add(), createMethod(), CCopasiParameterGroup::getParameter(), CCopasiParameter::getValue(), CCopasiTask::mpMethod, CCopasiTask::mpProblem, mUpdateMoieties, CCopasiParameter::Value::pBOOL, and CCopasiMethod::tssILDM.

61  :
64  mTimeSeries(),
65  mpTSSAProblem(NULL),
66  mpTSSAMethod(NULL),
67  mpCurrentState(NULL),
68  mpCurrentTime(NULL)
69 {
70  mpProblem = new CTSSAProblem(this);
72  this->add(mpMethod, true);
73 
74  CCopasiParameter * pParameter = mpMethod->getParameter("Integrate Reduced Model");
75 
76  if (pParameter != NULL)
77  mUpdateMoieties = *pParameter->getValue().pBOOL;
78  else
79  mUpdateMoieties = false;
80 }
CCopasiMethod * mpMethod
Definition: CCopasiTask.h:239
CTSSAMethod * mpTSSAMethod
Definition: CTSSATask.h:72
const C_FLOAT64 * mpCurrentTime
Definition: CTSSATask.h:87
CCopasiTask(const std::string &name="NoName", const CCopasiContainer *pParent=NULL, const std::string &type="Task")
CTSSAProblem * mpTSSAProblem
Definition: CTSSATask.h:67
CCopasiProblem * mpProblem
Definition: CCopasiTask.h:234
CState * mpCurrentState
Definition: CTSSATask.h:82
const Value & getValue() const
CCopasiParameter * getParameter(const std::string &name)
CTimeSeries mTimeSeries
Definition: CTSSATask.h:62
bool mUpdateMoieties
Definition: CTSSATask.h:77
virtual CCopasiMethod * createMethod(const int &type) const
Definition: CTSSATask.cpp:418
virtual bool add(CCopasiObject *pObject, const bool &adopt=true)
bool mTimeSeriesRequested
Definition: CTSSATask.h:57
CTSSATask::CTSSATask ( const CTSSATask src,
const CCopasiContainer pParent = NULL 
)

Copy constructor

Parameters
constCTSSATask & src
constCCopasiContainer * pParent (default: NULL)

Definition at line 82 of file CTSSATask.cpp.

References CCopasiContainer::add(), createMethod(), CCopasiParameterGroup::elevateChildren(), CCopasiMethod::getSubType(), CCopasiParameter::getValue(), CCopasiTask::mpMethod, CCopasiTask::mpProblem, mUpdateMoieties, and CCopasiParameter::Value::pBOOL.

83  :
84  CCopasiTask(src, pParent),
86  mTimeSeries(),
87  mpTSSAProblem(NULL),
88  mpTSSAMethod(NULL),
89  mpCurrentState(NULL),
90  mpCurrentTime(NULL)
91 {
92  mpProblem =
93  new CTSSAProblem(*static_cast< CTSSAProblem * >(src.mpProblem), this);
94 
96  * mpMethod = * src.mpMethod;
97  mpMethod->elevateChildren();
98 
99  this->add(mpMethod, true);
100 
101  CCopasiParameter * pParameter = mpMethod->getParameter("Integrate Reduced Model");
102 
103  if (pParameter != NULL)
104  mUpdateMoieties = *pParameter->getValue().pBOOL;
105  else
106  mUpdateMoieties = false;
107 }
CCopasiMethod * mpMethod
Definition: CCopasiTask.h:239
CTSSAMethod * mpTSSAMethod
Definition: CTSSATask.h:72
const C_FLOAT64 * mpCurrentTime
Definition: CTSSATask.h:87
CCopasiTask(const std::string &name="NoName", const CCopasiContainer *pParent=NULL, const std::string &type="Task")
CTSSAProblem * mpTSSAProblem
Definition: CTSSATask.h:67
const CCopasiMethod::SubType & getSubType() const
CCopasiProblem * mpProblem
Definition: CCopasiTask.h:234
CState * mpCurrentState
Definition: CTSSATask.h:82
const Value & getValue() const
CTimeSeries mTimeSeries
Definition: CTSSATask.h:62
bool mUpdateMoieties
Definition: CTSSATask.h:77
virtual CCopasiMethod * createMethod(const int &type) const
Definition: CTSSATask.cpp:418
virtual bool add(CCopasiObject *pObject, const bool &adopt=true)
bool mTimeSeriesRequested
Definition: CTSSATask.h:57
CTSSATask::~CTSSATask ( )

Destructor

Definition at line 109 of file CTSSATask.cpp.

References cleanup().

110 {
111  cleanup();
112 }
void cleanup()
Definition: CTSSATask.cpp:114

Member Function Documentation

void CTSSATask::cleanup ( )
private

cleanup()

Definition at line 114 of file CTSSATask.cpp.

References mpCurrentState, and pdelete.

Referenced by ~CTSSATask().

115 {
117 }
#define pdelete(p)
Definition: copasi.h:215
CState * mpCurrentState
Definition: CTSSATask.h:82
CCopasiMethod * CTSSATask::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 418 of file CTSSATask.cpp.

References CTSSAMethod::createMethod().

Referenced by CTSSATask(), and setMethodType().

419 {
421 
422  return CTSSAMethod::createMethod(Type);
423 }
static CTSSAMethod * createMethod(CCopasiMethod::SubType subType=CCopasiMethod::unset)
Definition: CTSSAMethod.cpp:44
CState * CTSSATask::getState ( )

Retrieves a pointer to current state of the integration.

Returns
CState * pState

Definition at line 425 of file CTSSATask.cpp.

References mpCurrentState.

426 {return mpCurrentState;}
CState * mpCurrentState
Definition: CTSSATask.h:82
const CTimeSeries & CTSSATask::getTimeSeries ( ) const

gets a reference to the time series

Returns
time series

Definition at line 428 of file CTSSATask.cpp.

References mTimeSeries.

429 {return mTimeSeries;}
CTimeSeries mTimeSeries
Definition: CTSSATask.h:62
bool CTSSATask::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 138 of file CTSSATask.cpp.

References COutputHandler::addInterface(), CTimeSeries::allocate(), CTimeSeries::clear(), CCopasiProblem::getModel(), CCopasiParameterGroup::getParameter(), CModel::getState(), CTSSAProblem::getStepNumber(), CState::getTime(), CCopasiParameter::getValue(), CCopasiTask::initialize(), CCopasiMethod::isValidProblem(), mpCurrentState, mpCurrentTime, CCopasiTask::mpMethod, CCopasiTask::mpProblem, mpTSSAMethod, mpTSSAProblem, mTimeSeries, mTimeSeriesRequested, mUpdateMoieties, CCopasiParameter::Value::pBOOL, pdelete, CTSSAMethod::predifineAnnotation(), CTSSAMethod::setModel(), CTSSAMethod::setProblem(), and CTSSAProblem::timeSeriesRequested().

141 {
142  assert(mpProblem && mpMethod);
143 
144  mpTSSAProblem = dynamic_cast<CTSSAProblem *>(mpProblem);
145  assert(mpTSSAProblem);
146 
147  mpTSSAMethod = dynamic_cast<CTSSAMethod *>(mpMethod);
148  assert(mpTSSAMethod);
149 
151 
152  bool success = mpMethod->isValidProblem(mpProblem);
153 
154  CCopasiParameter * pParameter = mpMethod->getParameter("Integrate Reduced Model");
155 
156  if (pParameter != NULL)
157  mUpdateMoieties = *pParameter->getValue().pBOOL;
158  else
159  mUpdateMoieties = false;
160 
164 
165  // Handle the time series as a regular output.
167 
168  if (pOutputHandler != NULL)
169  {
171  {
173  pOutputHandler->addInterface(&mTimeSeries);
174  }
175  else
176  {
177  mTimeSeries.clear();
178  }
179  }
180 
181 //NEW
182 
184 
186 
187 //
188 
189  if (!CCopasiTask::initialize(of, pOutputHandler, pOstream)) success = false;
190 
191  return success;
192 }
CCopasiMethod * mpMethod
Definition: CCopasiTask.h:239
#define pdelete(p)
Definition: copasi.h:215
CTSSAMethod * mpTSSAMethod
Definition: CTSSATask.h:72
bool timeSeriesRequested() const
const C_FLOAT64 * mpCurrentTime
Definition: CTSSATask.h:87
void clear()
Definition: CTimeSeries.cpp:96
virtual bool initialize(const OutputFlag &of, COutputHandler *pOutputHandler, std::ostream *pOstream)
CTSSAProblem * mpTSSAProblem
Definition: CTSSATask.h:67
virtual void predifineAnnotation()
void allocate(const size_t &steps)
Definition: CTimeSeries.cpp:73
Definition: CState.h:305
virtual bool isValidProblem(const CCopasiProblem *pProblem)
CCopasiProblem * mpProblem
Definition: CCopasiTask.h:234
CState * mpCurrentState
Definition: CTSSATask.h:82
virtual void addInterface(COutputInterface *pInterface)
const Value & getValue() const
const unsigned C_INT32 & getStepNumber() const
void setModel(CModel *model)
CCopasiParameter * getParameter(const std::string &name)
CTimeSeries mTimeSeries
Definition: CTSSATask.h:62
bool mUpdateMoieties
Definition: CTSSATask.h:77
const C_FLOAT64 & getTime() const
Definition: CState.cpp:325
void setProblem(CTSSAProblem *problem)
const CState & getState() const
Definition: CModel.cpp:1771
CModel * getModel() const
bool mTimeSeriesRequested
Definition: CTSSATask.h:57
bool CTSSATask::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 194 of file CTSSATask.cpp.

References CProcessReport::addItem(), COutputInterface::AFTER, COutputInterface::BEFORE, C_FLOAT64, COutputInterface::DURING, CCopasiMessage::ERROR, CCopasiMessage::EXCEPTION, CProcessReport::finishItem(), CTSSAProblem::getDuration(), CCopasiException::getMessage(), CCopasiProblem::getModel(), CTSSAProblem::getOutputStartTime(), CTSSAProblem::getStepSize(), MCTSSAMethod, MCTSSAProblem, CCopasiTask::mpCallBack, mpCurrentState, mpCurrentTime, mpTSSAProblem, mUpdateMoieties, CCopasiTask::output(), processStart(), processStep(), CProcessReport::progressItem(), CProcessReport::setName(), CModel::setState(), tbl(), tble(), tfl(), tfle(), and CModel::updateSimulatedValues().

195 {
196  //*****
197 
198  processStart(useInitialValues);
199 
200  //*****
201 
202  C_FLOAT64 StepSize = mpTSSAProblem->getStepSize();
203  C_FLOAT64 NextTimeToReport;
204 
205  const C_FLOAT64 EndTime = *mpCurrentTime + mpTSSAProblem->getDuration();
206  const C_FLOAT64 StartTime = *mpCurrentTime;
207 
208  C_FLOAT64 StepNumber = (mpTSSAProblem->getDuration()) / StepSize;
209 
210  bool (*LE)(const C_FLOAT64 &, const C_FLOAT64 &);
211  bool (*L)(const C_FLOAT64 &, const C_FLOAT64 &);
212 
213  if (StepSize < 0.0)
214  {
215  LE = &tble;
216  L = &tbl;
217  }
218  else
219  {
220  LE = &tfle;
221  L = &tfl;
222  }
223 
224  size_t StepCounter = 1;
225 
226  C_FLOAT64 outputStartTime = mpTSSAProblem->getOutputStartTime();
227 
228  if (StepSize == 0.0 && mpTSSAProblem->getDuration() != 0.0)
229  {
231  return false;
232  }
233 
235 
236  bool flagProceed = true;
237  C_FLOAT64 handlerFactor = 100.0 / mpTSSAProblem->getDuration();
238 
239  C_FLOAT64 Percentage = 0;
240  size_t hProcess;
241 
242  if (mpCallBack)
243  {
244  mpCallBack->setName("performing simulation...");
245  C_FLOAT64 hundred = 100;
246  hProcess = mpCallBack->addItem("Completion",
247  Percentage,
248  &hundred);
249  }
250 
251  //if ((*LE)(outputStartTime, *mpCurrentTime)) output(COutputInterface::DURING);
252 
253  try
254  {
255  do
256  {
257  // This is numerically more stable then adding
258  // mpTSSAProblem->getStepSize().
259  NextTimeToReport =
260  StartTime + (EndTime - StartTime) * StepCounter++ / StepNumber;
261 
262  flagProceed &= processStep(NextTimeToReport);
263 
264  if (mpCallBack)
265  {
266  Percentage = (*mpCurrentTime - StartTime) * handlerFactor;
267  flagProceed &= mpCallBack->progressItem(hProcess);
268  }
269 
270  if ((*LE)(outputStartTime, *mpCurrentTime))
271  {
273  }
274  }
275  while ((*L)(*mpCurrentTime, EndTime) && flagProceed);
276  }
277 
278  catch (int)
279  {
282 
283  if ((*LE)(outputStartTime, *mpCurrentTime))
284  {
286  }
287 
288  if (mpCallBack) mpCallBack->finishItem(hProcess);
289 
291 
293  }
294 
295  catch (CCopasiException & Exception)
296  {
299 
300  if ((*LE)(outputStartTime, *mpCurrentTime))
301  {
303  }
304 
305  if (mpCallBack) mpCallBack->finishItem(hProcess);
306 
308 
309  throw CCopasiException(Exception.getMessage());
310  }
311 
312  if (mpCallBack) mpCallBack->finishItem(hProcess);
313 
315 
316  return true;
317 }
#define MCTSSAMethod
const C_FLOAT64 & getOutputStartTime() const
bool tfle(const C_FLOAT64 &d1, const C_FLOAT64 &d2)
Definition: CTSSATask.cpp:41
const C_FLOAT64 * mpCurrentTime
Definition: CTSSATask.h:87
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
CTSSAProblem * mpTSSAProblem
Definition: CTSSATask.h:67
bool tfl(const C_FLOAT64 &d1, const C_FLOAT64 &d2)
Definition: CTSSATask.cpp:44
virtual void output(const COutputInterface::Activity &activity)
virtual bool progressItem(const size_t &handle)
const C_FLOAT64 & getStepSize() const
CState * mpCurrentState
Definition: CTSSATask.h:82
bool tbl(const C_FLOAT64 &d1, const C_FLOAT64 &d2)
Definition: CTSSATask.cpp:50
void setState(const CState &state)
Definition: CModel.cpp:1785
size_t addItem(const std::string &name, const std::string &value, const std::string *pEndValue=NULL)
virtual bool finishItem(const size_t &handle)
#define MCTSSAProblem
bool mUpdateMoieties
Definition: CTSSATask.h:77
#define C_FLOAT64
Definition: copasi.h:92
bool tble(const C_FLOAT64 &d1, const C_FLOAT64 &d2)
Definition: CTSSATask.cpp:47
void processStart(const bool &useInitialValues)
Definition: CTSSATask.cpp:319
bool processStep(const C_FLOAT64 &nextTime)
Definition: CTSSATask.cpp:332
CModel * getModel() const
const C_FLOAT64 & getDuration() const
void CTSSATask::processStart ( const bool &  useInitialValues)

Starts the process of integration by calling CTSSAMethod::start

Parameters
constbool & useInitialValues

Definition at line 319 of file CTSSATask.cpp.

References CModel::applyInitialValues(), CCopasiProblem::getModel(), CModel::getState(), mpCurrentState, mpTSSAMethod, mpTSSAProblem, CTSSAMethod::setCurrentState(), and CTSSAMethod::start().

Referenced by process().

320 {
321  if (useInitialValues)
323 
325 
328 
329  return;
330 }
CTSSAMethod * mpTSSAMethod
Definition: CTSSATask.h:72
void setCurrentState(CState *currentState)
CTSSAProblem * mpTSSAProblem
Definition: CTSSATask.h:67
void applyInitialValues()
Definition: CModel.cpp:1236
CState * mpCurrentState
Definition: CTSSATask.h:82
virtual void start(const CState *initialState)
const CState & getState() const
Definition: CModel.cpp:1771
CModel * getModel() const
bool CTSSATask::processStep ( const C_FLOAT64 nextTime)

Integrates one step

Parameters
constC_FLOAT64 & nextTime
Returns
bool success;

Definition at line 332 of file CTSSATask.cpp.

References C_FLOAT64, CCopasiMessage::EXCEPTION, CCopasiProblem::getModel(), MCTSSAMethod, mpCurrentState, mpCurrentTime, mpTSSAMethod, mpTSSAProblem, mUpdateMoieties, CModel::setState(), CTSSAMethod::step(), and CModel::updateSimulatedValues().

Referenced by process().

333 {
334  C_FLOAT64 CompareTime = nextTime - 100.0 * fabs(nextTime) * std::numeric_limits< C_FLOAT64 >::epsilon();
335 
336  if (*mpCurrentTime <= CompareTime)
337  {
338  do
339  {
340  mpTSSAMethod->step(nextTime - *mpCurrentTime);
341 
342  if (*mpCurrentTime > CompareTime) break;
343 
344  /* Here we will do conditional event processing */
345 
346  /* Currently this is correct since no events are processed. */
348  }
349  while (true);
350 
353 
354  return true;
355  }
356 
357  CompareTime = nextTime + 100.0 * fabs(nextTime) * std::numeric_limits< C_FLOAT64 >::epsilon();
358 
359  if (*mpCurrentTime >= CompareTime)
360  {
361  do
362  {
363  mpTSSAMethod->step(nextTime - *mpCurrentTime);
364 
365  if (*mpCurrentTime < CompareTime) break;
366 
367  /* Here we will do conditional event processing */
368 
369  /* Currently this is correct since no events are processed. */
371  }
372  while (true);
373 
376 
377  return true;
378  }
379 
380  // Current time is approximately nextTime;
381  return false;
382 }
#define MCTSSAMethod
CTSSAMethod * mpTSSAMethod
Definition: CTSSATask.h:72
const C_FLOAT64 * mpCurrentTime
Definition: CTSSATask.h:87
void updateSimulatedValues(const bool &updateMoieties)
Definition: CModel.cpp:1851
CTSSAProblem * mpTSSAProblem
Definition: CTSSATask.h:67
CState * mpCurrentState
Definition: CTSSATask.h:82
void setState(const CState &state)
Definition: CModel.cpp:1785
bool mUpdateMoieties
Definition: CTSSATask.h:77
#define C_FLOAT64
Definition: copasi.h:92
virtual void step(const double &deltaT)
CModel * getModel() const
bool CTSSATask::restore ( )
virtual

Perform necessary cleanup procedures

Reimplemented from CCopasiTask.

Definition at line 384 of file CTSSATask.cpp.

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

385 {
386  bool success = CCopasiTask::restore();
387 
388  if (mUpdateModel)
389  {
390  CModel * pModel = mpProblem->getModel();
391 
392  pModel->setState(*mpCurrentState);
394  pModel->setInitialState(pModel->getState());
395  pModel->updateInitialValues();
396  }
397 
398  return success;
399 }
void setInitialState(const CState &state)
Definition: CModel.cpp:1774
void updateSimulatedValues(const bool &updateMoieties)
Definition: CModel.cpp:1851
CCopasiProblem * mpProblem
Definition: CCopasiTask.h:234
CState * mpCurrentState
Definition: CTSSATask.h:82
void setState(const CState &state)
Definition: CModel.cpp:1785
bool mUpdateModel
Definition: CCopasiTask.h:223
bool mUpdateMoieties
Definition: CTSSATask.h:77
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 CTSSATask::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 401 of file CTSSATask.cpp.

References CCopasiContainer::add(), createMethod(), CCopasiMethod::getSubType(), CCopasiTask::isValidMethod(), CCopasiTask::mpMethod, pdelete, and ValidMethods.

402 {
404 
405  if (!isValidMethod(Type, ValidMethods)) return false;
406 
407  if (mpMethod->getSubType() == Type) return true;
408 
409  pdelete(mpMethod);
410  mpMethod = createMethod(Type);
411  this->add(mpMethod, true);
412  //mpMethod->setObjectParent(this);
413 
414  return true;
415 }
CCopasiMethod * mpMethod
Definition: CCopasiTask.h:239
#define pdelete(p)
Definition: copasi.h:215
const CCopasiMethod::SubType & getSubType() const
static const unsigned int ValidMethods[]
Definition: CTSSATask.h:50
virtual CCopasiMethod * createMethod(const int &type) const
Definition: CTSSATask.cpp:418
static bool isValidMethod(const unsigned int &method, const unsigned int *validMethods)
Definition: CCopasiTask.cpp:89
virtual bool add(CCopasiObject *pObject, const bool &adopt=true)
bool CTSSATask::updateMatrices ( )
virtual

Resizes result matrices and updates array annotations for a specific task. This is used when we need to know about the data structures of a task result without actually performing the task, e.g. when selecting objects for output. For now we assume that this functionality is also performed when initialize() is called.

Reimplemented from CCopasiTask.

Definition at line 119 of file CTSSATask.cpp.

References CCopasiProblem::getModel(), CCopasiMethod::isValidProblem(), CCopasiTask::mpMethod, CCopasiTask::mpProblem, CTSSAMethod::predifineAnnotation(), and CTSSAMethod::setModel().

120 {
121  assert(mpProblem != NULL && mpMethod != NULL);
122 
123  assert(dynamic_cast<CTSSAProblem *>(mpProblem) != NULL);
124 
125  if (!mpMethod->isValidProblem(mpProblem)) return false;
126 
127  CTSSAMethod * pMethod = dynamic_cast<CTSSAMethod*>(mpMethod);
128 
129  if (!pMethod) return false;
130 
131  pMethod->setModel(mpProblem->getModel());
132 
133  pMethod->predifineAnnotation();
134 
135  return true;
136 }
CCopasiMethod * mpMethod
Definition: CCopasiTask.h:239
virtual void predifineAnnotation()
virtual bool isValidProblem(const CCopasiProblem *pProblem)
CCopasiProblem * mpProblem
Definition: CCopasiTask.h:234
void setModel(CModel *model)
CModel * getModel() const

Member Data Documentation

CState* CTSSATask::mpCurrentState
private

A pointer to the current state of the integration.

Definition at line 82 of file CTSSATask.h.

Referenced by cleanup(), getState(), initialize(), process(), processStart(), processStep(), and restore().

const C_FLOAT64* CTSSATask::mpCurrentTime
private

A pointer to the current time of the integration.

Definition at line 87 of file CTSSATask.h.

Referenced by initialize(), process(), and processStep().

CTSSAMethod* CTSSATask::mpTSSAMethod
private

A pointer to the method

Definition at line 72 of file CTSSATask.h.

Referenced by initialize(), processStart(), and processStep().

CTSSAProblem* CTSSATask::mpTSSAProblem
private

A pointer to the Problem

Definition at line 67 of file CTSSATask.h.

Referenced by initialize(), process(), processStart(), and processStep().

CTimeSeries CTSSATask::mTimeSeries
private

the time series (if requested)

Definition at line 62 of file CTSSATask.h.

Referenced by getTimeSeries(), and initialize().

bool CTSSATask::mTimeSeriesRequested
private

whether the time series should be stored in mTimeSeries

Definition at line 57 of file CTSSATask.h.

Referenced by initialize().

bool CTSSATask::mUpdateMoieties
private

Indicates whether we need to update moieties.

Definition at line 77 of file CTSSATask.h.

Referenced by CTSSATask(), initialize(), process(), processStep(), and restore().

const unsigned int CTSSATask::ValidMethods
static
Initial value:

The methods which can be selected for performing this task.

Definition at line 50 of file CTSSATask.h.

Referenced by CQTSSAWidget::init(), and setMethodType().


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