# | Line 57 | Line 57 | namespace oopse { | |
---|---|---|
57 | ||
58 | Globals* simParams = info->getSimParams(); | |
59 | needCompression_ = simParams->getCompressDumpFile(); | |
60 | < | needForceVector_ = simParams->getDumpForceVector(); |
61 | < | |
60 | > | needForceVector_ = simParams->getOutputForceVector(); |
61 | > | createDumpFile_ = true; |
62 | #ifdef HAVE_LIBZ | |
63 | if (needCompression_) { | |
64 | filename_ += ".gz"; | |
# | Line 71 | Line 71 | namespace oopse { | |
71 | if (worldRank == 0) { | |
72 | #endif // is_mpi | |
73 | ||
74 | < | |
74 | > | |
75 | dumpFile_ = createOStream(filename_); | |
76 | ||
77 | if (!dumpFile_) { | |
# | Line 100 | Line 100 | namespace oopse { | |
100 | eorFilename_ = filename_.substr(0, filename_.rfind(".")) + ".eor"; | |
101 | ||
102 | needCompression_ = simParams->getCompressDumpFile(); | |
103 | < | needForceVector_ = simParams->getDumpForceVector(); |
104 | < | |
103 | > | needForceVector_ = simParams->getOutputForceVector(); |
104 | > | createDumpFile_ = true; |
105 | #ifdef HAVE_LIBZ | |
106 | if (needCompression_) { | |
107 | filename_ += ".gz"; | |
# | Line 114 | Line 114 | namespace oopse { | |
114 | if (worldRank == 0) { | |
115 | #endif // is_mpi | |
116 | ||
117 | < | |
117 | > | |
118 | dumpFile_ = createOStream(filename_); | |
119 | ||
120 | if (!dumpFile_) { | |
# | Line 133 | Line 133 | namespace oopse { | |
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 | ||
# | Line 141 | Line 189 | namespace oopse { | |
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 | } | |
# | Line 154 | Line 202 | namespace oopse { | |
202 | ||
203 | void DumpWriter::writeCommentLine(std::ostream& os, Snapshot* s) { | |
204 | ||
205 | < | double currentTime; |
205 | > | RealType currentTime; |
206 | Mat3x3d hmat; | |
207 | < | double chi; |
208 | < | double integralOfChiDt; |
207 | > | RealType chi; |
208 | > | RealType integralOfChiDt; |
209 | Mat3x3d eta; | |
210 | ||
211 | currentTime = s->getTime(); | |
# | Line 173 | Line 221 | namespace oopse { | |
221 | ||
222 | //write out additional parameters, such as chi and eta | |
223 | ||
224 | < | os << chi << "\t" << integralOfChiDt << "\t;"; |
224 | > | os << chi << "\t" << integralOfChiDt << ";\t"; |
225 | ||
226 | os << eta(0, 0) << "\t" << eta(1, 0) << "\t" << eta(2, 0) << ";\t" | |
227 | << eta(0, 1) << "\t" << eta(1, 1) << "\t" << eta(2, 1) << ";\t" | |
# | Line 299 | Line 347 | namespace oopse { | |
347 | int myPotato; | |
348 | int nProc; | |
349 | int which_node; | |
350 | < | double atomData[19]; |
350 | > | RealType atomData[19]; |
351 | int isDirectional; | |
352 | char MPIatomTypeString[MINIBUFFERSIZE]; | |
353 | int msgLen; // the length of message actually recieved at master nodes | |
# | Line 374 | Line 422 | namespace oopse { | |
422 | ||
423 | myPotato++; | |
424 | ||
425 | < | MPI_Recv(atomData, 19, MPI_DOUBLE, which_node, myPotato, |
425 | > | MPI_Recv(atomData, 19, MPI_REALTYPE, which_node, myPotato, |
426 | MPI_COMM_WORLD, &istatus); | |
427 | myPotato++; | |
428 | ||
429 | < | MPI_Get_count(&istatus, MPI_DOUBLE, &msgLen); |
429 | > | MPI_Get_count(&istatus, MPI_REALTYPE, &msgLen); |
430 | ||
431 | if (msgLen == 13 || msgLen == 19) | |
432 | isDirectional = 1; | |
# | Line 435 | Line 483 | namespace oopse { | |
483 | } | |
484 | } | |
485 | ||
486 | < | sprintf(writeLine, "\n"); |
439 | < | os << writeLine; |
486 | > | os << writeLine << "\n"; |
487 | ||
488 | } // end for(int l =0) | |
489 | ||
# | Line 558 | Line 605 | namespace oopse { | |
605 | } | |
606 | } | |
607 | ||
608 | < | sprintf(writeLine, "\n"); |
562 | < | os << writeLine; |
608 | > | os << writeLine << "\n"; |
609 | ||
610 | } //end for(iter = integrableObject.begin()) | |
611 | } | |
# | Line 678 | Line 724 | namespace oopse { | |
724 | myPotato++; | |
725 | ||
726 | if (isDirectional && needForceVector_) { | |
727 | < | MPI_Send(atomData, 19, MPI_DOUBLE, 0, myPotato, |
727 | > | MPI_Send(atomData, 19, MPI_REALTYPE, 0, myPotato, |
728 | MPI_COMM_WORLD); | |
729 | } else if (isDirectional) { | |
730 | < | MPI_Send(atomData, 13, MPI_DOUBLE, 0, myPotato, |
730 | > | MPI_Send(atomData, 13, MPI_REALTYPE, 0, myPotato, |
731 | MPI_COMM_WORLD); | |
732 | } else if (needForceVector_) { | |
733 | < | MPI_Send(atomData, 12, MPI_DOUBLE, 0, myPotato, |
733 | > | MPI_Send(atomData, 12, MPI_REALTYPE, 0, myPotato, |
734 | MPI_COMM_WORLD); | |
735 | } else { | |
736 | < | MPI_Send(atomData, 6, MPI_DOUBLE, 0, myPotato, |
736 | > | MPI_Send(atomData, 6, MPI_REALTYPE, 0, myPotato, |
737 | MPI_COMM_WORLD); | |
738 | } | |
739 |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |