PSCF v1.4.0
cp/field/Domain.h
1#ifndef PRDC_CL_DOMAIN_H
2#define PRDC_CL_DOMAIN_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 <util/param/ParamComposite.h> // base class
12#include <prdc/crystal/UnitCell.h> // member
13#include <pscf/mesh/Mesh.h> // member
14
15// Forward declarations
16namespace Util {
17 class FileMaster;
18 template <typename T> class Signal;
19 template <> class Signal<void>;
20}
21
22namespace Pscf {
23namespace Cp {
24
25 using namespace Util;
26 using namespace Prdc;
27
58 template <int D, class FFT, class WLT, class FIT>
59 class Domain : public ParamComposite
60 {
61
62 public:
63
68
73
76
82 void setFileMaster(FileMaster& fileMaster);
83
89 virtual void readParameters(std::istream& in);
90
100 void readFieldHeader(std::istream& in, int& nMonomer);
101
105
110
114 Mesh<D> const & mesh() const;
115
120
124 UnitCell<D> const & unitCell() const;
125
130
134 FFT const & fft() const;
135
139 WLT& waveList();
140
144 WLT const & waveList() const;
145
149 FIT& fieldIo();
150
154 FIT const & fieldIo() const;
155
160
162
163 private:
164
165 // Private member variables
166
170 Mesh<D> mesh_;
171
175 UnitCell<D> unitCell_;
176
180 typename UnitCell<D>::LatticeSystem lattice_;
181
185 FFT* fftPtr_;
186
190 WLT* waveListPtr_;
191
195 FIT* fieldIoPtr_;
196
200 Signal<void>* signalPtr_;
201
205 FileMaster* fileMasterPtr_;
206
207 // Boolean flags
208
212 bool isInitialized_;
213
214 // Private member function
215
216 /*
217 * Get FileMaster as const reference.
218 */
219 FileMaster const & fileMaster() const
220 {
221 UTIL_CHECK(fileMasterPtr_);
222 return * fileMasterPtr_;
223 }
224
225 // Members of parent class with non-dependent names
228
229 };
230
231 // Inline member functions
232
233 // Get the UnitCell by non-const reference.
234 template <int D, class FFT, class WLT, class FIT>
236 { return unitCell_; }
237
238 // Get the UnitCell by const reference.
239 template <int D, class FFT, class WLT, class FIT>
241 { return unitCell_; }
242
243 // Get the Mesh by non-const reference.
244 template <int D, class FFT, class WLT, class FIT>
246 { return mesh_; }
247
248 // Get the Mesh by const reference.
249 template <int D, class FFT, class WLT, class FIT>
251 { return mesh_; }
252
253 // Get the FFT by non-const reference.
254 template <int D, class FFT, class WLT, class FIT>
256 { return *fftPtr_; }
257
258 // Get the FFT by const reference.
259 template <int D, class FFT, class WLT, class FIT>
260 inline FFT const & Domain<D,FFT,WLT,FIT>::fft() const
261 { return *fftPtr_; }
262
263 // Get the WaveList by non-const reference.
264 template <int D, class FFT, class WLT, class FIT>
266 { return *waveListPtr_; }
267
268 // Get the WaveList by const reference.
269 template <int D, class FFT, class WLT, class FIT>
270 inline WLT const & Domain<D,FFT,WLT,FIT>::waveList() const
271 { return *waveListPtr_; }
272
273 // Get the FieldIo by const reference.
274 template <int D, class FFT, class WLT, class FIT>
276 { return *fieldIoPtr_; }
277
278 // Get the FieldIo by const reference.
279 template <int D, class FFT, class WLT, class FIT>
280 inline FIT const & Domain<D,FFT,WLT,FIT>::fieldIo() const
281 { return *fieldIoPtr_; }
282
283 // Get the lattice system enumeration value.
284 template <int D, class FFT, class WLT, class FIT>
285 inline
287 const
288 { return lattice_; }
289
290} // namespace Cp
291} // namespace Pscf
292#endif
virtual void readParameters(std::istream &in)
Read body of parameter block (without opening and closing lines).
Mesh< D > const & mesh() const
Get the Mesh by const reference.
Mesh< D > & mesh()
Get the Mesh by non-const reference.
FIT const & fieldIo() const
Get the FieldIo by const reference.
FFT & fft()
Get the FFT by non-const reference.
FIT & fieldIo()
Get the FieldIo by non-const reference.
WLT const & waveList() const
Get the WaveList by const reference.
UnitCell< D > & unitCell()
Get the UnitCell by non-const reference.
UnitCell< D > const & unitCell() const
Get the UnitCell by const reference.
void setFileMaster(FileMaster &fileMaster)
Create association with a FileMaster, needed by FieldIo.
FFT const & fft() const
Get the FFT object by non-const reference.
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.
Domain()
Constructor.
UnitCell< D >::LatticeSystem lattice() const
Get the lattice system (enumeration value).
Description of a regular grid of points in a periodic domain.
Definition Mesh.h:61
Fourier transform wrapper.
Definition cpu/FFT.h:39
Base template for UnitCell<D> classes, D=1, 2 or 3.
Definition UnitCell.h:56
A FileMaster manages input and output files for a simulation.
Definition FileMaster.h:143
ScalarParam< Type > & read(std::istream &in, const char *label, Type &value)
Add and read a new required ScalarParam < Type > object.
ScalarParam< Type > & readOptional(std::istream &in, const char *label, Type &value)
Add and read a new optional ScalarParam < Type > object.
ParamComposite()
Constructor.
Notifier (or subject) in the Observer design pattern.
Definition Signal.h:39
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
Definition global.h:68
Complex-valued periodic fields (class templates).
Definition cp.mod:6
Periodic fields and crystallography.
Definition complex.cpp:11
PSCF package top-level namespace.
Utility classes for scientific computation.