1#ifndef PRDC_CL_DOMAIN_TPP
2#define PRDC_CL_DOMAIN_TPP
12#include <prdc/field/fieldHeader.h>
13#include <util/signal/Signal.h>
14#include <util/misc/FileMaster.h>
25 template <
int D,
class FFT,
class WLT,
class FIT>
31 waveListPtr_(nullptr),
34 fileMasterPtr_(nullptr),
41 bool isRealField =
false;
42 waveListPtr_ =
new WLT(isRealField);
43 fieldIoPtr_ =
new FIT();
54 unitCell_.setSignal(*signalPtr_);
60 template <
int D,
class FFT,
class WLT,
class FIT>
72 template <
int D,
class FFT,
class WLT,
class FIT>
75 fileMasterPtr_ = &fileMaster;
76 fieldIo().setFileMaster(fileMaster);
82 template <
int D,
class FFT,
class WLT,
class FIT>
90 read(in,
"mesh", mesh_);
92 fft().setup(mesh_.dimensions());
95 read(in,
"lattice", lattice_);
96 unitCell_.set(lattice_);
101 waveList().allocate(mesh_, unitCell_);
104 std::string groupName;
105 readOptional(in,
"groupName", groupName);
107 isInitialized_ =
true;
115 template <
int D,
class FFT,
class WLT,
class FIT>
127 std::string groupName;
129 unitCell_, groupName, nMonomer);
132 lattice_ = unitCell_.lattice();
139 if (label !=
"mesh" && label !=
"ngrid") {
140 std::string msg =
"\n";
141 msg +=
"Error reading field file:\n";
142 msg +=
"Expected mesh or ngrid, but found [";
151 if (mesh_.size() == 0) {
152 mesh_.setDimensions(nGrid);
153 fft().setup(mesh_.dimensions());
158 waveList().allocate(mesh_, unitCell_);
161 isInitialized_ =
true;
virtual void readParameters(std::istream &in)
Read body of parameter block (without opening and closing lines).
FFT & fft()
Get the FFT by non-const reference.
FIT & fieldIo()
Get the FieldIo by non-const reference.
void setFileMaster(FileMaster &fileMaster)
Create association with a FileMaster, needed by FieldIo.
void readFieldHeader(std::istream &in, int &nMonomer)
Read initialization data from header of an r-grid field file.
WLT & waveList()
Get the WaveList by non-const reference.
An IntVec<D, T> is a D-component vector of elements of integer type T.
Fourier transform wrapper.
Base template for UnitCell<D> classes, D=1, 2 or 3.
A FileMaster manages input and output files for a simulation.
void setClassName(const char *className)
Set class name string.
Notifier (or subject) in the Observer design pattern.
#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 readFieldHeader(std::istream &in, int &ver1, int &ver2, UnitCell< D > &cell, std::string &groupName, int &nMonomer)
Read common part of field header (fortran PSCF format).
Complex-valued periodic fields (class templates).
Periodic fields and crystallography.
PSCF package top-level namespace.