Changeset 4799 in /cluster/svnroot


Ignore:
Timestamp:
Jul 9, 2014 6:19:50 PM (6 years ago)
Author:
amweeden06
Message:

HPCU Precipitate Distributed - ready to begin work on pickDirections function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bccd-ng/hpcu-weekly-challenge/precipitate-distributed/precipitate.c

    r4798 r4799  
    6666    MPI_Comm_size(MPI_COMM_WORLD, &NProcs);
    6767
    68     srandom(time(NULL));
     68    srandom(Rank + time(NULL));
    6969
    7070    if (Rank == 0) {
     
    100100    MPI_Allgather(MyXPositions, NParticles/NProcs, MPI_INT,
    101101            XPositions, NParticles/NProcs, MPI_INT, MPI_COMM_WORLD);
     102    MPI_Allgather(MyYPositions, NParticles/NProcs, MPI_INT,
     103            YPositions, NParticles/NProcs, MPI_INT, MPI_COMM_WORLD);
    102104
    103105    for (i = 0; i < NTimeSteps; i++) {
     
    171173
    172174    for (i = 0; i < NParticles/NProcs; i++) {
     175        ParticleStates[i] = NONE;
    173176        MyParticleStates[i] = NONE;
    174177        MyXPositions[i] = (EnvWidth - PartWidth) * random() / RAND_MAX;
     
    182185    int dir;
    183186
    184     for (i = 0; i < NParticles; i++) {
    185         if (ParticleStates[i] != PRECIPITATING) {
     187    for (i = 0; i < NParticles/NProcs; i++) {
     188        if (MyParticleStates[i] != PRECIPITATING) {
    186189            retval = false;
    187190            dir = 4 * random() / RAND_MAX;
     
    201204            }
    202205            if (retval) {
    203                 ParticleDirections[i] = dir;
    204                 ParticleStates[i] = MOVING;
     206                MyParticleDirections[i] = dir;
     207                MyParticleStates[i] = MOVING;
    205208            } else {
    206                 ParticleStates[i] = BLOCKED;
     209                MyParticleStates[i] = BLOCKED;
    207210            }
    208211        }
Note: See TracChangeset for help on using the changeset viewer.