Skip to content

Commit

Permalink
Merge branch 'release/Version-4.43' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
shoops committed Apr 30, 2024
2 parents c9d3fe0 + 1647e3d commit 2296fd2
Show file tree
Hide file tree
Showing 44 changed files with 345 additions and 288 deletions.
37 changes: 16 additions & 21 deletions copasi/CopasiDataModel/CDataModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ LIBCOMBINE_CPP_NAMESPACE_USE

// static
const CEnumAnnotation< std::string, CDataModel::ContentType >
CDataModel::ContentTypeNames( {"COPASI",
"GEPASI",
"SBML",
"SED-ML",
"OMEX"
});
CDataModel::ContentTypeNames({"COPASI",
"GEPASI",
"SBML",
"SED-ML",
"OMEX"
});

// static
CDataModel::ContentType CDataModel::contentType(std::istream & content)
Expand Down Expand Up @@ -257,11 +257,6 @@ CDataModel::~CDataModel()
CRegisteredCommonName::setEnabled(true);
}

CRegisteredCommonName CDataModel::registeredCN(const std::string & CN) const
{
return CRegisteredCommonName(CN, this);
}

bool CDataModel::loadFromString(const std::string & content,
std::string referenceDir,
CProcessReport * pProcessReport,
Expand Down Expand Up @@ -717,9 +712,9 @@ bool CDataModel::loadModelParameterSets(const std::string & fileName,
CDataVectorN< CModelParameterSet > & loadedSet = parameterSetModel->getModelParameterSets();
CCommonName loadedModelCn = parameterSetModel->getStringCN();

for (CModelParameterSet & set : loadedSet)
for (CModelParameterSet & set : loadedSet)
{
for (CModelParameter * current : dynamic_cast< CModelParameterGroup & >(set))
for (CModelParameter * current : dynamic_cast< CModelParameterGroup & >(set))
{
replaceCnInGroup(current, loadedModelCn, thisModelsCn);
}
Expand Down Expand Up @@ -762,7 +757,7 @@ void CDataModel::replaceCnInGroup(CModelParameter * pParam,
if (!group)
return;

for (CModelParameter * element : *group)
for (CModelParameter * element : *group)
{
CModelParameterGroup * inside = dynamic_cast< CModelParameterGroup * >(element);

Expand Down Expand Up @@ -2047,7 +2042,7 @@ void addMessages(const std::string & title, std::stringstream & messageStream, c

messageStream << "\n";

for (auto & message : messages)
for (auto & message : messages)
{
auto startPos = message.getText().find_first_of("\n");
auto text = message.getText().substr(startPos + 1);
Expand Down Expand Up @@ -2783,7 +2778,7 @@ CReportDefinition * CDataModel::addReport(const CTaskEnum::Task & taskType)
pReport->getFooterAddr()->push_back(CRegisteredCommonName("CN=Root,Vector=TaskList[Optimization],Object=Result", this));
break;

//**************************************************************************
//**************************************************************************
case CTaskEnum::Task::parameterFitting:
pReport = new CReportDefinition(CTaskEnum::TaskName[taskType]);
pReport->setTaskType(taskType);
Expand Down Expand Up @@ -2812,7 +2807,7 @@ CReportDefinition * CDataModel::addReport(const CTaskEnum::Task & taskType)
pReport->getFooterAddr()->push_back(CRegisteredCommonName("CN=Root,Vector=TaskList[Parameter Estimation],Object=Result", this));
break;

//**************************************************************************
//**************************************************************************
case CTaskEnum::Task::lyap:
pReport = new CReportDefinition(CTaskEnum::TaskName[taskType]);
pReport->setTaskType(taskType);
Expand All @@ -2829,7 +2824,7 @@ CReportDefinition * CDataModel::addReport(const CTaskEnum::Task & taskType)
pReport->getFooterAddr()->push_back(CRegisteredCommonName("CN=Root,Vector=TaskList[Lyapunov Exponents],Object=Result", this));
break;

//**************************************************************************
//**************************************************************************
case CTaskEnum::Task::mca:
pReport = new CReportDefinition(CTaskEnum::TaskName[taskType]);
pReport->setTaskType(taskType);
Expand All @@ -2846,7 +2841,7 @@ CReportDefinition * CDataModel::addReport(const CTaskEnum::Task & taskType)
pReport->getFooterAddr()->push_back(CRegisteredCommonName("CN=Root,Vector=TaskList[Metabolic Control Analysis],Object=Result", this));
break;

//**************************************************************************
//**************************************************************************
case CTaskEnum::Task::lna:
pReport = new CReportDefinition(CTaskEnum::TaskName[taskType]);
pReport->setTaskType(taskType);
Expand All @@ -2863,7 +2858,7 @@ CReportDefinition * CDataModel::addReport(const CTaskEnum::Task & taskType)
pReport->getFooterAddr()->push_back(CRegisteredCommonName("CN=Root,Vector=TaskList[Linear Noise Approximation],Object=Result", this));
break;

//**************************************************************************
//**************************************************************************
case CTaskEnum::Task::sens:
pReport = new CReportDefinition(CTaskEnum::TaskName[taskType]);
pReport->setTaskType(taskType);
Expand All @@ -2880,7 +2875,7 @@ CReportDefinition * CDataModel::addReport(const CTaskEnum::Task & taskType)
pReport->getFooterAddr()->push_back(CRegisteredCommonName("CN=Root,Vector=TaskList[Sensitivities],Object=Result", this));
break;

//**************************************************************************
//**************************************************************************
case CTaskEnum::Task::tssAnalysis:
pReport = new CReportDefinition(CTaskEnum::TaskName[taskType]);
pReport->setTaskType(taskType);
Expand Down
10 changes: 0 additions & 10 deletions copasi/CopasiDataModel/CDataModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,16 +191,6 @@ class CDataModel: public CDataContainer, public COutputHandler

virtual ~CDataModel();

/**
* resolves the given CN string in this dataModel to a
* registered common name
*
* @param CN the CN to resolve
*
* @return a registered common name for the CN
*/
CRegisteredCommonName registeredCN(const std::string & CN) const;

/**
* Load the model from the content which may be any supported type
* @param const std::string & content
Expand Down
2 changes: 1 addition & 1 deletion copasi/UI/CQBrowserPaneDM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ bool CQBrowserPaneDM::slotNotify(ListViews::ObjectType objectType, ListViews::Ac
pNode = findNodeFromCN(cn);
}

std::string NewCN = pNode != NULL ? pNode->getCN() : cn;
CRegisteredCommonName NewCN = pNode != NULL ? pNode->getCN() : cn;

if (cn != NewCN)
{
Expand Down
2 changes: 1 addition & 1 deletion copasi/UI/CQEventWidget1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ void CQEventWidget1::slotSelectObject()
if (pObject == NULL)
return;

if (mAssignments[mCurrentTarget].setTargetCN(pObject->getStringCN()))
if (mAssignments[mCurrentTarget].setTargetCN(pObject->getCN()))
{
// If the target key change was successful we need to update the label.
mpLBTarget->item((int) mCurrentTarget)->setText(FROM_UTF8(pObject->getObjectDisplayName()));
Expand Down
2 changes: 1 addition & 1 deletion copasi/UI/CQExperimentData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1554,7 +1554,7 @@ bool CQExperimentData::saveTable(CExperiment * pExperiment)

if (ObjectMap.getObjectCN(i) != TO_UTF8(mpTable->item((int) i, COL_OBJECT_HIDDEN)->text()))
{
ObjectMap.setObjectCN(i, TO_UTF8(mpTable->item((int) i, COL_OBJECT_HIDDEN)->text()));
ObjectMap.setObjectCN(i, CRegisteredCommonName(TO_UTF8(mpTable->item((int) i, COL_OBJECT_HIDDEN)->text()), mpDataModel));
Changed = true;
}

Expand Down
36 changes: 18 additions & 18 deletions copasi/UI/CQFittingItemWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,14 @@ void CQFittingItemWidget::slotCheckLowerInf(bool checked)
mpCheckLowerInf->setStyleSheet(QString(mpCheckLowerInf->metaObject()->className()) + " {background-color:" + mSavedColor.name() + ";}");
}

std::string Number;
CRegisteredCommonName Number;

if (checked)
Number = "-inf";
Number = CRegisteredCommonName("-inf", nullptr);
else if (isNumber(TO_UTF8(mpEditLower->text())))
Number = TO_UTF8(mpEditLower->text());
Number = CRegisteredCommonName(TO_UTF8(mpEditLower->text()), nullptr);
else if (mpLowerObject)
Number = mpLowerObject->getStringCN();
Number = mpLowerObject->getCN();
else return;

std::set< size_t >::const_iterator it = mSelection.begin();
Expand Down Expand Up @@ -185,14 +185,14 @@ void CQFittingItemWidget::slotCheckUpperInf(bool checked)
mpCheckUpperInf->setStyleSheet(QString(mpCheckUpperInf->metaObject()->className()) + " {background-color:" + mSavedColor.name() + ";}");
}

std::string Number;
CRegisteredCommonName Number;

if (checked)
Number = "inf";
Number = CRegisteredCommonName("inf", nullptr);
else if (isNumber(TO_UTF8(mpEditUpper->text())))
Number = TO_UTF8(mpEditUpper->text());
Number = CRegisteredCommonName(TO_UTF8(mpEditUpper->text()), nullptr);
else if (mpUpperObject)
Number = mpUpperObject->getStringCN();
Number = mpUpperObject->getCN();
else return;

std::set< size_t >::const_iterator it = mSelection.begin();
Expand Down Expand Up @@ -245,7 +245,7 @@ void CQFittingItemWidget::slotLowerEdit()
std::set< size_t >::const_iterator it = mSelection.begin();
std::set< size_t >::const_iterator end = mSelection.end();
mpLowerObject = pObject;
CCommonName CN = mpLowerObject->getStringCN();
CRegisteredCommonName CN = mpLowerObject->getCN();

for (; it != end; ++it)
{
Expand Down Expand Up @@ -299,7 +299,7 @@ void CQFittingItemWidget::slotUpperEdit()
std::set< size_t >::const_iterator it = mSelection.begin();
std::set< size_t >::const_iterator end = mSelection.end();
mpUpperObject = pObject;
CCommonName CN = mpUpperObject->getStringCN();
CRegisteredCommonName CN = mpUpperObject->getCN();

for (; it != end; ++it)
{
Expand Down Expand Up @@ -419,7 +419,7 @@ void CQFittingItemWidget::slotParamEdit()

for (; it != end; ++it)
{
(*mpItemsCopy)[*it]->setObjectCN(Selection[0]->getStringCN());
(*mpItemsCopy)[*it]->setObjectCN(Selection[0]->getCN());
setTableText((int) *it, (*mpItemsCopy)[*it]);
}

Expand Down Expand Up @@ -449,7 +449,7 @@ void CQFittingItemWidget::slotParamEdit()
break;
}

pItem->setObjectCN(Selection[i]->getStringCN());
pItem->setObjectCN(Selection[i]->getCN());
// Add the new item to the list.
mpItemsCopy->insert(mpItemsCopy->begin() + current + i, pItem);
// Update the table
Expand Down Expand Up @@ -1430,14 +1430,14 @@ void CQFittingItemWidget::saveSelection()
pItem = (*mpItemsCopy)[*it];

if (mpCheckLowerInf->isChecked())
pItem->setLowerBound(CCommonName("-inf"));
pItem->setLowerBound(CRegisteredCommonName("-inf", nullptr));
else if (isNumber(TO_UTF8(mpEditLower->text())))
pItem->setLowerBound(CCommonName(TO_UTF8(mpEditLower->text())));
pItem->setLowerBound(CRegisteredCommonName(TO_UTF8(mpEditLower->text()), nullptr));

if (mpCheckUpperInf->isChecked())
pItem->setUpperBound(CCommonName("inf"));
pItem->setUpperBound(CRegisteredCommonName("inf", nullptr));
else if (isNumber(TO_UTF8(mpEditUpper->text())))
pItem->setUpperBound(CCommonName(TO_UTF8(mpEditUpper->text())));
pItem->setUpperBound(CRegisteredCommonName(TO_UTF8(mpEditUpper->text()), nullptr));

if (isNumber(TO_UTF8(mpEditStart->text())))
pItem->setStartValue(mpEditStart->text().toDouble());
Expand Down Expand Up @@ -1508,7 +1508,7 @@ void CQFittingItemWidget::slotLowerLostFocus()

for (; it != end; ++it)
{
(*mpItemsCopy)[*it]->setLowerBound(Number);
(*mpItemsCopy)[*it]->setLowerBound(CRegisteredCommonName(Number, nullptr));

if (first)
{
Expand Down Expand Up @@ -1541,7 +1541,7 @@ void CQFittingItemWidget::slotUpperLostFocus()

for (; it != end; ++it)
{
(*mpItemsCopy)[*it]->setUpperBound(Number);
(*mpItemsCopy)[*it]->setUpperBound(CRegisteredCommonName(Number, nullptr));

if (first)
{
Expand Down
2 changes: 1 addition & 1 deletion copasi/UI/CQParameterGroupView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ void CQParameterGroupView::modifySelectCNs(CCopasiParameterGroup & group, const

for (; itNew != endNew; ++itNew)
{
group.addParameter("Reaction", CCopasiParameter::Type::CN, (*itNew)->getStringCN());
group.addParameter("Reaction", CCopasiParameter::Type::CN, (*itNew)->getCN());
}

mpParameterGroupDM->endResetModel();
Expand Down
5 changes: 2 additions & 3 deletions copasi/UI/SensitivitiesWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,9 @@ SensitivitiesWidget::initCombos()
// SubTaskChooser combo
int i = 0;

while (CSensProblem::SubTaskName[i].length() > 0)
for (int i = 0; i < CSensProblem::SubTaskType::__SIZE; ++i)
{
StringList.append(FROM_UTF8(CSensProblem::SubTaskName[i]));
++i;
StringList.append(FROM_UTF8(CTaskEnum::TaskName[CSensProblem::SubTaskTypeToTask[i]]));
}

SubTaskChooser->insertItems(SubTaskChooser->count(), StringList);
Expand Down
2 changes: 1 addition & 1 deletion copasi/analytics/CAnalyticsProblem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void CAnalyticsProblem::initializeParameter()
mpFlagLimitOutConvergence = assertParameter("DelayOutputUntilConvergence", CCopasiParameter::Type::BOOL, false);
mpConvergenceOutTolerance = assertParameter("OutputConvergenceTolerance", CCopasiParameter::Type::DOUBLE, (C_FLOAT64)1E-6);
mpTriggerExpression = assertParameter("TriggerExpression", CCopasiParameter::Type::EXPRESSION, std::string(""));
mpSingleObjectCN = assertParameter("SingleVariable", CCopasiParameter::Type::CN, CRegisteredCommonName(""));
mpSingleObjectCN = assertParameter("SingleVariable", CCopasiParameter::Type::CN, CRegisteredCommonName());
setOutputEvent(false);
}

Expand Down
6 changes: 3 additions & 3 deletions copasi/bindings/cpp_examples/example5/example5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ int main()
// now we create the optimization items
// i.e. the model elements that have to be changed during the optimization
// in order to get to the optimal solution
COptItem* pOptItem = &pOptProblem->addOptItem(CCommonName(pFixedModelValue->getObject(CCommonName("Reference=InitialValue"))->getCN()));
COptItem* pOptItem = &pOptProblem->addOptItem(pFixedModelValue->getObject(CCommonName("Reference=InitialValue"))->getCN());
// we want to change the fixed model value from -100 to +100 with a start
// value of 50
pOptItem->setStartValue(50.0);
pOptItem->setLowerBound(CCommonName("-100"));
pOptItem->setUpperBound(CCommonName("100"));
pOptItem->setLowerBound(-100);
pOptItem->setUpperBound(100);

// now we set some parameters on the method
// these parameters are specific to the method type we set above
Expand Down
15 changes: 10 additions & 5 deletions copasi/bindings/cpp_examples/example6/example6.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
// Copyright (C) 2017 by Pedro Mendes, Virginia Tech Intellectual
// Copyright (C) 2019 - 2024 by Pedro Mendes, Rector and Visitors of the
// University of Virginia, University of Heidelberg, and University
// of Connecticut School of Medicine.
// All rights reserved.

// Copyright (C) 2017 - 2018 by Pedro Mendes, Virginia Tech Intellectual
// Properties, Inc., University of Heidelberg, and University of
// of Connecticut School of Medicine.
// All rights reserved.
Expand Down Expand Up @@ -367,8 +372,8 @@ int main()
pFitItem1->setObjectCN(pParameterReference->getCN());
assert(pFitItem1 != NULL);
pFitItem1->setStartValue(4.0);
pFitItem1->setLowerBound(CCommonName("0.00001"));
pFitItem1->setUpperBound(CCommonName("10"));
pFitItem1->setLowerBound(0.00001);
pFitItem1->setUpperBound(10);
// add the fit item
pOptimizationItemGroup->addParameter(pFitItem1);

Expand All @@ -385,8 +390,8 @@ int main()
pFitItem2->setObjectCN(pParameterReference->getCN());
assert(pFitItem2 != NULL);
pFitItem2->setStartValue(4.0);
pFitItem2->setLowerBound(CCommonName("0.00001"));
pFitItem2->setUpperBound(CCommonName("10"));
pFitItem2->setLowerBound(0.00001);
pFitItem2->setUpperBound(10);
// add the fit item
pOptimizationItemGroup->addParameter(pFitItem2);

Expand Down
8 changes: 4 additions & 4 deletions copasi/bindings/swig/CCopasiParameter.i
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2019 - 2023 by Pedro Mendes, Rector and Visitors of the
// Copyright (C) 2019 - 2024 by Pedro Mendes, Rector and Visitors of the
// University of Virginia, University of Heidelberg, and University
// of Connecticut School of Medicine.
// All rights reserved.
Expand Down Expand Up @@ -194,14 +194,14 @@
return self->setValue(v);
}

bool setCNValue(const CCommonName& v)
bool setCNValue(const CRegisteredCommonName & v)
{
return self->setValue(v);
}

bool setCNValue(const std::string& v)
bool setCNValue(const std::string & v)
{
return self->setValue(CCommonName(v));
return self->setValue(CRegisteredCommonName(v));
}

bool setKeyValue(const std::string& v)
Expand Down
12 changes: 11 additions & 1 deletion copasi/bindings/swig/COptItem.i
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2019 - 2023 by Pedro Mendes, Rector and Visitors of the
// Copyright (C) 2019 - 2024 by Pedro Mendes, Rector and Visitors of the
// University of Virginia, University of Heidelberg, and University
// of Connecticut School of Medicine.
// All rights reserved.
Expand Down Expand Up @@ -71,6 +71,16 @@
return v;
}

bool setLowerBound(const std::string & v)
{
return self->setLowerBound(CRegisteredCommonName(v));
}

bool setUpperBound(const std::string & v)
{
return self->setUpperBound(CRegisteredCommonName(v));
}

CFitItem* asFitItem()
{
return dynamic_cast<CFitItem*>($self);
Expand Down
Loading

0 comments on commit 2296fd2

Please sign in to comment.