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 951 by mmeineke, Fri Jan 16 21:51:51 2004 UTC vs.
Revision 1097 by gezelter, Mon Apr 12 20:32:20 2004 UTC

# Line 1 | Line 1
1 + #define _LARGEFILE_SOURCE64
2   #define _FILE_OFFSET_BITS 64
3  
4   #include <string.h>
# Line 95 | Line 96 | void DumpWriter::sortByGlobalIndex(){
96      indexArray.push_back(make_pair(i, atoms[i]->getGlobalIndex()));
97    
98    sort(indexArray.begin(), indexArray.end(), indexSortingCriterion);    
98
99  //for (int i = 0; i < mpiSim->getMyNlocal(); i++) {
100  //  printf("node %d has global %d at local %d\n", worldRank, indexArray[i].second, indexArray[i].first);
101  //}
102    
99   }
100  
101   #endif
# Line 110 | Line 106 | void DumpWriter::writeDump(double currentTime){
106    vector<ofstream*> fileStreams;
107  
108   #ifdef IS_MPI
113  printf("Hello from node %d\n", worldRank);
114  sortByGlobalIndex();
109    if(worldRank == 0 ){
110 <    
110 > #endif    
111      finalOut.open( entry_plug->finalName, ios::out | ios::trunc );
112      if( !finalOut ){
113        sprintf( painCave.errMsg,
# Line 122 | Line 116 | void DumpWriter::writeDump(double currentTime){
116        painCave.isFatal = 1;
117        simError();
118      }
119 + #ifdef IS_MPI
120    }
121   #endif // is_mpi
122  
# Line 232 | Line 227 | void DumpWriter::writeFrame( vector<ofstream*>& outFil
227    int nAtoms = entry_plug->n_atoms;
228   #endif //is_mpi
229  
230 <  double q[4];
230 >  double q[4], ji[3];
231    DirectionalAtom* dAtom;
232    Atom** atoms = entry_plug->atoms;
233    double pos[3], vel[3];
# Line 279 | Line 274 | void DumpWriter::writeFrame( vector<ofstream*>& outFil
274  
275        dAtom = (DirectionalAtom *)atoms[i];
276        dAtom->getQ( q );
277 +      dAtom->getJ( ji );
278  
279        sprintf( tempBuffer,
280                 "%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
# Line 286 | Line 282 | void DumpWriter::writeFrame( vector<ofstream*>& outFil
282                 q[1],
283                 q[2],
284                 q[3],
285 <               dAtom->getJx(),
286 <               dAtom->getJy(),
287 <               dAtom->getJz());
285 >               ji[0],
286 >               ji[1],
287 >               ji[2]);
288        strcat( writeLine, tempBuffer );
289      }
290      else
# Line 395 | Line 391 | void DumpWriter::writeFrame( vector<ofstream*>& outFil
391          
392          haveError = 0;
393          which_atom = i;
398        
399        //local_index = -1;
400
401        //for (j=0; (j<mpiSim->getMyNlocal()) && (local_index < 0); j++) {
402        //  if (atoms[j]->getGlobalIndex() == which_atom) local_index = j;
403        //}
394          
405        //if (local_index != -1) {
406          
395            local_index = indexArray[currentIndex].first;        
396            
397            if (which_atom == indexArray[currentIndex].second) {
# Line 429 | Line 417 | void DumpWriter::writeFrame( vector<ofstream*>& outFil
417              
418              dAtom = (DirectionalAtom *)atoms[local_index];
419              dAtom->getQ( q );
420 +            dAtom->getJ( ji );
421  
422              for (int j = 0; j < 6 ; j++)
423                atomData13[j] = atomData6[j];            
# Line 438 | Line 427 | void DumpWriter::writeFrame( vector<ofstream*>& outFil
427              atomData13[8] = q[2];
428              atomData13[9] = q[3];
429              
430 <            atomData13[10] = dAtom->getJx();
431 <            atomData13[11] = dAtom->getJy();
432 <            atomData13[12] = dAtom->getJz();
430 >            atomData13[10] = ji[0];
431 >            atomData13[11] = ji[1];
432 >            atomData13[12] = ji[2];
433            }
434            
435          } else {
# Line 532 | Line 521 | void DumpWriter::writeFrame( vector<ofstream*>& outFil
521          }
522          which_atom = i;
523  
535        //local_index = -1;
536
537        //for (j=0; (j<mpiSim->getMyNlocal()) && (local_index < 0); j++) {
538        // if (atoms[j]->getGlobalIndex() == which_atom) local_index = j;
539        //}
540        
541        //if (local_index != -1) {
542
524          local_index = indexArray[currentIndex].first;        
525                  
526          if (which_atom == indexArray[currentIndex].second) {
# Line 565 | Line 546 | void DumpWriter::writeFrame( vector<ofstream*>& outFil
546              
547              dAtom = (DirectionalAtom *)atoms[local_index];
548              dAtom->getQ( q );
549 +            dAtom->getJ( ji );
550              
551              for (int j = 0; j < 6 ; j++)
552                atomData13[j] = atomData6[j];
# Line 574 | Line 556 | void DumpWriter::writeFrame( vector<ofstream*>& outFil
556              atomData13[8] = q[2];
557              atomData13[9] = q[3];
558    
559 <            atomData13[10] = dAtom->getJx();
560 <            atomData13[11] = dAtom->getJy();
561 <            atomData13[12] = dAtom->getJz();
559 >            atomData13[10] = ji[0];
560 >            atomData13[11] = ji[1];
561 >            atomData13[12] = ji[2];
562            }
563  
564          } else {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines