ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/mpiSimulation.cpp
(Generate patch)

Comparing trunk/OOPSE/libmdtools/mpiSimulation.cpp (file contents):
Revision 708 by tim, Wed Aug 20 22:23:34 2003 UTC vs.
Revision 1108 by tim, Wed Apr 14 15:37:41 2004 UTC

# Line 1 | Line 1
1   #ifdef IS_MPI
2   #include <iostream>
3 < #include <cstdlib>
4 < #include <cstring>
5 < #include <cmath>
3 > #include <stdlib.h>
4 > #include <string.h>
5 > #include <math.h>
6   #include <mpi.h>
7  
8   #include "mpiSimulation.hpp"
# Line 10 | Line 10
10   #include "fortranWrappers.hpp"
11   #include "randomSPRNG.hpp"
12  
13 #define BASE_SEED 123456789
14
13   mpiSimulation* mpiSim;
14  
15   mpiSimulation::mpiSimulation(SimInfo* the_entryPlug)
# Line 42 | Line 40 | mpiSimulation::~mpiSimulation(){
40    
41   }
42  
43 < int* mpiSimulation::divideLabor( void ){
46 <
47 <  int* globalIndex;
43 > void mpiSimulation::divideLabor( ){
44  
45    int nComponents;
46    MoleculeStamp** compStamps;
# Line 59 | Line 55 | int* mpiSimulation::divideLabor( void ){
55    int old_atoms, add_atoms, new_atoms;
56  
57    int nTarget;
58 <  int molIndex, atomIndex, compIndex, compStart;
58 >  int molIndex, atomIndex;
59    int done;
64  int nLocal, molLocal;
60    int i, j, loops, which_proc, nmol_local, natoms_local;
61    int nmol_global, natoms_global;
62 <  int local_index, index;
68 <  int smallDiff, bigDiff;
62 >  int local_index;
63    int baseSeed = entryPlug->getSeed();
64  
71  int testSum;
72
65    nComponents = entryPlug->nComponents;
66    compStamps = entryPlug->compStamps;
67    componentsNmol = entryPlug->componentsNmol;
# Line 82 | Line 74 | int* mpiSimulation::divideLabor( void ){
74    mpiPlug->nSRIGlobal = entryPlug->n_SRI;
75    mpiPlug->nMolGlobal = entryPlug->n_mol;
76  
85  
77    myRandom = new randomSPRNG( baseSeed );
78  
79    a = 3.0 * (double)mpiPlug->nMolGlobal / (double)mpiPlug->nAtomsGlobal;
# Line 280 | Line 271 | int* mpiSimulation::divideLabor( void ){
271    mpiPlug->myNMol = nmol_local;
272    mpiPlug->myNlocal = natoms_local;
273  
274 <  globalIndex = new int[mpiPlug->myNlocal];
274 >  globalAtomIndex.resize(mpiPlug->myNlocal);
275    local_index = 0;
276    for (i = 0; i < mpiPlug->nAtomsGlobal; i++) {
277      if (AtomToProcMap[i] == mpiPlug->myNode) {
278 <      globalIndex[local_index] = i;
278 >      globalAtomIndex[local_index] = i;
279 >
280 >      globalToLocalAtom[i] = local_index;
281        local_index++;
282 +      
283      }
284 +    else
285 +       globalToLocalAtom[i] = -1;
286    }
287 +
288 +  globalMolIndex.resize(mpiPlug->myNMol);
289 +  local_index = 0;
290 +  for (i = 0; i < mpiPlug->nMolGlobal; i++) {
291 +    if (MolToProcMap[i] == mpiPlug->myNode) {
292 +      globalMolIndex[local_index] = i;
293 +      globalToLocalMol[i] = local_index;
294 +      local_index++;
295 +    }
296 +    else
297 +      globalToLocalMol[i] = -1;
298 +  }
299    
292  return globalIndex;
300   }
301  
302  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines