COPASI API  4.16.103
Functions
SEDMLImporter.cpp File Reference
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <map>
#include <limits>
#include <cmath>
#include <algorithm>
#include <sedml/SedTypes.h>
#include <sbml/math/FormulaFormatter.h>
#include "copasi.h"
#include "report/CKeyFactory.h"
#include "model/CModel.h"
#include "model/CCompartment.h"
#include "model/CMetab.h"
#include "model/CReaction.h"
#include "model/CModelValue.h"
#include "model/CEvent.h"
#include "function/CNodeK.h"
#include "function/CFunctionDB.h"
#include "function/CEvaluationTree.h"
#include "function/CExpression.h"
#include "function/CFunctionParameters.h"
#include "report/CCopasiObjectReference.h"
#include "utilities/CCopasiTree.h"
#include "utilities/CNodeIterator.h"
#include "CopasiDataModel/CCopasiDataModel.h"
#include "report/CCopasiRootContainer.h"
#include "MIRIAM/CRDFGraphConverter.h"
#include "compareExpressions/CEvaluationNodeNormalizer.h"
#include "commandline/CLocaleString.h"
#include "commandline/COptions.h"
#include "utilities/CProcessReport.h"
#include "copasi/commandline/CConfigurationFile.h"
#include "utilities/CCopasiMessage.h"
#include "trajectory/CTrajectoryTask.h"
#include "trajectory/CTrajectoryProblem.h"
#include "sbml/SBMLImporter.h"
#include "utilities/CDirEntry.h"
#include "utilities/CCopasiException.h"
#include "utilities/CCopasiTask.h"
#include "plot/COutputDefinitionVector.h"
#include "plot/CPlotSpecification.h"
#include "report/CReportDefinitionVector.h"
#include <steadystate/CSteadyStateTask.h>
#include <scan/CScanTask.h>
#include "SEDMLImporter.h"
#include "SEDMLUtils.h"
Include dependency graph for SEDMLImporter.cpp:

Go to the source code of this file.

Functions

bool applyAttributeChange (CModel *pCopasiModel, CModelParameterSet &set, const std::string &target, const std::string &newValue)
 
bool applyValueToModelParameter (CModelParameter *modelParameter, CCopasiObject *obj, double newValue)
 
bool applyValueToParameterSet (CModelParameterSet &set, CCopasiObject *obj, double newValue)
 
bool isScan (const SedTask *task)
 
bool isScan (const SedRepeatedTask *task)
 
bool isTC (const SedTask *task)
 

Function Documentation

bool applyAttributeChange ( CModel pCopasiModel,
CModelParameterSet set,
const std::string &  target,
const std::string &  newValue 
)

Definition at line 787 of file SEDMLImporter.cpp.

References applyValueToParameterSet(), CCopasiObject::getObjectParent(), and SEDMLUtils::resolveXPath().

Referenced by SEDMLImporter::importFirstSBMLModel().

788 {
789  CCopasiObject *obj = const_cast<CCopasiObject*>(SEDMLUtils::resolveXPath(pCopasiModel, target, true));
790 
791  if (obj == NULL)
792  return false;
793 
794  // convert the string to double
795  std::stringstream str;
796  str << newValue;
797  double result;
798  str >> result;
799 
800  // set the value
801  applyValueToParameterSet(set, obj->getObjectParent(), result);
802  return true;
803 }
bool applyValueToParameterSet(CModelParameterSet &set, CCopasiObject *obj, double newValue)
static const CCopasiObject * resolveXPath(const CModel *model, const std::string &xpath, bool initial=false)
Definition: SEDMLUtils.cpp:242
CCopasiContainer * getObjectParent() const
bool applyValueToModelParameter ( CModelParameter modelParameter,
CCopasiObject obj,
double  newValue 
)

Definition at line 746 of file SEDMLImporter.cpp.

References CModelParameter::Concentration, CModelParameter::getChild(), CModelParameter::getCN(), CCopasiObject::getCN(), CModelParameter::getNumChildren(), and CModelParameter::setValue().

Referenced by applyValueToParameterSet().

