# | Line 2 | Line 2 | |
---|---|---|
2 | #define OPTIMIZATION_STATUSFUNCTION_HPP | |
3 | #include "config.h" | |
4 | #include "io/DumpWriter.hpp" | |
5 | + | #include "brains/Stats.hpp" |
6 | #include "io/StatWriter.hpp" | |
7 | ||
8 | namespace OpenMD { | |
# | Line 20 | Line 21 | namespace OpenMD { | |
21 | class DumpStatusFunction : public StatusFunction { | |
22 | ||
23 | public: | |
24 | < | DumpStatusFunction(SimInfo* info) : StatusFunction(), info_(info), thermo(info) { |
24 | > | DumpStatusFunction(SimInfo* info) : StatusFunction(), info_(info) { |
25 | > | stats = new Stats(info_); |
26 | dumpWriter = new DumpWriter(info_); | |
27 | < | StatsBitSet mask; |
27 | > | Stats::StatsBitSet mask; |
28 | mask.set(Stats::TIME); | |
29 | mask.set(Stats::POTENTIAL_ENERGY); | |
30 | < | statWriter = new StatWriter(info_->getStatFileName(), mask); |
30 | > | stats->setStatsMask(mask); |
31 | > | statWriter = new StatWriter(info_->getStatFileName(), stats); |
32 | } | |
33 | virtual void writeStatus(int functionCount, int gradientCount, const DynamicVector<RealType>& x, RealType f) { | |
34 | Snapshot* curSnapshot =info_->getSnapshotManager()->getCurrentSnapshot(); | |
32 | – | thermo.saveStat(); |
35 | curSnapshot->setTime(functionCount); | |
36 | + | |
37 | + | stats->collectStats(); |
38 | + | statWriter->writeStat(); |
39 | + | |
40 | dumpWriter->writeDumpAndEor(); | |
35 | – | statWriter->writeStat(curSnapshot->statData); |
41 | } | |
42 | ~DumpStatusFunction() { | |
43 | delete dumpWriter; | |
# | Line 41 | Line 46 | namespace OpenMD { | |
46 | ||
47 | private: | |
48 | SimInfo* info_; | |
49 | + | Stats* stats; |
50 | DumpWriter* dumpWriter; | |
51 | < | StatWriter* statWriter; |
46 | < | Thermo thermo; |
51 | > | StatWriter* statWriter; |
52 | }; | |
53 | ||
54 |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |