本文整理汇总了C++中CCopasiParameter类的典型用法代码示例。如果您正苦于以下问题:C++ CCopasiParameter类的具体用法?C++ CCopasiParameter怎么用?C++ CCopasiParameter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CCopasiParameter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nodeFromIndex
// virtual
int CQTaskMethodParametersDM::rowCount(const QModelIndex & parent) const
{
if (!parent.isValid())
{
QVector< CCopasiMethod * >::const_iterator it = mMethods.constBegin();
QVector< CCopasiMethod * >::const_iterator end = mMethods.constEnd();
int size = 0;
for (; it != end; ++it)
size += (int)(*it)->size();
return size;
}
CCopasiParameter * pParent = nodeFromIndex(parent);
switch (pParent->getType())
{
case CCopasiParameter::GROUP:
return (int) static_cast< CCopasiParameterGroup * >(pParent)->size();
break;
default:
break;
}
return 0;
}
示例2: while
void CQParameterGroupView::slotPushButtonClicked(const QModelIndex & index)
{
QModelIndex Source = index;
while (Source.model()->inherits("QSortFilterProxyModel"))
{
Source = static_cast< const QSortFilterProxyModel *>(Source.model())->mapToSource(index);
}
if (this->itemDelegateForRow(Source.row()) != mpPushButtonDelegate) return;
CCopasiParameter * pParameter = CQParameterGroupDM::nodeFromIndex(Source);
if (pParameter->getType() != CCopasiParameter::Type::GROUP) return;
CCopasiParameterGroup * pGroup = static_cast< CCopasiParameterGroup * >(pParameter);
CCopasiParameterGroup::elements::const_iterator it = pGroup->getElementTemplates().beginIndex();
CCopasiParameterGroup::elements::const_iterator end = pGroup->getElementTemplates().endIndex();
for (; it != end; ++it)
{
switch ((*it)->getType())
{
case CCopasiParameter::Type::CN:
modifySelectCNs(*pGroup, **it);
break;
default:
break;
}
}
}
示例3: CCopasiTask
CTSSATask::CTSSATask(const CTSSATask & src,
const CCopasiContainer * pParent):
CCopasiTask(src, pParent),
mTimeSeriesRequested(src.mTimeSeriesRequested),
mTimeSeries(),
mpTSSAProblem(NULL),
mpTSSAMethod(NULL),
mpCurrentState(NULL),
mpCurrentTime(NULL)
{
mpProblem =
new CTSSAProblem(*static_cast< CTSSAProblem * >(src.mpProblem), this);
mpMethod = createMethod(src.mpMethod->getSubType());
* mpMethod = * src.mpMethod;
mpMethod->elevateChildren();
this->add(mpMethod, true);
CCopasiParameter * pParameter = mpMethod->getParameter("Integrate Reduced Model");
if (pParameter != NULL)
mUpdateMoieties = *pParameter->getValue().pBOOL;
else
mUpdateMoieties = false;
}
示例4: assertParameter
void CTauLeapMethod::initializeParameter()
{
CCopasiParameter *pParm;
assertParameter("Epsilon", CCopasiParameter::DOUBLE, (C_FLOAT64) 0.001);
assertParameter("Max Internal Steps", CCopasiParameter::UINT, (unsigned C_INT32) 10000);
assertParameter("Use Random Seed", CCopasiParameter::BOOL, false);
assertParameter("Random Seed", CCopasiParameter::UINT, (unsigned C_INT32) 1);
// Check whether we have a method with the old parameter names
if ((pParm = getParameter("TAULEAP.Tau")) != NULL)
{
removeParameter("TAULEAP.Tau");
if ((pParm = getParameter("TAULEAP.UseRandomSeed")) != NULL)
{
setValue("Use Random Seed", *pParm->getValue().pBOOL);
removeParameter("TAULEAP.UseRandomSeed");
}
if ((pParm = getParameter("TAULEAP.RandomSeed")) != NULL)
{
setValue("Random Seed", *pParm->getValue().pUINT);
removeParameter("TAULEAP.RandomSeed");
}
}
}
示例5: CCopasiTask
CTrajectoryTask::CTrajectoryTask(const CCopasiContainer * pParent):
CCopasiTask(CCopasiTask::timeCourse, pParent),
mTimeSeriesRequested(true),
mTimeSeries(),
mpTrajectoryProblem(NULL),
mpSteadyState(NULL),
mpTrajectoryMethod(NULL),
mUpdateMoieties(false),
mpCurrentState(NULL),
mpCurrentTime(NULL),
mOutputStartTime(0.0),
mpLessOrEqual(&fle),
mpLess(&fl)
{
mpProblem = new CTrajectoryProblem(this);
mpMethod = createMethod(CCopasiMethod::deterministic);
this->add(mpMethod, true);
CCopasiParameter * pParameter = mpMethod->getParameter("Integrate Reduced Model");
if (pParameter != NULL)
mUpdateMoieties = *pParameter->getValue().pBOOL;
else
mUpdateMoieties = false;
}
示例6: assertParameter
void CLyapWolfMethod::initializeParameter()
{
assertParameter("Orthonormalization Interval", CCopasiParameter::UDOUBLE, (C_FLOAT64) 1.0);
assertParameter("Overall time", CCopasiParameter::UDOUBLE, (C_FLOAT64) 1000.0);
assertParameter("Relative Tolerance", CCopasiParameter::UDOUBLE, (C_FLOAT64) 1.0e-6);
assertParameter("Absolute Tolerance", CCopasiParameter::UDOUBLE, (C_FLOAT64) 1.0e-12);
assertParameter("Max Internal Steps", CCopasiParameter::UINT, (unsigned C_INT32) 10000);
// Check whether we have an (obsolete) parameter "Use Default Absolute Tolerance"
CCopasiParameter *pParm;
if ((pParm = getParameter("Use Default Absolute Tolerance")) != NULL)
{
C_FLOAT64 NewValue;
if (*pParm->getValue().pBOOL)
{
// The default
NewValue = 1.e-12;
}
else
{
NewValue = *getValue("Absolute Tolerance").pUDOUBLE;
}
setValue("Absolute Tolerance", NewValue);
removeParameter("Use Default Absolute Tolerance");
}
// These parameters are no longer supported.
removeParameter("Adams Max Order");
removeParameter("BDF Max Order");
}
示例7: getParameter
bool CFitItem::elevateChildren()
{
// The functionality of SavedValue is no handled more transparently
// through the StartValue. Therefore, in case we encounter an old file
// we need to copy its value.
CCopasiParameter *pSavedValue = getParameter("SavedValue");
if (pSavedValue)
{
setStartValue(*pSavedValue->getValue().pDOUBLE);
removeParameter("SavedValue");
}
mpGrpAffectedExperiments =
elevate<CCopasiParameterGroup, CCopasiParameterGroup>(mpGrpAffectedExperiments);
if (!mpGrpAffectedExperiments) return false;
mpGrpAffectedCrossValidations =
elevate<CCopasiParameterGroup, CCopasiParameterGroup>(mpGrpAffectedCrossValidations);
if (!mpGrpAffectedCrossValidations) return false;
return true;
}
示例8: assert
bool CTSSATask::initialize(const OutputFlag & of,
COutputHandler * pOutputHandler,
std::ostream * pOstream)
{
assert(mpProblem && mpMethod);
mpTSSAProblem = dynamic_cast<CTSSAProblem *>(mpProblem);
assert(mpTSSAProblem);
mpTSSAMethod = dynamic_cast<CTSSAMethod *>(mpMethod);
assert(mpTSSAMethod);
mpTSSAMethod->setProblem(mpTSSAProblem);
bool success = mpMethod->isValidProblem(mpProblem);
CCopasiParameter * pParameter = mpMethod->getParameter("Integrate Reduced Model");
if (pParameter != NULL)
mUpdateMoieties = *pParameter->getValue().pBOOL;
else
mUpdateMoieties = false;
pdelete(mpCurrentState);
mpCurrentState = new CState(mpTSSAProblem->getModel()->getState());
mpCurrentTime = &mpCurrentState->getTime();
// Handle the time series as a regular output.
mTimeSeriesRequested = mpTSSAProblem->timeSeriesRequested();
if (pOutputHandler != NULL)
{
if (mTimeSeriesRequested)
{
mTimeSeries.allocate(mpTSSAProblem->getStepNumber());
pOutputHandler->addInterface(&mTimeSeries);
}
else
{
mTimeSeries.clear();
}
}
//NEW
mpTSSAMethod->setModel(mpTSSAProblem->getModel());
mpTSSAMethod->predifineAnnotation();
//
if (!CCopasiTask::initialize(of, pOutputHandler, pOstream)) success = false;
return success;
}
示例9: assert
bool CCrossSectionTask::initialize(const OutputFlag & of,
COutputHandler * pOutputHandler,
std::ostream * pOstream)
{
assert(mpProblem && mpMethod);
mpCrossSectionProblem = dynamic_cast<CCrossSectionProblem *>(mpProblem);
assert(mpCrossSectionProblem);
mpTrajectoryMethod = dynamic_cast<CTrajectoryMethod *>(mpMethod);
assert(mpTrajectoryMethod);
mpTrajectoryMethod->setProblem(mpCrossSectionProblem);
bool success = mpMethod->isValidProblem(mpProblem);
CCopasiParameter * pParameter = mpMethod->getParameter("Integrate Reduced Model");
if (pParameter != NULL)
mUpdateMoieties = *pParameter->getValue().pBOOL;
else
mUpdateMoieties = false;
pdelete(mpCurrentState);
mpCurrentState = new CState(mpCrossSectionProblem->getModel()->getState());
mpCurrentTime = &mpCurrentState->getTime();
//init the ring buffer for the states
mStatesRing.resize(RING_SIZE);
mStatesRingCounter = 0;
// Handle the time series as a regular output.
mTimeSeriesRequested = true;//mpCrossSectionProblem->timeSeriesRequested();
if ((pOutputHandler != NULL) &&
mTimeSeriesRequested &&
(of & CCopasiTask::TIME_SERIES))
{
mTimeSeries.allocate(20);
pOutputHandler->addInterface(&mTimeSeries);
}
else
{
mTimeSeries.clear();
}
createEvent();
if (!CCopasiTask::initialize(of, pOutputHandler, pOstream)) success = false;
return success;
}
示例10: assertParameter
void CExperimentObjectMap::CDataColumn::initializeParameter()
{
mpRole = (CExperiment::Type *)
assertParameter("Role", CCopasiParameter::UINT, (unsigned C_INT32) CExperiment::ignore)->getValue().pUINT;
CCopasiParameter * pParm = getParameter("Object CN");
if (pParm != NULL)
mpObjectCN = pParm->getValue().pCN;
pParm = getParameter("Weight");
if (pParm != NULL)
mpScale = pParm->getValue().pUDOUBLE;
elevateChildren();
}
示例11: pdelete
void CTrajectoryTask::load(CReadConfig & configBuffer)
{
configBuffer.getVariable("Dynamics", "bool", &mScheduled,
CReadConfig::LOOP);
pdelete(mpProblem);
mpProblem = new CTrajectoryProblem(this);
((CTrajectoryProblem *) mpProblem)->load(configBuffer);
pdelete(mpMethod);
mpMethod = CTrajectoryMethod::createMethod();
this->add(mpMethod, true);
CCopasiParameter * pParameter = mpMethod->getParameter("Integrate Reduced Model");
if (pParameter != NULL)
mUpdateMoieties = *pParameter->getValue().pBOOL;
((CTrajectoryMethod *)mpMethod)->setProblem((CTrajectoryProblem *) mpProblem);
}
示例12: pdelete
bool CCrossSectionTask::setMethodType(const int & type)
{
CCopasiMethod::SubType Type = (CCopasiMethod::SubType) type;
if (!isValidMethod(Type, ValidMethods)) return false;
if (mpMethod->getSubType() == Type) return true;
pdelete(mpMethod);
mpMethod = createMethod(Type);
this->add(mpMethod, true);
CCopasiParameter * pParameter = mpMethod->getParameter("Integrate Reduced Model");
if (pParameter != NULL)
mUpdateMoieties = *pParameter->getValue().pBOOL;
else
mUpdateMoieties = false;
return true;
}
示例13: assertParameter
void CSteadyStateMethod::initializeParameter()
{
CCopasiParameter *pParm;
assertParameter("Resolution", CCopasiParameter::UDOUBLE, (C_FLOAT64) 1.0e-009);
mpSSResolution = (C_FLOAT64*)getValue("Resolution").pUDOUBLE;
mpDerivationResolution = (C_FLOAT64*)getValue("Resolution").pUDOUBLE;
assertParameter("Derivation Factor", CCopasiParameter::UDOUBLE, (C_FLOAT64) 1.0e-003);
mpDerivationFactor = (C_FLOAT64*)getValue("Derivation Factor").pUDOUBLE;
// Check whether we have a method with the old parameter names
if ((pParm = getParameter("Newton.DerivationFactor")) != NULL)
{
setValue("Derivation Factor", *pParm->getValue().pUDOUBLE);
removeParameter("Newton.DerivationFactor");
}
if ((pParm = getParameter("Newton.Resolution")) != NULL)
{
setValue("Resolution", *pParm->getValue().pUDOUBLE);
removeParameter("Newton.Resolution");
}
}
示例14: changeModel
void CFixLocalReactionParameters::changeModel()
{
CCopasiParameter * pParameter = NULL;
CModelValue * pModelValue = NULL;
CReaction * pReaction = NULL;
std::stringstream NameStream;
std::stringstream Message;
std::string OldCN;
std::string NewCNBase;
std::string NewCN;
std::string Infix;
std::string::size_type Start;
// Loop through all changes.
std::multimap< CCopasiParameter *, const CExpression * >::const_iterator itChanges = mChanges.begin();
std::multimap< CCopasiParameter *, const CExpression * >::const_iterator endChanges = mChanges.end();
for (; itChanges != endChanges; ++itChanges)
{
if (pParameter != itChanges->first)
{
// We have a new parameter
pParameter = itChanges->first;
OldCN = "<" + pParameter->getCN() + ",Reference=";
// Create a global quantity of type FIXED.
std::string Name = pParameter->getObjectName();
pReaction = static_cast< CReaction * >(pParameter->getObjectAncestor("Reaction"));
Name += "{" + pReaction->getObjectName() + "}";
pModelValue = mpModel->createModelValue(Name, pParameter->getValue< C_FLOAT64 >());
// In case the created name is not unique we append _n with increasing n
// until we succeed;
C_INT32 index = 0;
while (pModelValue == NULL)
{
NameStream.str("");
NameStream << Name << "_" << index++;
pModelValue = mpModel->createModelValue(NameStream.str(), pParameter->getValue< C_FLOAT64 >());
}
NewCNBase = "<" + pModelValue->getCN() + ",Reference=";
// If the parameter is actually used in the reaction
// it is changed to the global quantity.
if (pReaction->isLocalParameter(pParameter->getObjectName()))
pReaction->setParameterMapping(pParameter->getObjectName(), pModelValue->getKey());
Message << " " << pParameter->getObjectName() << " in " << pReaction->getObjectName()
<< " is replaced by " << pModelValue->getObjectName() << std::endl;
}
// We need to distinguish between initial and other expressions.
if (itChanges->second->getObjectName().compare(0, 7, "Initial") == 0)
NewCN = NewCNBase + "Initial";
else
NewCN = NewCNBase;
// Replace the OldCN of the parameter with the NewCN of global quantity in all expressions.
Infix = itChanges->second->getInfix();
// There may be more than one occurrence.
Start = 0;
while ((Start = Infix.find(OldCN), Start) != std::string::npos)
Infix.replace(Start, OldCN.length(), NewCN);
const_cast< CExpression * >(itChanges->second)->setInfix(Infix);
}
CCopasiMessage(CCopasiMessage::WARNING, MCXML + 14, Message.str().c_str());
}
示例15: slotBtnOk
void CQPreferenceDialog::slotBtnOk()
{
// We need to commit the changes
unsigned C_INT32 newMaxFiles = 0;
CConfigurationFile * configFile = CCopasiRootContainer::getConfiguration();
QList< QTreeWidgetItem *> Items = mpTreeWidget->findItems("Max Last Visited Files", 0, 0);
CCopasiParameter * pParameter = configFile->getRecentFiles().getParameter("MaxFiles");
if (Items.size() > 0 &&
pParameter != NULL)
{
newMaxFiles = Items[0]->text(COL_VALUE).toUInt();
unsigned C_INT32 maxFiles = *pParameter->getValue().pUINT;
if (newMaxFiles > 0 && newMaxFiles <= 20)
pParameter->setValue(newMaxFiles);
else
{
CQMessageBox::critical(this, "Incorrect Setting",
"Max Last Visited Files should be a number between 1 and 20.",
QMessageBox::Ok, QMessageBox::Ok);
Items[0]->setText(COL_VALUE, QString::number(maxFiles));
return;
}
}
Items = mpTreeWidget->findItems("Max Last Visited SBML Files", 0, 0);
pParameter = configFile->getRecentSBMLFiles().getParameter("MaxFiles");
if (Items.size() > 0 &&
pParameter != NULL)
{
newMaxFiles = Items[0]->text(COL_VALUE).toUInt();
unsigned C_INT32 maxFiles = *pParameter->getValue().pUINT;
if (newMaxFiles > 0 && newMaxFiles <= 20)
pParameter->setValue(newMaxFiles);
else
{
CQMessageBox::critical(this, "Incorrect Setting", "Max Last Visited SBML Files should be a number between 1 and 20.",
QMessageBox::Ok, QMessageBox::Ok);
Items[0]->setText(COL_VALUE, QString::number(maxFiles));
return;
}
}
Items = mpTreeWidget->findItems("Application for opening URLs", 0, 0);
pParameter = configFile->getParameter("Application for opening URLs");
if (Items.size() > 0 &&
pParameter != NULL)
{
if (Items[0]->text(COL_VALUE) != FROM_UTF8(*pParameter->getValue().pSTRING))
pParameter->setValue(std::string(TO_UTF8(Items[0]->text(COL_VALUE))));
}
Items = mpTreeWidget->findItems("Validate Units", 0, 0);
pParameter = configFile->getParameter("Validate Units");
if (Items.size() > 0 &&
pParameter != NULL)
{
pParameter->setValue(Items[0]->text(COL_VALUE).toUpper() == "YES");
}
Items = mpTreeWidget->findItems("Use OpenGL", 0, 0);
pParameter = configFile->getParameter("Use OpenGL");
if (Items.size() > 0 &&
pParameter != NULL)
{
pParameter->setValue(Items[0]->text(COL_VALUE).toUpper() == "YES");
}
Items = mpTreeWidget->findItems("Use Advanced Editing", 0, 0);
pParameter = configFile->getParameter("Use Advanced Editing");
if (Items.size() > 0 &&
pParameter != NULL)
{
pParameter->setValue(Items[0]->text(COL_VALUE).toUpper() == "YES");
}
done(1);
}