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

#include <CModelParameterSet.h>

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

Public Member Functions

void assignSetContent (const CModelParameterSet &src, const bool &createMissing)
 
 CModelParameterSet (const std::string &name, const CCopasiContainer *pParent=NULL)
 
 CModelParameterSet (const CModelParameterSet &src, const CCopasiContainer *pParent, const bool &createMissing=false)
 
bool compareWithModel (const CModelParameter::Framework &framework)
 
void createFromModel ()
 
virtual const std::string & getKey () const
 
CModelgetModel () const
 
virtual std::string getName () const
 
bool isActive () const
 
bool saveToStream (std::ostream &os, const CModelParameter::Framework &framework, const std::string &mode, const std::string &separator)
 
void setModel (const CModel *pModel)
 
virtual bool setObjectParent (const CCopasiContainer *pParent)
 
virtual bool updateModel ()
 
virtual ~CModelParameterSet ()
 
- 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
 
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)
 
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 ()
 
- Public Member Functions inherited from CModelParameterGroup
CModelParameteradd (const CModelParameter::Type &type)
 
void add (CModelParameter *pModelParameter)
 
iterator begin ()
 
const_iterator begin () const
 
void clear ()
 
 CModelParameterGroup (CModelParameterGroup *pParent, const CModelParameter::Type &type=CModelParameter::Group)
 
 CModelParameterGroup (const CModelParameterGroup &src, CModelParameterGroup *pParent, const bool &createMissing)
 
virtual void compile ()
 
virtual const CompareResultdiff (const CModelParameter &other, const CModelParameter::Framework &framework, const bool &createMissing=false)
 
iterator end ()
 
const_iterator end () const
 
virtual const CModelParametergetChild (const size_t &index) const
 
CModelParametergetModelParameter (const std::string &cn) const
 
CModelParametergetModelParameter (const std::string &name, const CModelParameter::Type &type) const
 
virtual size_t getNumChildren () const
 
virtual bool refreshFromModel (const bool &modifyExistence)
 
void remove (CModelParameter *pModelParameter)
 
void remove (const size_t &index)
 
size_t size () const
 
virtual ~CModelParameterGroup ()
 
- Public Member Functions inherited from CModelParameter
 CModelParameter (CModelParameterGroup *pParent, const CModelParameter::Type &type)
 
 CModelParameter (const CModelParameter &src, CModelParameterGroup *pParent)
 
const CCopasiObjectNamegetCN () const
 
const CompareResultgetCompareResult () const
 
size_t getIndex () const
 
std::string getInitialExpression () const
 
const CExpressiongetInitialExpressionPtr () const
 
CModelgetModel () const
 
CCopasiObjectgetObject () const
 
CModelParameterGroupgetParent () const
 
CModelParameterSetgetSet () const
 
const CModelEntity::StatusgetSimulationType () const
 
const TypegetType () const
 
const std::string getUnit (const Framework &framework) const
 
virtual const double & getValue (const Framework &framework) const
 
bool isInitialExpressionValid () const
 
bool isReadOnly () const
 
virtual void setCN (const CCopasiObjectName &cn)
 
void setCompareResult (const CompareResult &compareResult)
 
void setInitialExpression (const std::string &initialExpression)
 
void setParent (CModelParameterGroup *pParent)
 
bool setSimulationType (const CModelEntity::Status &simulationType)
 
virtual void setValue (const double &value, const Framework &framework)
 
virtual ~CModelParameter ()
 
- Public Member Functions inherited from CAnnotation
bool addUnsupportedAnnotation (const std::string &name, const std::string &xml)
 
 CAnnotation ()
 
 CAnnotation (const CAnnotation &src)
 
const std::string & getMiriamAnnotation () const
 
const std::string & getNotes () const
 
UnsupportedAnnotationgetUnsupportedAnnotations ()
 
const UnsupportedAnnotationgetUnsupportedAnnotations () const
 
bool operator== (const CAnnotation &rhs) const
 
bool removeUnsupportedAnnotation (const std::string &name)
 
bool replaceUnsupportedAnnotation (const std::string &name, const std::string &xml)
 
void setMiriamAnnotation (const std::string &miriamAnnotation, const std::string &newId, const std::string &oldId)
 
void setNotes (const std::string &notes)
 
virtual ~CAnnotation ()
 

Private Attributes

std::string mKey
 
CModelmpModel
 

Additional Inherited Members

- 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 Types inherited from CModelParameterGroup
typedef std::vector
< CModelParameter * >
::const_iterator 
const_iterator
 
typedef std::vector
< CModelParameter * >
::iterator 
iterator
 
- Public Types inherited from CModelParameter
enum  CompareResult {
  Obsolete, Missing, Modified, Conflict,
  Identical
}
 
enum  Framework { Concentration = 0, ParticleNumbers }
 
enum  Type {
  Model, Compartment, Species, ModelValue,
  ReactionParameter, Reaction, Group, Set,
  unknown
}
 
- Public Types inherited from CAnnotation
typedef std::map< std::string,
std::string > 
UnsupportedAnnotation
 
- 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 Member Functions inherited from CAnnotation
static CAnnotationcastObject (CCopasiObject *pObject)
 
static const CAnnotationcastObject (const CCopasiObject *pObject)
 
- Static Public Attributes inherited from CCopasiContainer
static const std::vector
< CCopasiContainer * > 
EmptyList
 
- Static Public Attributes inherited from CModelParameter
static const char * TypeNames []
 
- 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 Member Functions inherited from CModelParameterGroup
void assignGroupContent (const CModelParameterGroup &src, const bool &createMissing)
 
CModelParametercopy (const CModelParameter &src, const bool &createMissing)
 
- Static Protected Member Functions inherited from CModelParameter
static std::string nameFromCN (const CCopasiObjectName &cn)
 
- Protected Attributes inherited from CCopasiContainer
objectMap mObjects
 
- Protected Attributes inherited from CModelParameter
CRegisteredObjectName mCN
 
CompareResult mCompareResult
 
bool mIsInitialExpressionValid
 
CExpressionmpInitialExpression
 
CCopasiObjectmpObject
 
CModelParameterGroupmpParent
 
CModelEntity::Status mSimulationType
 
Type mType
 
double mValue
 
- Protected Attributes inherited from CAnnotation
std::string mKey
 
- Static Protected Attributes inherited from CCopasiObject
static CRenameHandlersmpRenameHandler = NULL
 

Detailed Description

Definition at line 17 of file CModelParameterSet.h.

Constructor & Destructor Documentation

CModelParameterSet::CModelParameterSet ( const std::string &  name,
const CCopasiContainer pParent = NULL 
)

Constructor

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

Definition at line 15 of file CModelParameterSet.cpp.

References setObjectParent().

16  :
17  CCopasiContainer(name, pParent, "ModelParameterSet"),
19  CAnnotation(),
20  mKey(CCopasiRootContainer::getKeyFactory()->add("ModelParameterSet", this)),
21  mpModel(NULL)
22 {
23  setObjectParent(pParent);
24 }
CModelParameterGroup(CModelParameterGroup *pParent, const CModelParameter::Type &type=CModelParameter::Group)
virtual bool setObjectParent(const CCopasiContainer *pParent)
static CKeyFactory * getKeyFactory()
CModelParameter * add(const CModelParameter::Type &type)
CModelParameterSet::CModelParameterSet ( const CModelParameterSet src,
const CCopasiContainer pParent,
const bool &  createMissing = false 
)

Copy constructor

Parameters
constCModelParameterSet & src
constCCopasiContainer * pParent
constbool & createMissing (default: false)

Definition at line 26 of file CModelParameterSet.cpp.

References CModelParameterGroup::compile(), getModel(), mpModel, and setObjectParent().

