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 963 by tim, Wed May 17 21:51:42 2006 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 542 | Line 544 | namespace oopse {
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          

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines