ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/DumpWriter.cpp
(Generate patch)

Comparing trunk/OOPSE/libmdtools/DumpWriter.cpp (file contents):
Revision 907 by gezelter, Thu Jan 8 17:40:56 2004 UTC vs.
Revision 912 by gezelter, Thu Jan 8 18:59:36 2004 UTC

# Line 66 | Line 66 | void DumpWriter::writeDump( double currentTime ){
66   void DumpWriter::writeDump( double currentTime ){
67  
68    const int BUFFERSIZE = 2000;
69 <  const int MINIBUFFERSIZE = 10;
69 >  const int MINIBUFFERSIZE = 100;
70  
71    char tempBuffer[BUFFERSIZE];
72    char writeLine[BUFFERSIZE];
# Line 78 | Line 78 | void DumpWriter::writeDump( double currentTime ){
78    double atomOrientData[7];
79    int isDirectional;
80    char* atomTypeString;
81 +  char MPIatomTypeString[MINIBUFFERSIZE];
82    int me;
83    int atomTypeTag;
84    int atomIsDirectionalTag;
# Line 199 | Line 200 | void DumpWriter::writeDump( double currentTime ){
200          atomTransDataTag     = 4*i + 2;
201          atomOrientDataTag    = 4*i + 3;
202  
203 <        MPI_Recv(atomTypeString, MINIBUFFERSIZE, MPI_CHAR, which_node,
203 >        MPI_Recv(MPIatomTypeString, MINIBUFFERSIZE, MPI_CHAR, which_node,
204                   atomTypeTag, MPI_COMM_WORLD, &istatus);
205          
206 +        strncpy(atomTypeString, MPIatomTypeString, MINIBUFFERSIZE);
207 +        
208 +        // Null terminate the atomTypeString just in case:
209 +
210 +        atomTypeString[strlen(atomTypeString) - 1] = '\0';
211 +
212          MPI_Recv(&isDirectional, 1, MPI_INT, which_node,
213                   atomIsDirectionalTag, MPI_COMM_WORLD, &istatus);
214          
# Line 373 | Line 380 | void DumpWriter::writeDump( double currentTime ){
380          atomTransDataTag     = 4*i + 2;
381          atomOrientDataTag    = 4*i + 3;
382  
383 <        MPI_Send(atomTypeString, MINIBUFFERSIZE, MPI_CHAR, 0,
383 >
384 >        strncpy(MPIatomTypeString, atomTypeString, MINIBUFFERSIZE);
385 >
386 >        // null terminate the string before sending (just in case):
387 >        MPIatomTypeString[MINIBUFFERSIZE-1] = '\0';
388 >
389 >        MPI_Send(MPIatomTypeString, MINIBUFFERSIZE, MPI_CHAR, 0,
390                   atomTypeTag, MPI_COMM_WORLD);
391          
392          MPI_Send(&isDirectional, 1, MPI_INT, 0,
# Line 409 | Line 422 | void DumpWriter::writeFinal(double finalTime){
422    ofstream finalOut;
423  
424    const int BUFFERSIZE = 2000;
425 <  const int MINIBUFFERSIZE = 10;
425 >  const int MINIBUFFERSIZE = 100;
426    char tempBuffer[BUFFERSIZE];
427    char writeLine[BUFFERSIZE];
428  
# Line 423 | Line 436 | void DumpWriter::writeFinal(double finalTime){
436    double atomOrientData[7];
437    int isDirectional;
438    char* atomTypeString;
439 +  char MPIatomTypeString[MINIBUFFERSIZE];
440    int atomTypeTag;
441    int atomIsDirectionalTag;
442    int atomTransDataTag;
# Line 564 | Line 578 | void DumpWriter::writeFinal(double finalTime){
578          atomTransDataTag     = 4*i + 2;
579          atomOrientDataTag    = 4*i + 3;
580  
581 <        MPI_Recv(atomTypeString, MINIBUFFERSIZE, MPI_CHAR, which_node,
581 >        MPI_Recv(MPIatomTypeString, MINIBUFFERSIZE, MPI_CHAR, which_node,
582                   atomTypeTag, MPI_COMM_WORLD, &istatus);
583          
584 +        strncpy(atomTypeString, MPIatomTypeString, MINIBUFFERSIZE);
585 +
586          MPI_Recv(&isDirectional, 1, MPI_INT, which_node,
587                   atomIsDirectionalTag, MPI_COMM_WORLD, &istatus);
588          
# Line 738 | Line 754 | void DumpWriter::writeFinal(double finalTime){
754          atomTransDataTag     = 4*i + 2;
755          atomOrientDataTag    = 4*i + 3;
756  
757 <        MPI_Send(atomTypeString, MINIBUFFERSIZE, MPI_CHAR, 0,
757 >        strncpy(MPIatomTypeString, atomTypeString, MINIBUFFERSIZE);
758 >
759 >        MPI_Send(MPIatomTypeString, MINIBUFFERSIZE, MPI_CHAR, 0,
760                   atomTypeTag, MPI_COMM_WORLD);
761          
762          MPI_Send(&isDirectional, 1, MPI_INT, 0,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines