PSCF v1.3
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#include <util/global.h>
13#include <rpg/system/System.h>
14
15namespace Pscf {
16namespace Rpg
17{
18
19 template <int D> class System;
20 template <int D> class Simulator;
21
22 using namespace Util;
23 using namespace Pscf::Prdc;
24 using namespace Pscf::Prdc::Cuda;
25
31 template <int D>
32 class TrajectoryWriter : public Analyzer<D>
33 {
34
35 public:
36
41
46 {}
47
53 virtual void readParameters(std::istream& in);
54
60 virtual void save(Serializable::OArchive& ar);
61
62 #if 0
68 virtual void loadParameters(Serializable::IArchive& ar);
69
76 template <class Archive>
77 void serialize(Archive& ar, const unsigned int version);
78 #endif
79
83 virtual void setup();
84
90 virtual void sample(long iStep);
91
95 virtual void output();
96
100 using Analyzer<D>::isAtInterval;
101
102 protected:
103
104 // Output file stream
105 std::ofstream outputFile_;
106
107 // Output filename
108 std::string filename_;
109
112
115
120
125
126 protected:
127
135 void writeHeader(std::ofstream& out);
136
143 void writeFrame(std::ofstream& out, long iStep);
144
148 System<D>& system();
149
154
155
156 };
157
158 #if 0
159 /*
160 * Serialize to/from an archive.
161 */
162 template <class Archive>
163 void TrajectoryWriter<D>::serialize(Archive& ar, const unsigned int version)
164 {
165 Analyzer::serialize(ar, version);
166 ar & nSample_;
167 }
168 #endif
169
170
171 // Get the parent system.
172 template <int D>
175
176 //Get parent Simulator object.
177 template <int D>
180
181
182
183}
184}
185#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 one complete 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.
void serialize(Archive &ar, const unsigned int version)
Serialize this ParamComponent as a string.
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.
File containing preprocessor macros for error handling.
Fields, FFTs, and utilities for periodic boundary conditions (CUDA)
Definition Reduce.cpp:14
Periodic fields and crystallography.
Definition CField.cpp:11
SCFT and PS-FTS with real periodic fields (GPU)
PSCF package top-level namespace.
Definition param_pc.dox:1