| 17 |
|
|
| 18 |
|
DumpWriter::DumpWriter( SimInfo* the_entry_plug ){ |
| 19 |
|
|
| 20 |
+ |
entry_plug = the_entry_plug; |
| 21 |
+ |
|
| 22 |
|
#ifdef IS_MPI |
| 23 |
|
if(worldRank == 0 ){ |
| 24 |
|
#endif // is_mpi |
| 25 |
|
|
| 26 |
< |
entry_plug = the_entry_plug; |
| 26 |
> |
|
| 27 |
|
|
| 28 |
|
strcpy( outName, entry_plug->sampleName ); |
| 29 |
|
|
| 28 |
– |
std::cerr << "Opening " << outName << " for dumping.\n"; |
| 29 |
– |
|
| 30 |
|
outFile.open(outName, ios::out | ios::trunc ); |
| 31 |
|
|
| 32 |
|
if( !outFile ){ |
| 86 |
|
|
| 87 |
|
for( i=0; i<nAtoms; i++ ){ |
| 88 |
|
|
| 89 |
+ |
|
| 90 |
|
sprintf( tempBuffer, |
| 91 |
|
"%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", |
| 92 |
|
atoms[i]->getType(), |
| 232 |
|
|
| 233 |
|
nodeAtomsStart = mpiSim->getMyAtomStart(); |
| 234 |
|
nodeAtomsEnd = mpiSim->getMyAtomEnd(); |
| 234 |
– |
|
| 235 |
– |
fprintf( stderr, |
| 236 |
– |
"node %d: myatomStart-> %d; myatomEnd-> %d\n", |
| 237 |
– |
worldRank, nodeAtomsStart, nodeAtomsEnd ); |
| 235 |
|
|
| 236 |
|
mpiErr = MPI_Send(&nodeAtomsStart,1,MPI_INT,0,TAKE_THIS_TAG, |
| 237 |
|
MPI_COMM_WORLD); |
| 238 |
|
mpiErr = MPI_Send(&nodeAtomsEnd,1,MPI_INT,0,TAKE_THIS_TAG, |
| 239 |
|
MPI_COMM_WORLD); |
| 240 |
|
|
| 244 |
– |
fprintf( stderr, "node %d: sent off the start and end\n", worldRank ); |
| 245 |
– |
|
| 241 |
|
sendError = -1; |
| 242 |
|
mpiErr = MPI_Recv(&sendError,1,MPI_INT,0,TAKE_THIS_TAG, |
| 243 |
|
MPI_COMM_WORLD, istatus); |
| 244 |
|
|
| 250 |
– |
fprintf( stderr, "node %d: value of sendError is %d\n", worldRank, sendError ); |
| 251 |
– |
|
| 245 |
|
if (sendError) MPIcheckPoint(); |
| 246 |
|
|
| 247 |
|
// send current node's configuration line by line. |
| 248 |
|
|
| 249 |
|
for( i=0; i<nAtoms; i++ ){ |
| 250 |
< |
|
| 250 |
> |
|
| 251 |
|
sprintf( tempBuffer, |
| 252 |
|
"%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", |
| 253 |
|
atoms[i]->getType(), |
| 256 |
|
atoms[i]->getZ(), |
| 257 |
|
atoms[i]->get_vx(), |
| 258 |
|
atoms[i]->get_vy(), |
| 259 |
< |
atoms[i]->get_vz()); |
| 259 |
> |
atoms[i]->get_vz()); // check here. |
| 260 |
|
strcpy( writeLine, tempBuffer ); |
| 261 |
|
|
| 262 |
|
if( atoms[i]->isDirectional() ){ |
| 278 |
|
else |
| 279 |
|
strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" ); |
| 280 |
|
|
| 288 |
– |
fprintf( stderr, |
| 289 |
– |
"node %d: I'm sending the line:\n->%s\n", worldRank, writeLine ); |
| 290 |
– |
|
| 281 |
|
mpiErr = MPI_Send(writeLine,BUFFERSIZE,MPI_CHAR,0,TAKE_THIS_TAG, |
| 282 |
|
MPI_COMM_WORLD); |
| 283 |
|
} |
| 404 |
|
|
| 405 |
|
masterIndex = 0; |
| 406 |
|
|
| 417 |
– |
std::cerr << "about to write node 0 aztoms. nAtoms = " << nAtoms << "\n"; |
| 418 |
– |
|
| 407 |
|
for( i=0; i<nAtoms; i++ ){ |
| 408 |
|
|
| 409 |
|
sprintf( tempBuffer, |