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

#include <CMetab.h>

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

Public Member Functions

 CParticleReference (const std::string &name, const CCopasiContainer *pParent, C_FLOAT64 &reference)
 
 CParticleReference (const CParticleReference &src, const CCopasiContainer *pParent)
 
virtual const DataObjectSetgetDirectDependencies (const DataObjectSet &context=DataObjectSet()) const
 
virtual const
CObjectInterface::ObjectSet
getPrerequisites () const
 
virtual bool isPrerequisiteForContext (const CObjectInterface *pObject, const CMath::SimulationContextFlag &context, const CObjectInterface::ObjectSet &changedObjects) const
 
 ~CParticleReference ()
 
- Public Member Functions inherited from CCopasiObjectReference< C_FLOAT64 >
 CCopasiObjectReference (const std::string &name, const CCopasiContainer *pParent, referenceType &reference, const unsigned C_INT32 &flag=0)
 
 CCopasiObjectReference (const CCopasiObjectReference< referenceType > &src, const CCopasiContainer *pParent)
 
virtual std::string getObjectDisplayName (bool regular=true, bool richtext=false) const
 
virtual const CCopasiObjectgetValueObject () const
 
virtual voidgetValuePointer () const
 
virtual void print (std::ostream *ostream) const
 
virtual void setReference (referenceType &reference)
 
virtual ~CCopasiObjectReference ()
 
- 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 std::string & getKey () const
 
virtual const CObjectInterfacegetObject (const CCopasiObjectName &cn) const
 
CCopasiContainergetObjectAncestor (const std::string &type) const
 
CCopasiDataModelgetObjectDataModel ()
 
const CCopasiDataModelgetObjectDataModel () const
 
const std::string & getObjectName () const
 
CCopasiContainergetObjectParent () const
 
const std::string & getObjectType () const
 
virtual RefreshgetRefresh () const
 
virtual std::string getUnits () 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
 
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
 
void removeDirectDependency (const CCopasiObject *pObject)
 
void setDirectDependencies (const DataObjectSet &directDependencies)
 
bool setObjectName (const std::string &name)
 
virtual bool setObjectParent (const CCopasiContainer *pParent)
 
void setObjectValue (const C_FLOAT64 &value)
 
void setObjectValue (const C_INT32 &value)
 
void setObjectValue (const bool &value)
 
template<class CType >
void setRefresh (CType *pType, void(CType::*method)(void))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const C_FLOAT64 &))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const C_INT32 &))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const bool &))
 
virtual ~CCopasiObject ()
 
- Public Member Functions inherited from CObjectInterface
 CObjectInterface ()
 
virtual ~CObjectInterface ()
 

Private Member Functions

 CParticleReference ()
 

Private Attributes

ObjectSet mPrerequisites
 

Static Private Attributes

static DataObjectSet EmptyDependencies
 

Additional Inherited Members

- Public Types inherited from CCopasiObjectReference< C_FLOAT64 >
typedef C_FLOAT64 referenceType
 
- Public Types inherited from CCopasiObject
typedef std::set< const
CCopasiObject * > 
DataObjectSet
 
typedef std::vector< Refresh * > DataUpdateSequence
 
- Public Types inherited from CObjectInterface
typedef std::set< const
CObjectInterface * > 
ObjectSet
 
typedef std::vector
< CObjectInterface * > 
UpdateSequence
 
- Static Public Member Functions inherited from CCopasiObject
static std::vector< Refresh * > buildUpdateSequence (const DataObjectSet &objects, const DataObjectSet &uptoDateObjects, const DataObjectSet &context=DataObjectSet())
 
static void setRenameHandler (CRenameHandler *rh)
 
- 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 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 108 of file CMetab.h.

Constructor & Destructor Documentation

CParticleReference::CParticleReference ( )
private

Hidden default constructor

CParticleReference::CParticleReference ( const std::string &  name,
const CCopasiContainer pParent,
C_FLOAT64 reference 
)

Specific constructor

Parameters
conststd::string & name
constCCopasiContainer * pParent,
C_FLOAT64& reference,

Definition at line 1144 of file CMetab.cpp.

1146  :
1147  CCopasiObjectReference< C_FLOAT64 >(name, pParent, reference),
1148  mPrerequisites()
1149 {}
ObjectSet mPrerequisites
Definition: CMetab.h:175
CParticleReference::CParticleReference ( const CParticleReference src,
const CCopasiContainer pParent 
)

Copy constructor

Parameters
constCParticleReference & src
constCCopasiContainer * pParent,

Definition at line 1151 of file CMetab.cpp.

CParticleReference::~CParticleReference ( )

Destructor

Definition at line 1156 of file CMetab.cpp.

1157 {}

Member Function Documentation

const CCopasiObject::DataObjectSet & CParticleReference::getDirectDependencies ( const DataObjectSet context = DataObjectSet()) const
virtual

Retrieve the list of direct dependencies

Parameters
constCCopasiObject::DataObjectSet & context (default empty set)
Returns
const CCopasiObject::DataObjectSet & directDependencies

Reimplemented from CCopasiObject.

Definition at line 1161 of file CMetab.cpp.

References CModelEntity::ASSIGNMENT, EmptyDependencies, CMetab::getConcentrationReference(), CCopasiObject::getDirectDependencies(), CMetab::getInitialConcentrationReference(), CModelEntity::getInitialExpression(), CCopasiObject::getObjectName(), CCopasiObject::getObjectParent(), and CModelEntity::getStatus().

