1#ifndef RP_RGRID_TRAJECTORY_READER_TPP
2#define RP_RGRID_TRAJECTORY_READER_TPP
11#include "RGridTrajectoryReader.h"
12#include <util/misc/ioUtil.h>
13#include <util/misc/FileMaster.h>
23 template <
int D,
class T>
25 typename T::System& system)
26 : TrajectoryReaderT(system),
33 template <
int D,
class T>
34 void RGridTrajectoryReader<D,T>::allocate()
36 const int nMonomer = system().mixture().nMonomer();
38 meshDimensions_ = system().domain().mesh().dimensions();
40 wField_.allocate(nMonomer);
41 for (
int i = 0; i < nMonomer; ++i) {
42 wField_[i].allocate(meshDimensions_);
51 template <
int D,
class T>
54 system().fileMaster().open(filename, inputfile_);
61 template <
int D,
class T>
64 int nMonomer = system().mixture().nMonomer();
65 typename T::FieldIo
const & fieldIo = system().domain().fieldIo();
68 fieldIo.readFieldHeader(inputfile_, nMonomer, tmpUnitCell,
70 system().setUnitCell(tmpUnitCell);
77 template <
int D,
class T>
82 UTIL_THROW(
"Memory not allocated in RGridTrajectoryReader");
86 std::stringstream line;
101 step = std::stoi(value);
115 int nMonomer = system().mixture().nMonomer();
116 typename T::FieldIo
const & fieldIo = system().domain().fieldIo();
117 fieldIo.readFieldsRGridData(inputfile_, wField_, nMonomer);
120 system().w().setRGrid(wField_);
128 template <
int D,
class T>
130 { inputfile_.close(); }
Base template for UnitCell<D> classes, D=1, 2 or 3.
bool readFrame() override
Read a single frame from the trajectory file.
RGridTrajectoryReader(typename T::System &system)
Constructor.
void readHeader() override
Read header of trajectory file (if any).
void close() override
Close the trajectory file.
void open(std::string filename) override
Open trajectory file and read header, if any.
static std::ostream & file()
Get log ostream by reference.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
void checkString(std::istream &in, const std::string &expected)
Extract string from stream, and compare to expected value.
bool getNextLine(std::istream &in, std::string &line)
Read the next non-empty line into a string, strip trailing whitespace.
bool hasSymmetry(AT const &in, Basis< D > const &basis, IntVec< D > const &dftDimensions, double epsilon=1.0e-8, bool verbose=true)
Check if a k-grid field has the declared space group symmetry.
Class templates for real-valued periodic fields.
PSCF package top-level namespace.