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

#include <CChemEq.h>

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

Public Types

enum  MetaboliteRole { PRODUCT = 0, SUBSTRATE, MODIFIER, NOROLE }
 
- 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 Member Functions

bool addMetabolite (const std::string &key, const C_FLOAT64 multiplicity, const MetaboliteRole &role)
 
 CChemEq (const std::string &name="NoName", const CCopasiContainer *pParent=NULL)
 
 CChemEq (const CChemEq &src, const CCopasiContainer *pParent=NULL)
 
void cleanup ()
 
const CCopasiVector
< CChemEqElement > & 
getBalances () const
 
size_t getCompartmentNumber () const
 
std::set< const CCompartment * > getCompartments () const
 
const CCompartmentgetLargestCompartment () const
 
const CCopasiVector
< CChemEqElement > & 
getModifiers () const
 
size_t getMolecularity (const MetaboliteRole role) const
 
const CCopasiVector
< CChemEqElement > & 
getProducts () const
 
const bool & getReversibility () const
 
const CCopasiVector
< CChemEqElement > & 
getSubstrates () const
 
bool setMultiplicity (const CMetab *pMetab, C_FLOAT64 newMult, MetaboliteRole role)
 
void setReversibility (const bool &reversible)
 
virtual ~CChemEq ()
 
- 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
 
virtual const std::string & getKey () const
 
CCopasiContainergetObjectAncestor (const std::string &type) const
 
CCopasiDataModelgetObjectDataModel ()
 
const CCopasiDataModelgetObjectDataModel () const
 
virtual std::string getObjectDisplayName (bool regular=true, bool richtext=false) const
 
const std::string & getObjectName () const
 
CCopasiContainergetObjectParent () const
 
const std::string & getObjectType () const
 
virtual const
CObjectInterface::ObjectSet
getPrerequisites () const
 
virtual RefreshgetRefresh () const
 
UpdateMethodgetUpdateMethod () const
 
virtual voidgetValuePointer () const
 
bool hasCircularDependencies (DataObjectSet &candidates, DataObjectSet &verified, const DataObjectSet &context) const
 
bool hasUpdateMethod () const
 
bool isArray () const
 
bool isContainer () const
 
bool isDataModel () const
 
bool isMatrix () const
 
bool isNameVector () const
 
bool isNonUniqueName () const
 
virtual bool isPrerequisiteForContext (const CObjectInterface *pObject, const CMath::SimulationContextFlag &context, const CObjectInterface::ObjectSet &changedObjects) const
 
bool isReference () const
 
bool isRoot () const
 
bool isSeparator () const
 
bool isStaticString () const
 
bool isValueBool () const
 
bool isValueDbl () const
 
bool isValueInt () const
 
bool isValueInt64 () const
 
bool isValueString () const
 
bool isVector () const
 
virtual bool mustBeDeleted (const DataObjectSet &deletedObjects) const
 
virtual void print (std::ostream *ostream) const
 
void removeDirectDependency (const CCopasiObject *pObject)
 
void setDirectDependencies (const DataObjectSet &directDependencies)
 
bool setObjectName (const std::string &name)
 
virtual bool setObjectParent (const CCopasiContainer *pParent)
 
void setObjectValue (const C_FLOAT64 &value)
 
void setObjectValue (const C_INT32 &value)
 
void setObjectValue (const bool &value)
 
template<class CType >
void setRefresh (CType *pType, void(CType::*method)(void))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const C_FLOAT64 &))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const C_INT32 &))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const bool &))
 
virtual ~CCopasiObject ()
 
- Public Member Functions inherited from CObjectInterface
 CObjectInterface ()
 
virtual ~CObjectInterface ()
 

Private Member Functions

void addElement (CCopasiVector< CChemEqElement > &structure, const CChemEqElement &element, CChemEq::MetaboliteRole role=CChemEq::PRODUCT)
 

Private Attributes

CCopasiVector< CChemEqElementmBalances
 
CCopasiVector< CChemEqElementmModifiers
 
CCopasiVector< CChemEqElementmProducts
 
bool mReversible
 
CCopasiVector< CChemEqElementmSubstrates
 

Friends

std::ostream & operator<< (std::ostream &os, const CChemEq &d)
 

Additional Inherited Members

- 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 inherited from CCopasiContainer
static const std::vector
< CCopasiContainer * > 
EmptyList
 
- Protected Types inherited from CCopasiObject
enum  Flag {
  Container = 0x1, Vector = 0x2, Matrix = 0x4, NameVector = 0x8,
  Reference = 0x10, ValueBool = 0x20, ValueInt = 0x40, ValueInt64 = 0x80,
  ValueDbl = 0x100, NonUniqueName = 0x200, StaticString = 0x400, ValueString = 0x800,
  Separator = 0x1000, ModelEntity = 0x2000, Array = 0x4000, DataModel = 0x8000,
  Root = 0x10000, Gui = 0x20000
}
 
- Protected Member Functions inherited from CCopasiContainer
template<class CType >
CCopasiObjectaddMatrixReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
 
template<class CType >
CCopasiObjectaddObjectReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
 
template<class CType >
CCopasiObjectaddVectorReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
 
void initObjects ()
 
- Protected Member Functions inherited from CCopasiObject
 CCopasiObject ()
 
 CCopasiObject (const std::string &name, const CCopasiContainer *pParent=NULL, const std::string &type="CN", const unsigned C_INT32 &flag=0)
 
- Protected Attributes inherited from CCopasiContainer
objectMap mObjects
 
- Static Protected Attributes inherited from CCopasiObject
static CRenameHandlersmpRenameHandler = NULL
 

Detailed Description

Definition at line 33 of file CChemEq.h.

Member Enumeration Documentation

Enumerator
PRODUCT 
SUBSTRATE 
MODIFIER 
NOROLE 

Definition at line 36 of file CChemEq.h.

37  {
38  PRODUCT = 0,
39  SUBSTRATE,
40  MODIFIER,
41  NOROLE
42  };

Constructor & Destructor Documentation

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

Default constructor

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

Definition at line 30 of file CChemEq.cpp.

References CONSTRUCTOR_TRACE.

31  :
32  CCopasiContainer(name, pParent, "Chemical Equation"),
33  mReversible(false),
34  mSubstrates("Substrates", this),
35  mProducts("Products", this),
36  mModifiers("Modifiers", this),
37  mBalances("Balances", this)
CCopasiVector< CChemEqElement > mModifiers
Definition: CChemEq.h:209
CCopasiVector< CChemEqElement > mProducts
Definition: CChemEq.h:204
CCopasiVector< CChemEqElement > mSubstrates
Definition: CChemEq.h:197
char name[1]
Definition: stdsoap2.h:1342
CCopasiVector< CChemEqElement > mBalances
Definition: CChemEq.h:216
bool mReversible
Definition: CChemEq.h:190
#define CONSTRUCTOR_TRACE
Definition: copasi.h:202
CChemEq::CChemEq ( const CChemEq src,
const CCopasiContainer pParent = NULL 
)

Copy constructor

Parameters
const CChemEq &src
constCCopasiContainer * pParent (default: NULL)

Definition at line 40 of file CChemEq.cpp.

References CONSTRUCTOR_TRACE.

41  :
42  CCopasiContainer(src, pParent),
44  mSubstrates(src.mSubstrates, this),
45  mProducts(src.mProducts, this),
46  mModifiers(src.mModifiers, this),
47  mBalances(src.mBalances, this)
CCopasiVector< CChemEqElement > mModifiers
Definition: CChemEq.h:209
CCopasiVector< CChemEqElement > mProducts
Definition: CChemEq.h:204
CCopasiVector< CChemEqElement > mSubstrates
Definition: CChemEq.h:197
CCopasiVector< CChemEqElement > mBalances
Definition: CChemEq.h:216
bool mReversible
Definition: CChemEq.h:190
#define CONSTRUCTOR_TRACE
Definition: copasi.h:202
CChemEq::~CChemEq ( )
virtual

Destructor

Definition at line 50 of file CChemEq.cpp.

References cleanup(), and DESTRUCTOR_TRACE.

#define DESTRUCTOR_TRACE
Definition: copasi.h:206
void cleanup()
Definition: CChemEq.cpp:52

Member Function Documentation

void CChemEq::addElement ( CCopasiVector< CChemEqElement > &  structure,
const CChemEqElement element,
CChemEq::MetaboliteRole  role = CChemEq::PRODUCT 
)
private

Adds an element to the vector given by structure. The element is either SUBSTRATE or PRODUCT.

Parameters
CCopasiVector < CChemEqElement > &structure
const CChemEqElement &element
CChemEq::MetaboliteRolerole (

Definition at line 180 of file CChemEq.cpp.

References CCopasiVector< T >::add(), CChemEqElement::getMetaboliteKey(), CChemEqElement::getMultiplicity(), CChemEqElement::setMultiplicity(), CCopasiVector< T >::size(), and SUBSTRATE.

Referenced by addMetabolite(), and setMultiplicity().

183 {
184  size_t i;
185 
186  std::string key = element.getMetaboliteKey();
187 
188  if (key == "")
189  return; // don�t add empty element
190 
191  for (i = 0; i < structure.size(); i++)
192  if (key == structure[i]->getMetaboliteKey())
193  break;
194 
195  if (i >= structure.size())
196  {
197  CChemEqElement * Element = new CChemEqElement(element);
198 
199  if (role == CChemEq::SUBSTRATE)
200  Element->setMultiplicity(- Element->getMultiplicity());
201 
202  structure.add(Element, true);
203  }
204  else if (role == CChemEq::SUBSTRATE)
205  structure[i]->addToMultiplicity(- element.getMultiplicity());
206  else
207  structure[i]->addToMultiplicity(element.getMultiplicity());
208 }
void setMultiplicity(const C_FLOAT64 multiplicity)
virtual size_t size() const
const C_FLOAT64 & getMultiplicity() const
virtual bool add(const CType &src)
const std::string & getMetaboliteKey() const
bool CChemEq::addMetabolite ( const std::string &  key,
const C_FLOAT64  multiplicity,
const MetaboliteRole role 
)

Add a species to the equation

Parameters
conststd::string & speciesKey
constC_FLOAT64 & multiplicity
constMetaboliteRole & role
Returns
bool success

Definition at line 80 of file CChemEq.cpp.

References addElement(), fatalError, mBalances, mModifiers, MODIFIER, mProducts, mSubstrates, PRODUCT, CChemEqElement::setMetabolite(), CChemEqElement::setMultiplicity(), and SUBSTRATE.

Referenced by CReaction::addModifier(), CReaction::addProduct(), CReaction::addSubstrate(), SBMLImporter::applyStoichiometricExpressions(), SBMLImporter::isMassActionExpression(), CReaction::loadOneRole(), and CChemEqInterface::writeToChemEq().

81 {
82  CChemEqElement element;
83  element.setMetabolite(key);
84  element.setMultiplicity(multiplicity);
85 
86  switch (role)
87  {
88  case CChemEq::SUBSTRATE:
89  addElement(mSubstrates, element);
91  break;
92 
93  case CChemEq::PRODUCT:
94  addElement(mProducts, element);
95  addElement(mBalances, element);
96  break;
97 
98  case CChemEq::MODIFIER:
99  addElement(mModifiers, element);
100  break;
101 
102  default:
103  fatalError();
104  break;
105  }
106 
107  return true;
108 }
void setMultiplicity(const C_FLOAT64 multiplicity)
CCopasiVector< CChemEqElement > mModifiers
Definition: CChemEq.h:209
#define fatalError()
CCopasiVector< CChemEqElement > mProducts
Definition: CChemEq.h:204
void addElement(CCopasiVector< CChemEqElement > &structure, const CChemEqElement &element, CChemEq::MetaboliteRole role=CChemEq::PRODUCT)
Definition: CChemEq.cpp:180
CCopasiVector< CChemEqElement > mSubstrates
Definition: CChemEq.h:197
void setMetabolite(const std::string &key)
CCopasiVector< CChemEqElement > mBalances
Definition: CChemEq.h:216
void CChemEq::cleanup ( )

Cleanup

Definition at line 52 of file CChemEq.cpp.

References CCopasiVector< T >::cleanup(), mBalances, mModifiers, mProducts, and mSubstrates.

Referenced by CChemEqInterface::writeToChemEq(), and ~CChemEq().

53 {
58 }
CCopasiVector< CChemEqElement > mModifiers
Definition: CChemEq.h:209
CCopasiVector< CChemEqElement > mProducts
Definition: CChemEq.h:204
CCopasiVector< CChemEqElement > mSubstrates
Definition: CChemEq.h:197
virtual void cleanup()
CCopasiVector< CChemEqElement > mBalances
Definition: CChemEq.h:216
const CCopasiVector< CChemEqElement > & CChemEq::getBalances ( ) const

Retrieves the vector of metabolites and their total balance in the chemical reaction.

Returns
"vector < CChemEqElement * > &" balances

Definition at line 69 of file CChemEq.cpp.

References mBalances.

Referenced by CMathReaction::initialize(), and CMMLOutput::writeRHS().

70 {return mBalances;}
CCopasiVector< CChemEqElement > mBalances
Definition: CChemEq.h:216
size_t CChemEq::getCompartmentNumber ( ) const

Returns the number of compartments the chemical equation is associated with.

Definition at line 110 of file CChemEq.cpp.

References getCompartments().

Referenced by CChemEqInterface::getCompartment(), CReaction::getCompartmentNumber(), test000091::test_delay_in_kinetic_law(), test000091::test_delay_in_kinetic_law_local_parameter(), test000033::test_hasOnlySubstanceUnits(), test000022::test_hasOnlySubstanceUnits(), test000043::test_hasOnlySubstanceUnits(), test000026::test_hasOnlySubstanceUnits(), test000041::test_hasOnlySubstanceUnits(), test000040::test_hasOnlySubstanceUnits(), test000039::test_hasOnlySubstanceUnits(), test000038::test_hasOnlySubstanceUnits(), test000037::test_hasOnlySubstanceUnits(), test000036::test_hasOnlySubstanceUnits(), test000034::test_hasOnlySubstanceUnits(), test000035::test_hasOnlySubstanceUnits(), test000021::test_hasOnlySubstanceUnits(), test000025::test_hasOnlySubstanceUnits(), test000031::test_hasOnlySubstanceUnits(), test000042::test_hasOnlySubstanceUnits(), test000029::test_hasOnlySubstanceUnits(), test000028::test_hasOnlySubstanceUnits(), test000027::test_hasOnlySubstanceUnits(), test000023::test_hasOnlySubstanceUnits(), test000032::test_hasOnlySubstanceUnits(), test000030::test_hasOnlySubstanceUnits(), test000024::test_hasOnlySubstanceUnits(), test000045::test_stoichiometricExpression(), test000044::test_stoichiometricExpression(), and test000046::test_stoichiometricExpression().

111 {
112  return getCompartments().size();
113 }
std::set< const CCompartment * > getCompartments() const
Definition: CChemEq.cpp:115
std::set< const CCompartment * > CChemEq::getCompartments ( ) const

Retrieves a set of the compartments.

Definition at line 115 of file CChemEq.cpp.

References CCopasiVector< T >::begin(), CCopasiVector< T >::end(), and mBalances.

Referenced by CMathObject::compileFlux(), and getCompartmentNumber().

116 {
117  const CCompartment * pCompartment = NULL;
118  std::set< const CCompartment * > Compartments;
119 
122 
123  for (; it != end; ++it)
124  {
125  if ((*it)->getMetabolite() == NULL)
126  continue;
127 
128  if ((pCompartment = (*it)->getMetabolite()->getCompartment()) != NULL)
129  {
130  Compartments.insert(pCompartment);
131  }
132  }
133 
134  return Compartments;
135 }
iterator begin()
iterator end()
CCopasiVector< CChemEqElement > mBalances
Definition: CChemEq.h:216
const CCompartment * CChemEq::getLargestCompartment ( ) const

Retrieve the largest compartment that the reaction touches. This is time dependent it can only be called after update initial values has been called. Note for an empty reaction a NULL pointer is returned.

Returns
const CCompartment * pCompartment

Definition at line 137 of file CChemEq.cpp.

References C_FLOAT64, C_INVALID_INDEX, mProducts, mSubstrates, and CCopasiVector< T >::size().

Referenced by CReaction::getLargestCompartment().

138 {
139  size_t indexSubstrates = C_INVALID_INDEX;
140  size_t indexProducts = C_INVALID_INDEX;
141  size_t i, imax;
142 
143  C_FLOAT64 tmp, maxVol = -1.0;
144 
145  for (i = 0, imax = mSubstrates.size(); i < imax; i++)
146  {
147  if (!mSubstrates[i]->getMetabolite()) continue;
148 
149  tmp = mSubstrates[i]->getMetabolite()->getCompartment()->getValue();
150 
151  if (tmp > maxVol)
152  {
153  maxVol = tmp;
154  indexSubstrates = i;
155  }
156  }
157 
158  for (i = 0, imax = mProducts.size(); i < imax; i++)
159  {
160  if (!mProducts[i]->getMetabolite()) continue;
161 
162  tmp = mProducts[i]->getMetabolite()->getCompartment()->getValue();
163 
164  if (tmp > maxVol)
165  {
166  maxVol = tmp;
167  indexProducts = i;
168  }
169  }
170 
171  if (indexProducts != C_INVALID_INDEX)
172  return mProducts[indexProducts]->getMetabolite()->getCompartment();
173 
174  if (indexSubstrates != C_INVALID_INDEX)
175  return mSubstrates[indexSubstrates]->getMetabolite()->getCompartment();
176 
177  return NULL;
178 }
virtual size_t size() const
#define C_INVALID_INDEX
Definition: copasi.h:222
CCopasiVector< CChemEqElement > mProducts
Definition: CChemEq.h:204
CCopasiVector< CChemEqElement > mSubstrates
Definition: CChemEq.h:197
#define C_FLOAT64
Definition: copasi.h:92
const CCopasiVector< CChemEqElement > & CChemEq::getModifiers ( ) const

Retrieves the vector of Modifiers and their multiplicity

Definition at line 66 of file CChemEq.cpp.

References mModifiers.

Referenced by CModelAdd::addReactions(), CModelAnalyzer::checkReaction(), CReaction::compile(), ReactionsWidget1::copy(), SBMLImporter::createCReactionFromReaction(), CSBMLExporter::createReaction(), CLayoutInitializer::createReactionGlyph(), SBMLImporter::doMapping(), CModelExpansion::duplicateReaction(), CChemEqInterface::loadFromChemEq(), CModelMerging::mergeMetabolites(), CReaction::object2variable(), CModelAdd::reactionInvolvesCompartment(), CModelExpansion::replaceInReaction(), CCopasiXML::saveModel(), SBMLImporter::setCorrectUsage(), CLLayoutRenderer::setDeduceSpeciesReferenceRoles(), test000091::test_delay_in_kinetic_law(), test000091::test_delay_in_kinetic_law_local_parameter(), test000031::test_hasOnlySubstanceUnits(), test000029::test_hasOnlySubstanceUnits(), test000028::test_hasOnlySubstanceUnits(), test000027::test_hasOnlySubstanceUnits(), test000035::test_hasOnlySubstanceUnits(), test000039::test_hasOnlySubstanceUnits(), test000034::test_hasOnlySubstanceUnits(), test000023::test_hasOnlySubstanceUnits(), test000042::test_hasOnlySubstanceUnits(), test000021::test_hasOnlySubstanceUnits(), test000036::test_hasOnlySubstanceUnits(), test000037::test_hasOnlySubstanceUnits(), test000025::test_hasOnlySubstanceUnits(), test000024::test_hasOnlySubstanceUnits(), test000030::test_hasOnlySubstanceUnits(), test000041::test_hasOnlySubstanceUnits(), test000026::test_hasOnlySubstanceUnits(), test000033::test_hasOnlySubstanceUnits(), test000032::test_hasOnlySubstanceUnits(), test000022::test_hasOnlySubstanceUnits(), test000038::test_hasOnlySubstanceUnits(), test000043::test_hasOnlySubstanceUnits(), test000040::test_hasOnlySubstanceUnits(), test000045::test_stoichiometricExpression(), test000044::test_stoichiometricExpression(), test000046::test_stoichiometricExpression(), and CLLayoutRenderer::update_associations().

67 {return mModifiers;}
CCopasiVector< CChemEqElement > mModifiers
Definition: CChemEq.h:209
size_t CChemEq::getMolecularity ( const MetaboliteRole  role) const

Checks if it is possible to figure out a compartment from the information in the chemical equation. If there are substrates and if all the substrates are in the same compartment this compartment will be returned. If there are no substrates and there are Products and all Products are in the same compartment this compartment will be returned, else an exception will be thrown. This returns the sum of the multiplicities

Definition at line 210 of file CChemEq.cpp.

References fatalError, mModifiers, MODIFIER, mProducts, mSubstrates, PRODUCT, CCopasiVector< T >::size(), and SUBSTRATE.

Referenced by CFindDimensions::setChemicalEquation().

211 {
212  const CCopasiVector<CChemEqElement> * tmpVector = NULL;
213 
214  switch (role)
215  {
216  case CChemEq::SUBSTRATE:
217  tmpVector = &mSubstrates;
218  break;
219 
220  case CChemEq::PRODUCT:
221  tmpVector = &mProducts;
222  break;
223 
224  case CChemEq::MODIFIER:
225  tmpVector = &mModifiers;
226  break;
227 
228  default:
229  fatalError();
230  break;
231  }
232 
233  size_t ccc, i, imax = tmpVector->size();
234  ccc = 0;
235 
236  for (i = 0; i < imax; ++i)
237  ccc += (size_t) floor((*tmpVector)[i]->getMultiplicity());
238 
239  return ccc;
240 }
CCopasiVector< CChemEqElement > mModifiers
Definition: CChemEq.h:209
virtual size_t size() const
#define fatalError()
CCopasiVector< CChemEqElement > mProducts
Definition: CChemEq.h:204
CCopasiVector< CChemEqElement > mSubstrates
Definition: CChemEq.h:197
const CCopasiVector< CChemEqElement > & CChemEq::getProducts ( ) const

Retrieves the vector of products and their multiplicity in the chemical reaction.

Returns
"vector < CChemEqElement * > &" products

Definition at line 63 of file CChemEq.cpp.

References mProducts.

Referenced by CModelAdd::addReactions(), CModelAnalyzer::checkReaction(), CReaction::compile(), CModel::convert2NonReversible(), ReactionsWidget1::copy(), SBMLImporter::createCReactionFromReaction(), CSBMLExporter::createKineticLaw(), CSBMLExporter::createReaction(), CLayoutInitializer::createReactionGlyph(), SBMLImporter::doMapping(), CModelExpansion::duplicateReaction(), CODEExporter::exportKineticFunction(), SBMLImporter::findCorrespondingFunction(), CChemEqInterface::getCompartment(), CEFMTask::getNetReactionData(), CEFMTask::getSpeciesChanges(), is_mass_action(), SBMLImporter::isMassActionExpression(), CODEExporterC::KineticFunction2ODEmember(), CChemEqInterface::loadFromChemEq(), CModelMerging::mergeMetabolites(), CReaction::object2variable(), CModelAdd::reactionInvolvesCompartment(), CModelExpansion::replaceInReaction(), CCopasiXML::saveModel(), SBMLImporter::setCorrectUsage(), CLLayoutRenderer::setDeduceSpeciesReferenceRoles(), CReaction::setScalingFactor(), test000091::test_delay_in_kinetic_law(), test000091::test_delay_in_kinetic_law_local_parameter(), test000029::test_hasOnlySubstanceUnits(), test000021::test_hasOnlySubstanceUnits(), test000022::test_hasOnlySubstanceUnits(), test000034::test_hasOnlySubstanceUnits(), test000023::test_hasOnlySubstanceUnits(), test000037::test_hasOnlySubstanceUnits(), test000043::test_hasOnlySubstanceUnits(), test000041::test_hasOnlySubstanceUnits(), test000035::test_hasOnlySubstanceUnits(), test000033::test_hasOnlySubstanceUnits(), test000039::test_hasOnlySubstanceUnits(), test000031::test_hasOnlySubstanceUnits(), test000038::test_hasOnlySubstanceUnits(), test000032::test_hasOnlySubstanceUnits(), test000025::test_hasOnlySubstanceUnits(), test000036::test_hasOnlySubstanceUnits(), test000027::test_hasOnlySubstanceUnits(), test000042::test_hasOnlySubstanceUnits(), test000028::test_hasOnlySubstanceUnits(), test000030::test_hasOnlySubstanceUnits(), test000026::test_hasOnlySubstanceUnits(), test000024::test_hasOnlySubstanceUnits(), test000040::test_hasOnlySubstanceUnits(), test000045::test_stoichiometricExpression(), test000044::test_stoichiometricExpression(), test000046::test_stoichiometricExpression(), and CLLayoutRenderer::update_associations().

64 {return mProducts;}
CCopasiVector< CChemEqElement > mProducts
Definition: CChemEq.h:204
const bool & CChemEq::getReversibility ( ) const

Retrieve the reversibility of the equation

Returns
const bool & reversible

Definition at line 77 of file CChemEq.cpp.

References mReversible.

Referenced by SBMLImporter::doMapping(), is_mass_action(), SBMLImporter::isMassActionExpression(), CReaction::isReversible(), and CChemEqInterface::loadFromChemEq().

78 {return mReversible;}
bool mReversible
Definition: CChemEq.h:190
const CCopasiVector< CChemEqElement > & CChemEq::getSubstrates ( ) const

Retrieves the vector of substrates and their multiplicity in the chemical reaction.

Returns
"vector < CChemEqElement * > &" substrates

Definition at line 60 of file CChemEq.cpp.

References mSubstrates.

Referenced by CModelAdd::addReactions(), SBMLImporter::applyStoichiometricExpressions(), CModelAnalyzer::checkReaction(), CReaction::compile(), CMathObject::compilePropensity(), CModel::convert2NonReversible(), ReactionsWidget1::copy(), SBMLImporter::createCReactionFromReaction(), CSBMLExporter::createKineticLaw(), CSBMLExporter::createReaction(), CLayoutInitializer::createReactionGlyph(), SBMLImporter::doMapping(), CModelExpansion::duplicateReaction(), CODEExporter::exportKineticFunction(), SBMLImporter::findCorrespondingFunction(), CChemEqInterface::getCompartment(), CEFMTask::getNetReactionData(), CEFMTask::getSpeciesChanges(), is_mass_action(), SBMLImporter::isMassActionExpression(), CODEExporterC::KineticFunction2ODEmember(), CChemEqInterface::loadFromChemEq(), CModelMerging::mergeMetabolites(), CReaction::object2variable(), CModelAdd::reactionInvolvesCompartment(), CModelExpansion::replaceInReaction(), CCopasiXML::saveModel(), SBMLImporter::setCorrectUsage(), CLLayoutRenderer::setDeduceSpeciesReferenceRoles(), CReaction::setScalingFactor(), test000091::test_delay_in_kinetic_law(), test000091::test_delay_in_kinetic_law_local_parameter(), test000034::test_hasOnlySubstanceUnits(), test000028::test_hasOnlySubstanceUnits(), test000042::test_hasOnlySubstanceUnits(), test000043::test_hasOnlySubstanceUnits(), test000021::test_hasOnlySubstanceUnits(), test000035::test_hasOnlySubstanceUnits(), test000022::test_hasOnlySubstanceUnits(), test000040::test_hasOnlySubstanceUnits(), test000029::test_hasOnlySubstanceUnits(), test000036::test_hasOnlySubstanceUnits(), test000039::test_hasOnlySubstanceUnits(), test000031::test_hasOnlySubstanceUnits(), test000032::test_hasOnlySubstanceUnits(), test000041::test_hasOnlySubstanceUnits(), test000030::test_hasOnlySubstanceUnits(), test000024::test_hasOnlySubstanceUnits(), test000037::test_hasOnlySubstanceUnits(), test000033::test_hasOnlySubstanceUnits(), test000026::test_hasOnlySubstanceUnits(), test000027::test_hasOnlySubstanceUnits(), test000038::test_hasOnlySubstanceUnits(), test000023::test_hasOnlySubstanceUnits(), test000025::test_hasOnlySubstanceUnits(), test000044::test_stoichiometricExpression(), test000045::test_stoichiometricExpression(), test000046::test_stoichiometricExpression(), and CLLayoutRenderer::update_associations().

61 {return mSubstrates;}
CCopasiVector< CChemEqElement > mSubstrates
Definition: CChemEq.h:197
bool CChemEq::setMultiplicity ( const CMetab pMetab,
C_FLOAT64  newMult,
MetaboliteRole  role 
)

Sets the stoichiometry of the chemical element that corresponds to the given metabolite and role to the new value. The role has to be either CChemEqElement::SUBSTRATE or CChemEqElement::PRODUCT. If the role is invalid, the multiplicity is negative or zero or if the element for the metabolite and role can not be found in the chemical equation, false is returned and nothing is changed.

Sets the stoichiometry of the chemical element that corresponds to the given metabolite and role to the new value. The role has to be either CChemEqElement::SUBSTRATE or CChemEqElement::PRODUCT. If the role is invalid, the multiplicity if negative or if the element for the metabolite and role can not be found in the chemical equation, false is returned and nothing is changed.

Definition at line 268 of file CChemEq.cpp.

References addElement(), CCopasiVector< T >::begin(), C_FLOAT64, CCopasiVector< T >::end(), CModelEntity::getKey(), mBalances, mProducts, mSubstrates, PRODUCT, CChemEqElement::setMultiplicity(), and SUBSTRATE.

269 {
270  bool result = true;
271 
272  // check if the multiplicity and the role are valid
273  if (pMetab == NULL || newMult <= 0 || !(role == CChemEq::SUBSTRATE || role == CChemEq::PRODUCT))
274  {
275  result = false;
276  }
277  else
278  {
279  // find the corresponding chemical element
280  std::string key = pMetab->getKey();
282 
283  if (role == CChemEq::SUBSTRATE)
284  {
285  it = this->mSubstrates.begin();
286  endit = this->mSubstrates.end();
287  }
288  else
289  {
290  it = this->mProducts.begin();
291  endit = this->mProducts.end();
292  }
293 
294  while (it != endit)
295  {
296  if ((*it)->getMetaboliteKey() == key)
297  {
298  break;
299  }
300 
301  ++it;
302  }
303 
304  if (it == endit)
305  {
306  result = false;
307  }
308  else
309  {
310  // set the new multiplicity and update the balances
311  C_FLOAT64 diff = newMult - (*it)->getMultiplicity();
312 
313  // we only make changes if there actually is a difference
314  if (fabs(diff) > 1e-9)
315  {
316  // we have to add the difference between the new and the old
317  // multiplicity to the balances
318  (*it)->setMultiplicity(newMult);
319  // copy the element
320  CChemEqElement tmp(**it);
321  // set the difference of the multiplicities
322  // as the multiplicity of the copy
323  tmp.setMultiplicity(diff);
324  // update the balances
325  this->addElement(this->mBalances, tmp, role);
326  }
327  }
328  }
329 
330  return result;
331 }
iterator begin()
CCopasiVector< CChemEqElement > mProducts
Definition: CChemEq.h:204
void addElement(CCopasiVector< CChemEqElement > &structure, const CChemEqElement &element, CChemEq::MetaboliteRole role=CChemEq::PRODUCT)
Definition: CChemEq.cpp:180
CCopasiVector< CChemEqElement > mSubstrates
Definition: CChemEq.h:197
iterator end()
virtual const std::string & getKey() const
#define C_FLOAT64
Definition: copasi.h:92
CCopasiVector< CChemEqElement > mBalances
Definition: CChemEq.h:216
void CChemEq::setReversibility ( const bool &  reversible)

Set the reversibility of the of the equation

Parameters
constbool & const bool & reversible

Definition at line 72 of file CChemEq.cpp.

References mReversible.

Referenced by CReaction::load(), CReaction::setReversible(), and CChemEqInterface::writeToChemEq().

73 {
74  mReversible = reversible;
75 }
bool mReversible
Definition: CChemEq.h:190

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const CChemEq d 
)
friend

