PSCF v1.3.1
rpg/fts/analyzer/TrajectoryWriter.h
1#ifndef RPG_TRAJECTORY_WRITER_H
2#define RPG_TRAJECTORY_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
13namespace Pscf {
14namespace Rpg {
15
16 template <int D> class System;
17 template <int D> class Simulator;
18
19 using namespace Util;
20
26 template <int D>
27 class TrajectoryWriter : public Analyzer<D>
28 {
29
30 public:
31
36
41 {}
42
48 virtual void readParameters(std::istream& in);
49
55 virtual void save(Serializable::OArchive& ar);
56
57 #if 0
63 virtual void loadParameters(Serializable::IArchive& ar);
64
71 template <class Archive>
72 void serialize(Archive& ar, const unsigned int version);
73 #endif
74
78 virtual void setup();
79
85 virtual void sample(long iStep);
86
90 virtual void output();
91
96
97 protected:
98
99 // Output file stream
100 std::ofstream outputFile_;
101
102 // Output filename
103 std::string filename_;
104
107
110
115
120
121 protected:
122
130 void writeHeader(std::ofstream& out);
131
138 void writeFrame(std::ofstream& out, long iStep);
139
143 System<D>& system();
144
149
150
151 };
152
153 // Get the parent system.
154 template <int D>
157
158 //Get parent Simulator object.
159 template <int D>
162
163
164
165}
166}
167#endif
Abstract base for periodic output and/or analysis actions.
const std::string & outputFileName() const
Return outputFileName string.
Analyzer()
Default constructor.
bool isAtInterval(long counter) const
Return true iff counter is a multiple of the interval.
Field theoretic simulator (base class).
Main class, representing a complete physical system.
void writeHeader(std::ofstream &out)
Write data that should appear once, at beginning of the file.
virtual void save(Serializable::OArchive &ar)
Save state to archive.
virtual void readParameters(std::istream &in)
Read interval and output file name.
virtual void setup()
Clear nSample counter.
long nSample_
Number of configurations dumped thus far (first dump is zero).
Simulator< D > & simulator()
Return reference to parent Simulator.
TrajectoryWriter(Simulator< D > &simulator, System< D > &system)
Constructor.
void writeFrame(std::ofstream &out, long iStep)
Write data that should appear in every frame.
Simulator< D > * simulatorPtr_
Pointer to parent Simulator.
System< D > & system()
Return reference to parent system.
virtual void output()
Close trajectory file after run.
long isInitialized_
Has readParam been called?
System< D > * systemPtr_
Pointer to the parent system.
virtual void sample(long iStep)
Write a frame/snapshot to trajectory file.
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.
virtual void loadParameters(Serializable::IArchive &ar)
Load state from archive, without adding Begin and End lines.
BinaryFileIArchive IArchive
Type of input archive used by load method.
BinaryFileOArchive OArchive
Type of output archive used by save method.
SCFT and PS-FTS with real periodic fields (GPU)
PSCF package top-level namespace.
Definition param_pc.dox:1