# | 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 | < | |
93 | > | |
94 | > | strcpy(checkPointMsg, "Dump file opened for reading successfully."); |
95 | > | MPIcheckPoint(); |
96 | > | |
97 | > | #endif |
98 | > | |
99 | > | return; |
100 | > | } |
101 | > | |
102 | DumpReader::~DumpReader() { | |
103 | < | |
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_) |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |