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 919 by tim, Sat Jan 10 02:15:35 2004 UTC vs.
Revision 927 by tim, Mon Jan 12 22:54:42 2004 UTC

# Line 160 | Line 160 | void DumpWriter::writeDump( double currentTime ){
160  
161   #else // is_mpi
162  
163  cout << "master" <<endl;
163    /* code to find maximum tag value */
164    
165 <  int tagub, flag, MAXTAG;
165 >  int *tagub, flag, MAXTAG;
166    MPI_Attr_get(MPI_COMM_WORLD, MPI_TAG_UB, &tagub, &flag);
167    if (flag) {
168 <    MAXTAG = tagub;
168 >    MAXTAG = *tagub;
169    } else {
170      MAXTAG = 32767;
171    }  
# Line 229 | Line 228 | void DumpWriter::writeDump( double currentTime ){
228          MPI_Recv(MPIatomTypeString, MINIBUFFERSIZE, MPI_CHAR, which_node,
229                   myPotato, MPI_COMM_WORLD, &istatus);
230          
231 <        strncpy(atomTypeString, MPIatomTypeString, MINIBUFFERSIZE);
231 >        //strncpy(atomTypeString, MPIatomTypeString, MINIBUFFERSIZE);
232          
233          // Null terminate the atomTypeString just in case:
234  
235 <        atomTypeString[strlen(atomTypeString) - 1] = '\0';
236 <
235 >        //atomTypeString[strlen(atomTypeString) - 1] = '\0';
236 >        atomTypeString = MPIatomTypeString;
237 >        
238          myPotato++;
239  
240          MPI_Recv(&isDirectional, 1, MPI_INT, which_node,
# Line 310 | Line 310 | void DumpWriter::writeDump( double currentTime ){
310          
311          if(haveError) DieDieDie();
312          
313 <        // If we've survived to here, format the line:
314 <        
315 <        if (!isDirectional) {
316 <
317 <          sprintf( tempBuffer,
318 <                   "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t",
319 <                   atomTypeString,
320 <                   atomData6[0],
321 <                   atomData6[1],
322 <                   atomData6[2],
323 <                   atomData6[3],
324 <                   atomData6[4],
325 <                   atomData6[5]);
326 <          
327 <          strcpy( writeLine, tempBuffer );
328 <          strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" );
329 <
330 <        } else {
331 <          
332 <          sprintf( tempBuffer,
333 <                   "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
334 <                   atomTypeString,
335 <                   atomData13[0],
336 <                   atomData13[1],
337 <                   atomData13[2],
338 <                   atomData13[3],
339 <                   atomData13[4],
340 <                   atomData13[5],
341 <                   atomData13[6],
342 <                   atomData13[7],
343 <                   atomData13[8],
344 <                   atomData13[9],
345 <                   atomData13[10],
346 <                   atomData13[11],
347 <                   atomData13[12]);
348 <          
349 <          strcat( writeLine, tempBuffer );
350 <          
351 <        }
313 >      }
314 >      // If we've survived to here, format the line:
315 >      
316 >      if (!isDirectional) {
317 >        
318 >        sprintf( tempBuffer,
319 >                 "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t",
320 >                 atomTypeString,
321 >                 atomData6[0],
322 >                 atomData6[1],
323 >                 atomData6[2],
324 >                 atomData6[3],
325 >                 atomData6[4],
326 >                 atomData6[5]);
327 >        
328 >        strcpy( writeLine, tempBuffer );
329 >        strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" );
330 >        
331 >      } else {
332 >        
333 >        sprintf( tempBuffer,
334 >                 "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
335 >                 atomTypeString,
336 >                 atomData13[0],
337 >                 atomData13[1],
338 >                 atomData13[2],
339 >                 atomData13[3],
340 >                 atomData13[4],
341 >                 atomData13[5],
342 >                 atomData13[6],
343 >                 atomData13[7],
344 >                 atomData13[8],
345 >                 atomData13[9],
346 >                 atomData13[10],
347 >                 atomData13[11],
348 >                 atomData13[12]);
349 >        
350 >        strcpy( writeLine, tempBuffer );
351          
353        outFile << writeLine;
354        outFile.flush();
352        }
353 +      
354 +      outFile << writeLine;
355 +      outFile.flush();
356      }
357 +    
358  
359      outFile.flush();
360      sprintf( checkPointMsg,
# Line 661 | Line 662 | void DumpWriter::writeFinal(double finalTime){
662          MPI_Recv(MPIatomTypeString, MINIBUFFERSIZE, MPI_CHAR, which_node,
663                   myPotato, MPI_COMM_WORLD, &istatus);
664          
665 <        strncpy(atomTypeString, MPIatomTypeString, MINIBUFFERSIZE);
666 <        
666 <        // Null terminate the atomTypeString just in case:
667 <
668 <        atomTypeString[strlen(atomTypeString) - 1] = '\0';
669 <
665 >        atomTypeString = MPIatomTypeString;
666 >                
667          myPotato++;
668  
669          MPI_Recv(&isDirectional, 1, MPI_INT, which_node,
# Line 742 | Line 739 | void DumpWriter::writeFinal(double finalTime){
739          
740          if(haveError) DieDieDie();
741          
742 <        // If we've survived to here, format the line:
746 <        
747 <        if (!isDirectional) {
742 >      }
743  
749          sprintf( tempBuffer,
750                   "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t",
751                   atomTypeString,
752                   atomData6[0],
753                   atomData6[1],
754                   atomData6[2],
755                   atomData6[3],
756                   atomData6[4],
757                   atomData6[5]);
758          
759          strcpy( writeLine, tempBuffer );
760          strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" );
744  
745 <        } else {
746 <          
747 <          sprintf( tempBuffer,
748 <                   "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
749 <                   atomTypeString,
750 <                   atomData13[0],
751 <                   atomData13[1],
752 <                   atomData13[2],
753 <                   atomData13[3],
754 <                   atomData13[4],
755 <                   atomData13[5],
756 <                   atomData13[6],
757 <                   atomData13[7],
758 <                   atomData13[8],
759 <                   atomData13[9],
760 <                   atomData13[10],
761 <                   atomData13[11],
762 <                   atomData13[12]);
763 <          
764 <          strcat( writeLine, tempBuffer );
765 <          
766 <        }
745 >      // If we've survived to here, format the line:
746 >      
747 >      if (!isDirectional) {
748 >        
749 >        sprintf( tempBuffer,
750 >                 "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t",
751 >                 atomTypeString,
752 >                 atomData6[0],
753 >                 atomData6[1],
754 >                 atomData6[2],
755 >                 atomData6[3],
756 >                 atomData6[4],
757 >                 atomData6[5]);
758 >        
759 >        strcpy( writeLine, tempBuffer );
760 >        strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" );
761 >        
762 >      } else {
763 >        
764 >        sprintf( tempBuffer,
765 >                 "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
766 >                 atomTypeString,
767 >                 atomData13[0],
768 >                 atomData13[1],
769 >                 atomData13[2],
770 >                 atomData13[3],
771 >                 atomData13[4],
772 >                 atomData13[5],
773 >                 atomData13[6],
774 >                 atomData13[7],
775 >                 atomData13[8],
776 >                 atomData13[9],
777 >                 atomData13[10],
778 >                 atomData13[11],
779 >                 atomData13[12]);
780 >        
781 >        strcpy( writeLine, tempBuffer );
782          
785        finalOut << writeLine;
786        finalOut.flush();
783        }
784 +        
785 +      finalOut << writeLine;
786 +      finalOut.flush();
787      }
788 <
788 >  
789      finalOut.flush();
790      sprintf( checkPointMsg,
791               "Sucessfully took a dump.\n");
792      delete[] potatoes;
793 <      
793 >    
794      MPIcheckPoint();        
795      
796    } else {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines