PSCF v1.3
rpc/fts/analyzer/ConcentrationWriter.h
1#ifndef RPC_CONCENTRATION_WRITER_H
2#define RPC_CONCENTRATION_WRITER_H
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 "Analyzer.h"
12#include <util/global.h>
13
14namespace Pscf {
15namespace Rpc {
16
17 template <int D> class System;
18 template <int D> class Simulator;
19
20 using namespace Util;
21
29 template <int D>
30 class ConcentrationWriter : public Analyzer<D>
31 {
32
33 public:
34
39
44 {}
45
51 virtual void readParameters(std::istream& in);
52
56 virtual void setup();
57
63 virtual void sample(long iStep);
64
68 virtual void output();
69
74
75 protected:
76
77 // Output file stream
78 std::ofstream outputFile_;
79
80 // Output filename
81 std::string filename_;
82
85
88
93
98
99 protected:
100
108 void writeHeader(std::ofstream& out);
109
116 void writeFrame(std::ofstream& out, long iStep);
117
121 System<D>& system();
122
127
128
129 };
130
131 // Get the parent system.
132 template <int D>
135
136 //Get parent Simulator object.
137 template <int D>
140
141 #ifndef RPC_CONCENTRATION_WRITER_TPP
142 // Suppress implicit instantiation
143 extern template class ConcentrationWriter<1>;
144 extern template class ConcentrationWriter<2>;
145 extern template class ConcentrationWriter<3>;
146 #endif
147
148}
149}
150#endif
Abstract base for periodic output and/or analysis actions.
bool isAtInterval(long counter) const
Return true iff counter is a multiple of the interval.
const std::string & outputFileName() const
Return outputFileName string.
Analyzer()
Default constructor.
Periodically write snapshots to a trajectory file.
void writeHeader(std::ofstream &out)
Write data that should appear once, at beginning of the file.
void writeFrame(std::ofstream &out, long iStep)
Write data that should appear in every frame.
Simulator< D > * simulatorPtr_
Pointer to parent Simulator.
System< D > * systemPtr_
Pointer to the parent system.
ConcentrationWriter(Simulator< D > &simulator, System< D > &system)
Constructor.
long nSample_
Number of configurations dumped thus far (first dump is zero).
System< D > & system()
Return reference to parent system.
Simulator< D > & simulator()
Return reference to parent Simulator.
virtual void sample(long iStep)
Write a frame/snapshot to trajectory file.
virtual void readParameters(std::istream &in)
Read interval and output file name.
virtual void output()
Close trajectory file after run.
Field theoretic simulator (base class).
Main class, representing one complete system.
ScalarParam< Type > & read(std::istream &in, const char *label, Type &value)
Add and read a new required ScalarParam < Type > object.
void setClassName(const char *className)
Set class name string.
File containing preprocessor macros for error handling.
Real periodic fields, SCFT and PS-FTS (CPU).
Definition param_pc.dox:2
PSCF package top-level namespace.
Definition param_pc.dox:1