Revision 08285dff src/sim/csimulation.cc

View differences:

src/sim/csimulation.cc
312 312
        vect = v;
313 313
        size += delta;
314 314
    }
315
	ev.createRNGs();
315 316
    vect[last_id] = mod;
316 317
    return last_id;
317 318
}
......
426 427
    // read config and setup thread pool
427 428
    setupThreadPool();
428 429

  
429
    // setup local RNGs for each module according to config
430
    setupLocalRNGs();
431

  
432 430
    // reset counters. Note msgQueue.clear() was already called from setupNetwork()
433 431
    cThreadPool::setSimTime(0.0);
434 432
    //sim_time = 0;
......
844 842
        return eventsPerSimTimeInstance + 1;
845 843
}
846 844

  
847
void cSimulation::setupLocalRNGs() {
848

  
849
    //
850
    // Walk through vect[] and setup RNGs for each cSimpleModule
851
    //
852
    // TODO: Better way to do this? What about dynamically created Modules?
853
    cSimpleModule* mod = NULL;
854
    for (int i = 1; i <= last_id; i++) {
855
        if (vect[i]) {
856
            mod = dynamic_cast<cSimpleModule*>(vect[i]);
857
            if (mod) {
858
                mod->initLocalRNGs();
859
            }
860
        }
861
    }
862
}
863

  
864 845
//----
865 846

  
866 847
/**
......
941 922
    virtual cEnvir& flush()  {::fflush(stdout); return *this;}
942 923

  
943 924
    // RNGs
944
    virtual int getNumRNGs() const {return 0;}
925
    virtual int getNumRNGsPerModule() const {return 0;}
945 926
    virtual cRNG *getRNG(int k)  {unsupported(); return NULL;}
946 927
    virtual void getRNGMappingFor(cComponent *component)  {component->setRNGMap(0,NULL);}
928
	virtual void createRNGs() {unsupported();}
947 929

  
948 930
    // output vectors
949 931
    virtual void *registerOutputVector(const char *modulename, const char *vectorname)  {return NULL;}

Also available in: Unified diff