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

#include <CEFMTask.h>

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

Public Member Functions

 CEFMTask (const CCopasiContainer *pParent=NULL)
 
 CEFMTask (const CEFMTask &src, const CCopasiContainer *pParent=NULL)
 
virtual CCopasiMethodcreateMethod (const int &type) const
 
std::string getFluxModeDescription (const CFluxMode &fluxMode) const
 
const std::vector< CFluxMode > & getFluxModes () const
 
std::string getInternalSpecies (const CFluxMode &fluxMode) const
 
std::string getNetReaction (const CFluxMode &fluxMode) const
 
std::string getReactionEquation (const std::map< size_t, C_FLOAT64 >::const_iterator &itReaction) const
 
std::pair< C_FLOAT64, C_FLOAT64getSpeciesChanges (const CFluxMode &fluxMode, const CMetab &metab) const
 
virtual bool initialize (const OutputFlag &of, COutputHandler *pOutputHandler, std::ostream *pOstream)
 
virtual bool process (const bool &useInitialValues)
 
virtual bool setCallBack (CProcessReport *pCallBack)
 
virtual bool setMethodType (const int &type)
 
virtual ~CEFMTask ()
 
- 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 bool restore ()
 
virtual void separate (const COutputInterface::Activity &activity)
 
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 ()
 

Static Public Member Functions

static bool isValidMethod (const unsigned C_INT32 &method, const unsigned C_INT32 *validMethods)
 
- 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)
 

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

std::map< const CMetab
*, C_FLOAT64
getNetReactionData (const CFluxMode &fluxMode) const
 

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
 
- 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 41 of file CEFMTask.h.

Constructor & Destructor Documentation

CEFMTask::CEFMTask ( const CCopasiContainer pParent = NULL)

default constructor

Parameters
constCCopasiContainer * pParent (default: NULL)

Definition at line 55 of file CEFMTask.cpp.

References CCopasiContainer::add(), CEFMMethod::createMethod(), CCopasiTask::mpMethod, and CCopasiTask::mpProblem.

55  :
57 {
58  mpProblem = new CEFMProblem(this);
60 
61  this->add(mpMethod, true);
62 }
CCopasiMethod * mpMethod
Definition: CCopasiTask.h:239
static CEFMMethod * createMethod(CCopasiMethod::SubType subType=CCopasiMethod::EFMAlgorithm)
Definition: CEFMMethod.cpp:47
CCopasiTask(const std::string &name="NoName", const CCopasiContainer *pParent=NULL, const std::string &type="Task")
CCopasiProblem * mpProblem
Definition: CCopasiTask.h:234
virtual bool add(CCopasiObject *pObject, const bool &adopt=true)
CEFMTask::CEFMTask ( const CEFMTask src,
const CCopasiContainer pParent = NULL 
)

Copy constructor

Parameters
constCOptTask & src

Definition at line 64 of file CEFMTask.cpp.

References CCopasiContainer::add(), CEFMMethod::createMethod(), CCopasiMethod::getSubType(), CCopasiTask::mpMethod, and CCopasiTask::mpProblem.

65  :
66  CCopasiTask(src, pParent)
67 {
68  mpProblem = new CCopasiProblem(*static_cast< CEFMProblem * >(src.mpProblem), this);
70 
71  this->add(mpMethod, true);
72 }
CCopasiMethod * mpMethod
Definition: CCopasiTask.h:239
static CEFMMethod * createMethod(CCopasiMethod::SubType subType=CCopasiMethod::EFMAlgorithm)
Definition: CEFMMethod.cpp:47
CCopasiTask(const std::string &name="NoName", const CCopasiContainer *pParent=NULL, const std::string &type="Task")
const CCopasiMethod::SubType & getSubType() const
CCopasiProblem * mpProblem
Definition: CCopasiTask.h:234
virtual bool add(CCopasiObject *pObject, const bool &adopt=true)
CEFMTask::~CEFMTask ( )
virtual

Destructor

Definition at line 74 of file CEFMTask.cpp.

75 {}

Member Function Documentation

CCopasiMethod * CEFMTask::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 125 of file CEFMTask.cpp.

References CEFMMethod::createMethod().

Referenced by setMethodType().

