ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/io/DumpReader.cpp
(Generate patch)

Comparing trunk/src/io/DumpReader.cpp (file contents):
Revision 721 by chrisfen, Tue Nov 8 13:32:27 2005 UTC vs.
Revision 996 by chrisfen, Wed Jun 28 14:35:14 2006 UTC

# Line 71 | Line 71 | namespace oopse {
71    
72    DumpReader::DumpReader(SimInfo* info, const std::string& filename)
73      : info_(info), filename_(filename), isScanned_(false), nframes_(0) {
74 <    
74 >    
75   #ifdef IS_MPI
76 <    
77 <      if (worldRank == 0) {
76 >    
77 >    if (worldRank == 0) {
78   #endif
79 <      
79 >      
80        inFile_ = new std::ifstream(filename_.c_str());
81 <      
82 <        if (inFile_->fail()) {
83 <          sprintf(painCave.errMsg, "DumpReader: Cannot open file: %s\n", filename_.c_str());
84 <          painCave.isFatal = 1;
85 <          simError();
86 <        }
87 <      
88 < #ifdef IS_MPI
89 <      
81 >      
82 >      if (inFile_->fail()) {
83 >        sprintf(painCave.errMsg,
84 >                "DumpReader: Cannot open file: %s\n",
85 >                filename_.c_str());
86 >        painCave.isFatal = 1;
87 >        simError();
88        }
89 <    
90 <      strcpy(checkPointMsg, "Dump file opened for reading successfully.");
91 <      MPIcheckPoint();
94 <    
95 < #endif
96 <    
97 <      return;
89 >      
90 > #ifdef IS_MPI
91 >      
92      }
93 <  
94 <  DumpReader::~DumpReader() {
95 <    
93 >    
94 >    strcpy(checkPointMsg, "Dump file opened for reading successfully.");
95 >    MPIcheckPoint();
96 >    
97 > #endif
98 >    
99 >    return;
100 >  }
101 >  
102 >  DumpReader::~DumpReader() {
103 >    
104   #ifdef IS_MPI
105 <    
105 >    
106      if (worldRank == 0) {
107   #endif
108 <      
108 >      
109        delete inFile_;
110 <      
110 >      
111   #ifdef IS_MPI
112 <      
112 >      
113      }
114 <    
114 >    
115      strcpy(checkPointMsg, "Dump file closed successfully.");
116      MPIcheckPoint();
117 <    
117 >    
118   #endif
119 <    
119 >    
120      return;
121    }
122 <  
122 >  
123    int DumpReader::getNFrames(void) {
124      
125      if (!isScanned_)
# Line 538 | Line 540 | namespace oopse {
540        q[2] = tokenizer.nextTokenAsDouble();
541        q[3] = tokenizer.nextTokenAsDouble();
542        
543 <      double qlen = q.length();
543 >      RealType qlen = q.length();
544        if (qlen < oopse::epsilon) { //check quaternion is not equal to 0
545          
546          sprintf(painCave.errMsg,
547 <                "DumpReader Error: initial quaternion error (q0^2 + q1^2 + q2^2 + q3^2 ~ 0\n");
547 >                "DumpReader Error: initial quaternion error (q0^2 + q1^2 + q2^2 + q3^2) ~ 0\n");
548          painCave.isFatal = 1;
549          simError();
550          
# Line 565 | Line 567 | namespace oopse {
567    
568    
569    void DumpReader::parseCommentLine(char* line, Snapshot* s) {
570 <    double currTime;
570 >    RealType currTime;
571      Mat3x3d hmat;
572 <    double chi;
573 <    double integralOfChiDt;
572 >    RealType chi;
573 >    RealType integralOfChiDt;
574      Mat3x3d eta;
575      
576      StringTokenizer tokenizer(line);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines