| 58 |  | Globals* simParams = info->getSimParams(); | 
| 59 |  | needCompression_ = simParams->getCompressDumpFile(); | 
| 60 |  | needForceVector_ = simParams->getOutputForceVector(); | 
| 61 | < |  | 
| 61 | > | createDumpFile_ = true; | 
| 62 |  | #ifdef HAVE_LIBZ | 
| 63 |  | if (needCompression_) { | 
| 64 |  | filename_ += ".gz"; | 
| 71 |  | if (worldRank == 0) { | 
| 72 |  | #endif // is_mpi | 
| 73 |  |  | 
| 74 | < |  | 
| 74 | > |  | 
| 75 |  | dumpFile_ = createOStream(filename_); | 
| 76 |  |  | 
| 77 |  | if (!dumpFile_) { | 
| 101 |  |  | 
| 102 |  | needCompression_ = simParams->getCompressDumpFile(); | 
| 103 |  | needForceVector_ = simParams->getOutputForceVector(); | 
| 104 | < |  | 
| 104 | > | createDumpFile_ = true; | 
| 105 |  | #ifdef HAVE_LIBZ | 
| 106 |  | if (needCompression_) { | 
| 107 |  | filename_ += ".gz"; | 
| 114 |  | if (worldRank == 0) { | 
| 115 |  | #endif // is_mpi | 
| 116 |  |  | 
| 117 | < |  | 
| 117 | > |  | 
| 118 |  | dumpFile_ = createOStream(filename_); | 
| 119 |  |  | 
| 120 |  | if (!dumpFile_) { | 
| 133 |  |  | 
| 134 |  | #endif // is_mpi | 
| 135 |  |  | 
| 136 | + | } | 
| 137 | + |  | 
| 138 | + | DumpWriter::DumpWriter(SimInfo* info, const std::string& filename, bool writeDumpFile) | 
| 139 | + | : info_(info), filename_(filename){ | 
| 140 | + |  | 
| 141 | + | Globals* simParams = info->getSimParams(); | 
| 142 | + | eorFilename_ = filename_.substr(0, filename_.rfind(".")) + ".eor"; | 
| 143 | + |  | 
| 144 | + | needCompression_ = simParams->getCompressDumpFile(); | 
| 145 | + | needForceVector_ = simParams->getOutputForceVector(); | 
| 146 | + |  | 
| 147 | + | #ifdef HAVE_LIBZ | 
| 148 | + | if (needCompression_) { | 
| 149 | + | filename_ += ".gz"; | 
| 150 | + | eorFilename_ += ".gz"; | 
| 151 | + | } | 
| 152 | + | #endif | 
| 153 | + |  | 
| 154 | + | #ifdef IS_MPI | 
| 155 | + |  | 
| 156 | + | if (worldRank == 0) { | 
| 157 | + | #endif // is_mpi | 
| 158 | + |  | 
| 159 | + | createDumpFile_ = writeDumpFile; | 
| 160 | + | if (createDumpFile_) { | 
| 161 | + | dumpFile_ = createOStream(filename_); | 
| 162 | + |  | 
| 163 | + | if (!dumpFile_) { | 
| 164 | + | sprintf(painCave.errMsg, "Could not open \"%s\" for dump output.\n", | 
| 165 | + | filename_.c_str()); | 
| 166 | + | painCave.isFatal = 1; | 
| 167 | + | simError(); | 
| 168 | + | } | 
| 169 | + | } | 
| 170 | + | #ifdef IS_MPI | 
| 171 | + |  | 
| 172 |  | } | 
| 173 | + |  | 
| 174 | + | sprintf(checkPointMsg, "Sucessfully opened output file for dumping.\n"); | 
| 175 | + | MPIcheckPoint(); | 
| 176 | + |  | 
| 177 | + | #endif // is_mpi | 
| 178 | + |  | 
| 179 | + | } | 
| 180 | + |  | 
| 181 | + |  | 
| 182 | + |  | 
| 183 | + |  | 
| 184 | + |  | 
| 185 |  |  | 
| 186 |  | DumpWriter::~DumpWriter() { | 
| 187 |  |  | 
| 189 |  |  | 
| 190 |  | if (worldRank == 0) { | 
| 191 |  | #endif // is_mpi | 
| 192 | < |  | 
| 193 | < | delete dumpFile_; | 
| 194 | < |  | 
| 192 | > | if (createDumpFile_){ | 
| 193 | > | delete dumpFile_; | 
| 194 | > | } | 
| 195 |  | #ifdef IS_MPI | 
| 196 |  |  | 
| 197 |  | } |