PSCF v1.5.0
ConcentrationWriter.h
1#ifndef RP_CONCENTRATION_WRITER_H
2#define RP_CONCENTRATION_WRITER_H
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 <rp/fts/analyzer/Analyzer.h> // base class template
12
13#include <pscf/backend/TmplDeclare.h>
14#include <iostream>
15#include <fstream>
16
17namespace Pscf {
18namespace Rp {
19
31 template <int D, class T>
32 class ConcentrationWriter : public Analyzer<D,T>
33 {
34
35 public:
36
45
51 void readParameters(std::istream& in) override;
52
56 void setup() override;
57
63 void sample(long iStep) override;
64
68 void output() override;
69
70 using AnalyzerT = Analyzer<D,T>;
73
74 private:
75
76 // Output file stream
77 std::ofstream outputFile_;
78
80 long nSample_;
81
83 long isInitialized_;
84
90 void writeHeader(std::ofstream& out);
91
98 void writeFrame(std::ofstream& out, long iStep);
99
100 };
101
102 // Explicit instantiation declarations
103 PSCF_TMPL_DECLARE(ConcentrationWriter)
104
105}
106}
107#endif
Analyzer(Simulator< D, T > &simulator, System< D, T > &system)
Constructor.
Definition Analyzer.tpp:31
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
Periodically write c-field snapshots to a trajectory file.
void readParameters(std::istream &in) override
Read interval and output file name.
Simulator< D, T > & simulator()
Get the parent Simulator by reference.
Definition Analyzer.h:233
void output() override
Close trajectory file after run.
ConcentrationWriter(Simulator< D, T > &simulator, System< D, T > &system)
Constructor.
System< D, T > & system()
Get the parent System by reference.
Definition Analyzer.h:243
void sample(long iStep) override
Write a frame/snapshot to trajectory file.
void setup() override
Initialize before main simulation loop.
Base class for field theoretic PS-FTS simulator.
Definition Simulator.h:93
Base class template for classes that represent a complete system.
Code for programs that simulate real-valued periodic fields.
Definition param_pc.dox:2
PSCF package top-level namespace.