| 6 |  | #include <mpi.h> | 
| 7 |  | #include <mpi++.h> | 
| 8 |  | #include "mpiSimulation.hpp" | 
| 9 | < | #define TAKE_THIS_TAG 0 | 
| 9 | > | #define TAKE_THIS_TAG 1 | 
| 10 |  | #endif //is_mpi | 
| 11 |  |  | 
| 12 |  | #include "ReadWrite.hpp" | 
| 132 |  | << entry_plug->box_x << "\t" | 
| 133 |  | << entry_plug->box_y << "\t" | 
| 134 |  | << entry_plug->box_z << "\n"; | 
| 135 | < |  | 
| 135 | > | outFile.flush(); | 
| 136 |  | for (i = 0 ; i < mpiSim->getTotAtoms(); i++ ) { | 
| 137 |  | // Get the Node number which has this atom; | 
| 138 |  |  | 
| 139 |  | which_node = AtomToProcMap[i]; | 
| 140 |  |  | 
| 141 |  | if (which_node == mpiSim->getMyNode()) { | 
| 142 | < |  | 
| 143 | < | sprintf( tempBuffer, | 
| 142 | > | sprintf( tempBuffer, | 
| 143 |  | "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", | 
| 144 |  | atoms[i]->getType(), | 
| 145 |  | atoms[i]->getX(), | 
| 171 |  |  | 
| 172 |  | } else { | 
| 173 |  |  | 
| 174 | + | std::cerr << "node 0: sending node " << which_node << " request for atom " << i << "\n"; | 
| 175 |  | MPI::COMM_WORLD.Send(&i, 1, MPI_INT, which_node, TAKE_THIS_TAG); | 
| 176 | + | std::cerr << "node 0: sent!\n"; | 
| 177 |  | MPI::COMM_WORLD.Recv(writeLine, BUFFERSIZE, MPI_CHAR, which_node, | 
| 178 |  | TAKE_THIS_TAG, istatus); | 
| 179 | + | std::cerr << "node 0: got this line: " << writeLine; | 
| 180 |  | } | 
| 181 |  |  | 
| 182 |  | outFile << writeLine; | 
| 183 | + | outFile.flush(); | 
| 184 |  | } | 
| 185 |  |  | 
| 186 |  | // kill everyone off: | 
| 193 |  |  | 
| 194 |  | done = 0; | 
| 195 |  | while (!done) { | 
| 196 | + | std::cerr << "node: " << mpiSim->getMyNode() << " Waiting for receive \n"; | 
| 197 |  | MPI::COMM_WORLD.Recv(&which_atom, 1, MPI_INT, 0, | 
| 198 |  | TAKE_THIS_TAG, istatus); | 
| 199 | < |  | 
| 199 | > | std::cerr << "node: " << mpiSim->getMyNode() << " got request for atom " << which_atom << "\n"; | 
| 200 |  | if (which_atom == -1) { | 
| 201 |  | done=1; | 
| 202 |  | continue; | 
| 236 |  | } | 
| 237 |  | else | 
| 238 |  | strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" ); | 
| 239 | < |  | 
| 239 | > | std::cerr << "node: " << mpiSim->getMyNode() << " sending this line" << writeLine; | 
| 240 |  | MPI::COMM_WORLD.Send(writeLine, BUFFERSIZE, MPI_CHAR, 0, | 
| 241 |  | TAKE_THIS_TAG); | 
| 242 |  | } else { |