28  :
29  CCopasiContainer(src, pParent),
30  CModelParameterGroup(src, NULL, createMissing),
31  CAnnotation(src),
32  mKey(CCopasiRootContainer::getKeyFactory()->add("ModelParameterSet", this)),
33  mpModel(NULL)
34 {
35  setObjectParent(pParent);
36 
37  if (mpModel == NULL)
38  {
39  mpModel = src.getModel();
40  }
41 
42  compile();
43 }
CModelParameterGroup(CModelParameterGroup *pParent, const CModelParameter::Type &type=CModelParameter::Group)
virtual bool setObjectParent(const CCopasiContainer *pParent)
static CKeyFactory * getKeyFactory()
CModelParameter * add(const CModelParameter::Type &type)
CModel * getModel() const
CModelParameterSet::~CModelParameterSet ( )
virtual

Destructor

Definition at line 46 of file CModelParameterSet.cpp.

References CCopasiRootContainer::getKeyFactory(), mKey, and CKeyFactory::remove().

47 {
49 }
bool remove(const std::string &key)
static CKeyFactory * getKeyFactory()

Member Function Documentation

void CModelParameterSet::assignSetContent ( const CModelParameterSet src,
const bool &  createMissing 
)

Assign the content of the source set to this, i.e., copy all contained parameters and groups.

Parameters
constCModelParameterSet & src
constbool & createMissing

Definition at line 231 of file CModelParameterSet.cpp.

References CModelParameterGroup::assignGroupContent(), and CModelParameterGroup::compile().

Referenced by CCopasiXMLParser::ListOfModelParameterSetsElement::end(), CQParameterOverviewWidget::leave(), CQParameterOverviewWidget::slotBtnNew(), and CQParameterOverviewWidget::slotBtnSaveAs().

233 {
234  assignGroupContent(src, createMissing);
235  compile();
236 }
void assignGroupContent(const CModelParameterGroup &src, const bool &createMissing)
bool CModelParameterSet::compareWithModel ( const CModelParameter::Framework framework)

Compare the parameter set with the assigned model

Definition at line 185 of file CModelParameterSet.cpp.

References createFromModel(), CModelParameterGroup::diff(), CModelParameter::Identical, and mpModel.

Referenced by CQParameterOverviewWidget::enterProtected(), CQParameterOverviewWidget::setFramework(), and CQParameterOverviewWidget::slotResolve().

186 {
187  if (mpModel == NULL)
188  {
189  return false;
190  }
191 
192  CModelParameterSet Tmp("Current", mpModel);
193  Tmp.createFromModel();
194 
195  return (diff(Tmp, framework, true) == CModelParameter::Identical);
196 }
virtual const CompareResult & diff(const CModelParameter &other, const CModelParameter::Framework &framework, const bool &createMissing=false)
void CModelParameterSet::createFromModel ( )

Create the parameter set from the assigned model

Definition at line 75 of file CModelParameterSet.cpp.

References CModelParameterGroup::add(), CModelEntity::ASSIGNMENT, CCopasiVector< T >::begin(), CModelParameterGroup::clear(), CModelParameter::Compartment, CModelParameterGroup::compile(), CCopasiVector< T >::end(), fatalError, CModelEntity::FIXED, CKeyFactory::get(), CModelParameter::getCN(), CCopasiObject::getCN(), CModel::getCompartments(), CModel::getInitialTime(), CModelEntity::getInitialValue(), CModelEntity::getInitialValueReference(), CCopasiRootContainer::getKeyFactory(), CModel::getMetabolites(), CModel::getModelValues(), CModel::getReactions(), CModelParameter::Group, CModelParameter::Model, CModelParameter::ModelValue, mpModel, CModelParameter::ParticleNumbers, CModelParameter::Reaction, CModelParameter::ReactionParameter, CModelParameter::setCN(), CModelParameter::setInitialExpression(), CModelParameter::setSimulationType(), CModelParameter::setValue(), and CModelParameter::Species.

Referenced by CModel::applyActiveParameterSet(), compareWithModel(), CModel::compile(), and createParameterSetsForExperiment().

76 {
77  clear();
78 
79  if (mpModel == NULL)
80  {
81  return;
82  }
83 
84  CModelParameter * pParameter;
85  CModelParameterGroup * pGroup;
86 
87  // TODO CRITICAL Create the proper structure that fits the parameter overview in the GUI
88  pGroup = static_cast< CModelParameterGroup *>(CModelParameterGroup::add(Group));
89  pGroup->setCN(CCopasiStaticString("Initial Time").getCN());
90 
91  pParameter = pGroup->add(Model);
92  pParameter->setCN(mpModel->getCN());
94 
95  pGroup = static_cast< CModelParameterGroup *>(CModelParameterGroup::add(Group));
96  pGroup->setCN(CCopasiStaticString("Initial Compartment Sizes").getCN());
97 
100 
101  for (; itCompartment != endCompartment; ++itCompartment)
102  {
103  pParameter = pGroup->add(Compartment);
104  pParameter->setCN((*itCompartment)->getCN());
105  pParameter->setSimulationType((*itCompartment)->getStatus());
106  pParameter->setValue((*itCompartment)->getInitialValue(), ParticleNumbers);
107  pParameter->setInitialExpression((*itCompartment)->getInitialExpression());
108  }
109 
110  pGroup = static_cast< CModelParameterGroup *>(CModelParameterGroup::add(Group));
111  pGroup->setCN(CCopasiStaticString("Initial Species Values").getCN());
112 
115 
116  for (; itSpecies != endSpecies; ++itSpecies)
117  {
118  pParameter = pGroup->add(Species);
119  pParameter->setCN((*itSpecies)->getCN());
120  pParameter->setSimulationType((*itSpecies)->getStatus());
121  pParameter->setValue((*itSpecies)->getInitialValue(), ParticleNumbers);
122  pParameter->setInitialExpression((*itSpecies)->getInitialExpression());
123  }
124 
125  pGroup = static_cast< CModelParameterGroup *>(CModelParameterGroup::add(Group));
126  pGroup->setCN(CCopasiStaticString("Initial Global Quantities").getCN());
127 
130 
131  for (; itModelValue != endModelValue; ++itModelValue)
132  {
133  pParameter = pGroup->add(ModelValue);
134  pParameter->setCN((*itModelValue)->getCN());
135  pParameter->setSimulationType((*itModelValue)->getStatus());
136  pParameter->setValue((*itModelValue)->getInitialValue(), ParticleNumbers);
137  pParameter->setInitialExpression((*itModelValue)->getInitialExpression());
138  }
139 
140  pGroup = static_cast< CModelParameterGroup *>(CModelParameterGroup::add(Group));
141  pGroup->setCN(CCopasiStaticString("Kinetic Parameters").getCN());
142 
145 
146  for (; itReaction != endReaction; ++itReaction)
147  {
148  CModelParameterGroup * pReaction = static_cast< CModelParameterGroup *>(pGroup->add(Reaction));
149  pReaction->setCN((*itReaction)->getCN());
150 
151  CCopasiParameterGroup::index_iterator itParameter = (*itReaction)->getParameters().beginIndex();
152  CCopasiParameterGroup::index_iterator endParameter = (*itReaction)->getParameters().endIndex();
153 
154  for (; itParameter != endParameter; ++itParameter)
155  {
156  pParameter = pReaction->add(ReactionParameter);
157  pParameter->setCN((*itParameter)->getCN());
158 
159  // Check whether this refers to a global quantity.
160  if ((*itReaction)->isLocalParameter((*itParameter)->getObjectName()))
161  {
163  pParameter->setValue(*(*itParameter)->getValue().pDOUBLE, ParticleNumbers);
164  }
165  else
166  {
168  const std::vector<std::string> ModelValue = (*itReaction)->getParameterMapping((*itParameter)->getObjectName());
169 
170  if (ModelValue.size() != 1) fatalError();
171 
172  const CModelValue * pModelValue = static_cast< CModelValue * >(CCopasiRootContainer::getKeyFactory()->get(ModelValue[0]));
173 
174  if (pModelValue == NULL) fatalError();
175 
176  pParameter->setValue(pModelValue->getInitialValue(), ParticleNumbers);
177  pParameter->setInitialExpression("<" + pModelValue->getInitialValueReference()->getCN() + ">");
178  }
179  }
180  }
181 
182  compile();
183 }
virtual CCopasiObjectName getCN() const
const CCopasiVector< CMetab > & getMetabolites() const
Definition: CModel.cpp:1051
const CCopasiVectorN< CModelValue > & getModelValues() const
Definition: CModel.cpp:1060
CCopasiObject * get(const std::string &key)
CCopasiObject * getInitialValueReference() const
iterator begin()
#define fatalError()
const CCopasiObjectName & getCN() const
void setInitialExpression(const std::string &initialExpression)
const C_FLOAT64 & getInitialValue() const
iterator end()
std::vector< CType * >::const_iterator const_iterator
Definition: CCopasiVector.h:57
virtual void setValue(const double &value, const Framework &framework)
const C_FLOAT64 & getInitialTime() const
Definition: CModel.cpp:1184
CCopasiVectorNS< CCompartment > & getCompartments()
Definition: CModel.cpp:1145
static CKeyFactory * getKeyFactory()
virtual void setCN(const CCopasiObjectName &cn)
CCopasiVectorNS< CReaction > & getReactions()
Definition: CModel.cpp:1039
bool setSimulationType(const CModelEntity::Status &simulationType)
CModelParameter * add(const CModelParameter::Type &type)
parameterGroup::iterator index_iterator
const std::string & CModelParameterSet::getKey ( ) const
virtual
CModel * CModelParameterSet::getModel ( ) const

