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 916 by gezelter, Fri Jan 9 20:29:32 2004 UTC vs.
Revision 927 by tim, Mon Jan 12 22:54:42 2004 UTC

# Line 161 | Line 161 | void DumpWriter::writeDump( double currentTime ){
161   #else // is_mpi
162  
163    /* code to find maximum tag value */
164 +  
165    int *tagub, flag, MAXTAG;
166    MPI_Attr_get(MPI_COMM_WORLD, MPI_TAG_UB, &tagub, &flag);
167    if (flag) {
# Line 227 | 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 308 | 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 <          
349 <        }
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          
351        outFile << writeLine;
352        outFile.flush();
352        }
353 +      
354 +      outFile << writeLine;
355 +      outFile.flush();
356      }
357 +    
358  
359      outFile.flush();
360      sprintf( checkPointMsg,
361               "Sucessfully took a dump.\n");
362      MPIcheckPoint();        
363 <    
363 >    delete[] potatoes;
364    } else {
365  
366      // worldRank != 0, so I'm a remote node.  
# Line 381 | Line 384 | void DumpWriter::writeDump( double currentTime ){
384            MPI_Recv(&myPotato, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, &istatus);
385            
386          }
387 <
388 <        local_index=-1;
387 >        which_atom = i;
388 >        local_index=-1;
389          for (j=0; (j<mpiSim->getMyNlocal()) && (local_index < 0); j++) {
390            if (atoms[j]->getGlobalIndex() == which_atom) local_index = j;
391          }
# Line 659 | 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 <        
664 <        // Null terminate the atomTypeString just in case:
665 <
666 <        atomTypeString[strlen(atomTypeString) - 1] = '\0';
667 <
665 >        atomTypeString = MPIatomTypeString;
666 >                
667          myPotato++;
668  
669          MPI_Recv(&isDirectional, 1, MPI_INT, which_node,
# Line 740 | Line 739 | void DumpWriter::writeFinal(double finalTime){
739          
740          if(haveError) DieDieDie();
741          
742 <        // If we've survived to here, format the line:
744 <        
745 <        if (!isDirectional) {
742 >      }
743  
747          sprintf( tempBuffer,
748                   "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t",
749                   atomTypeString,
750                   atomData6[0],
751                   atomData6[1],
752                   atomData6[2],
753                   atomData6[3],
754                   atomData6[4],
755                   atomData6[5]);
756          
757          strcpy( writeLine, tempBuffer );
758          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          
783        finalOut << writeLine;
784        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 +    
794      MPIcheckPoint();        
795      
796    } else {
# Line 813 | Line 816 | void DumpWriter::writeFinal(double finalTime){
816            MPI_Recv(&myPotato, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, &istatus);
817            
818          }
819 <
819 >        which_atom = i;  
820          local_index=-1;
821          for (j=0; (j<mpiSim->getMyNlocal()) && (local_index < 0); j++) {
822            if (atoms[j]->getGlobalIndex() == which_atom) local_index = j;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines