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

#include <CMetab.h>

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

Public Member Functions

virtual void calculate ()
 
void cleanup ()
 
 CMetab (const std::string &name="NoName", const CCopasiContainer *pParent=NULL)
 
 CMetab (const CMetab &src, const CCopasiContainer *pParent=NULL)
 
virtual bool compile ()
 
bool compileInitialValueDependencies ()
 
void compileIsInitialConcentrationChangeAllowed ()
 
virtual std::string getChildObjectUnits (const CCopasiObject *pObject) const
 
const CCompartmentgetCompartment () const
 
const C_FLOAT64getConcentration () const
 
C_FLOAT64 getConcentrationRate () const
 
CCopasiObjectgetConcentrationRateReference () const
 
CConcentrationReferencegetConcentrationReference () const
 
virtual DataObjectSet getDeletedObjects () const
 
const C_FLOAT64getInitialConcentration () const
 
CConcentrationReferencegetInitialConcentrationReference () const
 
const CModelgetModel () const
 
const CMoietygetMoiety () const
 
virtual std::string getObjectDisplayName (bool regular=true, bool richtext=false) const
 
const C_FLOAT64getTransitionTime () const
 
virtual const CCopasiObjectgetValueObject () const
 
virtual voidgetValuePointer () const
 
void initCompartment (const CCompartment *pCompartment=NULL)
 
bool isDependent () const
 
const bool & isInitialConcentrationChangeAllowed () const
 
C_INT32 load (CReadConfig &configbuffer)
 
virtual bool mustBeDeleted (const DataObjectSet &deletedObjects) const
 
CMetaboperator= (const CMetabOld &rhs)
 
void refreshConcentration ()
 
void refreshConcentrationRate ()
 
void refreshInitialConcentration ()
 
virtual void refreshInitialValue ()
 
void refreshNumber ()
 
void refreshRate ()
 
void refreshTransitionTime ()
 
void setConcentration (const C_FLOAT64 concentration)
 
void setDependentOn (const CMoiety *pMoiety)
 
void setInitialConcentration (const C_FLOAT64 &initialConcentration)
 
virtual bool setObjectParent (const CCopasiContainer *pParent)
 
virtual void setStatus (const CModelEntity::Status &status)
 
void setTransitionTime (const C_FLOAT64 &transitionTime)
 
 ~CMetab ()
 
- Public Member Functions inherited from CModelEntity
 CModelEntity (const std::string &name="NoName", const CCopasiContainer *pParent=NULL, const std::string &type="ModelEntity", const unsigned C_INT32 &flag=CCopasiObject::Container|CCopasiObject::ValueDbl)
 
 CModelEntity (const CModelEntity &src, const CCopasiContainer *pParent=NULL)
 
std::string getExpression () const
 
const CExpressiongetExpressionPtr () const
 
CExpressiongetExpressionPtr ()
 
std::string getInitialExpression () const
 
const CExpressiongetInitialExpressionPtr () const
 
CExpressiongetInitialExpressionPtr ()
 
const C_FLOAT64getInitialValue () const
 
CCopasiObjectgetInitialValueReference () const
 
virtual const std::string & getKey () const
 
const C_FLOAT64getRate () const
 
CCopasiObjectgetRateReference () const
 
const std::string & getSBMLId () const
 
const CModelEntity::StatusgetStatus () const
 
const C_FLOAT64getValue () const
 
CCopasiObjectgetValueReference () const
 
bool isFixed () const
 
const bool & isUsed () const
 
bool setExpression (const std::string &expression)
 
bool setExpressionPtr (CExpression *pExpression)
 
bool setInitialExpression (const std::string &expression)
 
bool setInitialExpressionPtr (CExpression *pExpression)
 
virtual void setInitialValue (const C_FLOAT64 &initialValue)
 
void setInitialValuePtr (C_FLOAT64 *pInitialValue)
 
void setRate (const C_FLOAT64 &rate)
 
void setSBMLId (const std::string &id)
 
void setUsed (const bool &used)
 
virtual void setValue (const C_FLOAT64 &value)
 
void setValuePtr (C_FLOAT64 *pValue)
 
 ~CModelEntity ()
 
- 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 const CObjectInterfacegetObject (const CCopasiObjectName &cn) const
 
virtual const objectMapgetObjects () const
 
virtual std::string getUnits () 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
 
const std::string & getObjectName () const
 
CCopasiContainergetObjectParent () const
 
const std::string & getObjectType () const
 
virtual const
CObjectInterface::ObjectSet
getPrerequisites () const
 
virtual RefreshgetRefresh () const
 
UpdateMethodgetUpdateMethod () 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 void print (std::ostream *ostream) const
 
void removeDirectDependency (const CCopasiObject *pObject)
 
void setDirectDependencies (const DataObjectSet &directDependencies)
 
bool setObjectName (const std::string &name)
 
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 ()
 
- Public Member Functions inherited from CAnnotation
bool addUnsupportedAnnotation (const std::string &name, const std::string &xml)
 
 CAnnotation ()
 
 CAnnotation (const CAnnotation &src)
 
const std::string & getMiriamAnnotation () const
 
const std::string & getNotes () const
 
UnsupportedAnnotationgetUnsupportedAnnotations ()
 
const UnsupportedAnnotationgetUnsupportedAnnotations () const
 
bool operator== (const CAnnotation &rhs) const
 
bool removeUnsupportedAnnotation (const std::string &name)
 
bool replaceUnsupportedAnnotation (const std::string &name, const std::string &xml)
 
void setMiriamAnnotation (const std::string &miriamAnnotation, const std::string &newId, const std::string &oldId)
 
void setNotes (const std::string &notes)
 
virtual ~CAnnotation ()
 

Static Public Member Functions

static C_FLOAT64 convertToConcentration (const C_FLOAT64 &number, const CCompartment &compartment, const CModel &model)
 
static C_FLOAT64 convertToNumber (const C_FLOAT64 &concentration, const CCompartment &compartment, const CModel &model)
 
- 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 Member Functions inherited from CAnnotation
static CAnnotationcastObject (CCopasiObject *pObject)
 
static const CAnnotationcastObject (const CCopasiObject *pObject)
 

Protected Attributes

CCopasiObjectReference
< C_FLOAT64 > * 
mpConcRateReference
 
CConcentrationReferencempConcReference
 
CConcentrationReferencempIConcReference
 
CCopasiObjectReference
< C_FLOAT64 > * 
mpTTReference
 
- Protected Attributes inherited from CModelEntity
CExpressionmpExpression
 
CExpressionmpInitialExpression
 
C_FLOAT64mpIValue
 
CCopasiObjectReference
< C_FLOAT64 > * 
mpIValueReference
 
CModelmpModel
 
CCopasiObjectReference
< C_FLOAT64 > * 
mpRateReference
 
C_FLOAT64mpValue
 
CCopasiObjectReference
< C_FLOAT64 > * 
mpValueReference
 
C_FLOAT64 mRate
 
std::string mSBMLId
 
- Protected Attributes inherited from CCopasiContainer
objectMap mObjects
 
- Protected Attributes inherited from CAnnotation
std::string mKey
 

Private Member Functions

void initObjects ()
 

Private Attributes

C_FLOAT64 mConc
 
C_FLOAT64 mConcRate
 
C_FLOAT64 mIConc
 
bool mIsInitialConcentrationChangeAllowed
 
const CCompartmentmpCompartment
 
const CMoietympMoiety
 
std::vector< std::pair
< C_FLOAT64, const C_FLOAT64 * > > 
mRateVector
 
C_FLOAT64 mTT
 

Friends

void CMoiety::add (C_FLOAT64 value, CMetab *pMetabolite)
 
std::ostream & operator<< (std::ostream &os, const CMetab &d)
 

Additional Inherited Members

- Public Types inherited from CModelEntity
enum  Status {
  FIXED = 0, ASSIGNMENT, REACTIONS, ODE,
  TIME
}
 
- 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 Types inherited from CAnnotation
typedef std::map< std::string,
std::string > 
UnsupportedAnnotation
 
- Static Public Attributes inherited from CModelEntity
static const std::string StatusName []
 
static const char * XMLStatus []
 
- 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)
 
- Static Protected Attributes inherited from CCopasiObject
static CRenameHandlersmpRenameHandler = NULL
 

Detailed Description

Definition at line 178 of file CMetab.h.

Constructor & Destructor Documentation

CMetab::CMetab ( const std::string &  name = "NoName",
const CCopasiContainer pParent = NULL 
)

Default constructor

Parameters
conststd::string & name (default: "NoName")
constCCopasiContainer * pParent (default: NULL)

Definition at line 46 of file CMetab.cpp.

References CKeyFactory::add(), CONSTRUCTOR_TRACE, CCopasiRootContainer::getKeyFactory(), CCopasiObject::getObjectParent(), initCompartment(), initObjects(), CAnnotation::mKey, CModelEntity::REACTIONS, setConcentration(), setInitialConcentration(), and setStatus().

47  :
48  CModelEntity(name, pParent, "Metabolite",
50  mConc(std::numeric_limits<C_FLOAT64>::quiet_NaN()),
51  mIConc(0.0),
52  mConcRate(0.0),
53  mTT(0.0),
54  mpCompartment(NULL),
55  mpMoiety(NULL),
57 {
58  mKey = CCopasiRootContainer::getKeyFactory()->add("Metabolite", this);
59  initObjects();
60 
62 
63  if (getObjectParent())
64  {
65  initCompartment(NULL);
66 
68  setConcentration(1.0);
69  }
70 
72 }
void setInitialConcentration(const C_FLOAT64 &initialConcentration)
Definition: CMetab.cpp:257
void initCompartment(const CCompartment *pCompartment=NULL)
Definition: CMetab.cpp:209
virtual void setStatus(const CModelEntity::Status &status)
Definition: CMetab.cpp:291
C_FLOAT64 mTT
Definition: CMetab.h:226
bool mIsInitialConcentrationChangeAllowed
Definition: CMetab.h:241
C_FLOAT64 mConc
Definition: CMetab.h:211
std::string mKey
Definition: CAnnotation.h:119
const CCompartment * mpCompartment
Definition: CMetab.h:232
C_FLOAT64 mConcRate
Definition: CMetab.h:221
void setConcentration(const C_FLOAT64 concentration)
Definition: CMetab.cpp:250
std::string add(const std::string &prefix, CCopasiObject *pObject)
static CKeyFactory * getKeyFactory()
C_FLOAT64 mIConc
Definition: CMetab.h:216
void initObjects()
Definition: CMetab.cpp:777
const CMoiety * mpMoiety
Definition: CMetab.h:237
CModelEntity(const std::string &name="NoName", const CCopasiContainer *pParent=NULL, const std::string &type="ModelEntity", const unsigned C_INT32 &flag=CCopasiObject::Container|CCopasiObject::ValueDbl)
Definition: CModelValue.cpp:62
CCopasiContainer * getObjectParent() const
#define CONSTRUCTOR_TRACE
Definition: copasi.h:202
CMetab::CMetab ( const CMetab src,
const CCopasiContainer pParent = NULL 
)

Copy constructor

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

Definition at line 74 of file CMetab.cpp.

References CKeyFactory::add(), CONSTRUCTOR_TRACE, CCopasiRootContainer::getKeyFactory(), initCompartment(), initObjects(), CAnnotation::mKey, and mpCompartment.

75  :
76  CModelEntity(src, pParent),
77  mConc(src.mConc),
78  mIConc(src.mIConc),
79  mConcRate(src.mConcRate),
80  mTT(src.mTT),
81  mpCompartment(NULL),
82  mpMoiety(src.mpMoiety),
84 {
85  mKey = CCopasiRootContainer::getKeyFactory()->add("Metabolite", this);
86 
87  initObjects();
88 
91 }
void initCompartment(const CCompartment *pCompartment=NULL)
Definition: CMetab.cpp:209
C_FLOAT64 mTT
Definition: CMetab.h:226
bool mIsInitialConcentrationChangeAllowed
Definition: CMetab.h:241
C_FLOAT64 mConc
Definition: CMetab.h:211
std::string mKey
Definition: CAnnotation.h:119
const CCompartment * mpCompartment
Definition: CMetab.h:232
C_FLOAT64 mConcRate
Definition: CMetab.h:221
std::string add(const std::string &prefix, CCopasiObject *pObject)
static CKeyFactory * getKeyFactory()
C_FLOAT64 mIConc
Definition: CMetab.h:216
void initObjects()
Definition: CMetab.cpp:777
const CMoiety * mpMoiety
Definition: CMetab.h:237
CModelEntity(const std::string &name="NoName", const CCopasiContainer *pParent=NULL, const std::string &type="ModelEntity", const unsigned C_INT32 &flag=CCopasiObject::Container|CCopasiObject::ValueDbl)
Definition: CModelValue.cpp:62
#define CONSTRUCTOR_TRACE
Definition: copasi.h:202
CMetab::~CMetab ( )

Destructor.

Definition at line 111 of file CMetab.cpp.

References DESTRUCTOR_TRACE, CCopasiRootContainer::getKeyFactory(), CAnnotation::mKey, and CKeyFactory::remove().

112 {
115 }
bool remove(const std::string &key)
std::string mKey
Definition: CAnnotation.h:119
#define DESTRUCTOR_TRACE
Definition: copasi.h:206
static CKeyFactory * getKeyFactory()

Member Function Documentation

void CMetab::calculate ( void  )
virtual

Calculate the value or the rate depending whether we have an ASIGNMENT or ODE

Reimplemented from CModelEntity.

Definition at line 669 of file CMetab.cpp.

References CModelEntity::ASSIGNMENT, CExpression::calcValue(), CModelEntity::FIXED, CMoiety::getDependentNumber(), CModel::getQuantity2NumberFactor(), CModelEntity::getStatus(), CModelEntity::getValue(), isDependent(), mConc, mpCompartment, CModelEntity::mpExpression, CModelEntity::mpModel, mpMoiety, CModelEntity::mpValue, CModelEntity::mRate, CModelEntity::ODE, and CModelEntity::REACTIONS.

Referenced by compile(), and setStatus().

670 {
671  switch (getStatus())
672  {
673  case FIXED:
674  break;
675 
676  case ASSIGNMENT:
678  break;
679 
680  case ODE:
682  break;
683 
684  case REACTIONS:
685 
686  if (isDependent())
688 
689  break;
690 
691  default:
692  break;
693  }
694 }
C_FLOAT64 mRate
Definition: CModelValue.h:331
C_FLOAT64 * mpValue
Definition: CModelValue.h:321
C_FLOAT64 mConc
Definition: CMetab.h:211
const C_FLOAT64 & getQuantity2NumberFactor() const
Definition: CModel.cpp:2354
virtual const C_FLOAT64 & calcValue()
const CCompartment * mpCompartment
Definition: CMetab.h:232
const C_FLOAT64 & getDependentNumber() const
Definition: CMoiety.cpp:145
bool isDependent() const
Definition: CMetab.cpp:989
const C_FLOAT64 & getValue() const
CExpression * mpExpression
Definition: CModelValue.h:336
const CMoiety * mpMoiety
Definition: CMetab.h:237
const CModelEntity::Status & getStatus() const
CModel * mpModel
Definition: CModelValue.h:359
void CMetab::cleanup ( )

Cleanup

Definition at line 207 of file CMetab.cpp.

207 {}
bool CMetab::compile ( )
virtual

Compile the model value.

Returns
bool success

Reimplemented from CModelEntity.

Definition at line 385 of file CMetab.cpp.

References CModelEntity::ASSIGNMENT, CCopasiVector< T >::begin(), calculate(), CCopasiObject::clearDirectDependencies(), CCopasiObject::clearRefresh(), CExpression::compile(), compileInitialValueDependencies(), CExpression::createInitialExpression(), CCopasiVector< T >::end(), CModelEntity::FIXED, CCopasiObject::getDirectDependencies(), CCopasiObject::getObjectAncestor(), CCopasiObject::getObjectDataModel(), CModelEntity::getRateReference(), CModel::getReactions(), CModelEntity::getStatus(), CModelEntity::getValueReference(), mConcRate, CAnnotation::mKey, mpCompartment, mpConcRateReference, mpConcReference, CModelEntity::mpExpression, CModelEntity::mpInitialExpression, CModelEntity::mpModel, CModelEntity::mpRateReference, mpTTReference, CModelEntity::mpValueReference, CModelEntity::mRate, mRateVector, mTT, CModelEntity::ODE, pdelete, CModelEntity::REACTIONS, refreshConcentration(), refreshConcentrationRate(), refreshNumber(), refreshRate(), refreshTransitionTime(), CCopasiObject::setDirectDependencies(), CCopasiObject::setObjectName(), and CCopasiObject::setRefresh().

386 {
387  bool success = true;
388 
389  // We first clear all dependencies and refreshes
390  // Particle Number
393 
394  // Rate (particle number rate)
395  mRateVector.clear();
398 
399  // Concentration
402 
403  // Concentration Rate
406 
407  // Transition Time
410 
411  // Prepare the compilation
412  std::set<const CCopasiObject *> Dependencies;
413  std::vector< CCopasiContainer * > listOfContainer;
414  listOfContainer.push_back(getObjectAncestor("Model"));
415 
416  CCopasiDataModel* pDataModel = NULL;
417  const CCopasiObject * pVolumeReference = NULL;
418 
419  if (mpCompartment)
420  pVolumeReference = mpCompartment->getValueReference();
421 
422  // Compile the value (particle number)
423  Dependencies.insert(mpConcReference);
424 
425  if (pVolumeReference)
426  Dependencies.insert(pVolumeReference);
427 
428  // We no longer need to distinguish the cases since the reference are now context sensitive
431 
432  Dependencies.clear();
433 
434  // Compiling of the rest.
435  switch (getStatus())
436  {
437  case FIXED:
438  // Concentration
439  Dependencies.insert(mpValueReference);
440 
441  if (pVolumeReference)
442  Dependencies.insert(pVolumeReference);
443 
444  mpConcReference->setDirectDependencies(Dependencies);
446 
447  // Fixed values
448  mRate = 0.0;
449  mConcRate = 0.0;
450  mTT = std::numeric_limits<C_FLOAT64>::infinity();
451  break;
452 
453  case ASSIGNMENT:
454  // Concentration
455  success = mpExpression->compile(listOfContainer);
458 
459  // Implicit initial expression
461  pDataModel = getObjectDataModel();
463  mpInitialExpression->setObjectName("InitialExpression");
464 
465  // Fixed values
466  mRate = std::numeric_limits< C_FLOAT64 >::quiet_NaN();
467  mConcRate = std::numeric_limits< C_FLOAT64 >::quiet_NaN();
468  mTT = std::numeric_limits< C_FLOAT64 >::quiet_NaN();
469  break;
470 
471  case ODE:
472  // Concentration
473  Dependencies.insert(mpValueReference);
474 
475  if (pVolumeReference)
476  Dependencies.insert(pVolumeReference);
477 
478  mpConcReference->setDirectDependencies(Dependencies);
480 
481  // Rate (particle number rate)
482  success = mpExpression->compile(listOfContainer);
483  Dependencies = mpExpression->getDirectDependencies();
484 
485  if (pVolumeReference)
486  Dependencies.insert(pVolumeReference);
487 
488  mpRateReference->setDirectDependencies(Dependencies);
490  Dependencies.clear();
491 
492  // Concentration Rate
493  Dependencies.insert(mpRateReference);
494  Dependencies.insert(mpConcReference);
495 
496  if (pVolumeReference)
497  Dependencies.insert(pVolumeReference);
498 
499  if (mpCompartment)
500  Dependencies.insert(mpCompartment->getRateReference());
501 
504  Dependencies.clear();
505 
506  // Transition Time
507  Dependencies.insert(mpValueReference);
508  Dependencies.insert(mpRateReference);
509  mpTTReference->setDirectDependencies(Dependencies);
511  Dependencies.clear();
512  break;
513 
514  case REACTIONS:
515  // Concentration
516  Dependencies.insert(mpValueReference);
517 
518  if (pVolumeReference)
519  Dependencies.insert(pVolumeReference);
520 
521  mpConcReference->setDirectDependencies(Dependencies);
523 
524  Dependencies.clear();
525 
526  // Create the rate vector
527  {
530 
531  for (; it != end; ++it)
532  {
533  const CCopasiVector< CChemEqElement > &Balances =
534  (*it)->getChemEq().getBalances();
537 
538  for (; itChem != endChem; ++itChem)
539  if ((*itChem)->getMetaboliteKey() == mKey)
540  break;
541 
542  if (itChem != endChem)
543  {
544  Dependencies.insert((*it)->getParticleFluxReference());
545 
546  std::pair< C_FLOAT64, const C_FLOAT64 * > Insert;
547  Insert.first = (*itChem)->getMultiplicity();
548  Insert.second = &(*it)->getParticleFlux();
549 
550  mRateVector.push_back(Insert);
551  }
552  }
553  }
554 
555  // Rate (particle number rate)
557  mpRateReference->setDirectDependencies(Dependencies);
558 
559  // Transition Time
561  mpTTReference->setDirectDependencies(Dependencies);
562  Dependencies.clear();
563 
564  // Concentration Rate
565  Dependencies.insert(mpRateReference);
566  Dependencies.insert(mpConcReference);
567 
568  if (pVolumeReference)
569  Dependencies.insert(pVolumeReference);
570 
571  if (mpCompartment)
572  Dependencies.insert(mpCompartment->getRateReference());
573 
576  Dependencies.clear();
577 
578  break;
579 
580  default:
581  break;
582  }
583 
584  // The initial values
585  success &= compileInitialValueDependencies();
586 
587  return success;
588 }
CCopasiDataModel * getObjectDataModel()
CCopasiContainer * getObjectAncestor(const std::string &type) const
void clearDirectDependencies()
void setRefresh(CType *pType, void(CType::*method)(void))
#define pdelete(p)
Definition: copasi.h:215
CExpression * mpInitialExpression
Definition: CModelValue.h:341
C_FLOAT64 mTT
Definition: CMetab.h:226
C_FLOAT64 mRate
Definition: CModelValue.h:331
virtual void calculate()
Definition: CMetab.cpp:669
bool compileInitialValueDependencies()
Definition: CMetab.cpp:590
iterator begin()
void setDirectDependencies(const DataObjectSet &directDependencies)
CCopasiObjectReference< C_FLOAT64 > * mpRateReference
Definition: CModelValue.h:358
virtual bool compile(std::vector< CCopasiContainer * > listOfContainer=CCopasiContainer::EmptyList)
Definition: CExpression.cpp:97
static CExpression * createInitialExpression(const CExpression &expression, const CCopasiDataModel *pDataModel)
std::string mKey
Definition: CAnnotation.h:119
iterator end()
const CCompartment * mpCompartment
Definition: CMetab.h:232
C_FLOAT64 mConcRate
Definition: CMetab.h:221
void refreshRate()
Definition: CMetab.cpp:696
void refreshNumber()
Definition: CMetab.cpp:286
void refreshTransitionTime()
Definition: CMetab.cpp:728
CCopasiObjectReference< C_FLOAT64 > * mpValueReference
Definition: CModelValue.h:357
CCopasiObjectReference< C_FLOAT64 > * mpTTReference
Definition: CMetab.h:247
void refreshConcentration()
Definition: CMetab.cpp:281
virtual const DataObjectSet & getDirectDependencies(const DataObjectSet &context=DataObjectSet()) const
void refreshConcentrationRate()
Definition: CMetab.cpp:876
CExpression * mpExpression
Definition: CModelValue.h:336
CCopasiVectorNS< CReaction > & getReactions()
Definition: CModel.cpp:1039
const CModelEntity::Status & getStatus() const
bool setObjectName(const std::string &name)
CCopasiObject * getRateReference() const
CCopasiObjectReference< C_FLOAT64 > * mpConcRateReference
Definition: CMetab.h:246
CModel * mpModel
Definition: CModelValue.h:359
CConcentrationReference * mpConcReference
Definition: CMetab.h:245
CCopasiObject * getValueReference() const
std::vector< std::pair< C_FLOAT64, const C_FLOAT64 * > > mRateVector
Definition: CMetab.h:239
bool CMetab::compileInitialValueDependencies ( )

Compile the initial particle number and initial concentration dependencies.

Returns
bool success

Definition at line 590 of file CMetab.cpp.

References CModelEntity::ASSIGNMENT, CExpression::calcValue(), CExpression::compile(), CCopasiObject::getDirectDependencies(), CEvaluationTree::getInfix(), CModelEntity::getInitialValueReference(), CCopasiObject::getObjectAncestor(), CModelEntity::getStatus(), CEvaluationTree::isUsable(), mIConc, mpCompartment, mpIConcReference, CModelEntity::mpInitialExpression, CModelEntity::mpIValueReference, and CCopasiObject::setDirectDependencies().

Referenced by compile().

591 {
592  bool success = true;
593  std::set<const CCopasiObject *> Dependencies;
594  std::vector< CCopasiContainer * > listOfContainer;
595  listOfContainer.push_back(getObjectAncestor("Model"));
596 
597  // If we have an assignment or a valid initial expression we must update both
598  if (getStatus() == ASSIGNMENT ||
599  (mpInitialExpression != NULL &&
600  mpInitialExpression->getInfix() != ""))
601  {
602  // Initial concentration
603  success &= mpInitialExpression->compile(listOfContainer);
605 
606  // Initial particle number
607  Dependencies.insert(mpIConcReference);
608 
609  if (mpCompartment)
610  Dependencies.insert(mpCompartment->getInitialValueReference());
611 
613  Dependencies.clear();
614 
615  // If we have a valid initial expression, we update the initial value.
616  // In case the expression is constant this suffices others are updated lated again.
619 
620  return success;
621  }
622 
623  // The context sensitivity is handle in the virtual method getDirectDependencies();
624 
625  // Initial particle number
626  Dependencies.insert(mpIConcReference);
627 
628  if (mpCompartment)
629  Dependencies.insert(mpCompartment->getInitialValueReference());
630 
632  Dependencies.clear();
633 
634  // Initial concentration
635  Dependencies.insert(mpIValueReference);
636 
637  if (mpCompartment)
638  Dependencies.insert(mpCompartment->getInitialValueReference());
639 
641  return success;
642 }
CCopasiContainer * getObjectAncestor(const std::string &type) const
CCopasiObjectReference< C_FLOAT64 > * mpIValueReference
Definition: CModelValue.h:356
CExpression * mpInitialExpression
Definition: CModelValue.h:341
CCopasiObject * getInitialValueReference() const
void setDirectDependencies(const DataObjectSet &directDependencies)
virtual bool compile(std::vector< CCopasiContainer * > listOfContainer=CCopasiContainer::EmptyList)
Definition: CExpression.cpp:97
virtual const C_FLOAT64 & calcValue()
const CCompartment * mpCompartment
Definition: CMetab.h:232
bool isUsable() const
CConcentrationReference * mpIConcReference
Definition: CMetab.h:244
virtual const DataObjectSet & getDirectDependencies(const DataObjectSet &context=DataObjectSet()) const
C_FLOAT64 mIConc
Definition: CMetab.h:216
const CModelEntity::Status & getStatus() const
const std::string & getInfix() const
void CMetab::compileIsInitialConcentrationChangeAllowed ( )

Determine whether changing the initial concentration is allowed

Definition at line 644 of file CMetab.cpp.

References CCopasiObject::hasCircularDependencies(), mIsInitialConcentrationChangeAllowed, mpIConcReference, and CModelEntity::mpIValueReference.

645 {
646  // We check whether changing the initial concentration will lead to circular
647  // dependencies in the system.
648 
649  // These circular dependencies must always involve the initial particle number, i.e.,
650  // it suffices to check whether the initial particle number has circular dependencies when the
651  // concentration is changes.
652 
653  CCopasiObject::DataObjectSet Candidates;
656 
657  Context.insert(this->mpIConcReference);
658 
660 
661  return;
662 }
CCopasiObjectReference< C_FLOAT64 > * mpIValueReference
Definition: CModelValue.h:356
bool mIsInitialConcentrationChangeAllowed
Definition: CMetab.h:241
bool hasCircularDependencies(DataObjectSet &candidates, DataObjectSet &verified, const DataObjectSet &context) const
CConcentrationReference * mpIConcReference
Definition: CMetab.h:244
std::set< const CCopasiObject * > DataObjectSet
C_FLOAT64 CMetab::convertToConcentration ( const C_FLOAT64 number,
const CCompartment compartment,
const CModel model 
)
static

Converts the number to concentration

Parameters
constC_FLOAT64 & number
constCCompartment & compartment
constCModel & model
Returns
C_FLOAT64 concentration

Definition at line 41 of file CMetab.cpp.

References CModelEntity::getInitialValue(), and CModel::getNumber2QuantityFactor().

Referenced by CQSpecieDM::setData(), and CQSpeciesDetail::slotInitialValueLostFocus().

44 {return number / compartment.getInitialValue() * model.getNumber2QuantityFactor();}
const C_FLOAT64 & getInitialValue() const
const C_FLOAT64 & getNumber2QuantityFactor() const
Definition: CModel.cpp:2357
C_FLOAT64 CMetab::convertToNumber ( const C_FLOAT64 concentration,
const CCompartment compartment,
const CModel model 
)
static

Converts the concentration to number

Parameters
constC_FLOAT64 & concentration
constCCompartment & compartment
constCModel & model
Returns
C_FLOAT64 number

Definition at line 35 of file CMetab.cpp.

References CModelEntity::getInitialValue(), and CModel::getQuantity2NumberFactor().

Referenced by operator=(), CQSpecieDM::setData(), and CQSpeciesDetail::slotInitialValueLostFocus().

38 {return concentration * compartment.getInitialValue() * model.getQuantity2NumberFactor();}
const C_FLOAT64 & getInitialValue() const
const C_FLOAT64 & getQuantity2NumberFactor() const
Definition: CModel.cpp:2354
std::string CMetab::getChildObjectUnits ( const CCopasiObject pObject) const
virtual

Retrieve the units of the child object.

Returns
std::string units

Reimplemented from CCopasiContainer.

Definition at line 118 of file CMetab.cpp.

References CCompartment::getChildObjectUnits(), CModel::getFrequencyUnitsDisplayString(), CModelEntity::getInitialValueReference(), CModel::getQuantityUnitsDisplayString(), CModel::getTimeUnitsDisplayString(), mpCompartment, mpConcRateReference, mpConcReference, mpIConcReference, CModelEntity::mpIValueReference, CModelEntity::mpModel, CModelEntity::mpRateReference, mpTTReference, and CModelEntity::mpValueReference.

Referenced by CModelParameter::getUnit().

119 {
120  if (mpModel == NULL) return "";
121 
122  if (pObject == mpIValueReference ||
123  pObject == mpValueReference)
124  {
125  return "";
126  }
127  else if (pObject == mpRateReference)
128  {
130  }
131  else if (pObject == mpTTReference)
132  {
134  }
135  else if (mpCompartment != NULL)
136  {
137  std::string Unit = mpModel->getQuantityUnitsDisplayString();
138  std::string CompartmentUnit = mpCompartment->getChildObjectUnits(mpCompartment->getInitialValueReference());
139  std::string TimeUnit = mpModel->getTimeUnitsDisplayString();
140 
141  if (pObject == mpIConcReference ||
142  pObject == mpConcReference)
143  {
144  if (Unit == "")
145  {
146  if (CompartmentUnit == "")
147  {
148  return "";
149  }
150 
151  return "1/" + CompartmentUnit;
152  }
153 
154  if (CompartmentUnit == "")
155  {
156  return Unit;
157  }
158 
159  return Unit + "/" + CompartmentUnit;
160  }
161  else if (pObject == this->mpConcRateReference)
162  {
163  if (Unit == "")
164  {
165  if (CompartmentUnit == "")
166  {
167  if (TimeUnit == "")
168  {
169  return "";
170  }
171 
172  return "1/" + TimeUnit;
173  }
174 
175  if (TimeUnit == "")
176  {
177  return "1/" + CompartmentUnit;
178  }
179 
180  return "1/(" + CompartmentUnit + "*" + TimeUnit + ")";
181  }
182  else
183  {
184  if (CompartmentUnit == "")
185  {
186  if (TimeUnit == "")
187  {
188  return Unit;
189  }
190 
191  return Unit + "/" + TimeUnit;
192  }
193 
194  if (TimeUnit == "")
195  {
196  return Unit + "/" + CompartmentUnit;
197  }
198 
199  return Unit + "/(" + CompartmentUnit + "*" + TimeUnit + ")";
200  }
201  }
202  }
203 
204  return "";
205 }
CCopasiObjectReference< C_FLOAT64 > * mpIValueReference
Definition: CModelValue.h:356
std::string getTimeUnitsDisplayString() const
Definition: CModel.cpp:4531
std::string getFrequencyUnitsDisplayString() const
Definition: CModel.cpp:4539
CCopasiObject * getInitialValueReference() const
CCopasiObjectReference< C_FLOAT64 > * mpRateReference
Definition: CModelValue.h:358
virtual std::string getChildObjectUnits(const CCopasiObject *pObject) const
const CCompartment * mpCompartment
Definition: CMetab.h:232
CCopasiObjectReference< C_FLOAT64 > * mpValueReference
Definition: CModelValue.h:357
CCopasiObjectReference< C_FLOAT64 > * mpTTReference
Definition: CMetab.h:247
CConcentrationReference * mpIConcReference
Definition: CMetab.h:244
std::string getQuantityUnitsDisplayString() const
Definition: CModel.cpp:4647
CCopasiObjectReference< C_FLOAT64 > * mpConcRateReference
Definition: CMetab.h:246
CModel * mpModel
Definition: CModelValue.h:359
CConcentrationReference * mpConcReference
Definition: CMetab.h:245
const CCompartment * CMetab::getCompartment ( ) const

Definition at line 222 of file CMetab.cpp.

References mpCompartment.

Referenced by CModelAdd::addMetabolites(), CModel::calculateElasticityMatrix(), CTimeSeries::compile(), CChemEqInterface::completeCompartments(), CQSpeciesDetail::copy(), CMathObject::createExtensiveODERateExpression(), CMathObject::createExtensiveValueExpression(), CSBMLExporter::createInitialAssignment(), CMathObject::createIntensiveRateExpression(), CMathObject::createIntensiveValueExpression(), CCopasiSpringLayout::createLayout(), CModelExpansion::createLinearArray(), CSBMLExporter::createMetabolite(), CModelExpansion::createRectangularArray(), CSBMLExporter::createRule(), CCSPMethod::cspstep(), CQSpecieDM::data(), CModelExpansion::duplicateMetab(), CSBMLExporter::exportEventAssignments(), CODEExporter::exportMetabolites(), CODEExporter::exportModelEntityExpression(), CChemEqInterface::getCompartment(), CMetabNameInterface::getDisplayName(), SBMLImporter::importEvent(), SBMLImporter::importInitialAssignments(), CCopasiSpringLayout::initFromLayout(), CTSSAMethod::initializeAtol(), CModel::initializeAtolVector(), CQSpeciesDetail::load(), CQSimpleSelectionTree::populateTree(), CCopasiSpringLayout::randomize(), CModelExpansion::replaceInMetab(), CSBMLExporter::replaceSpeciesReferences(), CQSpeciesDetail::save(), CCopasiXML::saveModel(), CQSpecieDM::setData(), CReaction::setScalingFactor(), CNewtonMethod::solveJacobianXeqB(), CNewtonMethod::targetFunction(), and CMMLOutput::writeRHS().

222 {return mpCompartment;}
const CCompartment * mpCompartment
Definition: CMetab.h:232
const C_FLOAT64 & CMetab::getConcentration ( ) const

Definition at line 218 of file CMetab.cpp.

References mConc.

Referenced by CModel::calculateElasticityMatrix(), CQSpecieDM::data(), operator<<(), and CQSpeciesDetail::setFramework().

218 {return mConc;}
C_FLOAT64 mConc
Definition: CMetab.h:211
C_FLOAT64 CMetab::getConcentrationRate ( ) const

Return rate of production of this metaboLite

Definition at line 870 of file CMetab.cpp.

References mConcRate, and refreshConcentrationRate().

Referenced by CQSpecieDM::data(), operator<<(), and CQSpeciesDetail::setFramework().

871 {
872  const_cast<CMetab *>(this)->refreshConcentrationRate();
873  return mConcRate;
874 }
Definition: CMetab.h:178
C_FLOAT64 mConcRate
Definition: CMetab.h:221
void refreshConcentrationRate()
Definition: CMetab.cpp:876
CCopasiObject * CMetab::getConcentrationRateReference ( ) const

Retrieve object referencing the concentration

Returns
CCopasiObject * concentrationRateReference

Definition at line 867 of file CMetab.cpp.

References mpConcRateReference.

Referenced by findObjectByDisplayName(), CMathContainer::initializeMathObjects(), and CQSimpleSelectionTree::populateTree().

868 {return mpConcRateReference;}
CCopasiObjectReference< C_FLOAT64 > * mpConcRateReference
Definition: CMetab.h:246
CConcentrationReference * CMetab::getConcentrationReference ( ) const
CCopasiObject::DataObjectSet CMetab::getDeletedObjects ( ) const
virtual

Retrieve the list of deleted numeric child objects;

Returns
CCopasiObject::DataObjectSet deletedObjects

Reimplemented from CModelEntity.

Definition at line 806 of file CMetab.cpp.

References CModelEntity::getDeletedObjects(), mpConcRateReference, mpConcReference, mpIConcReference, and mpTTReference.

Referenced by CModel::appendDependentModelObjects(), CQSpeciesDetail::loadReactionTable(), mustBeDeleted(), CModel::removeMetabolite(), CQSpecieDM::removeRows(), CQSpeciesDetail::slotBtnDelete(), and CQSpeciesDetail::slotSwitchToReaction().

807 {
809 
810  Deleted.insert(mpIConcReference);
811  Deleted.insert(mpConcReference);
812  Deleted.insert(mpConcRateReference);
813  Deleted.insert(mpTTReference);
814 
815  return Deleted;
816 }
virtual std::set< const CCopasiObject * > getDeletedObjects() const
CCopasiObjectReference< C_FLOAT64 > * mpTTReference
Definition: CMetab.h:247
CConcentrationReference * mpIConcReference
Definition: CMetab.h:244
CCopasiObjectReference< C_FLOAT64 > * mpConcRateReference
Definition: CMetab.h:246
std::set< const CCopasiObject * > DataObjectSet
CConcentrationReference * mpConcReference
Definition: CMetab.h:245
const C_FLOAT64 & CMetab::getInitialConcentration ( ) const
CConcentrationReference * CMetab::getInitialConcentrationReference ( ) const
const CModel * CMetab::getModel ( ) const
const CMoiety * CMetab::getMoiety ( ) const

Retrieve a pointer to the moiety the species depends on

Returns
const CMoiety * pMoiety;

Definition at line 992 of file CMetab.cpp.

References mpMoiety.

Referenced by CMathObject::compileValue().

993 {return mpMoiety;}
const CMoiety * mpMoiety
Definition: CMetab.h:237
std::string CMetab::getObjectDisplayName ( bool  regular = true,
bool  richtext = false 
) const
virtual

Reimplemented from CCopasiObject.

Definition at line 974 of file CMetab.cpp.

References CMetabNameInterface::getDisplayName(), CCopasiObject::getObjectAncestor(), and CCopasiObject::getObjectDisplayName().

Referenced by CSBMLExporter::createMetabolite(), CQSelectionWizardPage::fillTree(), findObjectByDisplayName(), and CQSideCompoundWizardPage::alphaSorter::operator()().

975 {
976  CModel* tmp = dynamic_cast<CModel*>(this->getObjectAncestor("Model"));
977 
978  if (tmp)
979  {
980  return CMetabNameInterface::getDisplayName(tmp, *this, false);
981  }
982 
983  return CCopasiObject::getObjectDisplayName(regular, richtext);
984 }
CCopasiContainer * getObjectAncestor(const std::string &type) const
virtual std::string getObjectDisplayName(bool regular=true, bool richtext=false) const
static std::string getDisplayName(const CModel *model, const std::string &key, const bool &quoted)
Definition: CModel.h:50
const C_FLOAT64 & CMetab::getTransitionTime ( ) const

Retrieves the transition time

Returns
"const C_FLOAT64 &" transitionTime

Definition at line 229 of file CMetab.cpp.

References mTT.

Referenced by CQSpeciesDetail::load(), and operator<<().

229 {return mTT;}
C_FLOAT64 mTT
Definition: CMetab.h:226
const CCopasiObject * CMetab::getValueObject ( ) const
virtual

Retrieve the object representing the value;

Reimplemented from CModelEntity.

Definition at line 889 of file CMetab.cpp.

References mpConcReference.

890 {
891  return mpConcReference;
892 }
CConcentrationReference * mpConcReference
Definition: CMetab.h:245
void * CMetab::getValuePointer ( ) const
virtual

Retrieve a pointer to the value;

Reimplemented from CModelEntity.

Definition at line 895 of file CMetab.cpp.

References C_FLOAT64, and mConc.

896 {
897  return const_cast<C_FLOAT64 *>(&mConc);
898 }
C_FLOAT64 mConc
Definition: CMetab.h:211
#define C_FLOAT64
Definition: copasi.h:92
void CMetab::initCompartment ( const CCompartment pCompartment = NULL)

Definition at line 209 of file CMetab.cpp.

References CCopasiObject::getObjectAncestor(), and mpCompartment.

Referenced by CMetab(), and setObjectParent().

210 {
211  mpCompartment =
212  dynamic_cast< const CCompartment * >(getObjectAncestor("Compartment"));
213 
214  if (!mpCompartment)
215  mpCompartment = pCompartment;
216 }
CCopasiContainer * getObjectAncestor(const std::string &type) const
const CCompartment * mpCompartment
Definition: CMetab.h:232
void CMetab::initObjects ( )
private

Initialize the contained CCopasiObjects

Definition at line 777 of file CMetab.cpp.

References CCopasiContainer::addObjectReference(), C_FLOAT64, CCopasiObjectReference< CType >::getValuePointer(), mConc, mConcRate, mIConc, mpConcRateReference, mpConcReference, mpIConcReference, CModelEntity::mpIValueReference, CModelEntity::mpRateReference, mpTTReference, CModelEntity::mpValueReference, mTT, pdelete, refreshInitialConcentration(), refreshInitialValue(), CCopasiObject::setObjectName(), CCopasiObject::setRefresh(), and CCopasiObject::ValueDbl.

Referenced by CMetab().

778 {
779  // We need to have mpIValueRefernce point to a CParticleReference object.
780  C_FLOAT64 * pValue = static_cast< C_FLOAT64 * >(mpValueReference->getValuePointer());
781  assert(pValue != NULL);
783  mpIValueReference = new CParticleReference("InitialParticleNumber", this, *pValue);
785 
786  // We need to have mpValueRefernce point to a CParticleReference object.
787  pValue = static_cast< C_FLOAT64 * >(mpValueReference->getValuePointer());
788  assert(pValue != NULL);
790  mpValueReference = new CParticleReference("ParticleNumber", this, *pValue);
791 
792  mpRateReference->setObjectName("ParticleNumberRate");
793 
794  mpIConcReference = new CConcentrationReference("InitialConcentration", this, mIConc);
796 
797  mpConcReference = new CConcentrationReference("Concentration", this, mConc);
798 
801 
802  mpTTReference =
804 }
void setRefresh(CType *pType, void(CType::*method)(void))
#define pdelete(p)
Definition: copasi.h:215
CCopasiObjectReference< C_FLOAT64 > * mpIValueReference
Definition: CModelValue.h:356
C_FLOAT64 mTT
Definition: CMetab.h:226
CCopasiObjectReference< C_FLOAT64 > * mpRateReference
Definition: CModelValue.h:358
C_FLOAT64 mConc
Definition: CMetab.h:211
C_FLOAT64 mConcRate
Definition: CMetab.h:221
virtual void refreshInitialValue()
Definition: CMetab.cpp:264
CCopasiObjectReference< C_FLOAT64 > * mpValueReference
Definition: CModelValue.h:357
void refreshInitialConcentration()
Definition: CMetab.cpp:269
virtual void * getValuePointer() const
CCopasiObjectReference< C_FLOAT64 > * mpTTReference
Definition: CMetab.h:247
CConcentrationReference * mpIConcReference
Definition: CMetab.h:244
C_FLOAT64 mIConc
Definition: CMetab.h:216
#define C_FLOAT64
Definition: copasi.h:92
bool setObjectName(const std::string &name)
CCopasiObjectReference< C_FLOAT64 > * mpConcRateReference
Definition: CMetab.h:246
CCopasiObject * addObjectReference(const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
CConcentrationReference * mpConcReference
Definition: CMetab.h:245
bool CMetab::isDependent ( ) const
const bool & CMetab::isInitialConcentrationChangeAllowed ( ) const

Check whether changing the initial concentration is allowed

Returns
const bool & allowed

Definition at line 664 of file CMetab.cpp.

References mIsInitialConcentrationChangeAllowed.

Referenced by DataModelGUI::buildChangedObjects(), CModel::buildInitialRefreshSequence(), SliderDialog::determineCorrectObjectForSlider(), CQSpecieDM::flags(), and CQSpeciesDetail::setFramework().

665 {
667 }
bool mIsInitialConcentrationChangeAllowed
Definition: CMetab.h:241
C_INT32 CMetab::load ( CReadConfig configbuffer)

Loads an object with data coming from a CReadConfig object. (CReadConfig object reads an input stream)

Parameters
pconfigbufferreference to a CReadConfig object.
Returns
Fail

Definition at line 922 of file CMetab.cpp.

References C_INT32, CCopasiObject::getObjectName(), CReadConfig::getVariable(), METAB_MOIETY, mIConc, CModelEntity::REACTIONS, CReadConfig::SEARCH, setConcentration(), setInitialConcentration(), CCopasiObject::setObjectName(), setStatus(), and CCopasiMessage::WARNING.

923 {
924  C_INT32 Fail = 0;
925 
926  std::string tmp;
927  Fail = configbuffer.getVariable("Metabolite", "string",
928  (void *) & tmp,
930 
931  if (Fail)
932  return Fail;
933 
934  setObjectName(tmp);
935 
936  Fail = configbuffer.getVariable("InitialConcentration", "C_FLOAT64",
937  (void *) & mIConc);
938 
941 
942  Status GepasiStatus;
943  Fail = configbuffer.getVariable("Type", "C_INT16",
944  (void *) & GepasiStatus);
945 
946  if (Fail)
947  return Fail;
948 
949  setStatus(GepasiStatus);
950 
951  // sanity check
952  if ((GepasiStatus < 0) || (GepasiStatus > 7))
953  {
955  "The file specifies a non-existing type "
956  "for '%s'.\nReset to internal species.",
957  getObjectName().c_str());
959  }
960 
961  // sanity check
962  if ((GepasiStatus != METAB_MOIETY) && (mIConc < 0.0))
963  {
965  "The file specifies a negative concentration "
966  "for '%s'.\nReset to default.",
967  getObjectName().c_str());
968  mIConc = 1.0;
969  }
970 
971  return Fail;
972 }
void setInitialConcentration(const C_FLOAT64 &initialConcentration)
Definition: CMetab.cpp:257
const std::string & getObjectName() const
virtual void setStatus(const CModelEntity::Status &status)
Definition: CMetab.cpp:291
#define C_INT32
Definition: copasi.h:90
void setConcentration(const C_FLOAT64 concentration)
Definition: CMetab.cpp:250
#define METAB_MOIETY
Definition: CMetab.cpp:32
C_FLOAT64 mIConc
Definition: CMetab.h:216
C_INT32 getVariable(const std::string &name, const std::string &type, void *pout, CReadConfig::Mode mode=CReadConfig::NEXT)
Definition: CReadConfig.cpp:81
bool setObjectName(const std::string &name)
bool CMetab::mustBeDeleted ( const DataObjectSet deletedObjects) const
virtual

Check whether an object must be deleted because its prerequisites can no longer be fulfilled due to the given deleted objects

Parameters
constDataObjectSet & deletedObjects
Returns
bool mustBeDeleted

Reimplemented from CModelEntity.

Definition at line 819 of file CMetab.cpp.

References getDeletedObjects(), CModelEntity::getStatus(), mpConcRateReference, CModelEntity::mpRateReference, mpTTReference, and CModelEntity::REACTIONS.

820 {
821  bool MustBeDeleted = false;
822 
823  DataObjectSet ChildObjects = getDeletedObjects();
824 
825  DataObjectSet::const_iterator it = ChildObjects.begin();
826  DataObjectSet::const_iterator end = ChildObjects.end();
827 
828  for (; it != end; ++it)
829  {
830  if (*it == this)
831  {
832  if ((*it)->CCopasiObject::mustBeDeleted(deletedObjects))
833  {
834  MustBeDeleted = true;
835  break;
836  }
837 
838  continue;
839  }
840 
841  // The following objects are automatically corrected, i.e., they
842  // are no reasons for being deleted.
843  if (getStatus() == REACTIONS &&
844  (*it == this->mpConcRateReference ||
845  *it == this->mpRateReference ||
846  *it == this->mpTTReference))
847  {
848  continue;
849  }
850 
851  if ((*it)->mustBeDeleted(deletedObjects))
852  {
853  MustBeDeleted = true;
854  break;
855  }
856  }
857 
858  return MustBeDeleted;
859 }
CCopasiObjectReference< C_FLOAT64 > * mpRateReference
Definition: CModelValue.h:358
virtual DataObjectSet getDeletedObjects() const
Definition: CMetab.cpp:806
CCopasiObjectReference< C_FLOAT64 > * mpTTReference
Definition: CMetab.h:247
const CModelEntity::Status & getStatus() const
CCopasiObjectReference< C_FLOAT64 > * mpConcRateReference
Definition: CMetab.h:246
std::set< const CCopasiObject * > DataObjectSet
CMetab & CMetab::operator= ( const CMetabOld rhs)

Assignment operator.

Definition at line 93 of file CMetab.cpp.

References C_FLOAT64, convertToNumber(), CCopasiObject::getObjectName(), mConcRate, CMetabOld::mIConc, mpCompartment, CModelEntity::mpModel, CModelEntity::mRate, CMetabOld::mStatus, mTT, CModelEntity::setInitialValue(), CCopasiObject::setObjectName(), and setStatus().

94 {
95  setObjectName(RHS.getObjectName());
96 
97  setStatus(RHS.mStatus);
98 
99  // We need to set the initial particle number since that is the expected for the initial state
100  C_FLOAT64 InitialParticleNumber =
102  setInitialValue(InitialParticleNumber);
103 
104  mRate = 0.0;
105  mConcRate = 0.0;
106  mTT = 0.0;
107 
108  return *this; // Assignment operator returns left side.
109 }
virtual void setStatus(const CModelEntity::Status &status)
Definition: CMetab.cpp:291
C_FLOAT64 mTT
Definition: CMetab.h:226
C_FLOAT64 mRate
Definition: CModelValue.h:331
const CCompartment * mpCompartment
Definition: CMetab.h:232
C_FLOAT64 mConcRate
Definition: CMetab.h:221
static C_FLOAT64 convertToNumber(const C_FLOAT64 &concentration, const CCompartment &compartment, const CModel &model)
Definition: CMetab.cpp:35
#define C_FLOAT64
Definition: copasi.h:92
virtual void setInitialValue(const C_FLOAT64 &initialValue)
bool setObjectName(const std::string &name)
CModel * mpModel
Definition: CModelValue.h:359
void CMetab::refreshConcentration ( )
void CMetab::refreshConcentrationRate ( )

Calculate the concentration rate.

Definition at line 876 of file CMetab.cpp.

References CModel::getNumber2QuantityFactor(), CModelEntity::getRate(), CModelEntity::getValue(), mConc, mConcRate, mpCompartment, CModelEntity::mpModel, and CModelEntity::mRate.

Referenced by compile(), getConcentrationRate(), and setStatus().

877 {
878  // d(Particle Number*conversion/Volume)/dt
879  // = (Rate / Volume - Particle Number / Volume^2 * Volume Rate) * conversion
880  // = (Rate - Particle Number / Volume * Volume Rate) / Volume * conversion
881  // = (Rate * conversion - Concentration * Volume Rate) / Volume
882 
883  mConcRate =
885  / mpCompartment->getValue();
886 }
const C_FLOAT64 & getRate() const
C_FLOAT64 mRate
Definition: CModelValue.h:331
C_FLOAT64 mConc
Definition: CMetab.h:211
const C_FLOAT64 & getNumber2QuantityFactor() const
Definition: CModel.cpp:2357
const CCompartment * mpCompartment
Definition: CMetab.h:232
C_FLOAT64 mConcRate
Definition: CMetab.h:221
const C_FLOAT64 & getValue() const
CModel * mpModel
Definition: CModelValue.h:359
void CMetab::refreshInitialConcentration ( )

Definition at line 269 of file CMetab.cpp.

References CExpression::calcValue(), CEvaluationTree::getInfix(), CModelEntity::getInitialValue(), CModel::getNumber2QuantityFactor(), CModelEntity::isFixed(), mConc, mIConc, mpCompartment, CModelEntity::mpInitialExpression, CModelEntity::mpIValue, and CModelEntity::mpModel.

Referenced by initObjects().

270 {
271  if (mpInitialExpression != NULL &&
272  mpInitialExpression->getInfix() != "")
274  else
275  mIConc =
277 
278  if (isFixed()) mConc = mIConc;
279 }
CExpression * mpInitialExpression
Definition: CModelValue.h:341
C_FLOAT64 mConc
Definition: CMetab.h:211
C_FLOAT64 * mpIValue
Definition: CModelValue.h:326
bool isFixed() const
Definition: CModelValue.h:124
const C_FLOAT64 & getInitialValue() const
const C_FLOAT64 & getNumber2QuantityFactor() const
Definition: CModel.cpp:2357
virtual const C_FLOAT64 & calcValue()
const CCompartment * mpCompartment
Definition: CMetab.h:232
C_FLOAT64 mIConc
Definition: CMetab.h:216
CModel * mpModel
Definition: CModelValue.h:359
const std::string & getInfix() const
void CMetab::refreshInitialValue ( )
virtual

Refresh the initial value

Reimplemented from CModelEntity.

Definition at line 264 of file CMetab.cpp.

References CModelEntity::getInitialValue(), CModel::getQuantity2NumberFactor(), mIConc, mpCompartment, CModelEntity::mpIValue, and CModelEntity::mpModel.

Referenced by CModel::createMetabolite(), and initObjects().

265 {
267 }
C_FLOAT64 * mpIValue
Definition: CModelValue.h:326
const C_FLOAT64 & getInitialValue() const
const C_FLOAT64 & getQuantity2NumberFactor() const
Definition: CModel.cpp:2354
const CCompartment * mpCompartment
Definition: CMetab.h:232
C_FLOAT64 mIConc
Definition: CMetab.h:216
CModel * mpModel
Definition: CModelValue.h:359
void CMetab::refreshNumber ( )

Definition at line 286 of file CMetab.cpp.

References CModel::getQuantity2NumberFactor(), CModelEntity::getValue(), mConc, mpCompartment, CModelEntity::mpModel, and CModelEntity::mpValue.

Referenced by compile(), setStatus(), and CSensMethod::setValue().

287 {
289 }
C_FLOAT64 * mpValue
Definition: CModelValue.h:321
C_FLOAT64 mConc
Definition: CMetab.h:211
const C_FLOAT64 & getQuantity2NumberFactor() const
Definition: CModel.cpp:2354
const CCompartment * mpCompartment
Definition: CMetab.h:232
const C_FLOAT64 & getValue() const
CModel * mpModel
Definition: CModelValue.h:359
void CMetab::refreshRate ( )

Calculate the particle rate.

Definition at line 696 of file CMetab.cpp.

References CModelEntity::ASSIGNMENT, CModelEntity::FIXED, CModelEntity::getStatus(), CModelEntity::mRate, mRateVector, CModelEntity::ODE, and CModelEntity::REACTIONS.

Referenced by compile(), and setStatus().

697 {
698  switch (getStatus())
699  {
700  case FIXED:
701  break;
702 
703  case ASSIGNMENT:
704  break;
705 
706  case ODE:
707  break;
708 
709  case REACTIONS:
710  {
711  mRate = 0.0;
712 
713  std::vector< std::pair< C_FLOAT64, const C_FLOAT64 * > >::const_iterator it =
714  mRateVector.begin();
715  std::vector< std::pair< C_FLOAT64, const C_FLOAT64 * > >::const_iterator end =
716  mRateVector.end();
717 
718  for (; it != end; ++it)
719  mRate += it->first * *it->second;
720  }
721  break;
722 
723  default:
724  break;
725  }
726 }
C_FLOAT64 mRate
Definition: CModelValue.h:331
const CModelEntity::Status & getStatus() const
std::vector< std::pair< C_FLOAT64, const C_FLOAT64 * > > mRateVector
Definition: CMetab.h:239
void CMetab::refreshTransitionTime ( )

Calculate the transition time.

Definition at line 728 of file CMetab.cpp.

References CModelEntity::ASSIGNMENT, C_FLOAT64, CModelEntity::FIXED, CModelEntity::getStatus(), min, CModelEntity::mpValue, CModelEntity::mRate, mRateVector, mTT, CModelEntity::ODE, and CModelEntity::REACTIONS.

Referenced by compile().

729 {
730  switch (getStatus())
731  {
732  case FIXED:
733  break;
734 
735  case ASSIGNMENT:
736  break;
737 
738  case ODE:
739  mTT = *mpValue / fabs(mRate);
740  break;
741 
742  case REACTIONS:
743  {
744  C_FLOAT64 PositiveFlux = 0;
745  C_FLOAT64 NegativeFlux = 0;
746  C_FLOAT64 Flux;
747 
748  std::vector< std::pair< C_FLOAT64, const C_FLOAT64 * > >::const_iterator it =
749  mRateVector.begin();
750  std::vector< std::pair< C_FLOAT64, const C_FLOAT64 * > >::const_iterator end =
751  mRateVector.end();
752 
753  for (; it != end; ++it)
754  {
755  Flux = it->first * *it->second;
756 
757  if (Flux > 0.0)
758  PositiveFlux += Flux;
759  else
760  NegativeFlux -= Flux;
761  }
762 
763  Flux = std::min(PositiveFlux, NegativeFlux);
764 
765  if (Flux == 0.0)
766  mTT = std::numeric_limits<C_FLOAT64>::infinity();
767  else
768  mTT = *mpValue / Flux;
769  }
770  break;
771 
772  default:
773  break;
774  }
775 }
C_FLOAT64 mTT
Definition: CMetab.h:226
C_FLOAT64 mRate
Definition: CModelValue.h:331
C_FLOAT64 * mpValue
Definition: CModelValue.h:321
#define C_FLOAT64
Definition: copasi.h:92
const CModelEntity::Status & getStatus() const
#define min(a, b)
Definition: f2c.h:175
std::vector< std::pair< C_FLOAT64, const C_FLOAT64 * > > mRateVector
Definition: CMetab.h:239
void CMetab::setConcentration ( const C_FLOAT64  concentration)

Definition at line 250 of file CMetab.cpp.

References CModelEntity::isFixed(), and mConc.

Referenced by CMetab(), load(), and CSensMethod::setValue().

251 {
252  if (isFixed()) return;
253 
254  mConc = concentration;
255 }
C_FLOAT64 mConc
Definition: CMetab.h:211
bool isFixed() const
Definition: CModelValue.h:124
void CMetab::setDependentOn ( const CMoiety pMoiety)

Set whether the metabolite is dependent, i.e., calculated by a moiety

Parameters
constCMoiety * pMoiety

Definition at line 986 of file CMetab.cpp.

References mpMoiety.

Referenced by CMoiety::add().

987 {mpMoiety = pMoiety;}
const CMoiety * mpMoiety
Definition: CMetab.h:237
void CMetab::setInitialConcentration ( const C_FLOAT64 initialConcentration)

Definition at line 257 of file CMetab.cpp.

References mIConc.

Referenced by CMetab(), CModel::createMetabolite(), load(), CQSpeciesDetail::save(), CQSpecieDM::setData(), and CQSpeciesDetail::slotBtnNew().

258 {
259  mIConc = initialConcentration;
260 
261  return;
262 }
C_FLOAT64 mIConc
Definition: CMetab.h:216
bool CMetab::setObjectParent ( const CCopasiContainer pParent)
virtual

Sets the parent of the metabolite;

Parameters
constCCopasiContainer * pParent
Returns
bool success

Reimplemented from CModelEntity.

Definition at line 231 of file CMetab.cpp.

References CModelEntity::FIXED, CModelEntity::getStatus(), initCompartment(), CModelEntity::REACTIONS, CModelEntity::setObjectParent(), and setStatus().

232 {
234  initCompartment(NULL);
235 
236  Status CurrentStatus = getStatus();
237 
238  if (CurrentStatus != FIXED)
239  setStatus(FIXED);
240  else
242 
243  setStatus(CurrentStatus);
244 
245  return true;
246 }
void initCompartment(const CCompartment *pCompartment=NULL)
Definition: CMetab.cpp:209
virtual void setStatus(const CModelEntity::Status &status)
Definition: CMetab.cpp:291
virtual bool setObjectParent(const CCopasiContainer *pParent)
const CModelEntity::Status & getStatus() const
void CMetab::setStatus ( const CModelEntity::Status status)
virtual

Set the status

Parameters
constCModelEntity::Status & status

Reimplemented from CModelEntity.

Definition at line 291 of file CMetab.cpp.

References CModelEntity::ASSIGNMENT, calculate(), CCopasiObject::clearRefresh(), CModelEntity::FIXED, CCopasiObject::getDirectDependencies(), CModelEntity::getStatus(), CModelEntity::getValueReference(), mpCompartment, mpConcRateReference, mpConcReference, CModelEntity::mpExpression, CModelEntity::mpModel, CModelEntity::mpRateReference, CModelEntity::mpValueReference, CModelEntity::ODE, CModelEntity::REACTIONS, refreshConcentration(), refreshConcentrationRate(), refreshNumber(), refreshRate(), CCopasiObject::setDirectDependencies(), CCopasiObject::setRefresh(), and CModelEntity::setStatus().

Referenced by CModelAdd::addMetabolites(), CMetab(), SBMLImporter::createCMetabFromSpecies(), CModel::createMetabolite(), load(), operator=(), CQSpeciesDetail::save(), CQSpecieDM::setData(), and setObjectParent().

292 {
293  Status OldStatus = getStatus();
294 
295  CModelEntity::setStatus(status);
296 
297  if (status == OldStatus) return;
298 
299  CCopasiObject::DataObjectSet Dependencies;
300 
301  const CCopasiObject * pVolumeReference = NULL;
302 
303  if (mpCompartment)
304  pVolumeReference = mpCompartment->getValueReference();
305 
306  switch (getStatus())
307  {
308  case FIXED:
309  break;
310 
311  case ASSIGNMENT:
312  Dependencies.insert(mpConcReference);
313 
314  if (pVolumeReference)
315  Dependencies.insert(pVolumeReference);
316 
319 
322 
323  // The dependencies and refresh of the rate are correct (see CModelEntity::setStatus).
324 
327  break;
328 
329  case ODE:
332 
333  Dependencies.insert(mpValueReference);
334 
335  if (pVolumeReference)
336  Dependencies.insert(pVolumeReference);
337 
338  mpConcReference->setDirectDependencies(Dependencies);
340 
341  Dependencies.clear();
342  Dependencies.insert(mpConcRateReference);
343 
344  if (pVolumeReference)
345  Dependencies.insert(pVolumeReference);
346 
347  mpRateReference->setDirectDependencies(Dependencies);
349 
352 
353  break;
354 
355  case REACTIONS:
358 
359  if (pVolumeReference)
360  Dependencies.insert(pVolumeReference);
361 
362  Dependencies.insert(mpValueReference);
363  mpConcReference->setDirectDependencies(Dependencies);
365 
367 
368  Dependencies.clear();
369 
370  if (pVolumeReference)
371  Dependencies.insert(pVolumeReference);
372 
373  Dependencies.insert(mpRateReference);
376  break;
377 
378  default:
379  break;
380  }
381 
383 }
void setRefresh(CType *pType, void(CType::*method)(void))
virtual void calculate()
Definition: CMetab.cpp:669
void setDirectDependencies(const DataObjectSet &directDependencies)
CCopasiObjectReference< C_FLOAT64 > * mpRateReference
Definition: CModelValue.h:358
const CCompartment * mpCompartment
Definition: CMetab.h:232
virtual void setStatus(const CModelEntity::Status &status)
void refreshRate()
Definition: CMetab.cpp:696
void refreshNumber()
Definition: CMetab.cpp:286
CCopasiObjectReference< C_FLOAT64 > * mpValueReference
Definition: CModelValue.h:357
void refreshConcentration()
Definition: CMetab.cpp:281
virtual const DataObjectSet & getDirectDependencies(const DataObjectSet &context=DataObjectSet()) const
void refreshConcentrationRate()
Definition: CMetab.cpp:876
CExpression * mpExpression
Definition: CModelValue.h:336
const CModelEntity::Status & getStatus() const
CCopasiObjectReference< C_FLOAT64 > * mpConcRateReference
Definition: CMetab.h:246
std::set< const CCopasiObject * > DataObjectSet
CModel * mpModel
Definition: CModelValue.h:359
CConcentrationReference * mpConcReference
Definition: CMetab.h:245
CCopasiObject * getValueReference() const
void CMetab::setTransitionTime ( const C_FLOAT64 transitionTime)

Set transition time

Parameters
const C_FLOAT64 &transitionTime

Definition at line 226 of file CMetab.cpp.

References mTT.

227 {mTT = transitionTime;}
C_FLOAT64 mTT
Definition: CMetab.h:226

Friends And Related Function Documentation

void CMoiety::add ( C_FLOAT64  value,
CMetab pMetabolite 
)
friend
std::ostream& operator<< ( std::ostream &  os,
const CMetab d 
)
friend

ostream operator

Definition at line 900 of file CMetab.cpp.

901 {
902  os << " ++++CMetab: " << d.getObjectName() << std::endl;
903  os << " mConc " << d.mConc << " mIConc " << d.mIConc << std::endl;
904  os << " mValue (particle number) " << *d.mpValue << " mIValue " << *d.mpIValue << std::endl;
905  os << " mRate " << d.mRate << " mTT " << d.mTT << " mStatus " << d.getStatus() << std::endl;
906 
907  if (d.mpCompartment)
908  os << " mpCompartment == " << d.mpCompartment << std::endl;
909  else
910  os << " mpCompartment == 0 " << std::endl;
911 
912  if (d.mpModel)
913  os << " mpModel == " << d.mpModel << std::endl;
914  else
915  os << " mpModel == 0 " << std::endl;
916 
917  os << " ----CMetab " << std::endl;
918 
919  return os;
920 }
const std::string & getObjectName() const
C_FLOAT64 mTT
Definition: CMetab.h:226
C_FLOAT64 mRate
Definition: CModelValue.h:331
C_FLOAT64 * mpValue
Definition: CModelValue.h:321
C_FLOAT64 mConc
Definition: CMetab.h:211
C_FLOAT64 * mpIValue
Definition: CModelValue.h:326
const CCompartment * mpCompartment
Definition: CMetab.h:232
C_FLOAT64 mIConc
Definition: CMetab.h:216
const CModelEntity::Status & getStatus() const
CModel * mpModel
Definition: CModelValue.h:359

Member Data Documentation

C_FLOAT64 CMetab::mConc
private
C_FLOAT64 CMetab::mConcRate
private

The rate of concentration change

Definition at line 221 of file CMetab.h.

Referenced by compile(), getConcentrationRate(), initObjects(), operator=(), and refreshConcentrationRate().

C_FLOAT64 CMetab::mIConc
private
bool CMetab::mIsInitialConcentrationChangeAllowed
private
const CCompartment* CMetab::mpCompartment
private
CCopasiObjectReference<C_FLOAT64>* CMetab::mpConcRateReference
protected
CConcentrationReference* CMetab::mpConcReference
protected
CConcentrationReference* CMetab::mpIConcReference
protected
const CMoiety* CMetab::mpMoiety
private

If dependent the moiety the metabolite is calculated from

Definition at line 237 of file CMetab.h.

Referenced by calculate(), getMoiety(), isDependent(), and setDependentOn().

CCopasiObjectReference<C_FLOAT64>* CMetab::mpTTReference
protected

Definition at line 247 of file CMetab.h.

Referenced by compile(), getChildObjectUnits(), getDeletedObjects(), initObjects(), and mustBeDeleted().

std::vector< std::pair< C_FLOAT64, const C_FLOAT64 * > > CMetab::mRateVector
private

Definition at line 239 of file CMetab.h.

Referenced by compile(), refreshRate(), and refreshTransitionTime().

C_FLOAT64 CMetab::mTT
private

Transition time of the metabolite

Definition at line 226 of file CMetab.h.

Referenced by compile(), getTransitionTime(), initObjects(), operator<<(), operator=(), refreshTransitionTime(), and setTransitionTime().


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