COPASI API  4.16.103
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
CModelAdd Class Reference

#include <CModelMerging.h>

Collaboration diagram for CModelAdd:
Collaboration graph
[legend]

Public Member Functions

 CModelAdd (CModel *pModel, CModel *mModel)
 
void setModel (CModel *pModel, CModel *mModel)
 
void simpleCall ()
 just a simple method to call during development More...
 

Protected Member Functions

bool addCompartments (std::string name)
 
bool addCompartmentsExpressions ()
 
bool addEvents (std::string name)
 
bool addMetabolites (std::string name)
 
bool addMetabolitesExpressions ()
 
bool addModelValues (std::string name)
 
bool addModelValuesExpressions ()
 
bool addReactions (std::string name)
 
bool copyDelayExpression (const CEvent *sourceEvent, CEvent *newEvent)
 
bool copyEventAssignmentExpression (const CEventAssignment *sourceAssignment, CEventAssignment *newAssignment)
 
bool copyExpression (const CModelEntity *sourceEntity, CModelEntity *newEntity)
 
bool copyInitialExpression (const CModelEntity *sourceEntity, CModelEntity *newEntity)
 
bool copyTriggerExpression (const CEvent *sourceEvent, CEvent *newEvent)
 

Static Protected Member Functions

static bool reactionInvolvesCompartment (const CReaction *reac, const CCompartment *comp)
 

Protected Attributes

std::map< std::string,
std::string > 
keyMap
 
CModelmmModel
 
CModelmpModel
 
std::map< std::string,
std::string > 
nameMap
 

Detailed Description

Definition at line 30 of file CModelMerging.h.

Constructor & Destructor Documentation

CModelAdd::CModelAdd ( CModel pModel,
CModel mModel 
)

Definition at line 28 of file CModelMerging.cpp.

29  : mpModel(pModel), mmModel(mModel)
30 {
31 }
CModel * mmModel
Definition: CModelMerging.h:69
CModel * mpModel
Definition: CModelMerging.h:68

Member Function Documentation

bool CModelAdd::addCompartments ( std::string  name)
protected

Definition at line 448 of file CModelMerging.cpp.

References CModel::createCompartment(), CModel::getCompartments(), CCompartment::getDimensionality(), CModelEntity::getInitialValue(), CModelEntity::getKey(), CCopasiObject::getObjectName(), CModelEntity::getStatus(), keyMap, mmModel, mpModel, nameMap, CCompartment::setDimensionality(), CModelEntity::setStatus(), and CCopasiVector< T >::size().

Referenced by simpleCall().

449 {
450 
451  size_t i, imax = mmModel->getCompartments().size();
452 
453  for (i = 0; i < imax; ++i)
454  {
455  const CCompartment* sourceComp = mmModel->getCompartments()[i];
456 
457  if (!sourceComp) return false;
458 
459  //create new compartment
460 
461  std::string newName = sourceComp->getObjectName() + "_" + name;
462 
463  CCompartment* newComp = mpModel->createCompartment(newName, sourceComp->getInitialValue());
464 
465  if (!newComp) return false;
466 
467  newComp->setStatus(sourceComp->getStatus());
468 
469  newComp->setDimensionality(sourceComp->getDimensionality());
470 
471  keyMap[sourceComp->getKey()] = newComp->getKey();
472  nameMap[sourceComp->getObjectName()] = newName;
473  }
474 
475  return true;
476 }
CModel * mmModel
Definition: CModelMerging.h:69
const std::string & getObjectName() const
bool setDimensionality(unsigned C_INT32 dim)
unsigned C_INT32 getDimensionality() const
virtual size_t size() const
std::map< std::string, std::string > keyMap
Definition: CModelMerging.h:42
CModel * mpModel
Definition: CModelMerging.h:68
const C_FLOAT64 & getInitialValue() const
std::map< std::string, std::string > nameMap
Definition: CModelMerging.h:43
virtual const std::string & getKey() const
virtual void setStatus(const CModelEntity::Status &status)
CCopasiVectorNS< CCompartment > & getCompartments()
Definition: CModel.cpp:1145
const CModelEntity::Status & getStatus() const
CCompartment * createCompartment(const std::string &name, const C_FLOAT64 &volume=1.0)
Definition: CModel.cpp:2698
bool CModelAdd::addCompartmentsExpressions ( )
protected

Definition at line 478 of file CModelMerging.cpp.

References CModelEntity::ASSIGNMENT, copyExpression(), copyInitialExpression(), CModelEntity::FIXED, CKeyFactory::get(), CModel::getCompartments(), CModelEntity::getInitialExpression(), CModelEntity::getKey(), CCopasiRootContainer::getKeyFactory(), keyMap, mmModel, CModelEntity::ODE, and CCopasiVector< T >::size().

Referenced by simpleCall().

479 {
480 
481  bool info = false;
482 
483  size_t i, imax = mmModel->getCompartments().size();
484 
485  for (i = 0; i < imax; ++i)
486  {
487  const CCompartment* sourceComp = mmModel->getCompartments()[i];
488 
489  if (!sourceComp) return info;
490 
491  std::string newKey = keyMap[sourceComp->getKey()];
492 
493  CCopasiObject* pObject = (CCopasiRootContainer::getKeyFactory()->get(newKey));
494 
495  CCompartment* newComp = dynamic_cast< CCompartment * >(pObject);
496 
497  if (!newComp) return info;
498 
499  switch (newComp ->getStatus())
500  {
501  case CModelEntity::FIXED:
502 
503  break;
505 
506  if (!copyExpression(sourceComp, newComp)) return info;
507 
508  break;
509 
510  case CModelEntity::ODE:
511 
512  if (!copyExpression(sourceComp, newComp)) return info;
513 
514  if (sourceComp->getInitialExpression() != "")
515  if (!copyInitialExpression(sourceComp, newComp)) return info;
516 
517  break;
518 
519  default:
520 
521  return info;
522 
523  break;
524  }
525  }
526 
527  return true;
528 }
CModel * mmModel
Definition: CModelMerging.h:69
virtual size_t size() const
CCopasiObject * get(const std::string &key)
std::map< std::string, std::string > keyMap
Definition: CModelMerging.h:42
bool copyExpression(const CModelEntity *sourceEntity, CModelEntity *newEntity)
virtual const std::string & getKey() const
std::string getInitialExpression() const
CCopasiVectorNS< CCompartment > & getCompartments()
Definition: CModel.cpp:1145
static CKeyFactory * getKeyFactory()
bool copyInitialExpression(const CModelEntity *sourceEntity, CModelEntity *newEntity)
bool CModelAdd::addEvents ( std::string  name)
protected

Definition at line 75 of file CModelMerging.cpp.

References CCopasiVectorN< CType >::add(), C_INVALID_INDEX, copyDelayExpression(), copyEventAssignmentExpression(), copyTriggerExpression(), CModel::createEvent(), CEvent::getAssignments(), CEvent::getDelayAssignment(), CEvent::getDelayExpressionPtr(), CModel::getEvents(), CEventAssignment::getExpressionPtr(), CCopasiVectorN< CType >::getIndex(), CCopasiObject::getObjectName(), CEventAssignment::getTargetKey(), CEvent::getTriggerExpressionPtr(), keyMap, mmModel, mpModel, CEvent::setDelayAssignment(), CEventAssignment::setTargetKey(), and CCopasiVector< T >::size().

Referenced by simpleCall().

76 {
77 
78  bool info = false;
79 
80  size_t i, imax = mmModel->getEvents().size();
81 
82  for (i = 0; i < imax; ++i)
83  {
84  const CEvent* sourceEvent = mmModel->getEvents()[i];
85 
86  if (!sourceEvent) return info;
87 
88  //create new event
89 
90  std::string eventName;
91 
92  eventName = sourceEvent->getObjectName();
93 
94  std::string appendix = "";
95 #if 0
96  unsigned int counter = 2;
97  std::ostringstream numberStream;
98 
99  while (mpModel->getEvents().getIndex(eventName + appendix) != C_INVALID_INDEX)
100  {
101  numberStream.str("");
102  numberStream << "_" << counter;
103  counter++;
104  appendix = numberStream.str();
105  }
106 
107 #else
108  appendix = "_" + name;
109 #endif
110 
111  CEvent* newEvent = mpModel->createEvent(eventName + appendix);
112 
113  if (newEvent == NULL) return info;
114 
115  /* copy trigger expression */
116 
117  if (sourceEvent->getTriggerExpressionPtr() != NULL)
118  {
119  if (!copyTriggerExpression(sourceEvent, newEvent))
120  return info;
121  }
122  else
123  {
124  return info;
125  }
126 
127  /* set whether the calculation or the assignment shall be delayed */
128 
129  newEvent->setDelayAssignment(sourceEvent->getDelayAssignment());
130 
131  /* copy the delay expression */
132 
133  if (sourceEvent->getDelayExpressionPtr() != NULL)
134  if (!copyDelayExpression(sourceEvent, newEvent)) return info;
135 
136  /* copy the assignments */
137 
138  size_t j, jmax = sourceEvent->getAssignments().size();
139 
140  for (j = 0; j < jmax; ++j)
141  {
142  const CEventAssignment* sourceAssignment = sourceEvent->getAssignments()[j];
143 
144  if (!sourceAssignment) return info;
145 
146  std::string key = sourceAssignment->getTargetKey();
147 
148  CEventAssignment* newAssignment = new CEventAssignment;
149 
150  newEvent->getAssignments().add(newAssignment, true);
151 
152  newAssignment->setTargetKey(keyMap[key]);
153 
154  if (sourceAssignment->getExpressionPtr() != NULL)
155  {
156  if (!copyEventAssignmentExpression(sourceAssignment, newAssignment))
157  return info;
158  }
159  else
160  {
161  return info;
162  }
163  }
164  }
165 
166  return true;
167 }
Definition: CEvent.h:152
CModel * mmModel
Definition: CModelMerging.h:69
const CCopasiVectorN< CEventAssignment > & getAssignments() const
Definition: CEvent.cpp:678
const bool & getDelayAssignment() const
Definition: CEvent.cpp:419
CEvent * createEvent(const std::string &name)
Definition: CModel.cpp:2928
CCopasiVectorN< CEvent > & getEvents()
Definition: CModel.cpp:1110
const std::string & getObjectName() const
virtual size_t size() const
const std::string & getTargetKey() const
Definition: CEvent.cpp:162
std::map< std::string, std::string > keyMap
Definition: CModelMerging.h:42
const CExpression * getExpressionPtr() const
Definition: CEvent.cpp:226
#define C_INVALID_INDEX
Definition: copasi.h:222
CModel * mpModel
Definition: CModelMerging.h:68
virtual size_t getIndex(const std::string &name) const
bool setTargetKey(const std::string &targetKey)
Definition: CEvent.cpp:151
bool copyEventAssignmentExpression(const CEventAssignment *sourceAssignment, CEventAssignment *newAssignment)
CExpression * getDelayExpressionPtr()
Definition: CEvent.cpp:606
virtual bool add(const CType &src)
bool copyTriggerExpression(const CEvent *sourceEvent, CEvent *newEvent)
void setDelayAssignment(const bool &delayCalculation)
Definition: CEvent.cpp:408
const CExpression * getTriggerExpressionPtr() const
Definition: CEvent.cpp:534
bool copyDelayExpression(const CEvent *sourceEvent, CEvent *newEvent)
bool CModelAdd::addMetabolites ( std::string  name)
protected

Definition at line 530 of file CModelMerging.cpp.

References CModel::createMetabolite(), CMetab::getCompartment(), CMetab::getInitialConcentration(), CModelEntity::getKey(), CModel::getMetabolites(), CCopasiObject::getObjectName(), CModelEntity::getStatus(), keyMap, mmModel, mpModel, nameMap, CMetab::setStatus(), and CCopasiVector< T >::size().

Referenced by simpleCall().

531 {
532  bool info = false;
533 
534  size_t i, imax = mmModel->getMetabolites().size();
535 
536  for (i = 0; i < imax; ++i)
537  {
538  const CMetab* sourceMetab = mmModel->getMetabolites()[i];
539  const CCompartment* sourceComp = sourceMetab->getCompartment();
540 
541  if (!sourceMetab) return info;
542 
543  if (!sourceComp) return info;
544 
545  //create new metabolite
546 
547  std::string newName = sourceMetab->getObjectName() + "_" + name;
548 
549  CMetab* newMetab = mpModel->createMetabolite(sourceMetab->getObjectName(), nameMap[sourceComp->getObjectName()], sourceMetab->getInitialConcentration());
550 
551  if (!newMetab) return info;
552 
553  newMetab->setStatus(sourceMetab->getStatus());
554 
555  keyMap[sourceMetab->getKey()] = newMetab->getKey();
556  nameMap[sourceMetab->getObjectName()] = newName;
557  }
558 
559  return true;
560 }
CModel * mmModel
Definition: CModelMerging.h:69
const CCopasiVector< CMetab > & getMetabolites() const
Definition: CModel.cpp:1051
const std::string & getObjectName() const
virtual void setStatus(const CModelEntity::Status &status)
Definition: CMetab.cpp:291
virtual size_t size() const
const C_FLOAT64 & getInitialConcentration() const
Definition: CMetab.cpp:220
std::map< std::string, std::string > keyMap
Definition: CModelMerging.h:42
CModel * mpModel
Definition: CModelMerging.h:68
Definition: CMetab.h:178
std::map< std::string, std::string > nameMap
Definition: CModelMerging.h:43
virtual const std::string & getKey() const
const CModelEntity::Status & getStatus() const
const CCompartment * getCompartment() const
Definition: CMetab.cpp:222
CMetab * createMetabolite(const std::string &name, const std::string &compartment, const C_FLOAT64 &iconc=1.0, const CModelEntity::Status &status=CModelEntity::REACTIONS)
Definition: CModel.cpp:2622
bool CModelAdd::addMetabolitesExpressions ( )
protected

Definition at line 562 of file CModelMerging.cpp.

References CModelEntity::ASSIGNMENT, copyExpression(), copyInitialExpression(), CModelEntity::FIXED, CKeyFactory::get(), CModelEntity::getInitialExpression(), CModelEntity::getKey(), CCopasiRootContainer::getKeyFactory(), CModel::getMetabolites(), keyMap, mmModel, CModelEntity::ODE, CModelEntity::REACTIONS, and CCopasiVector< T >::size().

Referenced by simpleCall().

563 {
564  bool info = false;
565 
566  size_t i, imax = mmModel->getMetabolites().size();
567 
568  for (i = 0; i < imax; ++i)
569  {
570  const CMetab* sourceMetab = mmModel->getMetabolites()[i];
571 
572  if (!sourceMetab) return info;
573 
574  std::string newKey = keyMap[sourceMetab->getKey()];
575 
576  CCopasiObject* pObject = (CCopasiRootContainer::getKeyFactory()->get(newKey));
577 
578  CMetab* newMetab = dynamic_cast< CMetab * >(pObject);
579 
580  if (!newMetab) return info;
581 
582  switch (newMetab ->getStatus())
583  {
584  case CModelEntity::FIXED:
585 
586  break;
588 
589  if (!copyExpression(sourceMetab, newMetab)) return info;
590 
591  break;
592 
593  case CModelEntity::ODE:
594 
595  if (!copyExpression(sourceMetab, newMetab)) return info;
596 
597  if (sourceMetab->getInitialExpression() != "")
598  if (!copyInitialExpression(sourceMetab, newMetab)) return info;
599 
600  break;
601 
603 
604  break;
605  default:
606 
607  return info;
608 
609  break;
610  }
611  }
612 
613  return true;
614 }
CModel * mmModel
Definition: CModelMerging.h:69
const CCopasiVector< CMetab > & getMetabolites() const
Definition: CModel.cpp:1051
virtual size_t size() const
CCopasiObject * get(const std::string &key)
std::map< std::string, std::string > keyMap
Definition: CModelMerging.h:42
Definition: CMetab.h:178
bool copyExpression(const CModelEntity *sourceEntity, CModelEntity *newEntity)
virtual const std::string & getKey() const
std::string getInitialExpression() const
static CKeyFactory * getKeyFactory()
bool copyInitialExpression(const CModelEntity *sourceEntity, CModelEntity *newEntity)
bool CModelAdd::addModelValues ( std::string  name)
protected

Definition at line 616 of file CModelMerging.cpp.

References CModel::createModelValue(), CModelEntity::getInitialValue(), CModelEntity::getKey(), CModel::getModelValues(), CCopasiObject::getObjectName(), CModelEntity::getStatus(), keyMap, mmModel, mpModel, nameMap, CModelEntity::setStatus(), and CCopasiVector< T >::size().

Referenced by simpleCall().

617 {
618  bool info = false;
619 
620  size_t i, imax = mmModel->getModelValues().size();
621 
622  for (i = 0; i < imax; ++i)
623  {
624  const CModelValue* sourceModVal = mmModel->getModelValues()[i];
625 
626  if (!sourceModVal) return info;
627 
628  //create new model value
629 
630  std::string newName = sourceModVal->getObjectName() + "_" + name;
631 
632  CModelValue* newModVal = mpModel->createModelValue(newName, sourceModVal->getInitialValue());
633 
634  if (!newModVal) return info;
635 
636  newModVal->setStatus(sourceModVal->getStatus());
637 
638  keyMap[sourceModVal->getKey()] = newModVal->getKey();
639  nameMap[sourceModVal->getObjectName()] = newName;
640  }
641 
642  return true;
643 }
CModel * mmModel
Definition: CModelMerging.h:69
const std::string & getObjectName() const
const CCopasiVectorN< CModelValue > & getModelValues() const
Definition: CModel.cpp:1060
virtual size_t size() const
std::map< std::string, std::string > keyMap
Definition: CModelMerging.h:42
CModel * mpModel
Definition: CModelMerging.h:68
CModelValue * createModelValue(const std::string &name, const C_FLOAT64 &value=0.0)
Definition: CModel.cpp:2838
const C_FLOAT64 & getInitialValue() const
std::map< std::string, std::string > nameMap
Definition: CModelMerging.h:43
virtual const std::string & getKey() const
virtual void setStatus(const CModelEntity::Status &status)
const CModelEntity::Status & getStatus() const
bool CModelAdd::addModelValuesExpressions ( )
protected

Definition at line 645 of file CModelMerging.cpp.

References CModelEntity::ASSIGNMENT, copyExpression(), copyInitialExpression(), CModelEntity::FIXED, CKeyFactory::get(), CModelEntity::getInitialExpression(), CModelEntity::getKey(), CCopasiRootContainer::getKeyFactory(), CModel::getModelValues(), keyMap, mmModel, CModelEntity::ODE, and CCopasiVector< T >::size().

Referenced by simpleCall().

646 {
647  bool info = false;
648 
649  size_t i, imax = mmModel->getModelValues().size();
650 
651  for (i = 0; i < imax; ++i)
652  {
653  const CModelValue* sourceModVal = mmModel->getModelValues()[i];
654 
655  if (!sourceModVal) return info;
656 
657  std::string newKey = keyMap[sourceModVal->getKey()];
658 
659  CCopasiObject* pObject = (CCopasiRootContainer::getKeyFactory()->get(newKey));
660 
661  CModelValue* newModVal = dynamic_cast<CModelValue * >(pObject);
662 
663  if (!newModVal) return info;
664 
665  switch (newModVal ->getStatus())
666  {
667  case CModelEntity::FIXED:
668 
669  break;
671 
672  if (!copyExpression(sourceModVal, newModVal)) return info;
673 
674  break;
675 
676  case CModelEntity::ODE:
677 
678  if (!copyExpression(sourceModVal, newModVal)) return info;
679 
680  if (sourceModVal->getInitialExpression() != "")
681  if (!copyInitialExpression(sourceModVal, newModVal)) return info;
682 
683  break;
684 
685  default:
686 
687  return info;
688 
689  break;
690  }
691  }
692 
693  return true;
694 }
CModel * mmModel
Definition: CModelMerging.h:69
const CCopasiVectorN< CModelValue > & getModelValues() const
Definition: CModel.cpp:1060
virtual size_t size() const
CCopasiObject * get(const std::string &key)
std::map< std::string, std::string > keyMap
Definition: CModelMerging.h:42
bool copyExpression(const CModelEntity *sourceEntity, CModelEntity *newEntity)
virtual const std::string & getKey() const
std::string getInitialExpression() const
static CKeyFactory * getKeyFactory()
bool copyInitialExpression(const CModelEntity *sourceEntity, CModelEntity *newEntity)
bool CModelAdd::addReactions ( std::string  name)
protected

Definition at line 696 of file CModelMerging.cpp.

References CReaction::addModifier(), CReaction::addParameterMapping(), CReaction::addProduct(), CReaction::addSubstrate(), CReaction::clearParameterMapping(), CModel::createReaction(), CReaction::getChemEq(), CModel::getCompartments(), CReaction::getFunction(), CReaction::getFunctionParameters(), CModelEntity::getKey(), CChemEqElement::getMetaboliteKey(), CChemEq::getModifiers(), CChemEqElement::getMultiplicity(), CCopasiObject::getObjectName(), CReaction::getParameterMappings(), CReaction::getParameterValue(), CChemEq::getProducts(), CModel::getReactions(), CChemEq::getSubstrates(), CReaction::isLocalParameter(), CReaction::isReversible(), keyMap, mmModel, CFunctionParameter::MODIFIER, mpModel, CFunctionParameter::PARAMETER, CFunctionParameter::PRODUCT, reactionInvolvesCompartment(), CReaction::setFunction(), CReaction::setParameterMapping(), CReaction::setParameterValue(), CReaction::setReversible(), CFunctionParameters::size(), CCopasiVector< T >::size(), CFunctionParameter::SUBSTRATE, CFunctionParameter::TIME, CFunctionParameter::VFLOAT64, and CFunctionParameter::VOLUME.

Referenced by simpleCall().

697 {
698 
699  bool info = false;
700 
701  //create copies of the relevant reactions
702 
703  size_t i, imax = mmModel->getReactions().size();
704 
705  size_t ic, icmax = mmModel->getCompartments().size();
706 
707  for (ic = 0; ic < icmax; ++ic)
708  {
709  const CCompartment* sourceComp = mmModel->getCompartments()[ic];
710 
711  if (!sourceComp) return info;
712 
713  for (i = 0; i < imax; ++i)
714  {
715  CReaction * sourceReac = mmModel->getReactions()[i];
716 
717  if (reactionInvolvesCompartment(sourceReac, sourceComp))
718  {
719 
720  std::string newName = sourceReac->getObjectName() + "_" + name;
721 
722  CReaction* newReac = mpModel->createReaction(newName);
723 
724  if (!newReac) return info;
725 
726  //copy the chemical equation. If the involved metabs are among those that
727  //were copied with the compartment, replace them. Otherwise keep the original metab
728  newReac->setReversible(sourceReac->isReversible());
729  std::map<std::string, std::string>::const_iterator mapIt;
730  std::string targetKey;
731  size_t j, jmax = sourceReac->getChemEq().getSubstrates().size();
732 
733  for (j = 0; j < jmax; ++j)
734  {
735  const CChemEqElement * sourceElement = sourceReac->getChemEq().getSubstrates()[j];
736  //check if the metab is in the map. If yes, translate it, otherwise not.
737  mapIt = keyMap.find(sourceElement->getMetaboliteKey());
738 
739  if (mapIt == keyMap.end())
740  {
741  targetKey = sourceElement->getMetaboliteKey();
742  }
743  else
744  targetKey = mapIt->second;
745 
746  newReac->addSubstrate(targetKey, sourceElement->getMultiplicity());
747  }
748 
749  jmax = sourceReac->getChemEq().getProducts().size();
750 
751  for (j = 0; j < jmax; ++j)
752  {
753  const CChemEqElement * sourceElement = sourceReac->getChemEq().getProducts()[j];
754  //check if the metab is in the map. If yes, translate it, otherwise not.
755  mapIt = keyMap.find(sourceElement->getMetaboliteKey());
756 
757  if (mapIt == keyMap.end())
758  {
759  targetKey = sourceElement->getMetaboliteKey();
760  }
761  else
762  targetKey = mapIt->second;
763 
764  newReac->addProduct(targetKey, sourceElement->getMultiplicity());
765  }
766 
767  jmax = sourceReac->getChemEq().getModifiers().size();
768 
769  for (j = 0; j < jmax; ++j)
770  {
771  const CChemEqElement * sourceElement = sourceReac->getChemEq().getModifiers()[j];
772  //check if the metab is in the map. If yes, translate it, otherwise not.
773 
774  mapIt = keyMap.find(sourceElement->getMetaboliteKey());
775 
776  if (mapIt == keyMap.end())
777  {
778  targetKey = sourceElement->getMetaboliteKey();
779  }
780  else
781  targetKey = mapIt->second;
782 
783  newReac->addModifier(targetKey);
784  }
785 
786  //set the kinetic function
787  newReac->setFunction(const_cast<CFunction*>(sourceReac->getFunction()));
788 
789  //mapping and local parameters
790  for (j = 0; j < newReac->getFunctionParameters().size(); ++j)
791  {
792  switch (newReac->getFunctionParameters()[j]->getUsage())
793  {
797  //translate the metab keys
798  {
799  bool isVector = (newReac->getFunctionParameters()[j]->getType() == CFunctionParameter::VFLOAT64);
800 
801  //we assume that only SUBSTRATE, PRODUCT, MODIFIER can be vectors
802  if (isVector)
803  newReac->clearParameterMapping(j);
804 
805  size_t k;
806 
807  for (k = 0; k < sourceReac->getParameterMappings()[j].size(); ++k)
808  {
809  mapIt = keyMap.find(sourceReac->getParameterMappings()[j][k]);
810 
811  if (mapIt == keyMap.end())
812  {
813  targetKey = sourceReac->getParameterMappings()[j][k];
814  }
815  else
816  targetKey = mapIt->second;
817 
818  if (isVector)
819  newReac->addParameterMapping(j, targetKey);
820  else
821  newReac->setParameterMapping(j, targetKey);
822  }
823  }
824  break;
825 
827  //just copy the key
828  {
829  mapIt = keyMap.find(sourceReac->getParameterMappings()[j][0]);
830 
831  if (mapIt == keyMap.end())
832  {
833  targetKey = sourceReac->getParameterMappings()[j][0];
834  }
835  else
836  targetKey = mapIt->second;
837 
838  newReac->setParameterMapping(j, targetKey);
839  }
840  break;
841 
843 
844  //translate the compartment key if necessary
845  if (sourceReac->getParameterMappings()[j][0] == sourceComp->getKey())
846  newReac->setParameterMapping(j, keyMap[sourceComp->getKey()]);
847  else
848  {
849  mapIt = keyMap.find(sourceReac->getParameterMappings()[j][0]);
850 
851  if (mapIt == keyMap.end())
852  {
853  targetKey = sourceReac->getParameterMappings()[j][0];
854  }
855  else
856  targetKey = mapIt->second;
857 
858  newReac->setParameterMapping(j, targetKey);
859  }
860 
861  //TODO: this needs to be adapted when sets of compartments will be copied
862  break;
863 
865 
866  if (sourceReac->isLocalParameter(j))
867  newReac->setParameterValue(newReac->getFunctionParameters()[j]->getObjectName(),
868  sourceReac->getParameterValue(newReac->getFunctionParameters()[j]->getObjectName()));
869  else
870  {
871  mapIt = keyMap.find(sourceReac->getParameterMappings()[j][0]);
872 
873  if (mapIt == keyMap.end())
874  {
875  targetKey = sourceReac->getParameterMappings()[j][0];
876  }
877  else
878  targetKey = mapIt->second;
879 
880  newReac->setParameterMapping(j, targetKey);
881  }
882 
883  break;
884 
885  default:
886  return info;
887  break;
888  }
889  }
890  }
891  }
892  }
893 
894  return true;
895 }
void setReversible(bool reversible)
Definition: CReaction.cpp:247
CModel * mmModel
Definition: CModelMerging.h:69
bool addSubstrate(const std::string &metabKey, const C_FLOAT64 &multiplicity=1.0)
Definition: CReaction.cpp:232
const std::string & getObjectName() const
virtual size_t size() const
void setParameterValue(const std::string &parameterName, const C_FLOAT64 &value, const bool &updateStatus=true)
Definition: CReaction.cpp:303
std::map< std::string, std::string > keyMap
Definition: CModelMerging.h:42
bool addProduct(const std::string &metabKey, const C_FLOAT64 &multiplicity=1.0)
Definition: CReaction.cpp:236
bool isLocalParameter(const size_t &index) const
Definition: CReaction.cpp:449
void clearParameterMapping(const std::string &parameterName)
Definition: CReaction.cpp:407
CModel * mpModel
Definition: CModelMerging.h:68
const CCopasiVector< CChemEqElement > & getProducts() const
Definition: CChemEq.cpp:63
const CFunction * getFunction() const
Definition: CReaction.cpp:252
const CFunctionParameters & getFunctionParameters() const
Definition: CReaction.cpp:576
bool addModifier(const std::string &metabKey, const C_FLOAT64 &multiplicity=1.0)
Definition: CReaction.cpp:240
bool setFunction(const std::string &functionName)
Definition: CReaction.cpp:255
virtual const std::string & getKey() const
CReaction * createReaction(const std::string &name)
Definition: CModel.cpp:2760
const C_FLOAT64 & getMultiplicity() const
const std::string & getMetaboliteKey() const
const CCopasiVector< CChemEqElement > & getSubstrates() const
Definition: CChemEq.cpp:60
bool isReversible() const
Definition: CReaction.cpp:229
CCopasiVectorNS< CCompartment > & getCompartments()
Definition: CModel.cpp:1145
const CCopasiVector< CChemEqElement > & getModifiers() const
Definition: CChemEq.cpp:66
void setParameterMapping(const size_t &index, const std::string &key)
Definition: CReaction.cpp:339
CCopasiVectorNS< CReaction > & getReactions()
Definition: CModel.cpp:1039
static bool reactionInvolvesCompartment(const CReaction *reac, const CCompartment *comp)
const std::vector< std::vector< std::string > > & getParameterMappings() const
Definition: CReaction.h:285
const CChemEq & getChemEq() const
Definition: CReaction.cpp:223
const C_FLOAT64 & getParameterValue(const std::string &parameterName) const
Definition: CReaction.cpp:326
void addParameterMapping(const size_t &index, const std::string &key)
Definition: CReaction.cpp:348
bool CModelAdd::copyDelayExpression ( const CEvent sourceEvent,
CEvent newEvent 
)
protected

Definition at line 224 of file CModelMerging.cpp.

References CKeyFactory::get(), CCopasiObject::getCN(), CEvent::getDelayExpressionPtr(), CEvaluationTree::getInfix(), CCopasiRootContainer::getKeyFactory(), CEvaluationTree::getNodeList(), CCopasiContainer::getObject(), CEvaluationNodeObject::getObjectCN(), CCopasiObject::getObjectDataModel(), CCopasiObject::getObjectName(), CCopasiObject::getObjectParent(), CCopasiObject::isReference(), keyMap, mmModel, CEvaluationNode::OBJECT, CEvaluationNodeObject::setData(), CEvent::setDelayExpression(), CEvaluationNode::type(), and CEvaluationTree::updateTree().

Referenced by addEvents().

