--- trunk/OOPSE/libmdtools/DumpWriter.cpp 2003/03/27 15:07:29 419 +++ trunk/OOPSE/libmdtools/DumpWriter.cpp 2003/03/28 19:30:59 434 @@ -6,7 +6,7 @@ #include #include #include "mpiSimulation.hpp" -#define TAKE_THIS_TAG 0 +#define TAKE_THIS_TAG 1 #endif //is_mpi #include "ReadWrite.hpp" @@ -132,15 +132,14 @@ void DumpWriter::writeDump( double currentTime ){ << entry_plug->box_x << "\t" << entry_plug->box_y << "\t" << entry_plug->box_z << "\n"; - + outFile.flush(); for (i = 0 ; i < mpiSim->getTotAtoms(); i++ ) { // Get the Node number which has this atom; which_node = AtomToProcMap[i]; if (which_node == mpiSim->getMyNode()) { - - sprintf( tempBuffer, + sprintf( tempBuffer, "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", atoms[i]->getType(), atoms[i]->getX(), @@ -172,12 +171,16 @@ void DumpWriter::writeDump( double currentTime ){ } else { + std::cerr << "node 0: sending node " << which_node << " request for atom " << i << "\n"; MPI::COMM_WORLD.Send(&i, 1, MPI_INT, which_node, TAKE_THIS_TAG); + std::cerr << "node 0: sent!\n"; MPI::COMM_WORLD.Recv(writeLine, BUFFERSIZE, MPI_CHAR, which_node, TAKE_THIS_TAG, istatus); + std::cerr << "node 0: got this line: " << writeLine; } outFile << writeLine; + outFile.flush(); } // kill everyone off: @@ -190,9 +193,10 @@ void DumpWriter::writeDump( double currentTime ){ done = 0; while (!done) { + std::cerr << "node: " << mpiSim->getMyNode() << " Waiting for receive \n"; MPI::COMM_WORLD.Recv(&which_atom, 1, MPI_INT, 0, TAKE_THIS_TAG, istatus); - + std::cerr << "node: " << mpiSim->getMyNode() << " got request for atom " << which_atom << "\n"; if (which_atom == -1) { done=1; continue; @@ -232,7 +236,7 @@ void DumpWriter::writeDump( double currentTime ){ } else strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" ); - + std::cerr << "node: " << mpiSim->getMyNode() << " sending this line" << writeLine; MPI::COMM_WORLD.Send(writeLine, BUFFERSIZE, MPI_CHAR, 0, TAKE_THIS_TAG); } else {