Previous Page Parent Page Next Page TOC

Math Object

Mathematical Object (CMathObject)

This object provide the means for all calculations in the mathematical model. It is closely related to CCopasiObjectReference. However it does not rely on virtual function calls.

Value Types

  • Value: The value of an entity (extensive or intensive)
  • Rate: The rate of an entity (extensive or intensive)
  • Particle Flux: The particle flux of a reaction
  • Flux: The flux in amount units of a reaction
  • Propensity: The propensity of a reaction
  • Total Mass: The total mass of a moiety
  • Dependent Mass: The dependent mass of a moiety
  • Discontinuous: Automatically created entity which changes discontinuously, e.g., due to a piecewise defined function
  • Event Delay: The delay of an event assignment or calculation
  • Event Priority: The event priority
  • Event Assignment: An event assignment
  • Event Trigger: The event trigger
  • Event Root: The estimated distance from a part of the event trigger changing its state
  • Event Root State: The state (true or false) of a part of the event trigger

Interface

 
  /**
   * Retrieve the CN of the object
   * @return CCopasiObjectName
   */
  virtual CCopasiObjectName getCN() const;

  /**
   * Retrieve a descendant object by its CN.
   * @param const CCopasiObjectName & cn
   * @return const CObjectInterface * pObject
   */
  virtual const CObjectInterface * getObject(const CCopasiObjectName & cn) const;

  /**
   * Retrieve the prerequisites, i.e., the objects which need to be evaluated
   * before this.
   * @return const CObjectInterface::ObjectSet & prerequisites
   */
  virtual const CObjectInterface::ObjectSet & getPrerequisites() const;

  /**
   * Check whether a given object is a prerequisite for a context.
   * @param const CObjectInterface * pObject
   * @param const CMath::SimulationContextFlag & context
   * @param const CObjectInterface::ObjectSet & changedObjects
   * @return bool isPrerequisiteForContext
   */
  virtual bool isPrerequisiteForContext(const CObjectInterface * pObject,
                                        const CMath::SimulationContextFlag & context,
                                        const CObjectInterface::ObjectSet & changedObjects) const;

  /**
   * This is the output method for any object. The default implementation
   * provided with CCopasiObject uses the ostream operator<< of the object
   * to print the object.To override this default behavior one needs to
   * reimplement the virtual print function.
   * @param std::ostream * ostream
   */
  virtual void print(std::ostream * ostream) const;

  /**
   * Retrieve a pointer to the value of the object
   */
  virtual void * getValuePointer() const;

  /**
   * Calculate the objects value
   */
  void calculate();

  /**
   * Initialize a single mathematical object and advance relevant pointers
   * @param CMathObject *& pObject
   * @param C_FLOAT64 *& pValue
   * @param const CMath::Value & valueType
   * @param const CMath::EntityType & entityType
   * @param const CMath::SimulationType & simulationType
   * @param const bool & isIntensiveProperty
   * @param const bool & isInitialValue
   * @param const CCopasiObject * pDataObject
   */
  static void initialize(CMathObject *& pObject,
                         C_FLOAT64 *& pValue,
                         const CMath::ValueType & valueType,
                         const CMath::EntityType & entityType,
                         const CMath::SimulationType & simulationType,
                         const bool & isIntensiveProperty,
                         const bool & isInitialValue,
                         const CCopasiObject * pDataObject);

  /**
   * Compile
   * @param CMathContainer & container
   * @return bool §success
   */
  bool compile(CMathContainer & container);

  /**
   * Retrieve the pointer to the data object
   * @return const CCopasiObject * pDataObject
   */
  const CCopasiObject * getDataObject() const;

  /**
   * Retrieve the value type
   * @return const CMath::ValueType & valueType
   */
  const CMath::ValueType & getValueType() const;

  /**
   * Retrieve the entity type
   * @return const CMath::EntityType & entityType
   */
  const CMath::EntityType & getEntityType() const;

  /**
   * Retrieve the simulation type
   * @return const CMath::SimulationType & simulationType
   */
  const CMath::SimulationType & getSimulationType() const;

  /**
   * Set the simulation type
   * @param const CMath::SimulationType & simulationType
   */
  void setSimulationType(const CMath::SimulationType & simulationType);

  /**
   * Check whether the object is an intensive property
   * @return const bool & isIntensiveProperty
   */
  const bool & isIntensiveProperty() const;

  /**
   * Check whether the object is an initial value
   * @return const bool & isInitialValue
   */
  const bool & isInitialValue() const;


  /**
   * Set the expression and compile the object.
   * @param const CExpression & expression,
   * @param CMathContainer & container
   * @return bool success
   */
  bool setExpression(const CExpression & expression,
                     CMathContainer & container);

  /**
   * Set the expression and compile the object.
   * @param CMathExpression * pMathExpression,
   * @return bool success
   */
  bool setExpressionPtr(CMathExpression * pMathExpression);

  /**
   * Retrieve a pointer to the math expression.
   * @return const CMathExpression * pExpression
   */
  const CMathExpression * getExpressionPtr() const;

Attributes

 
  /**
   * The expression which determines the value of the object.
   */
  CMathExpression * mpExpression;

  /**
   * A pointer to value of the object
   */
  C_FLOAT64 *mpValue;

  /**
   * The prerequisites, i.e., the objects which need to be evaluated before this.
   */
  CObjectInterface::ObjectSet mPrerequisites;

  /**
   * The type of the object
   */
  CMath::ValueType mValueType;

  /**
   * The entity type the object belongs
   */
  CMath::EntityType mEntityType;

  /**
   * The simulation type
   */
  CMath::SimulationType mSimulationType;

  /**
   * A flag indicating whether this is an intensive or extensive property.
   */
  bool mIsIntensiveProperty;

  /**
   * A flag indicating whether this is an initial value, i.e, which dependency graph
   * is used to update the object.
   */
  bool mIsInitialValue;

  /**
   * A pointer to the corresponding intensive property if it exists otherwise NULL
   */
  const CMathObject * mpIntensiveProperty;

  /**
   * A pointer to the data object
   */
  const CCopasiObject * mpDataObject;