1#ifndef RPG_CONCENTRATION_WRITER_TPP
2#define RPG_CONCENTRATION_WRITER_TPP
10#include "ConcentrationWriter.h"
12#include <rpg/fts/simulator/Simulator.h>
13#include <rpg/System.h>
14#include <util/misc/FileMaster.h>
15#include <util/misc/ioUtil.h>
32 isInitialized_(false),
33 simulatorPtr_(&simulator),
34 systemPtr_(&(simulator.system()))
44 isInitialized_ =
true;
55 filename_ = outputFileName();
56 system().fileMaster().openOutputFile(filename_ , outputFile_);
57 writeHeader(outputFile_);
64 if (!system().hasCFields()){
67 out <<
"i = " << iStep <<
"\n";
68 bool writeHeader =
false;
69 bool isSymmetric =
false;
70 Domain<D> const & domain = system().domain();
74 writeHeader, isSymmetric);
82 int nMonomer = system().mixture().nMonomer();
83 bool isSymmetric =
false;
84 Domain<D> const & domain = system().domain();
98 if (isAtInterval(iStep)) {
99 writeFrame(outputFile_, iStep);
109 { 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.
ConcentrationWriter(Simulator< D > &simulator, System< D > &system)
Constructor.
virtual void setup()
Clear nSample counter.
void setClassName(const char *className)
Set class name string.
virtual void readParameters(std::istream &in)
Read interval and output file name.
virtual void sample(long iStep)
Write a frame/snapshot to trajectory file.
virtual void output()
Close trajectory file after run.
void writeFrame(std::ofstream &out, long iStep)
Write data that should appear in every frame.
void writeHeader(std::ofstream &out)
Write data that should appear once, at beginning of the file.
Spatial domain and spatial discretization for a periodic structure.
UnitCell< D > & unitCell()
Get UnitCell by reference.
FieldIo< D > & fieldIo()
Get associated FieldIo object.
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
Write array of RField objects (fields on r-space grid) to a stream.
Field theoretic simulator (base class).
Main class for calculations that represent one system.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
PSCF package top-level namespace.
Utility classes for scientific computation.