本文整理汇总了C++中CCompartment::getObjectName方法的典型用法代码示例。如果您正苦于以下问题:C++ CCompartment::getObjectName方法的具体用法?C++ CCompartment::getObjectName怎么用?C++ CCompartment::getObjectName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCompartment
的用法示例。
在下文中一共展示了CCompartment::getObjectName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: redo
void InsertCompartmentRowsCommand::redo()
{
if (firstTime)
{
mpCompartmentDM->insertNewCompartmentRow(mPosition, mRows, QModelIndex());
assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
CCopasiDataModel* pDataModel = (*CCopasiRootContainer::getDatamodelList())[0];
assert(pDataModel != NULL);
CModel * pModel = pDataModel->getModel();
assert(pModel != NULL);
CCompartment *pCompartment = pModel->getCompartments()[mPosition];
mpCompartmentData->setName(pCompartment->getObjectName());
mpCompartmentData->setStatus(pCompartment->getStatus());
mpCompartmentData->setInitialValue(pCompartment->getInitialValue());
firstTime = false;
}
else
{
mpCompartmentDM->addCompartmentRow(mpCompartmentData);
}
setUndoState(true);
setAction("Add to list");
setName(mpCompartmentData->getName());
}
示例2: removeRows
bool CQCompartmentDM::removeRows(QModelIndexList rows, const QModelIndex& index)
{
if (rows.isEmpty())
return false;
// Build the list of pointers to items to be deleted
// before actually deleting any item.
QList <CCompartment *> Compartments;
QModelIndexList::const_iterator i;
for (i = rows.begin(); i != rows.end(); ++i)
if (!isDefaultRow(*i) &&
&mpCompartments->operator[](i->row()) != NULL)
{
Compartments.append(&mpCompartments->operator[](i->row()));
}
QList< CCompartment * >::const_iterator j;
for (j = Compartments.begin(); j != Compartments.end(); ++j)
{
CCompartment * pCompartment = *j;
QMessageBox::StandardButton choice =
CQMessageBox::confirmDelete(NULL, "compartment",
FROM_UTF8(pCompartment->getObjectName()),
pCompartment);
if (choice == QMessageBox::Ok)
{
removeRows(mpCompartments->getIndex(pCompartment->getObjectName()), 1);
}
}
return true;
}
示例3: main
int main()
{
// initialize the backend library
// since we are not interested in the arguments
// that are passed to main, we pass 0 and NULL to
// init
CCopasiRootContainer::init(0, NULL);
assert(CCopasiRootContainer::getRoot() != NULL);
// create a new datamodel
CCopasiDataModel* pDataModel = CCopasiRootContainer::addDatamodel();
assert(CCopasiRootContainer::getDatamodelList()->size() == 1);
// get the model from the datamodel
CModel* pModel = pDataModel->getModel();
assert(pModel != NULL);
// set the units for the model
// we want seconds as the time unit
// microliter as the volume units
// and nanomole as the substance units
pModel->setTimeUnit(CModel::s);
pModel->setVolumeUnit(CModel::microl);
pModel->setQuantityUnit(CModel::nMol);
// we have to keep a set of all the initial values that are changed during
// the model building process
// They are needed after the model has been built to make sure all initial
// values are set to the correct initial value
std::set<const CCopasiObject*> changedObjects;
// create a compartment with the name cell and an initial volume of 5.0
// microliter
CCompartment* pCompartment = pModel->createCompartment("cell", 5.0);
const CCopasiObject* pObject = pCompartment->getValueReference();
assert(pObject != NULL);
changedObjects.insert(pObject);
assert(pCompartment != NULL);
assert(pModel->getCompartments().size() == 1);
// create a new metabolite with the name S and an inital
// concentration of 10 nanomol
// the metabolite belongs to the compartment we created and is is to be
// fixed
CMetab* pS = pModel->createMetabolite("S", pCompartment->getObjectName(), 10.0, CMetab::FIXED);
pObject = pS->getInitialConcentrationReference();
assert(pObject != NULL);
changedObjects.insert(pObject);
assert(pCompartment != NULL);
assert(pS != NULL);
assert(pModel->getMetabolites().size() == 1);
// create a second metabolite called P with an initial
// concentration of 0. This metabolite is to be changed by reactions
CMetab* pP = pModel->createMetabolite("P", pCompartment->getObjectName(), 0.0, CMetab::REACTIONS);
assert(pP != NULL);
pObject = pP->getInitialConcentrationReference();
assert(pObject != NULL);
changedObjects.insert(pObject);
assert(pModel->getMetabolites().size() == 2);
// now we create a reaction
CReaction* pReaction = pModel->createReaction("reaction");
assert(pReaction != NULL);
assert(pModel->getReactions().size() == 1);
// reaction converts S to P
// we can set these on the chemical equation of the reaction
CChemEq* pChemEq = &pReaction->getChemEq();
// S is a substrate with stoichiometry 1
pChemEq->addMetabolite(pS->getKey(), 1.0, CChemEq::SUBSTRATE);
// P is a product with stoichiometry 1
pChemEq->addMetabolite(pP->getKey(), 1.0, CChemEq::PRODUCT);
assert(pChemEq->getSubstrates().size() == 1);
assert(pChemEq->getProducts().size() == 1);
// this reaction is to be irreversible
pReaction->setReversible(false);
assert(pReaction->isReversible() == false);
CModelValue* pMV = pModel->createModelValue("K", 42.0);
// set the status to FIXED
pMV->setStatus(CModelValue::FIXED);
assert(pMV != NULL);
pObject = pMV->getInitialValueReference();
assert(pObject != NULL);
changedObjects.insert(pObject);
assert(pModel->getModelValues().size() == 1);
// now we ned to set a kinetic law on the reaction
// for this we create a user defined function
CFunctionDB* pFunDB = CCopasiRootContainer::getFunctionList();
assert(pFunDB != NULL);
CKinFunction* pFunction = new CKinFunction("My Rate Law");
pFunDB->add(pFunction, true);
CFunction* pRateLaw = dynamic_cast<CFunction*>(pFunDB->findFunction("My Rate Law"));
assert(pRateLaw != NULL);
// now we create the formula for the function and set it on the function
std::string formula = "(1-0.4/(EXPONENTIALE^(temp-37)))*0.00001448471257*1.4^(temp-37)*substrate";
bool result = pFunction->setInfix(formula);
assert(result == true);
// make the function irreversible
pFunction->setReversible(TriFalse);
//.........这里部分代码省略.........