ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/math/ParallelRandNumGen.cpp
(Generate patch)

Comparing trunk/OOPSE-4/src/math/ParallelRandNumGen.cpp (file contents):
Revision 3469 by gezelter, Fri Apr 25 15:14:47 2008 UTC vs.
Revision 3470 by gezelter, Wed Oct 22 20:01:49 2008 UTC

# Line 51 | Line 51 | namespace oopse {
51    ParallelRandNumGen::ParallelRandNumGen(const uint32& oneSeed) {
52  
53      const int masterNode = 0;
54 <    int seed = oneSeed;
54 >    unsigned long seed = oneSeed;
55 >
56   #ifdef IS_MPI
57      MPI_Bcast(&seed, 1, MPI_UNSIGNED_LONG, masterNode, MPI_COMM_WORLD);
58   #endif
59 +
60      if (seed != oneSeed) {
61        sprintf(painCave.errMsg,
62                "Using different seed to initialize ParallelRandNumGen.\n");
# Line 64 | Line 66 | namespace oopse {
66  
67      int nProcessors;
68   #ifdef IS_MPI
69 <    MPI_Comm_size(MPI_COMM_WORLD, &nProcessors);
69 >    MPI_Comm_size( MPI_COMM_WORLD, &nProcessors);
70      MPI_Comm_rank( MPI_COMM_WORLD, &myRank_);
71   #else
72      nProcessors = 1;
# Line 74 | Line 76 | namespace oopse {
76      //actual seed used by random number generator is the seed passed
77      //to the constructor plus the number of random number generators
78      //which are already created.
79 <    int newSeed = oneSeed + nCreatedRNG_;
79 >    unsigned long newSeed = oneSeed + nCreatedRNG_;
80      mtRand_ = new MTRand(newSeed, nProcessors, myRank_);
81      
82      ++nCreatedRNG_;
# Line 86 | Line 88 | namespace oopse {
88      const int masterNode = 0;
89      int nProcessors;
90   #ifdef IS_MPI
91 <    MPI_Comm_size(MPI_COMM_WORLD, &nProcessors);
91 >    MPI_Comm_size( MPI_COMM_WORLD, &nProcessors);
92      MPI_Comm_rank( MPI_COMM_WORLD, &myRank_);
93   #else
94      nProcessors = 1;
# Line 102 | Line 104 | namespace oopse {
104    void ParallelRandNumGen::seed( const uint32 oneSeed ) {
105  
106      const int masterNode = 0;
107 <    int seed = oneSeed;
107 >    unsigned long seed = oneSeed;
108   #ifdef IS_MPI
109      MPI_Bcast(&seed, 1, MPI_UNSIGNED_LONG, masterNode, MPI_COMM_WORLD);
110   #endif
# Line 113 | Line 115 | namespace oopse {
115        simError();
116      }
117      
118 <    int newSeed = oneSeed +nCreatedRNG_;
118 >    unsigned long newSeed = oneSeed +nCreatedRNG_;
119      mtRand_->seed(newSeed);
120      
121      ++nCreatedRNG_;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines