Exemple #1
0
void Fixed::initPushVariables() {
    QMap<QString, double> pvList = decodeList<QString, double>(pushVariablesAsString, this);
    int n = pvList.size();
    pushVariables.fill(0, n);

    int i = -1;
    QMapIterator<QString, double> pv(pvList);
    while(pv.hasNext()) {
        ++i;
        pv.next();
        Identifier id = pv.key();
        pushVariables[i] = pv.value();
        double *valuePtr = &pushVariables[i];
        new PushVariable<double>(id, valuePtr, this, id.label() + " set to fixed value");
    }
}
Exemple #2
0
void Phenology::initialize() {
    stages = seekChildren<Model*>("*");
    int n = stages.size();
    if (n == 0)
        throw Exception("There must be at least one UniSim::Stage child model");

    proportions.fill(0., n);
    for (int i = 0; i < n; ++i) {
        Identifier id = stages[i]->id();
        double *valuePtr = &proportions[i];
        new PullVariable<double>(id, valuePtr, this,
        "Proportion of plant population in " + id.label() + " stage. "
        "Note: The number and names of these pull variables are defined by the stages "
        "included as children of @F Phenology in the XML model file.");
    }
}
Exemple #3
0
void Fixed::initParameters() {
    QMap<QString, double> pList = decodeList<QString, double>(parametersAsString, this);
    int n = pList.size();
    parameters.fill(0, n);

    int i = -1;
    QMapIterator<QString, double> pa(pList);
    while(pa.hasNext()) {
        ++i;
        pa.next();
        Identifier id = pa.key();
        parameters[i] = pa.value();
        double *valuePtr = &parameters[i];
        new Parameter<double>(id, valuePtr, pa.value(), this, id.label() + " set to fixed value");
    }
}
Exemple #4
0
Authors::Author Authors::find(Identifier id) {
    if (!theCollection.contains(id))
        throw Exception("Author id '" + id.label() + "' is missing");
    return theCollection.value(id);
}