Retrieve the model the parameter set is storing values for

Returns
CModel * pModel

Definition at line 68 of file CModelParameterSet.cpp.

References mpModel.

Referenced by CModelParameterSet(), CModelParameter::getModel(), CModelParameterSpecies::getName(), CQParameterOverviewWidget::slotBtnCopy(), CQParameterOverviewWidget::slotBtnDelete(), CQParameterOverviewWidget::slotBtnNew(), and CQParameterOverviewWidget::slotBtnSaveAs().

69 {
70  assert(mpModel != NULL);
71 
72  return mpModel;
73 }
std::string CModelParameterSet::getName ( ) const
virtual

Retrieve the name of the parameter set

Returns
std::string name

Reimplemented from CModelParameter.

Definition at line 199 of file CModelParameterSet.cpp.

References CCopasiObject::getObjectName().

200 {
201  return getObjectName();
202 }
const std::string & getObjectName() const
bool CModelParameterSet::isActive ( ) const

Determine whether this is parameter set is currently active, i.e., it is synchronized with the model.

Returns
bool isActive

Definition at line 221 of file CModelParameterSet.cpp.

References getKey(), CModel::getModelParameterSet(), mKey, and mpModel.

Referenced by CQParameterOverviewWidget::enterProtected(), CQParameterOverviewWidget::leave(), CQParameterOverviewWidget::setFramework(), and CModelParameter::setValue().

222 {
223  if (mpModel == NULL)
224  {
225  return false;
226  }
227 
228  return (mpModel->getModelParameterSet().getKey() == mKey);
229 }
const CModelParameterSet & getModelParameterSet() const
Definition: CModel.cpp:1072
virtual const std::string & getKey() const
bool CModelParameterSet::saveToStream ( std::ostream &  os,
const CModelParameter::Framework framework,
const std::string &  mode,
const std::string &  separator 
)

Save the parameter set to a stream

Parameters
std::ostream& os
constCModelParameter::Framework & framework
conststd::string & mode (report or table)
conststd::string & separator

Definition at line 238 of file CModelParameterSet.cpp.

References CNodeIteratorMode::After, CNodeIteratorMode::Before, CNodeContextIterator< Node, int >::end(), CModelParameter::getName(), CModelParameter::getType(), CModelParameter::getUnit(), CModelParameter::getValue(), CModelParameter::Group, CNodeContextIterator< Node, int >::level(), CNodeContextIterator< Node, int >::next(), CModelParameter::Set, and CNodeContextIterator< Node, int >::setProcessingModes().

Referenced by CQParameterOverviewWidget::slotBtnSaveToFile().

242 {
243  bool success = true;
244 
246 
247  if (mode == "report")
248  {
249  itNode.setProcessingModes(CNodeIteratorMode::Before);
250 
251  while (itNode.next() != itNode.end())
252  {
253  if (*itNode != NULL)
254  {
255  for (unsigned int i = 1; i < itNode.level(); i++)
256  {
257  os << separator;
258  }
259 
260  os << itNode->getName();
261 
262  for (unsigned int i = itNode.level(); i < 6; i++)
263  {
264  os << separator;
265  }
266 
267  if (itNode->getType() != Group &&
268  itNode->getType() != Set)
269  {
270  os << itNode->getValue(framework) << " " << itNode->getUnit(framework);
271  }
272 
273  os << std::endl;
274  }
275  }
276  }
277  else if (mode == "table")
278  {
279  itNode.setProcessingModes(CNodeIteratorMode::After);
280 
281  while (itNode.next() != itNode.end())
282  {
283  if (*itNode != NULL)
284  {
285  if (itNode->getType() != Group &&
286  itNode->getType() != Set)
287  {
288  os << itNode->getName() << " " << itNode->getUnit(framework) << separator;
289  }
290  }
291  }
292 
293  os << std::endl;
294 
297 
298  while (itNode.next() != itNode.end())
299  {
300  if (*itNode != NULL)
301  {
302  if (itNode->getType() != Group &&
303  itNode->getType() != Set)
304  {
305  os << itNode->getValue(framework) << separator;
306  }
307  }
308  }
309 
310  os << std::endl;
311  }
312  else
313  {
314  success = false;
315  }
316 
317  return success;
318 }
void setProcessingModes(const CNodeIteratorMode::Flag &processingModes)
void CModelParameterSet::setModel ( const CModel pModel)

Set the model the parameter set is storing values for

Parameters
constCModel * pModel
bool CModelParameterSet::setObjectParent ( const CCopasiContainer pParent)
virtual

Set the object parent

Parameters
constCCopasiContainer * pParent
Returns
bool success

Reimplemented from CCopasiObject.

Definition at line 58 of file CModelParameterSet.cpp.

References CCopasiObject::getObjectAncestor(), mpModel, and CCopasiObject::setObjectParent().

Referenced by CModelParameterSet().

59 {
60  bool success = CCopasiObject::setObjectParent(pParent);
61 
62  mpModel = dynamic_cast< CModel * >(getObjectAncestor("Model"));
63 
64  return success;
65 }
virtual bool setObjectParent(const CCopasiContainer *pParent)
CCopasiContainer * getObjectAncestor(const std::string &type) const
Definition: CModel.h:50
bool CModelParameterSet::updateModel ( )
virtual

Update the corresponding model object with the current parameter settings

Reimplemented from CModelParameterGroup.

Definition at line 205 of file CModelParameterSet.cpp.

References CModelParameterGroup::compile(), mpModel, CModel::updateInitialValues(), and CModelParameterGroup::updateModel().

Referenced by CModel::applyActiveParameterSet(), CCopasiDataModel::commonAfterLoad(), CQParameterOverviewWidget::leave(), and CQParameterOverviewWidget::slotBtnNew().

206 {
207  if (mpModel == NULL)
208  {
209  return false;
210  }
211 
212  compile();
213 
214  bool success = CModelParameterGroup::updateModel();
215 
217 
218  return success;
219 }
bool updateInitialValues()
Definition: CModel.cpp:1461

Member Data Documentation

std::string CModelParameterSet::mKey
private

The unique key of the set

Definition at line 121 of file CModelParameterSet.h.

Referenced by getKey(), isActive(), and ~CModelParameterSet().

CModel* CModelParameterSet::mpModel
private

A pointer to the model the parameter set is storing values for

Definition at line 126 of file CModelParameterSet.h.

Referenced by CModelParameterSet(), compareWithModel(), createFromModel(), getModel(), isActive(), setObjectParent(), and updateModel().


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