225 {
226 
227  bool info = false;
228 
229  const CExpression* pExpression = sourceEvent->getDelayExpressionPtr();
230 
231  if (pExpression == NULL) return info;
232 
233  CExpression* tmp;
234  tmp = new CExpression(*pExpression, mmModel);
235 
236  const std::vector<CEvaluationNode*>& objectNodes = tmp->getNodeList();
237  size_t j, jmax = objectNodes.size();
238 
239  for (j = 0; j < jmax; ++j)
240  {
241  if (CEvaluationNode::type(objectNodes[j]->getType()) == CEvaluationNode::OBJECT)
242  {
243  CEvaluationNodeObject* pObjectNode = dynamic_cast<CEvaluationNodeObject*>(objectNodes[j]);
244 
245  if (pObjectNode == NULL) return info;
246 
247  CCopasiObjectName cn = pObjectNode->getObjectCN();
248 
249  const CCopasiObject* mObject =
250  static_cast< const CCopasiObject * >(mmModel->getObjectDataModel()->getObject(cn));
251 
252  if (mObject == NULL) return info;
253 
254  std::string host = "";
255 
256  if (mObject->isReference())
257  {
258  host = ",Reference=" + mObject->getObjectName();
259  mObject = mObject->getObjectParent();
260  }
261 
262  if (mObject == NULL) return info;
263 
264  std::string key = keyMap[(dynamic_cast<const CModelEntity * >(mObject))->getKey()];
266 
267  cn = pObject->getCN() + host;
268 
269  pObjectNode->setData("<" + cn + ">");
270  }
271  }
272 
273  tmp->updateTree();
274 
275  newEvent->setDelayExpression(tmp->getInfix().c_str());
276 
277  return true;
278 }
CCopasiDataModel * getObjectDataModel()
CModel * mmModel
Definition: CModelMerging.h:69
virtual CCopasiObjectName getCN() const
const std::string & getObjectName() const
const CRegisteredObjectName & getObjectCN() const
CCopasiObject * get(const std::string &key)
std::map< std::string, std::string > keyMap
Definition: CModelMerging.h:42
CExpression * getDelayExpressionPtr()
Definition: CEvent.cpp:606
static Type type(const Type &type)
bool isReference() const
static CKeyFactory * getKeyFactory()
bool setDelayExpression(const std::string &expression)
Definition: CEvent.cpp:544
virtual bool setData(const Data &data)
virtual const CObjectInterface * getObject(const CCopasiObjectName &cn) const
const std::vector< CEvaluationNode * > & getNodeList() const
const std::string & getInfix() const
CCopasiContainer * getObjectParent() const
bool CModelAdd::copyEventAssignmentExpression ( const CEventAssignment sourceAssignment,
CEventAssignment newAssignment 
)
protected

Definition at line 168 of file CModelMerging.cpp.

References CKeyFactory::get(), CCopasiObject::getCN(), CEventAssignment::getExpressionPtr(), CEvaluationTree::getInfix(), CCopasiRootContainer::getKeyFactory(), CEvaluationTree::getNodeList(), CCopasiContainer::getObject(), CEvaluationNodeObject::getObjectCN(), CCopasiObject::getObjectDataModel(), CCopasiObject::getObjectName(), CCopasiObject::getObjectParent(), CCopasiObject::isReference(), keyMap, mmModel, CEvaluationNode::OBJECT, CEvaluationNodeObject::setData(), CEventAssignment::setExpression(), CEvaluationNode::type(), and CEvaluationTree::updateTree().

Referenced by addEvents().

169 {
170 
171  bool info = false;
172 
173  const CExpression* pExpression = sourceAssignment->getExpressionPtr();
174 
175  if (pExpression == NULL) return info;
176 
177  CExpression* tmp;
178  tmp = new CExpression(*pExpression, mmModel);
179 
180  const std::vector<CEvaluationNode*>& objectNodes = tmp->getNodeList();
181  size_t j, jmax = objectNodes.size();
182 
183  for (j = 0; j < jmax; ++j)
184  {
185  if (CEvaluationNode::type(objectNodes[j]->getType()) == CEvaluationNode::OBJECT)
186  {
187  CEvaluationNodeObject* pObjectNode = dynamic_cast<CEvaluationNodeObject*>(objectNodes[j]);
188 
189  if (pObjectNode == NULL) return info;
190 
191  CCopasiObjectName cn = pObjectNode->getObjectCN();
192 
193  const CCopasiObject* mObject =
194  static_cast< const CCopasiObject * >(mmModel->getObjectDataModel()->getObject(cn));
195 
196  if (mObject == NULL) return info;
197 
198  std::string host = "";
199 
200  if (mObject->isReference())
201  {
202  host = ",Reference=" + mObject->getObjectName();
203  mObject = mObject->getObjectParent();
204  }
205 
206  if (mObject == NULL) return info;
207 
208  std::string key = keyMap[(dynamic_cast<const CModelEntity * >(mObject))->getKey()];
210 
211  cn = pObject->getCN() + host;
212 
213  pObjectNode->setData("<" + cn + ">");
214  }
215  }
216 
217  tmp->updateTree();
218 
219  newAssignment->setExpression(tmp->getInfix().c_str());
220 
221  return true;
222 }
CCopasiDataModel * getObjectDataModel()
CModel * mmModel
Definition: CModelMerging.h:69
virtual CCopasiObjectName getCN() const
const std::string & getObjectName() const
const CRegisteredObjectName & getObjectCN() const
CCopasiObject * get(const std::string &key)
std::map< std::string, std::string > keyMap
Definition: CModelMerging.h:42
const CExpression * getExpressionPtr() const
Definition: CEvent.cpp:226
bool setExpression(const std::string &expression)
Definition: CEvent.cpp:167
static Type type(const Type &type)
bool isReference() const
static CKeyFactory * getKeyFactory()
virtual bool setData(const Data &data)
virtual const CObjectInterface * getObject(const CCopasiObjectName &cn) const
const std::vector< CEvaluationNode * > & getNodeList() const
const std::string & getInfix() const
CCopasiContainer * getObjectParent() const
bool CModelAdd::copyExpression ( const CModelEntity sourceEntity,
CModelEntity newEntity 
)
protected

Definition at line 336 of file CModelMerging.cpp.

References CKeyFactory::get(), CCopasiObject::getCN(), CModelEntity::getExpressionPtr(), CEvaluationTree::getInfix(), CCopasiRootContainer::getKeyFactory(), CEvaluationTree::getNodeList(), CCopasiContainer::getObject(), CEvaluationNodeObject::getObjectCN(), CCopasiObject::getObjectDataModel(), CCopasiObject::getObjectName(), CCopasiObject::getObjectParent(), CCopasiObject::isReference(), keyMap, mmModel, CEvaluationNode::OBJECT, CEvaluationNodeObject::setData(), CModelEntity::setExpression(), CEvaluationNode::type(), and CEvaluationTree::updateTree().

Referenced by addCompartmentsExpressions(), addMetabolitesExpressions(), and addModelValuesExpressions().

337 {
338 
339  bool info = false;
340 
341  const CExpression* pExpression = sourceEntity->getExpressionPtr();
342 
343  if (pExpression == NULL) return info;
344 
345  CExpression* tmp;
346  tmp = new CExpression(*pExpression, mmModel);
347 
348  const std::vector<CEvaluationNode*>& objectNodes = tmp->getNodeList();
349  size_t j, jmax = objectNodes.size();
350 
351  for (j = 0; j < jmax; ++j)
352  {
353  if (CEvaluationNode::type(objectNodes[j]->getType()) == CEvaluationNode::OBJECT)
354  {
355  CEvaluationNodeObject* pObjectNode = dynamic_cast<CEvaluationNodeObject*>(objectNodes[j]);
356 
357  if (pObjectNode == NULL) return info;
358 
359  CCopasiObjectName cn = pObjectNode->getObjectCN();
360 
361  const CCopasiObject* mObject =
362  static_cast< const CCopasiObject * >(mmModel->getObjectDataModel()->getObject(cn));
363 
364  if (mObject == NULL) return info;
365 
366  std::string host = "";
367 
368  if (mObject->isReference())
369  {
370  host = ",Reference=" + mObject->getObjectName();
371  mObject = mObject->getObjectParent();
372  }
373 
374  if (mObject == NULL) return info;
375 
376  std::string key = keyMap[(dynamic_cast<const CModelEntity * >(mObject))->getKey()];
378 
379  cn = pObject->getCN() + host;
380 
381  pObjectNode->setData("<" + cn + ">");
382  }
383  }
384 
385  tmp->updateTree();
386 
387  newEntity->setExpression(tmp->getInfix().c_str());
388 
389  return true;
390 }
const CExpression * getExpressionPtr() const
CCopasiDataModel * getObjectDataModel()
CModel * mmModel
Definition: CModelMerging.h:69
virtual CCopasiObjectName getCN() const
const std::string & getObjectName() const
const CRegisteredObjectName & getObjectCN() const
CCopasiObject * get(const std::string &key)
std::map< std::string, std::string > keyMap
Definition: CModelMerging.h:42
static Type type(const Type &type)
bool isReference() const
static CKeyFactory * getKeyFactory()
virtual bool setData(const Data &data)
virtual const CObjectInterface * getObject(const CCopasiObjectName &cn) const
bool setExpression(const std::string &expression)
const std::vector< CEvaluationNode * > & getNodeList() const
const std::string & getInfix() const
CCopasiContainer * getObjectParent() const
bool CModelAdd::copyInitialExpression ( const CModelEntity sourceEntity,
CModelEntity newEntity 
)
protected

Definition at line 392 of file CModelMerging.cpp.

References CKeyFactory::get(), CCopasiObject::getCN(), CEvaluationTree::getInfix(), CModelEntity::getInitialExpressionPtr(), CCopasiRootContainer::getKeyFactory(), CEvaluationTree::getNodeList(), CCopasiContainer::getObject(), CEvaluationNodeObject::getObjectCN(), CCopasiObject::getObjectDataModel(), CCopasiObject::getObjectName(), CCopasiObject::getObjectParent(), CCopasiObject::isReference(), keyMap, mmModel, CEvaluationNode::OBJECT, CEvaluationNodeObject::setData(), CModelEntity::setInitialExpression(), CEvaluationNode::type(), and CEvaluationTree::updateTree().

Referenced by addCompartmentsExpressions(), addMetabolitesExpressions(), and addModelValuesExpressions().

393 {
394 
395  bool info = false;
396 
397  const CExpression* pExpression = sourceEntity->getInitialExpressionPtr();
398 
399  if (pExpression == NULL) return info;
400 
401  CExpression* tmp;
402  tmp = new CExpression(*pExpression, mmModel);
403 
404  const std::vector<CEvaluationNode*>& objectNodes = tmp->getNodeList();
405  size_t j, jmax = objectNodes.size();
406 
407  for (j = 0; j < jmax; ++j)
408  {
409  if (CEvaluationNode::type(objectNodes[j]->getType()) == CEvaluationNode::OBJECT)
410  {
411  CEvaluationNodeObject* pObjectNode = dynamic_cast<CEvaluationNodeObject*>(objectNodes[j]);
412 
413  if (pObjectNode == NULL) return info;
414 
415  CCopasiObjectName cn = pObjectNode->getObjectCN();
416 
417  const CCopasiObject* mObject =
418  static_cast< const CCopasiObject * >(mmModel->getObjectDataModel()->getObject(cn));
419 
420  if (mObject == NULL) return info;
421 
422  std::string host = "";
423 
424  if (mObject->isReference())
425  {
426  host = ",Reference=" + mObject->getObjectName();
427  mObject = mObject->getObjectParent();
428  }
429 
430  if (mObject == NULL) return info;
431 
432  std::string key = keyMap[(dynamic_cast<const CModelEntity * >(mObject))->getKey()];
434 
435  cn = pObject->getCN() + host;
436 
437  pObjectNode->setData("<" + cn + ">");
438  }
439  }
440 
441  tmp->updateTree();
442 
443  newEntity->setInitialExpression(tmp->getInfix().c_str());
444 
445  return info;
446 }
CCopasiDataModel * getObjectDataModel()
CModel * mmModel
Definition: CModelMerging.h:69
virtual CCopasiObjectName getCN() const
const std::string & getObjectName() const
const CRegisteredObjectName & getObjectCN() const
CCopasiObject * get(const std::string &key)
std::map< std::string, std::string > keyMap
Definition: CModelMerging.h:42
bool setInitialExpression(const std::string &expression)
static Type type(const Type &type)
bool isReference() const
static CKeyFactory * getKeyFactory()
virtual bool setData(const Data &data)
virtual const CObjectInterface * getObject(const CCopasiObjectName &cn) const
const std::vector< CEvaluationNode * > & getNodeList() const
const std::string & getInfix() const
CCopasiContainer * getObjectParent() const
const CExpression * getInitialExpressionPtr() const
bool CModelAdd::copyTriggerExpression ( const CEvent sourceEvent,
CEvent newEvent 
)
protected

Definition at line 280 of file CModelMerging.cpp.

References CKeyFactory::get(), CCopasiObject::getCN(), CEvaluationTree::getInfix(), CCopasiRootContainer::getKeyFactory(), CEvaluationTree::getNodeList(), CCopasiContainer::getObject(), CEvaluationNodeObject::getObjectCN(), CCopasiObject::getObjectDataModel(), CCopasiObject::getObjectName(), CCopasiObject::getObjectParent(), CEvent::getTriggerExpressionPtr(), CCopasiObject::isReference(), keyMap, mmModel, CEvaluationNode::OBJECT, CEvaluationNodeObject::setData(), CEvent::setTriggerExpression(), CEvaluationNode::type(), and CEvaluationTree::updateTree().

Referenced by addEvents().

281 {
282 
283  bool info = false;
284 
285  const CExpression* pExpression = sourceEvent->getTriggerExpressionPtr();
286 
287  if (pExpression == NULL) return info;
288 
289  CExpression* tmp;
290  tmp = new CExpression(*pExpression, mmModel);
291 
292  const std::vector<CEvaluationNode*>& objectNodes = tmp->getNodeList();
293  size_t j, jmax = objectNodes.size();
294 
295  for (j = 0; j < jmax; ++j)
296  {
297  if (CEvaluationNode::type(objectNodes[j]->getType()) == CEvaluationNode::OBJECT)
298  {
299  CEvaluationNodeObject* pObjectNode = dynamic_cast<CEvaluationNodeObject*>(objectNodes[j]);
300 
301  if (pObjectNode == NULL) return info;
302 
303  CCopasiObjectName cn = pObjectNode->getObjectCN();
304 
305  const CCopasiObject* mObject =
306  static_cast< const CCopasiObject * >(mmModel->getObjectDataModel()->getObject(cn));
307 
308  if (mObject == NULL) return info;
309 
310  std::string host = "";
311 
312  if (mObject->isReference())
313  {
314  host = ",Reference=" + mObject->getObjectName();
315  mObject = mObject->getObjectParent();
316  }
317 
318  if (mObject == NULL) return info;
319 
320  std::string key = keyMap[(dynamic_cast<const CModelEntity * >(mObject))->getKey()];
322 
323  cn = pObject->getCN() + host;
324 
325  pObjectNode->setData("<" + cn + ">");
326  }
327  }
328 
329  tmp->updateTree();
330 
331  newEvent->setTriggerExpression(tmp->getInfix().c_str());
332 
333  return true;
334 }
CCopasiDataModel * getObjectDataModel()
CModel * mmModel
Definition: CModelMerging.h:69
virtual CCopasiObjectName getCN() const
const std::string & getObjectName() const
const CRegisteredObjectName & getObjectCN() const
CCopasiObject * get(const std::string &key)
std::map< std::string, std::string > keyMap
Definition: CModelMerging.h:42
static Type type(const Type &type)
bool isReference() const
bool setTriggerExpression(const std::string &expression)
Definition: CEvent.cpp:474
const CExpression * getTriggerExpressionPtr() const
Definition: CEvent.cpp:534
static CKeyFactory * getKeyFactory()
virtual bool setData(const Data &data)
virtual const CObjectInterface * getObject(const CCopasiObjectName &cn) const
const std::vector< CEvaluationNode * > & getNodeList() const
const std::string & getInfix() const
CCopasiContainer * getObjectParent() const
bool CModelAdd::reactionInvolvesCompartment ( const CReaction reac,
const CCompartment comp 
)
staticprotected

determine whether the one of the substrate, products, or modifiers of the reaction is located in the given compartment

Definition at line 898 of file CModelMerging.cpp.

References CReaction::getChemEq(), CChemEq::getModifiers(), CChemEq::getProducts(), CChemEq::getSubstrates(), and CCopasiVector< T >::size().

Referenced by addReactions().

899 {
900  if (!reac) return false;
901 
902  if (!comp) return false;
903 
904  size_t i, imax = reac->getChemEq().getSubstrates().size();
905 
906  for (i = 0; i < imax; ++i)
907  if (reac->getChemEq().getSubstrates()[i]->getMetabolite()->getCompartment() == comp)
908  return true;
909 
910  imax = reac->getChemEq().getProducts().size();
911 
912  for (i = 0; i < imax; ++i)
913  if (reac->getChemEq().getProducts()[i]->getMetabolite()->getCompartment() == comp)
914  return true;
915 
916  imax = reac->getChemEq().getModifiers().size();
917 
918  for (i = 0; i < imax; ++i)
919  if (reac->getChemEq().getModifiers()[i]->getMetabolite()->getCompartment() == comp)
920  return true;
921 
922  return false;
923 }
virtual size_t size() const
const CCopasiVector< CChemEqElement > & getProducts() const
Definition: CChemEq.cpp:63
const CCopasiVector< CChemEqElement > & getSubstrates() const
Definition: CChemEq.cpp:60
const CCopasiVector< CChemEqElement > & getModifiers() const
Definition: CChemEq.cpp:66
const CChemEq & getChemEq() const
Definition: CReaction.cpp:223
void CModelAdd::setModel ( CModel pModel,
CModel mModel 
)

Definition at line 33 of file CModelMerging.cpp.

References mmModel, and mpModel.

34 {
35  mpModel = pModel;
36  mmModel = mModel;
37 }
CModel * mmModel
Definition: CModelMerging.h:69
CModel * mpModel
Definition: CModelMerging.h:68
void CModelAdd::simpleCall ( )

just a simple method to call during development

Definition at line 39 of file CModelMerging.cpp.

References addCompartments(), addCompartmentsExpressions(), addEvents(), addMetabolites(), addMetabolitesExpressions(), addModelValues(), addModelValuesExpressions(), addReactions(), CModel::compileIfNecessary(), CCopasiMessage::ERROR, fatalError, CModel::getKey(), keyMap, MCModelMerging, mmModel, and mpModel.

40 {
41  if (!mpModel)
42  {
43  fatalError();
44  }
45 
46  if (!mmModel)
47  {
48  fatalError();
49  }
50 
52 
53  std::string name = "model_2"; // temporary we do not take care about naming conflicts.
54  // : "model_2" is the appendix for the names of compartments and reactions,
55  // comming form the second model
56 
57  bool progress = addCompartments(name)
58  && addMetabolites(name)
59  && addModelValues(name)
63  && addReactions(name)
64  && addEvents(name);
65 
66  if (!progress)
67  {
69  return;
70  }
71 
73 }
CModel * mmModel
Definition: CModelMerging.h:69
bool addMetabolitesExpressions()
#define fatalError()
std::map< std::string, std::string > keyMap
Definition: CModelMerging.h:42
bool addEvents(std::string name)
CModel * mpModel
Definition: CModelMerging.h:68
bool addModelValuesExpressions()
bool addMetabolites(std::string name)
bool addCompartmentsExpressions()
bool addCompartments(std::string name)
bool addModelValues(std::string name)
const std::string & getKey() const
Definition: CModel.cpp:1142
bool compileIfNecessary(CProcessReport *pProcessReport)
Definition: CModel.cpp:612
#define MCModelMerging
bool addReactions(std::string name)

Member Data Documentation

std::map<std::string, std::string> CModelAdd::keyMap
protected
CModel* CModelAdd::mmModel
protected
CModel* CModelAdd::mpModel
protected
std::map<std::string, std::string> CModelAdd::nameMap
protected

Definition at line 43 of file CModelMerging.h.

Referenced by addCompartments(), addMetabolites(), and addModelValues().


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