Exemplo n.º 1
0
// virtual
void CModelParameterReactionParameter::compile()
{
    CModelParameter::compile();

    mGlobalQuantityCN = std::string();

    std::string Infix = getInitialExpression();

    if (Infix.length() > 2)
    {
        // Infix: <CN,Reference=InitialValue> or <CN,Reference=Value>
        CCopasiObjectName Tmp = Infix.substr(1, Infix.length() - 2);
        std::string Separator = "";

        for (; Tmp != ""; Tmp = Tmp.getRemainder())
        {
            CCopasiObjectName Primary = Tmp.getPrimary();

            if (Primary.getObjectType() == "Reference")
            {
                break;
            }

            mGlobalQuantityCN += Separator + Primary;
            Separator = ",";
        }

        setSimulationType(CModelEntity::ASSIGNMENT);
    }
    else
    {
        setSimulationType(CModelEntity::FIXED);
    }

    mpGlobalQuantity = this->getSet()->getModelParameter(mGlobalQuantityCN);

    if (mpGlobalQuantity != NULL)
    {
        mValue = mpGlobalQuantity->getValue(ParticleNumbers);
    }

    std::vector< CCopasiContainer * > ListOfContainer;

    CModel * pModel = getModel();
    ListOfContainer.push_back(pModel);

    mpReaction = static_cast< CReaction * >(pModel->getObjectDataModel()->ObjectFromName(ListOfContainer, mpParent->getCN()));
}
Exemplo n.º 2
0
// virtual
void CModelParameterSpecies::setCN(const CCopasiObjectName & cn)
{
    CModelParameter::setCN(cn);

    // Determine the CN for the compartment.
    // "CN=Root,Model=New Model,Vector=Compartments[compartment],Vector=Metabolites[A]"
    CCopasiObjectName Tmp = mCN;
    std::string Separator = "";

    for (; Tmp != ""; Tmp = Tmp.getRemainder())
    {
        CCopasiObjectName Primary = Tmp.getPrimary();
        mCompartmentCN += Separator + Primary;
        Separator = ",";

        if (Primary.getObjectType() == "Vector" &&
                Primary.getObjectName() == "Compartments")
        {
            break;
        }
    }
}