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

Comparing trunk/OOPSE-2.0/src/io/DumpWriter.cpp (file contents):
Revision 2318 by tim, Wed Sep 21 20:59:31 2005 UTC vs.
Revision 2420 by chrisfen, Tue Nov 8 13:32:27 2005 UTC

# Line 57 | Line 57 | namespace oopse {
57  
58      Globals* simParams = info->getSimParams();
59      needCompression_ = simParams->getCompressDumpFile();
60 +    needForceVector_ = simParams->getDumpForceVector();
61  
62   #ifdef HAVE_LIBZ
63      if (needCompression_) {
# Line 99 | Line 100 | namespace oopse {
100      eorFilename_ = filename_.substr(0, filename_.rfind(".")) + ".eor";    
101  
102      needCompression_ = simParams->getCompressDumpFile();
103 +    needForceVector_ = simParams->getDumpForceVector();
104  
105   #ifdef HAVE_LIBZ
106      if (needCompression_) {
# Line 191 | Line 193 | namespace oopse {
193      Vector3d ji;
194      Vector3d pos;
195      Vector3d vel;
196 +    Vector3d frc;
197 +    Vector3d trq;
198  
199      Molecule* mol;
200      StuntDouble* integrableObject;
# Line 227 | Line 231 | namespace oopse {
231            q = integrableObject->getQ();
232            ji = integrableObject->getJ();
233  
234 <          sprintf(tempBuffer, "%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
234 >          sprintf(tempBuffer, "%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf",
235                    q[0], q[1], q[2], q[3],
236                    ji[0], ji[1], ji[2]);
237            strcat(writeLine, tempBuffer);
238          } else {
239 <          strcat(writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n");
239 >          strcat(writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0");
240          }
241  
242 +        if (needForceVector_) {
243 +          frc = integrableObject->getFrc();
244 +          trq = integrableObject->getTrq();
245 +          
246 +          sprintf(tempBuffer, "\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf",
247 +                  frc[0], frc[1], frc[2],
248 +                  trq[0], trq[1], trq[2]);
249 +          strcat(writeLine, tempBuffer);
250 +        }
251 +        
252 +        strcat(writeLine, "\n");
253          os << writeLine;
254  
255        }
# Line 284 | Line 299 | namespace oopse {
299      int myPotato;
300      int nProc;
301      int which_node;
302 <    double atomData[13];
302 >    double atomData[19];
303      int isDirectional;
304      char MPIatomTypeString[MINIBUFFERSIZE];
305      int msgLen; // the length of message actually recieved at master nodes
# Line 359 | Line 374 | namespace oopse {
374  
375              myPotato++;
376  
377 <            MPI_Recv(atomData, 13, MPI_DOUBLE, which_node, myPotato,
377 >            MPI_Recv(atomData, 19, MPI_DOUBLE, which_node, myPotato,
378                       MPI_COMM_WORLD, &istatus);
379              myPotato++;
380  
381              MPI_Get_count(&istatus, MPI_DOUBLE, &msgLen);
382  
383 <            if (msgLen == 13)
383 >            if (msgLen == 13 || msgLen == 19)
384                isDirectional = 1;
385              else
386                isDirectional = 0;
# Line 380 | Line 395 | namespace oopse {
395                        atomData[5]);
396  
397                strcat(writeLine,
398 <                     "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n");
398 >                     "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0");
399              } else {
400                sprintf(writeLine,
401 <                      "%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",
401 >                      "%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",
402                        MPIatomTypeString,
403                        atomData[0],
404                        atomData[1],
# Line 398 | Line 413 | namespace oopse {
413                        atomData[10],
414                        atomData[11],
415                        atomData[12]);
416 +            }
417 +            
418 +            if (needForceVector_) {
419 +              if (!isDirectional) {
420 +                sprintf(writeLine, "\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf",
421 +                        atomData[6],
422 +                        atomData[7],
423 +                        atomData[8],
424 +                        atomData[9],
425 +                        atomData[10],
426 +                        atomData[11]);
427 +              } else {
428 +                sprintf(writeLine, "\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf",
429 +                        atomData[13],
430 +                        atomData[14],
431 +                        atomData[15],
432 +                        atomData[16],
433 +                        atomData[17],
434 +                        atomData[18]);
435 +              }
436              }
437  
438 +            sprintf(writeLine, "\n");
439              os << writeLine;
440  
441            } // end for(int l =0)
# Line 449 | Line 485 | namespace oopse {
485                atomData[10] = ji[0];
486                atomData[11] = ji[1];
487                atomData[12] = ji[2];
488 +            }
489 +
490 +            if (needForceVector_) {
491 +              frc = integrableObject->getFrc();
492 +              trq = integrableObject->getTrq();
493 +
494 +              if (!isDirectional) {
495 +                atomData[6] = frc[0];
496 +                atomData[7] = frc[1];
497 +                atomData[8] = frc[2];
498 +                atomData[9] = trq[0];
499 +                atomData[10] = trq[1];
500 +                atomData[11] = trq[2];
501 +              } else {
502 +                atomData[13] = frc[0];
503 +                atomData[14] = frc[1];
504 +                atomData[15] = frc[2];
505 +                atomData[16] = trq[0];
506 +                atomData[17] = trq[1];
507 +                atomData[18] = trq[2];
508 +              }
509              }
510  
511              // If we've survived to here, format the line:
# Line 461 | Line 518 | namespace oopse {
518                        atomData[5]);
519  
520                strcat(writeLine,
521 <                     "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n");
521 >                     "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0");
522              } else {
523                sprintf(writeLine,
524 <                      "%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",
524 >                      "%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",
525                        integrableObject->getType().c_str(),
526                        atomData[0],
527                        atomData[1],
# Line 481 | Line 538 | namespace oopse {
538                        atomData[12]);
539              }
540  
541 +            if (needForceVector_) {
542 +              if (!isDirectional) {
543 +              sprintf(writeLine, "\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf",
544 +                      atomData[6],
545 +                      atomData[7],
546 +                      atomData[8],
547 +                      atomData[9],
548 +                      atomData[10],
549 +                      atomData[11]);
550 +              } else {
551 +                sprintf(writeLine, "\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf",
552 +                        atomData[13],
553 +                        atomData[14],
554 +                        atomData[15],
555 +                        atomData[16],
556 +                        atomData[17],
557 +                        atomData[18]);
558 +              }
559 +            }
560  
561 +            sprintf(writeLine, "\n");
562              os << writeLine;
563  
564            } //end for(iter = integrableObject.begin())
# Line 567 | Line 644 | namespace oopse {
644                atomData[12] = ji[2];
645              }
646  
647 +            if (needForceVector_) {
648 +              frc = integrableObject->getFrc();
649 +              trq = integrableObject->getTrq();
650 +              
651 +              if (!isDirectional) {
652 +                atomData[6] = frc[0];
653 +                atomData[7] = frc[1];
654 +                atomData[8] = frc[2];
655 +                
656 +                atomData[9] = trq[0];
657 +                atomData[10] = trq[1];
658 +                atomData[11] = trq[2];
659 +              } else {
660 +                atomData[13] = frc[0];
661 +                atomData[14] = frc[1];
662 +                atomData[15] = frc[2];
663 +                
664 +                atomData[16] = trq[0];
665 +                atomData[17] = trq[1];
666 +                atomData[18] = trq[2];
667 +              }
668 +            }
669 +
670              strncpy(MPIatomTypeString, integrableObject->getType().c_str(), MINIBUFFERSIZE);
671  
672              // null terminate the  std::string before sending (just in case):
# Line 577 | Line 677 | namespace oopse {
677  
678              myPotato++;
679  
680 <            if (isDirectional) {
680 >            if (isDirectional && needForceVector_) {
681 >              MPI_Send(atomData, 19, MPI_DOUBLE, 0, myPotato,
682 >                       MPI_COMM_WORLD);
683 >            } else if (isDirectional) {
684                MPI_Send(atomData, 13, MPI_DOUBLE, 0, myPotato,
685                         MPI_COMM_WORLD);
686 +            } else if (needForceVector_) {
687 +              MPI_Send(atomData, 12, MPI_DOUBLE, 0, myPotato,
688 +                       MPI_COMM_WORLD);
689              } else {
690                MPI_Send(atomData, 6, MPI_DOUBLE, 0, myPotato,
691                         MPI_COMM_WORLD);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines