301 |
|
moleculeStamps_.push_back(molStamp); |
302 |
|
molStampIds_.insert(molStampIds_.end(), nmol, curStampId) |
303 |
|
} |
304 |
+ |
|
305 |
+ |
void SimInfo::update() { |
306 |
+ |
|
307 |
+ |
|
308 |
+ |
|
309 |
+ |
//SimInfo is responsible for creating localToGlobalAtomIndex and localToGlobalGroupIndex |
310 |
+ |
std::vector<int> localToGlobalAtomIndex(getNAtoms(), 0); |
311 |
+ |
std::vector<int> localToGlobalCutoffGroupIndex; |
312 |
+ |
typename SimInfo::MoleculeIterator mi; |
313 |
+ |
typename Molecule::AtomIterator ai; |
314 |
+ |
typename Molecule::CutoffGroupIterator ci; |
315 |
+ |
Molecule* mol; |
316 |
+ |
Atom* atom; |
317 |
+ |
CutoffGroup* cg; |
318 |
+ |
mpiSimData parallelData; |
319 |
+ |
int isError; |
320 |
|
|
321 |
+ |
for (mol = beginMolecule(mi); mol != NULL; mol = nextMolecule(mi)) { |
322 |
+ |
|
323 |
+ |
//local index(index in DataStorge) of atom is important |
324 |
+ |
for (atom = mol->beginAtom(ai); atom != NULL; atom = mol->nextAtom(ai)) { |
325 |
+ |
localToGlobalAtomIndex[atom->getLocalIndex()] = atom->getGlobalIndex() + 1; |
326 |
+ |
} |
327 |
+ |
|
328 |
+ |
//local index of cutoff group is trivial, it only depends on the order of travesing |
329 |
+ |
for (cg = mol->beginCutoffGroup(ci); cg != NULL; cg = mol->nextCutoffGroup(ci)) { |
330 |
+ |
localToGlobalCutoffGroupIndex.push_back(cg->getGlobalIndex() + 1); |
331 |
+ |
} |
332 |
+ |
|
333 |
+ |
} |
334 |
+ |
|
335 |
+ |
//Setup Parallel Data and pass the index arrays to fortran |
336 |
+ |
parallelData.nMolGlobal = getNMolGlobal(); |
337 |
+ |
parallelData.nMolLocal = ; |
338 |
+ |
parallelData.nAtomsGlobal = ; |
339 |
+ |
parallelData.nAtomsLocal = ; |
340 |
+ |
parallelData.nGroupsGlobal = ; |
341 |
+ |
parallelData.nGroupsLocal = ; |
342 |
+ |
parallelData.myNode = worldRank; |
343 |
+ |
MPI_Comm_size(MPI_COMM_WORLD, &(parallelData->nProcessors)); |
344 |
+ |
|
345 |
+ |
setFsimParallel(parallelData, &(parallelData->nAtomsLocal), |
346 |
+ |
&localToGlobalAtomIndex[0], &(parallelData->nGroupsLocal), |
347 |
+ |
&localToGlobalCutoffGroupIndex[0], &isError); |
348 |
+ |
|
349 |
+ |
if (isError) { |
350 |
+ |
sprintf(painCave.errMsg, |
351 |
+ |
"mpiRefresh errror: fortran didn't like something we gave it.\n"); |
352 |
+ |
painCave.isFatal = 1; |
353 |
+ |
simError(); |
354 |
+ |
} |
355 |
+ |
|
356 |
+ |
sprintf(checkPointMsg, " mpiRefresh successful.\n"); |
357 |
+ |
MPIcheckPoint(); |
358 |
+ |
|
359 |
+ |
|
360 |
+ |
} |
361 |
+ |
|
362 |
|
std::ostream& operator <<(ostream& o, SimInfo& info) { |
363 |
|
|
364 |
|
return o; |