PSCF v1.5.0
StepLogger.tpp
1#ifndef RP_STEP_LOGGER_TPP
2#define RP_STEP_LOGGER_TPP
3
4/*
5* PSCF - Polymer Self-Consistent Field
6*
7* Copyright 2015 - 2026, David Morse (morse012@um.edu) and co-authors
8* Distributed under the terms of the GNU General Public License.
9*/
10
11#include "StepLogger.h"
12#include <util/format/Int.h>
13#include <util/misc/Log.h>
14
15namespace Pscf {
16namespace Rp {
17
18 using namespace Util;
19
20 /*
21 * Constructor.
22 */
23 template <int D, class T>
28
29 /*
30 * Read interval.
31 */
32 template <int D, class T>
35
36 /*
37 * Periodically write the step index to a log file.
38 */
39 template <int D, class T>
40 void StepLogger<D,T>::sample(long iStep)
41 {
42 if (Analyzer<D,T>::isAtInterval(iStep)) {
43 Log::file() << "iStep " << Int(iStep,10) << std::endl;
44 }
45 }
46
47}
48}
49#endif
Analyzer(Simulator< D, T > &simulator, System< D, T > &system)
Constructor.
Definition Analyzer.tpp:31
void readInterval(std::istream &in)
Optionally read interval from file, with error checking.
Definition Analyzer.tpp:55
bool isAtInterval(long counter) const
Return true iff counter is a multiple of the interval.
Definition Analyzer.h:219
Simulator< D, T > & simulator()
Get the parent Simulator by reference.
Definition Analyzer.h:233
System< D, T > & system()
Get the parent System by reference.
Definition Analyzer.h:243
Base class for field theoretic PS-FTS simulator.
Definition Simulator.h:93
StepLogger(Simulator< D, T > &simulator, System< D, T > &system)
Constructor.
void readParameters(std::istream &in) override
Read interval.
void sample(long iStep) override
Write the step index to a log file.
Base class template for classes that represent a complete system.
Int()
Default constructor.
Definition Int.cpp:19
static std::ostream & file()
Get log ostream by reference.
Definition Log.cpp:59
void setClassName(const char *className)
Set class name string.
Code for programs that simulate real-valued periodic fields.
Definition param_pc.dox:2
PSCF package top-level namespace.