Exemple #1
0
        void operator()()
        {
            std::string vpzname(vpz->project().experiment().name());

            for (uint32_t i = expgen.min() + index; i <= expgen.max();
                 i += threads) {
                Simulation sim(mLogOption, mSimulationOption, NULL);
                Error err;
                vpz::Vpz *file = new vpz::Vpz(*vpz);
                setExperimentName(file, vpzname, i);
                expgen.get(i, &file->project().experiment().conditions());

                value::Map *simresult = sim.run(file, modulemgr, &err);

                if (err.code) {
                    // writeRunLog(err.message);

                    if (not error->code) {
                        error->code = -1;
                        error->message = _("Manager failure.");
                    }
                } else {
                    result->add(i, 0, simresult);
                }
            }
        }
Exemple #2
0
void
RootCoordinator::load(vpz::Vpz& io)
{
    m_begin = io.project().experiment().begin();
    m_end = m_begin + io.project().experiment().duration();
    m_currentTime = m_begin;

    m_coordinator = std::make_unique<Coordinator>(m_context,
                                                  io.project().dynamics(),
                                                  io.project().classes(),
                                                  io.project().experiment());

    m_coordinator->init(io.project().model(), m_currentTime, m_end);

    m_root = io.project().model().graph();
}
    void get(uint32_t index, vpz::Conditions *conditions)
    {
        const vpz::Conditions& cnds(mVpz.project().experiment().conditions());
        conditions->deleteValueSet();
        vpz::ConditionList& cdldst(conditions->conditionlist());

        vpz::ConditionList::const_iterator it;
        for (it = cnds.begin(); it != cnds.end(); ++it) {

            std::pair < vpz::ConditionList::iterator, bool > r =
                cdldst.insert(std::make_pair(
                        it->first, vpz::Condition(it->first)));

            const vpz::ConditionValues& cnvsrc = it->second.conditionvalues();
            vpz::ConditionValues& cnvdst = r.first->second.conditionvalues();

            for (vpz::ConditionValues::const_iterator jt = cnvsrc.begin();
                 jt != cnvsrc.end(); ++jt) {

                value::Set *cpy = new value::Set();

                if (jt->second->size() == 1) {
                    cpy->add(jt->second->get(0)->clone());
                } else if (jt->second->size() > 1 and jt->second->size() >
                           index) {
                    cpy->add(jt->second->get(index)->clone());
                } else {
                    throw utils::InternalError(fmt(
                            _("ExperimentGenerator can not access to the index"
                              " `%1%' of the condition `%2%' port `%3%' ")) %
                        index % it->first % jt->first);
                }

                delete cnvdst[jt->first];
                cnvdst[jt->first] = cpy;
            }
        }
    }
 ~Pimpl()
 {
     delete mVpz.project().model().model();
 }