Friend declaration for ostream operator

Parameters
std::ostream& os
constCChemEq & d
Returns
std::ostream & os

Definition at line 242 of file CChemEq.cpp.

243 {
244  os << "CChemEq:" << std::endl;
245  //os << " mChemicalEquation: " << d.getChemicalEquation() << std::endl;
246  //os << " mChemicalEquationConverted: " << d.getChemicalEquationConverted() << std::endl;
247 
248  os << " mSubstrates:" << std::endl;
249  os << d.mSubstrates;
250  os << " mProducts:" << std::endl;
251  os << d.mProducts;
252  os << " mBalances:" << std::endl;
253  os << d.mBalances;
254 
255  os << "----CChemEq" << std::endl;
256  return os;
257 }
CCopasiVector< CChemEqElement > mProducts
Definition: CChemEq.h:204
CCopasiVector< CChemEqElement > mSubstrates
Definition: CChemEq.h:197
CCopasiVector< CChemEqElement > mBalances
Definition: CChemEq.h:216

Member Data Documentation

CCopasiVector< CChemEqElement > CChemEq::mBalances
private

A vector of metabolites and their total balance in the chemical reaction 0..* Stoichiometry

Definition at line 216 of file CChemEq.h.

Referenced by addMetabolite(), cleanup(), getBalances(), getCompartments(), operator<<(), and setMultiplicity().

CCopasiVector< CChemEqElement > CChemEq::mModifiers
private

A vector of modifiers in the chemical reaction.

Definition at line 209 of file CChemEq.h.

Referenced by addMetabolite(), cleanup(), getModifiers(), and getMolecularity().

CCopasiVector< CChemEqElement > CChemEq::mProducts
private

A vector of products and their multiplicity in the chemical reaction 0..* Products

Definition at line 204 of file CChemEq.h.

Referenced by addMetabolite(), cleanup(), getLargestCompartment(), getMolecularity(), getProducts(), operator<<(), and setMultiplicity().

bool CChemEq::mReversible
private

Indicates whether the chemical equation is reversible

Definition at line 190 of file CChemEq.h.

Referenced by getReversibility(), and setReversibility().

CCopasiVector< CChemEqElement > CChemEq::mSubstrates
private

A vector of substrates and their multiplicity in the chemical reaction 0..* Substrates

Definition at line 197 of file CChemEq.h.

Referenced by addMetabolite(), cleanup(), getLargestCompartment(), getMolecularity(), getSubstrates(), operator<<(), and setMultiplicity().


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