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 202 by mmeineke, Tue Dec 10 21:41:26 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 +  simTotAtoms = entryPlug->n_atoms;
53 +  simTotBonds = entryPlug->n_bonds;
54 +  simTotBends = entryPlug->n_bends;
55 +  simTotTorsions = entryPlug->n_torsions;
56 +  simTotSRI = entryPlug->n_SRI;
57 +  simTotNmol = entryPlug->n_nmol;
58 +
59    numerator = (double) entryPlug->n_atoms;
60    denominator = (double) numberProcessors;
61    precast = numerator / denominator;
# Line 54 | Line 69 | void mpiSimulation::divideLabor(int nComponents, Molec
69      
70      done = 0;
71      nLocal = 0;
72 +    molLocal = 0;
73  
74      if( i == myNode ){
75        myMolStart = molIndex;
# Line 71 | Line 87 | void mpiSimulation::divideLabor(int nComponents, Molec
87        nLocal += compStamps[compIndex]->getNAtoms();
88        atomIndex += compStamps[compIndex]->getNAtoms();
89        molIndex++;
90 +      molLocal++;
91        
92        if ( nLocal == nTarget ) done = 1;
93        
# Line 83 | Line 100 | void mpiSimulation::divideLabor(int nComponents, Molec
100          if( bigDiff < smallDiff ) done = 1;
101          else{
102            molIndex--;
103 +          molLocal--;
104            atomIndex -= compStamps[compIndex]->getNAtoms();
105            nLocal -= compStamps[compIndex]->getNAtoms();
106            done = 1;
# Line 94 | Line 112 | void mpiSimulation::divideLabor(int nComponents, Molec
112        myMolEnd = (molIndex - 1);
113        myAtomEnd = (atomIndex - 1);
114        myNlocal = nLocal;
115 +      myMol = molLocal;
116      }
117      
118      numerator = (double)( entryPlug->n_atoms - atomIndex );
# Line 107 | Line 126 | void mpiSimulation::divideLabor(int nComponents, Molec
126        myAtomStart = atomIndex;
127  
128        nLocal = 0;
129 +      molLocal = 0;
130        while( compIndex < nComponents ){
131          
132          if( (molIndex-compStart) >= componentsNmol[compIndex] ){
# Line 118 | Line 138 | void mpiSimulation::divideLabor(int nComponents, Molec
138          nLocal += compStamps[compIndex]->getNAtoms();
139          atomIndex += compStamps[compIndex]->getNAtoms();
140          molIndex++;
141 +        molLocal++;
142        }
143        
144        myMolEnd = (molIndex - 1);
145        myAtomEnd = (atomIndex - 1);
146 <      myNlocal = nLocal;  
146 >      myNlocal = nLocal;  
147 >      myMol = molLocal;
148    }
149  
150  
# Line 141 | Line 163 | void mpiSimulation::divideLabor(int nComponents, Molec
163    sprintf( checkPointMsg,
164             "Successfully divided the molecules among the processors.\n" );
165    MPIcheckPoint();
166 +
167 +  // lets create the identity array
168   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines