COPASI API  4.16.103
Functions
CODEExporter.cpp File Reference
#include <locale>
#include <cmath>
#include <iostream>
#include <fstream>
#include <sstream>
#include <ctype.h>
#include "copasi.h"
#include "CopasiDataModel/CCopasiDataModel.h"
#include "report/CCopasiRootContainer.h"
#include "CODEExporter.h"
#include "model/CModel.h"
#include "model/CMetab.h"
#include "model/CMetabNameInterface.h"
#include "utilities/CCopasiVector.h"
#include "model/CReaction.h"
#include "model/CMoiety.h"
#include "model/CChemEqElement.h"
#include "function/CFunction.h"
#include "function/CExpression.h"
#include "function/CFunctionDB.h"
#include "report/CKeyFactory.h"
#include "function/CEvaluationTree.h"
#include "function/CEvaluationNode.h"
#include "function/CEvaluationNodeObject.h"
#include "function/CEvaluationNodeOperator.h"
#include "function/CEvaluationNodeFunction.h"
#include "utilities/CCopasiTree.h"
#include "utilities/CCopasiMessage.h"
#include "commandline/CLocaleString.h"
#include "trajectory/CTrajectoryTask.h"
#include "trajectory/CTrajectoryProblem.h"
Include dependency graph for CODEExporter.cpp:

Go to the source code of this file.

Functions

std::string getQuantityParameterOrValue (const std::map< std::string, std::string > &map, const CCopasiDataModel *pDataModel)
 
size_t getReactionIndex (const CCopasiVector< CReaction > &reacs, const CReaction *react)
 

Function Documentation

std::string getQuantityParameterOrValue ( const std::map< std::string, std::string > &  map,
const CCopasiDataModel pDataModel 
)

Definition at line 539 of file CODEExporter.cpp.

References CCopasiVector< T >::begin(), CCopasiVector< T >::end(), CCopasiDataModel::getModel(), CModel::getModelValues(), and CModel::getQuantity2NumberFactor().

Referenced by CODEExporter::exportExpression().

540 {
541  double val = pDataModel->getModel()->getQuantity2NumberFactor();
542  const CCopasiVectorN< CModelValue >& vals = pDataModel->getModel()->getModelValues();
544 
545  for (; it != vals.end(); ++it)
546  {
547  std::map< std::string, std::string >::const_iterator key = map.find((*it)->getKey());
548 
549  if ((*it)->getInitialValue() == val && key != map.end())
550  return key->second;
551  }
552 
553  std::ostringstream str;
554  str << val;
555  return str.str();
556 }
const CCopasiVectorN< CModelValue > & getModelValues() const
Definition: CModel.cpp:1060
iterator begin()
iterator end()
const C_FLOAT64 & getQuantity2NumberFactor() const
Definition: CModel.cpp:2354
size_t getReactionIndex ( const CCopasiVector< CReaction > &  reacs,
const CReaction react 
)

Definition at line 528 of file CODEExporter.cpp.

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

Referenced by CODEExporter::exportExpression(), and CEFMTask::getFluxModeDescription().

529 {
530  for (size_t i = 0; i < reacs.size(); ++i)
531  {
532  if (reacs[i] == react)
533  return i;
534  }
535 
536  return C_INVALID_INDEX;
537 }
virtual size_t size() const
#define C_INVALID_INDEX
Definition: copasi.h:222