--- trunk/mdtools/mpi_implementation/mpiSimulation.cpp 2003/01/28 22:16:55 252 +++ trunk/mdtools/mpi_implementation/mpiSimulation.cpp 2003/01/30 15:20:21 253 @@ -1,4 +1,4 @@ -i#include +#include #include #include @@ -19,7 +19,7 @@ mpiSimulation::mpiSimulation(SimInfo* the_entryPlug) mpiSimulation::mpiSimulation(SimInfo* the_entryPlug) { entryPlug = the_entryPlug; - mpiPlug = new MpiSimData; + mpiPlug = new mpiSimData; mpiPlug->numberProcessors = MPI::COMM_WORLD.Get_size(); mpiPlug->myNode = worldRank; @@ -44,8 +44,10 @@ void mpiSimulation::wrapMe(){ -void mpiSimulation::divideLabor( void ){ +int* mpiSimulation::divideLabor( void ){ + int* globalIndex; + int nComponents; MoleculeStamp** compStamps; int* componentsNmol; @@ -58,7 +60,7 @@ void mpiSimulation::divideLabor( void ){ int molIndex, atomIndex, compIndex, compStart; int done; int nLocal, molLocal; - int i; + int i, index; int smallDiff, bigDiff; int testSum; @@ -72,7 +74,7 @@ void mpiSimulation::divideLabor( void ){ mpiPlug->nBendsGlobal = entryPlug->n_bends; mpiPlug->nTorsionsGlobal = entryPlug->n_torsions; mpiPlug->nSRIGlobal = entryPlug->n_SRI; - mpiPlug->nMolGlobal = entryPlug->n_nmol; + mpiPlug->nMolGlobal = entryPlug->n_mol; numerator = (double) entryPlug->n_atoms; denominator = (double) mpiPlug->numberProcessors; @@ -183,6 +185,15 @@ void mpiSimulation::divideLabor( void ){ MPIcheckPoint(); // lets create the identity array + + globalIndex = new int[mpiPlug->myNlocal]; + index = mpiPlug->myAtomStart; + for( i=0; imyNlocal; i++){ + globalIndex[i] = index; + index++; + } + + return globalIndex; } @@ -190,3 +201,30 @@ void wrapSimParallel(void (*fSub)(mpiSimData*, int*, i mpiSim->setInternal( fSub ); } + + +void mpiSimulation::mpiRefresh( void ){ + + int isError, i; + int *globalIndex = new int[mpiPlug->myNlocal]; + + for(i=0; imyNlocal; i++) globalIndex[i] = entryPlug->atoms[i]->getGlobalIndex(); + + + isError = 0; + setFsimParallel( mpiPlug, &(entryPlug->n_atoms), globalIndex, &isError ); + if( isError ){ + + sprintf( painCave.errMsg, + "mpiRefresh errror: fortran didn't like something we gave it.\n" ); + painCave.isFatal = 1; + simError(); + } + + delete[] globalIndex; + + sprintf( checkPointMsg, + " mpiRefresh successful.\n" ); + MPIcheckPoint(); +} +