126 {
128 
129  return CEFMMethod::createMethod(Type);
130 }
static CEFMMethod * createMethod(CCopasiMethod::SubType subType=CCopasiMethod::EFMAlgorithm)
Definition: CEFMMethod.cpp:47
std::string CEFMTask::getFluxModeDescription ( const CFluxMode fluxMode) const

Retrieve the description of the flux mode

Parameters
constCFluxMode & fluxMode
Returns
std::string fluxModeDescription

Definition at line 132 of file CEFMTask.cpp.

References CFluxMode::begin(), C_INT32, CFluxMode::end(), getReactionIndex(), CCopasiMethod::getSubType(), CSSAMethod::isReactionReversed(), CCopasiTask::mpMethod, and CCopasiTask::mpProblem.

Referenced by CQNewMainWindow::checkForElementaryModesSlot(), CQFluxModeDM::data(), and CEFMProblem::printResult().

133 {
134  std::stringstream tmp;
135  tmp.flags(std::ios::fixed);
136  tmp.precision(0);
137 
138  const std::vector< const CReaction * > & ReorderedReactions =
139  static_cast<CEFMProblem *>(mpProblem)->getReorderedReactions();
140 
141  unsigned C_INT32 j;
142  CFluxMode::const_iterator itMode = fluxMode.begin();
143  CFluxMode::const_iterator endMode = fluxMode.end();
144 
145 #ifdef COPASI_SSA
146 
147  if (mpMethod->getSubType() == CCopasiMethod::stoichiometricStabilityAnalysis)
148  {
149  CSSAMethod * method = dynamic_cast<CSSAMethod *>(mpMethod);
150 
151  for (j = 0; j < jmax; j++)
152  {
153  if (j) tmp << "\n";
154 
155  std::string addstrng = "";
156 
157  if (ReorderedReactions[FluxModes[index].getReactionIndex(j)]->isReversible())
158  {
159  addstrng = " (Forward)";
160 
161  if (method->isReactionReversed(FluxModes[index].getReactionIndex(j)))
162  addstrng = " (Backward)";
163  }
164 
165  tmp << FluxModes[index].getMultiplier(j) << " * "
166  << ReorderedReactions[FluxModes[index].getReactionIndex(j)]->getObjectName()
167  << addstrng;
168  }
169  }
170  else
171 #endif
172  for (j = 0; itMode != endMode; ++itMode, j++)
173  {
174  if (j) tmp << "\n";
175 
176  tmp << itMode->second << " * "
177  << ReorderedReactions[itMode->first]->getObjectName();
178  }
179 
180  return tmp.str();
181 }
CCopasiMethod * mpMethod
Definition: CCopasiTask.h:239
bool isReactionReversed(int index) const
Definition: CSSAMethod.cpp:199
const CCopasiMethod::SubType & getSubType() const
#define C_INT32
Definition: copasi.h:90
CCopasiProblem * mpProblem
Definition: CCopasiTask.h:234
const_iterator begin() const
Definition: CFluxMode.cpp:69
std::map< size_t, C_FLOAT64 >::const_iterator const_iterator
Definition: CFluxMode.h:43
size_t getReactionIndex(const CCopasiVector< CReaction > &reacs, const CReaction *react)
const_iterator end() const
Definition: CFluxMode.cpp:74
const std::vector< CFluxMode > & CEFMTask::getFluxModes ( ) const

Retrieve the Flux Modes

Returns
const std::vector< CFluxMode > &

Definition at line 183 of file CEFMTask.cpp.

References CCopasiTask::mpProblem.

Referenced by CQEFMResultWidget::loadResult(), CEFMProblem::printResult(), CQEFMReactionDM::setTask(), CQEFMNetReactionDM::setTask(), CQFluxModeDM::setTask(), and CQEFMSpeciesDM::setTask().

184 {
185  return static_cast<const CEFMProblem *>(mpProblem)->getFluxModes();
186 }
const std::vector< CFluxMode > & getFluxModes() const
Definition: CEFMTask.cpp:183
CCopasiProblem * mpProblem
Definition: CCopasiTask.h:234
std::string CEFMTask::getInternalSpecies ( const CFluxMode fluxMode) const

Retrieve the internal species for the given flux mode.

Parameters
constCFluxMode & fluxMode
Returns
std::string species

Definition at line 334 of file CEFMTask.cpp.

References CMetabNameInterface::getDisplayName(), CCopasiProblem::getModel(), getNetReactionData(), and CCopasiTask::getProblem().

Referenced by CQEFMNetReactionDM::data(), and CEFMProblem::printResult().

335 {
336  const CModel* pModel = getProblem()->getModel();
337 
338  if (pModel == NULL)
339  return "";
340 
341  std::map< const CMetab *, C_FLOAT64 > Data = getNetReactionData(fluxMode);
342 
343  std::stringstream Modifiers;
344  Modifiers.flags(std::ios::fixed);
345  Modifiers.precision(0);
346  std::string ModifiersSeparator = "";
347 
348  std::map< const CMetab *, C_FLOAT64 >::const_iterator it = Data.begin();
349  std::map< const CMetab *, C_FLOAT64 >::const_iterator end = Data.end();
350 
351  for (; it != end; ++it)
352  {
353  if (fabs(it->second) < 100.0 * std::numeric_limits< C_FLOAT64 >::epsilon())
354  {
355  Modifiers << ModifiersSeparator;
356  Modifiers << CMetabNameInterface::getDisplayName(pModel, *it->first, true);
357  ModifiersSeparator = ", ";
358  }
359  }
360 
361  return Modifiers.str();
362 }
CCopasiProblem * getProblem()
std::map< const CMetab *, C_FLOAT64 > getNetReactionData(const CFluxMode &fluxMode) const
Definition: CEFMTask.cpp:364
static std::string getDisplayName(const CModel *model, const std::string &key, const bool &quoted)
Definition: CModel.h:50
CModel * getModel() const
std::string CEFMTask::getNetReaction ( const CFluxMode fluxMode) const

Retrieve the net reaction for the given flux mode.

Parameters
constCFluxMode & fluxMode
Returns
std::string netReaction

Definition at line 274 of file CEFMTask.cpp.

References CMetabNameInterface::getDisplayName(), CCopasiProblem::getModel(), getNetReactionData(), CCopasiTask::getProblem(), and CFluxMode::isReversible().

Referenced by CQEFMNetReactionDM::data(), and CEFMProblem::printResult().

275 {
276  const CModel* pModel = getProblem()->getModel();
277 
278  if (pModel == NULL)
279  return "";
280 
281  std::map< const CMetab *, C_FLOAT64 > Data = getNetReactionData(fluxMode);
282 
283  std::stringstream Substrates;
284  Substrates.flags(std::ios::fixed);
285  Substrates.precision(0);
286  std::string SubstratesSeparator = "";
287 
288  std::stringstream Products;
289  Products.flags(std::ios::fixed);
290  Products.precision(0);
291  std::string ProductsSeparator = "";
292 
293  std::map< const CMetab *, C_FLOAT64 >::const_iterator it = Data.begin();
294  std::map< const CMetab *, C_FLOAT64 >::const_iterator end = Data.end();
295 
296  for (; it != end; ++it)
297  {
298  if (it->second > 100.0 * std::numeric_limits< C_FLOAT64 >::epsilon())
299  {
300  Products << ProductsSeparator;
301 
302  if (it->second > 1.0 + 100.0 * std::numeric_limits< C_FLOAT64 >::epsilon())
303  {
304  Products << it->second << " * ";
305  }
306 
307  Products << CMetabNameInterface::getDisplayName(pModel, *it->first, true);
308  ProductsSeparator = " + ";
309  }
310  else if (it->second < -100.0 * std::numeric_limits< C_FLOAT64 >::epsilon())
311  {
312  Substrates << SubstratesSeparator;
313 
314  if (it->second < -1.0 - 100.0 * std::numeric_limits< C_FLOAT64 >::epsilon())
315  {
316  Substrates << -it->second << " * ";
317  }
318 
319  Substrates << CMetabNameInterface::getDisplayName(pModel, *it->first, true);
320  SubstratesSeparator = " + ";
321  }
322  }
323 
324  if (fluxMode.isReversible())
325  {
326  return Substrates.str() + " = " + Products.str();
327  }
328  else
329  {
330  return Substrates.str() + " -> " + Products.str();
331  }
332 }
CCopasiProblem * getProblem()
std::map< const CMetab *, C_FLOAT64 > getNetReactionData(const CFluxMode &fluxMode) const
Definition: CEFMTask.cpp:364
static std::string getDisplayName(const CModel *model, const std::string &key, const bool &quoted)
Definition: CModel.h:50
bool isReversible() const
Definition: CFluxMode.cpp:79
CModel * getModel() const
std::map< const CMetab *, C_FLOAT64 > CEFMTask::getNetReactionData ( const CFluxMode fluxMode) const
private

Retrieve the net reaction data for the given flux mode.

Parameters
constCFluxMode & fluxMode
Returns
std::map< const CMetab *, C_FLOAT64 >g netReactionData

Definition at line 364 of file CEFMTask.cpp.

References CFluxMode::begin(), CCopasiVector< T >::begin(), CFluxMode::end(), CCopasiVector< T >::end(), CReaction::getChemEq(), CChemEq::getProducts(), getSpeciesChanges(), CChemEq::getSubstrates(), and CCopasiTask::mpProblem.

Referenced by getInternalSpecies(), and getNetReaction().

365 {
366  std::map< const CMetab *, C_FLOAT64 > NetReaction;
367  std::pair< C_FLOAT64, C_FLOAT64 > Changes;
368 
369  CFluxMode::const_iterator itReaction = fluxMode.begin();
370  CFluxMode::const_iterator endReaction = fluxMode.end();
371 
372  const std::vector< const CReaction * > & ReorderedReactions =
373  static_cast<CEFMProblem *>(mpProblem)->getReorderedReactions();
374 
375  const CMetab * pSpecies;
376 
377  for (; itReaction != endReaction; ++itReaction)
378  {
379  const CReaction * pReaction = ReorderedReactions[itReaction->first];
380 
383 
384  for (; it != end; ++it)
385  {
386  pSpecies = (*it)->getMetabolite();
387 
388  if (NetReaction.count(pSpecies) == 0)
389  {
390  Changes = getSpeciesChanges(fluxMode, *pSpecies);
391  NetReaction[pSpecies] = Changes.second - Changes.first;
392  }
393  }
394 
395  it = pReaction->getChemEq().getProducts().begin();
396  end = pReaction->getChemEq().getProducts().end();
397 
398  for (; it != end; ++it)
399  {
400  pSpecies = (*it)->getMetabolite();
401 
402  if (NetReaction.count(pSpecies) == 0)
403  {
404  Changes = getSpeciesChanges(fluxMode, *pSpecies);
405  NetReaction[pSpecies] = Changes.second - Changes.first;
406  }
407  }
408  }
409 
410  return NetReaction;
411 }
std::pair< C_FLOAT64, C_FLOAT64 > getSpeciesChanges(const CFluxMode &fluxMode, const CMetab &metab) const
Definition: CEFMTask.cpp:216
iterator begin()
Definition: CMetab.h:178
CCopasiProblem * mpProblem
Definition: CCopasiTask.h:234
const CCopasiVector< CChemEqElement > & getProducts() const
Definition: CChemEq.cpp:63
iterator end()
const_iterator begin() const
Definition: CFluxMode.cpp:69
const CCopasiVector< CChemEqElement > & getSubstrates() const
Definition: CChemEq.cpp:60
std::map< size_t, C_FLOAT64 >::const_iterator const_iterator
Definition: CFluxMode.h:43
const CChemEq & getChemEq() const
Definition: CReaction.cpp:223
const_iterator end() const
Definition: CFluxMode.cpp:74
std::string CEFMTask::getReactionEquation ( const std::map< size_t, C_FLOAT64 >::const_iterator &  itReaction) const

Retrieve the reaction equation of the part of the flux mode pointed at by itReaction

Parameters
conststd::map< size_t, C_FLOAT64 >::const_iterator & itReaction
Returns
std::string reactionEquation

Definition at line 188 of file CEFMTask.cpp.

References CChemEqInterface::getChemEqString(), CCopasiProblem::getModel(), CEFMProblem::getReorderedReactions(), CCopasiMethod::getSubType(), CSSAMethod::isReactionReversed(), CReaction::isReversible(), CCopasiTask::mpMethod, and CCopasiTask::mpProblem.

