1#ifndef RPC_TRAJECTORY_WRITER_TPP
2#define RPC_TRAJECTORY_WRITER_TPP
10#include "TrajectoryWriter.h"
12#include <rpc/fts/simulator/Simulator.h>
13#include <rpc/System.h>
14#include <util/misc/FileMaster.h>
16#include <util/misc/ioUtil.h>
33 isInitialized_(false),
34 simulatorPtr_(&simulator),
35 systemPtr_(&(simulator.system()))
45 isInitialized_ =
true;
57 isInitialized_ =
true;
76 filename_ = outputFileName();
77 system().fileMaster().openOutputFile(filename_ , outputFile_);
78 writeHeader(outputFile_);
84 out <<
"i = " << iStep <<
"\n";
85 bool writeHeader =
false;
86 bool isSymmetric =
false;
87 Domain<D> const & domain = system().domain();
91 writeHeader, isSymmetric);
99 int nMonomer = system().mixture().nMonomer();
100 bool isSymmetric =
false;
101 Domain<D> const & domain = system().domain();
115 if (isAtInterval(iStep)) {
116 writeFrame(outputFile_, iStep);
126 { outputFile_.close(); }
void writeFieldHeader(std::ostream &out, int nMonomer, UnitCell< D > const &unitCell, bool isSymmetric=true) const
Write header for field file (fortran pscf format)
Abstract base for periodic output and/or analysis actions.
virtual void readParameters(std::istream &in)
Read parameters from archive.
Spatial domain and spatial discretization for a periodic structure.
FieldIo< D > & fieldIo()
Get associated FieldIo object.
UnitCell< D > & unitCell()
Get UnitCell (i.e., lattice type and parameters) by reference.
File input/output operations and format conversions for fields.
void writeFieldsRGrid(std::ostream &out, DArray< RField< D > > const &fields, UnitCell< D > const &unitCell, bool writeHeader=true, bool isSymmetric=true, bool writeMeshSize=true) const override
Write array of RField objects (fields on r-space grid) to a stream.
Field theoretic simulator (base class).
Main class for SCFT or PS-FTS simulation of one system.
virtual void readParameters(std::istream &in)
Read interval and output file name.
void setClassName(const char *className)
Set class name string.
void writeHeader(std::ofstream &out)
Write data that should appear once, at beginning of the file.
virtual void output()
Close trajectory file after run.
void writeFrame(std::ofstream &out, long iStep)
Write data that should appear in every frame.
TrajectoryWriter(Simulator< D > &simulator, System< D > &system)
Constructor.
virtual void setup()
Clear nSample counter.
virtual void sample(long iStep)
Write a frame/snapshot to trajectory file.
Loading (input) archive for binary istream.
Saving / output archive for binary ostream.
virtual void loadParameters(Serializable::IArchive &ar)
Load state from archive, without adding Begin and End lines.
virtual void save(OArchive &ar)=0
Save to an archive.
PSCF package top-level namespace.
Utility classes for scientific computation.