1162 {
1163  // If the particle number was changed in the context it has no further dependencies
1164  if (context.count(this) > 0)
1165  {
1166  return EmptyDependencies;
1167  }
1168 
1169  const CMetab * pSpecies = static_cast< const CMetab * >(getObjectParent());
1170 
1171  // In an assignment the particles (initial or transient) have always dependencies
1172  if (pSpecies == NULL ||
1173  pSpecies->getStatus() == CModelEntity::ASSIGNMENT)
1174  {
1176  }
1177 
1178  // We need to distinguish between initial and transient value.
1179  const CCopasiObject * pConcentrationReference = NULL;
1180 
1181  if (getObjectName() == "InitialParticleNumber")
1182  {
1183  // If we have an initial expression the initial particle number has dependencies.
1184  if (pSpecies->getInitialExpression() != "")
1186 
1187  pConcentrationReference = pSpecies->getInitialConcentrationReference();
1188  }
1189  else
1190  {
1191  pConcentrationReference = pSpecies->getConcentrationReference();
1192  }
1193 
1194  // In other cases we need to find out whether the concentration was changed in
1195  // the context.
1196 
1197  if (pConcentrationReference != NULL &&
1198  context.count(pConcentrationReference) > 0)
1199  {
1201  }
1202 
1203  return EmptyDependencies;
1204 }
static DataObjectSet EmptyDependencies
Definition: CMetab.h:170
const std::string & getObjectName() const
Definition: CMetab.h:178
std::string getInitialExpression() const
virtual const DataObjectSet & getDirectDependencies(const DataObjectSet &context=DataObjectSet()) const
const CModelEntity::Status & getStatus() const
CConcentrationReference * getInitialConcentrationReference() const
Definition: CMetab.cpp:861
CCopasiContainer * getObjectParent() const
CConcentrationReference * getConcentrationReference() const
Definition: CMetab.cpp:864
const CObjectInterface::ObjectSet & CParticleReference::getPrerequisites ( ) const
virtual

Retrieve the prerequisites, i.e., the objects which need to be evaluated before this.

Returns
const CObjectInterface::ObjectSet & prerequisites

Reimplemented from CCopasiObject.

Definition at line 1207 of file CMetab.cpp.

References CMoiety::getDependentNumberReference(), CCopasiObject::getDirectDependencies(), CCopasiObject::getObjectParent(), and mPrerequisites.

1208 {
1210  const CMoiety * pMoiety = static_cast< const CMetab * >(getObjectParent())->getMoiety();
1211 
1212  if (pMoiety != NULL)
1213  {
1214  mPrerequisites.insert(pMoiety->getDependentNumberReference());
1215  }
1216 
1217  return mPrerequisites;
1218 }
Definition: CMetab.h:178
std::set< const CObjectInterface * > ObjectSet
virtual const DataObjectSet & getDirectDependencies(const DataObjectSet &context=DataObjectSet()) const
ObjectSet mPrerequisites
Definition: CMetab.h:175
CCopasiObject * getDependentNumberReference() const
Definition: CMoiety.cpp:151
CCopasiContainer * getObjectParent() const
bool CParticleReference::isPrerequisiteForContext ( const CObjectInterface pObject,
const CMath::SimulationContextFlag context,
const CObjectInterface::ObjectSet changedObjects 
) const
virtual

Check whether a given object is a prerequisite for a context.

Parameters
constCObjectInterface * pObject
constCMath::SimulationContextFlag & context
constCObjectInterface::ObjectSet & changedObjects
Returns
bool isPrerequisiteForContext

Reimplemented from CCopasiObject.

Definition at line 1221 of file CMetab.cpp.

References CModelEntity::ASSIGNMENT, CMetab::getConcentrationReference(), CMetab::getInitialConcentrationReference(), CCopasiObject::getObjectName(), CCopasiObject::getObjectParent(), CModelEntity::getStatus(), CMetab::isDependent(), and CMath::UseMoieties.

1224 {
1225  const CMetab * pSpecies = static_cast< const CMetab * >(getObjectParent());
1226 
1227  if ((context & CMath::UseMoieties) &&
1228  pSpecies->isDependent())
1229  {
1230  return true;
1231  }
1232 
1233  // If the value is changed it must not be recalculated, i.e., it does not depend on the object.
1234  if (changedObjects.find(this) != changedObjects.end())
1235  return false;
1236 
1237  // Amounts which are determine by assignment need to be recalculated.
1238  if (pSpecies->getStatus() == CModelEntity::ASSIGNMENT)
1239  return true;
1240 
1241  const CConcentrationReference * pConcentrationReference = NULL;
1242 
1243  if (getObjectName() != "ParticleNumber")
1244  {
1245  pConcentrationReference = pSpecies->getInitialConcentrationReference();
1246  }
1247  else
1248  {
1249  pConcentrationReference = pSpecies->getConcentrationReference();
1250  }
1251 
1252  // If the concentration was changed in the context we need to recalculate.
1253  if (changedObjects.find(pConcentrationReference) != changedObjects.end())
1254  return true;
1255 
1256  return false;
1257 }
const std::string & getObjectName() const
Definition: CMetab.h:178
bool isDependent() const
Definition: CMetab.cpp:989
const CModelEntity::Status & getStatus() const
CConcentrationReference * getInitialConcentrationReference() const
Definition: CMetab.cpp:861
CCopasiContainer * getObjectParent() const
CConcentrationReference * getConcentrationReference() const
Definition: CMetab.cpp:864

Member Data Documentation

CCopasiObject::DataObjectSet CParticleReference::EmptyDependencies
staticprivate

The list of direct dependencies when the values is in the changed context, i.e., it is always empty

Definition at line 170 of file CMetab.h.

Referenced by getDirectDependencies().

ObjectSet CParticleReference::mPrerequisites
mutableprivate

The prerequisites for building the math dependency graph.

Definition at line 175 of file CMetab.h.

Referenced by getPrerequisites().


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