Referenced by CQFluxModeDM::data(), and CEFMProblem::printResult().

189 {
190  CEFMProblem * pProblem = static_cast<CEFMProblem *>(mpProblem);
191 
192  const CReaction * pReaction =
193  pProblem->getReorderedReactions()[itReaction->first];
194 
195 #ifdef COPASI_SSA
196 
197  if (mpMethod->getSubType() == CCopasiMethod::stoichiometricStabilityAnalysis)
198  {
199  CSSAMethod * method = static_cast<CSSAMethod *>(mpMethod);
200 
201  std::string retstring = getReactionEquationForward(index1, index2);
202 
203  if (pReaction->isReversible())
204  {
205  if (method->isReactionReversed(pMethod->getFluxModes()[index1].getReactionIndex(index2)))
206  retstring = getReactionEquationBackward(index1, index2);
207  }
208 
209  return retstring;
210  }
211  else
212 #endif //COPASI_SSA
213  return CChemEqInterface::getChemEqString(mpProblem->getModel(), *pReaction, false);
214 }
CCopasiMethod * mpMethod
Definition: CCopasiTask.h:239
bool isReactionReversed(int index) const
Definition: CSSAMethod.cpp:199
const CCopasiMethod::SubType & getSubType() const
CCopasiProblem * mpProblem
Definition: CCopasiTask.h:234
std::string getChemEqString(bool expanded) const
const std::vector< const CReaction * > & getReorderedReactions() const
Definition: CEFMProblem.cpp:86
bool isReversible() const
Definition: CReaction.cpp:229
CModel * getModel() const
std::pair< C_FLOAT64, C_FLOAT64 > CEFMTask::getSpeciesChanges ( const CFluxMode fluxMode,
const CMetab metab 
) const

Retrieve the species changes for the given flux mode and species

Parameters
constCFluxMode & fluxMode
constCMetab & pMetab
Returns
std::pair< C_FLOAT64, C_FLOAT64 > changes

Definition at line 216 of file CEFMTask.cpp.

References CFluxMode::begin(), CCopasiVector< T >::begin(), C_FLOAT64, CFluxMode::end(), CCopasiVector< T >::end(), CReaction::getChemEq(), CModelEntity::getKey(), CChemEq::getProducts(), CChemEq::getSubstrates(), and CCopasiTask::mpProblem.

Referenced by CQEFMSpeciesDM::data(), getNetReactionData(), and CEFMProblem::printResult().

218 {
219  C_FLOAT64 In = 0.0;
220  C_FLOAT64 Out = 0.0;
221  C_FLOAT64 *pIn, *pOut;
222 
223  CFluxMode::const_iterator itReaction = fluxMode.begin();
224  CFluxMode::const_iterator endReaction = fluxMode.end();
225 
226  std::string Key = metab.getKey();
227 
228  const std::vector< const CReaction * > & ReorderedReactions =
229  static_cast<CEFMProblem *>(mpProblem)->getReorderedReactions();
230 
231  for (; itReaction != endReaction; ++itReaction)
232  {
233  const CReaction * pReaction = ReorderedReactions[itReaction->first];
234 
235  if (itReaction->second < 0.0)
236  {
237  pIn = &Out;
238  pOut = &In;
239  }
240  else
241  {
242  pIn = &In;
243  pOut = &Out;
244  }
245 
248 
249  for (; it != end; ++it)
250  {
251  if ((*it)->getMetaboliteKey() == Key)
252  {
253  *pIn += fabs(itReaction->second) * (*it)->getMultiplicity();
254  break;
255  }
256  }
257 
258  it = pReaction->getChemEq().getProducts().begin();
259  end = pReaction->getChemEq().getProducts().end();
260 
261  for (; it != end; ++it)
262  {
263  if ((*it)->getMetaboliteKey() == Key)
264  {
265  *pOut += fabs(itReaction->second) * (*it)->getMultiplicity();
266  break;
267  }
268  }
269  }
270 
271  return std::make_pair(In, Out);
272 }
iterator begin()
CCopasiProblem * mpProblem
Definition: CCopasiTask.h:234
const CCopasiVector< CChemEqElement > & getProducts() const
Definition: CChemEq.cpp:63
iterator end()
virtual const std::string & getKey() const
const_iterator begin() const
Definition: CFluxMode.cpp:69
const CCopasiVector< CChemEqElement > & getSubstrates() const
Definition: CChemEq.cpp:60
#define C_FLOAT64
Definition: copasi.h:92
std::map< size_t, C_FLOAT64 >::const_iterator const_iterator
Definition: CFluxMode.h:43
const CChemEq & getChemEq() const
Definition: CReaction.cpp:223
const_iterator end() const
Definition: CFluxMode.cpp:74
bool CEFMTask::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 88 of file CEFMTask.cpp.

