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

Comparing trunk/mdtools/mpi_implementation/mpiSimulation.cpp (file contents):
Revision 195 by chuckv, Thu Dec 5 18:53:40 2002 UTC vs.
Revision 200 by mmeineke, Mon Dec 9 20:54:42 2002 UTC

# Line 26 | Line 26 | mpiSimulation::~mpiSimulation(){
26   }
27  
28  
29 < void mpiSimulation::divideLabor(int nComponents, MoleculeStamp** compStamps, int* componentsNmol ){
30 <  
29 > void mpiSimulation::divideLabor( void ){
30 >
31 >  int nComponents;
32 >  MoleculeStamp** compStamps;
33 >  int* componentsNmol;
34 >
35    double numerator;
36    double denominator;
37    double precast;
# Line 35 | Line 39 | void mpiSimulation::divideLabor(int nComponents, Molec
39    int nTarget;
40    int molIndex, atomIndex, compIndex, compStart;
41    int done;
42 <  int nLocal;
42 >  int nLocal, molLocal;
43    int i;
44    int smallDiff, bigDiff;
45  
46    int testSum;
47  
48 +  nComponents = entryPlug->nComponents;
49 +  compStamps = entryPlug->compStamps;
50 +  componentsNmol = entryPlug->componentsNmol;
51 +
52    numerator = (double) entryPlug->n_atoms;
53    denominator = (double) numberProcessors;
54    precast = numerator / denominator;
# Line 54 | Line 62 | void mpiSimulation::divideLabor(int nComponents, Molec
62      
63      done = 0;
64      nLocal = 0;
65 +    molLocal = 0;
66  
67      if( i == myNode ){
68        myMolStart = molIndex;
# Line 71 | Line 80 | void mpiSimulation::divideLabor(int nComponents, Molec
80        nLocal += compStamps[compIndex]->getNAtoms();
81        atomIndex += compStamps[compIndex]->getNAtoms();
82        molIndex++;
83 +      molLocal++;
84        
85        if ( nLocal == nTarget ) done = 1;
86        
# Line 83 | Line 93 | void mpiSimulation::divideLabor(int nComponents, Molec
93          if( bigDiff < smallDiff ) done = 1;
94          else{
95            molIndex--;
96 +          molLocal--;
97            atomIndex -= compStamps[compIndex]->getNAtoms();
98            nLocal -= compStamps[compIndex]->getNAtoms();
99            done = 1;
# Line 94 | Line 105 | void mpiSimulation::divideLabor(int nComponents, Molec
105        myMolEnd = (molIndex - 1);
106        myAtomEnd = (atomIndex - 1);
107        myNlocal = nLocal;
108 +      myMol = molLocal;
109      }
110      
111      numerator = (double)( entryPlug->n_atoms - atomIndex );
# Line 107 | Line 119 | void mpiSimulation::divideLabor(int nComponents, Molec
119        myAtomStart = atomIndex;
120  
121        nLocal = 0;
122 +      molLocal = 0;
123        while( compIndex < nComponents ){
124          
125          if( (molIndex-compStart) >= componentsNmol[compIndex] ){
# Line 118 | Line 131 | void mpiSimulation::divideLabor(int nComponents, Molec
131          nLocal += compStamps[compIndex]->getNAtoms();
132          atomIndex += compStamps[compIndex]->getNAtoms();
133          molIndex++;
134 +        molLocal++;
135        }
136        
137        myMolEnd = (molIndex - 1);
138        myAtomEnd = (atomIndex - 1);
139 <      myNlocal = nLocal;  
139 >      myNlocal = nLocal;  
140 >      myMol = molLocal;
141    }
142  
143  
# Line 141 | Line 156 | void mpiSimulation::divideLabor(int nComponents, Molec
156    sprintf( checkPointMsg,
157             "Successfully divided the molecules among the processors.\n" );
158    MPIcheckPoint();
159 +
160 +  // lets create the identity array
161   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines