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 { |
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 stats; |
44 |
|
delete dumpWriter; |
45 |
|
delete statWriter; |
46 |
|
} |
47 |
|
|
48 |
|
private: |
49 |
|
SimInfo* info_; |
50 |
+ |
Stats* stats; |
51 |
|
DumpWriter* dumpWriter; |
52 |
< |
StatWriter* statWriter; |
46 |
< |
Thermo thermo; |
52 |
> |
StatWriter* statWriter; |
53 |
|
}; |
54 |
|
|
55 |
|
|