PSCF v1.3
rpc/fts/analyzer/StepLogger.tpp
1#ifndef RPC_STEP_LOGGER_TPP
2#define RPC_STEP_LOGGER_TPP
3
4/*
5* PSCF - Polymer Self-Consistent Field
6*
7* Copyright 2015 - 2025, The Regents of the University of Minnesota
8* Distributed under the terms of the GNU General Public License.
9*/
10
11#include "StepLogger.h"
12#include "Analyzer.h"
13#include <util/format/Int.h>
14#include <util/misc/Log.h>
15
16namespace Pscf {
17namespace Rpc {
18
19 using namespace Util;
20
21 /*
22 * Constructor.
23 */
24 template <int D>
26 : Analyzer<D>()
27 { setClassName("StepLogger"); }
28
29 /*
30 * Read interval and outputFileName.
31 */
32 template <int D>
33 void StepLogger<D>::readParameters(std::istream& in)
35
36 /*
37 * Periodically write a frame to file
38 */
39 template <int D>
40 void StepLogger<D>::sample(long iStep)
41 {
42 if (isAtInterval(iStep)) {
43 Log::file() << "iStep " << Int(iStep,10) << std::endl;
44 }
45 }
46
47}
48}
49#endif
bool isAtInterval(long counter) const
Return true iff counter is a multiple of the interval.
void readInterval(std::istream &in)
Optionally read interval from file, with error checking.
Analyzer()
Default constructor.
void setClassName(const char *className)
Set class name string.
virtual void readParameters(std::istream &in)
Read interval and output file name.
virtual void sample(long iStep)
Write a frame/snapshot to trajectory file.
Wrapper for an int, for formatted ostream output.
Definition Int.h:37
static std::ostream & file()
Get log ostream by reference.
Definition Log.cpp:59
Real periodic fields, SCFT and PS-FTS (CPU).
Definition param_pc.dox:2
PSCF package top-level namespace.
Definition param_pc.dox:1