747 {
748  if (modelParameter == NULL || obj == NULL) return false;
749 
750  size_t numChilren = modelParameter->getNumChildren();
751 
752  const CCopasiObjectName& cn = modelParameter->getCN();
753  const CCopasiObjectName& targetCN = obj->getCN();
754 
755  if (cn == targetCN)
756  {
757  modelParameter->setValue(newValue, CModelParameter::Concentration);
758  return true;
759  }
760 
761  for (unsigned int i = 0; i < numChilren; ++i)
762  {
763  CModelParameter* current = const_cast<CModelParameter* >(modelParameter->getChild(i));
764 
765  if (applyValueToModelParameter(current, obj, newValue))
766  return true;
767  }
768 
769  return false;
770 }
virtual CCopasiObjectName getCN() const
virtual const CModelParameter * getChild(const size_t &index) const
const CCopasiObjectName & getCN() const
bool applyValueToModelParameter(CModelParameter *modelParameter, CCopasiObject *obj, double newValue)
virtual void setValue(const double &value, const Framework &framework)
virtual size_t getNumChildren() const
bool applyValueToParameterSet ( CModelParameterSet set,
CCopasiObject obj,
double  newValue 
)

Definition at line 772 of file SEDMLImporter.cpp.

References applyValueToModelParameter(), CModelParameterGroup::begin(), and CModelParameterGroup::end().

Referenced by applyAttributeChange().

773 {
775 
776  while (it != set.end())
777  {
778  if (applyValueToModelParameter(*it, obj, newValue))
779  return true;
780 
781  ++it;
782  }
783 
784  return false;
785 }
std::vector< CModelParameter * >::iterator iterator
bool applyValueToModelParameter(CModelParameter *modelParameter, CCopasiObject *obj, double newValue)
bool isScan ( const SedTask *  task)

Definition at line 184 of file SEDMLImporter.cpp.

Referenced by isScan(), and SEDMLImporter::readListOfPlotsFromSedMLOutput().

185 {
186 
187  if (task == NULL || task->getSedDocument() == NULL) return false;
188 
189  const SedDocument* doc = task->getSedDocument();
190 
191  if (task->isSetSimulationReference())
192  {
193  const SedSimulation* sim = doc->getSimulation(task->getSimulationReference());
194 
195  if (sim != NULL && (
196  sim->getTypeCode() == SEDML_SIMULATION_STEADYSTATE ||
197  sim->getTypeCode() == SEDML_SIMULATION_ONESTEP ||
198  sim->getTypeCode() == SEDML_SIMULATION_UNIFORMTIMECOURSE))
199  return true;
200  }
201 
202  return false;
203 }
bool isScan ( const SedRepeatedTask *  task)

Definition at line 205 of file SEDMLImporter.cpp.

References isScan().

206 {
207  if (task == NULL || task->getSedDocument() == NULL) return false;
208 
209  const SedDocument* doc = task->getSedDocument();
210 
211  if (task->isSetSimulationReference())
212  {
213  const SedSimulation* sim = doc->getSimulation(task->getSimulationReference());
214 
215  if (sim != NULL && (
216  sim->getTypeCode() == SEDML_SIMULATION_STEADYSTATE ||
217  sim->getTypeCode() == SEDML_SIMULATION_ONESTEP ||
218  sim->getTypeCode() == SEDML_SIMULATION_UNIFORMTIMECOURSE))
219  return true;
220  }
221 
222  for (size_t i = 0; i < task->getNumSubTasks(); ++i)
223  {
224  const SedSubTask* subTask = task->getSubTask(i);
225  const SedTask* t = doc->getTask(subTask->getTask());
226 
227  if (isScan(t)) return true;
228  }
229 
230  return false;
231 }
bool isScan(const SedTask *task)
bool isTC ( const SedTask *  task)

Definition at line 166 of file SEDMLImporter.cpp.

Referenced by SEDMLImporter::readListOfPlotsFromSedMLOutput().

167 {
168  if (task == NULL || task->getSedDocument() == NULL) return false;
169 
170  const SedDocument* doc = task->getSedDocument();
171 
172  if (task->isSetSimulationReference())
173  {
174  const SedSimulation* sim = doc->getSimulation(task->getSimulationReference());
175 
176  if (sim != NULL && (
177  sim->getTypeCode() == SEDML_SIMULATION_UNIFORMTIMECOURSE))
178  return true;
179  }
180 
181  return false;
182 }