References CCopasiTask::initialize(), CCopasiMethod::isValidProblem(), CCopasiTask::mpMethod, and CCopasiTask::mpProblem.

91 {
92  CEFMMethod * pMethod = dynamic_cast<CEFMMethod *>(mpMethod);
93 
94  if (pMethod == NULL) return false;
95 
97  {
98  return false;
99  }
100 
101  return CCopasiTask::initialize(of, pOutputHandler, pOstream);
102 }
CCopasiMethod * mpMethod
Definition: CCopasiTask.h:239
virtual bool initialize(const OutputFlag &of, COutputHandler *pOutputHandler, std::ostream *pOstream)
virtual bool isValidProblem(const CCopasiProblem *pProblem)
CCopasiProblem * mpProblem
Definition: CCopasiTask.h:234
static bool CEFMTask::isValidMethod ( const unsigned C_INT32 method,
const unsigned C_INT32 validMethods 
)
static

Check whether the given method is in the list of valid methods This list must end with CCopasiMethod::unset

Parameters
constunsigned C_INT32 & method
constunsigned C_INT32 * validMethods
Returns
bool isValid
bool CEFMTask::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 104 of file CEFMTask.cpp.

References CCopasiTask::mpMethod.

105 {
106  return static_cast<CEFMMethod *>(mpMethod)->calculate();
107 }
CCopasiMethod * mpMethod
Definition: CCopasiTask.h:239
bool CEFMTask::setCallBack ( CProcessReport pCallBack)
virtual

Set the call back of the task

Parameters
CProcessReport* pCallBack
Returns
bool success

Reimplemented from CCopasiTask.

Definition at line 77 of file CEFMTask.cpp.

References CCopasiTask::mpMethod, CCopasiTask::mpProblem, CCopasiProblem::setCallBack(), CCopasiMethod::setCallBack(), and CCopasiTask::setCallBack().

78 {
79  bool success = CCopasiTask::setCallBack(pCallBack);
80 
81  if (!mpProblem->setCallBack(pCallBack)) success = false;
82 
83  if (!mpMethod->setCallBack(pCallBack)) success = false;
84 
85  return success;
86 }
virtual bool setCallBack(CProcessReport *pCallBack)
CCopasiMethod * mpMethod
Definition: CCopasiTask.h:239
virtual bool setCallBack(CProcessReport *pCallBack)
CCopasiProblem * mpProblem
Definition: CCopasiTask.h:234
virtual bool setCallBack(CProcessReport *pCallBack)
bool CEFMTask::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 109 of file CEFMTask.cpp.

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

110 {
112 
113  if (mpMethod->getSubType() == Type) return true;
114 
115  pdelete(mpMethod);
116 
117  mpMethod = createMethod(Type);
118 
119  this->add(mpMethod, true);
120 
121  return true;
122 }
CCopasiMethod * mpMethod
Definition: CCopasiTask.h:239
#define pdelete(p)
Definition: copasi.h:215
const CCopasiMethod::SubType & getSubType() const
virtual bool add(CCopasiObject *pObject, const bool &adopt=true)
virtual CCopasiMethod * createMethod(const int &type) const
Definition: CEFMTask.cpp:125

Member Data Documentation

const unsigned int CEFMTask::ValidMethods
static
Initial value:

The methods which can be selected for performing this task.

CEFMTask class.

This class implements a optimization task which is comprised of a of a problem and a method.

Definition at line 47 of file CEFMTask.h.


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