PSCF v1.4.0
rp/field/Domain.h
1#ifndef RP_DOMAIN_H
2#define RP_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#include <string> // member (groupName)
15
16// Forward declarations
17namespace Util {
18 class FileMaster;
19 template <typename T> class Signal;
20 template <> class Signal<void>;
21}
22namespace Pscf {
23 namespace Prdc {
24 template <int D> class SpaceGroup;
25 template <int D> class Basis;
26 }
27}
28
29namespace Pscf {
30namespace Rp {
31
32 using namespace Util;
33 using namespace Pscf::Prdc;
34
68 template <int D, class FFT, class WLT, class FIT>
69 class Domain : public ParamComposite
70 {
71
72 public:
73
76
82 void setFileMaster(FileMaster& fileMaster);
83
89 virtual void readParameters(std::istream& in);
90
100 void readRGridFieldHeader(std::istream& in, int& nMonomer);
101
105 void makeBasis();
106
110
115
119 Mesh<D> const & mesh() const;
120
125
129 UnitCell<D> const & unitCell() const;
130
134 SpaceGroup<D> const & group() const ;
135
140
144 Basis<D> const & basis() const;
145
150
154 FFT const & fft() const;
155
159 WLT& waveList();
160
164 WLT const & waveList() const;
165
169 FIT& fieldIo();
170
174 FIT const & fieldIo() const;
175
179
184
188 std::string groupName() const;
189
193 bool hasGroup() const;
194
198 bool hasBasis() const;
199
203
212 void writeWaves(std::string const & filename) const;
213
222 void writeStars(std::string const & filename) const;
223
229 void writeGroup(std::string const & filename) const;
230
232
233 protected:
234
238 Domain();
239
243 ~Domain();
244
245 private:
246
247 // Private member variables
248
252 Mesh<D> mesh_;
253
257 UnitCell<D> unitCell_;
258
262 typename UnitCell<D>::LatticeSystem lattice_;
263
267 std::string groupName_;
268
269 // Pointers to owned and associated objects.
270
274 SpaceGroup<D>* groupPtr_;
275
279 Basis<D>* basisPtr_;
280
284 FFT* fftPtr_;
285
289 WLT* waveListPtr_;
290
294 FIT* fieldIoPtr_;
295
299 Signal<void>* signalPtr_;
300
304 FileMaster* fileMasterPtr_;
305
306 // Boolean flags
307
311 bool hasGroup_;
312
316 bool isInitialized_;
317
318 // Private member function
319
320 /*
321 * Get FileMaster as const reference.
322 */
323 FileMaster const & fileMaster() const;
324
325 };
326
327 // Public inline member functions
328
329 // Get the UnitCell by non-const reference.
330 template <int D, class FFT, class WLT, class FIT> inline
332 { return unitCell_; }
333
334 // Get the UnitCell by const reference.
335 template <int D, class FFT, class WLT, class FIT> inline
337 { return unitCell_; }
338
339 // Get the Mesh by non-const reference.
340 template <int D, class FFT, class WLT, class FIT> inline
342 { return mesh_; }
343
344 // Get the Mesh by const reference.
345 template <int D, class FFT, class WLT, class FIT> inline
347 { return mesh_; }
348
349 // Get the SpaceGroup by const reference.
350 template <int D, class FFT, class WLT, class FIT> inline
352 { return *groupPtr_; }
353
354 // Get the Basis by non-const reference.
355 template <int D, class FFT, class WLT, class FIT> inline
357 { return *basisPtr_; }
358
359 // Get the Basis by const reference.
360 template <int D, class FFT, class WLT, class FIT> inline
362 { return *basisPtr_; }
363
364 // Get the FFT by non-const reference.
365 template <int D, class FFT, class WLT, class FIT> inline
367 { return *fftPtr_; }
368
369 // Get the FFT by const reference.
370 template <int D, class FFT, class WLT, class FIT> inline
372 { return *fftPtr_; }
373
374 // Get the WaveList by non-const reference.
375 template <int D, class FFT, class WLT, class FIT> inline
377 { return *waveListPtr_; }
378
379 // Get the WaveList by const reference.
380 template <int D, class FFT, class WLT, class FIT> inline
382 { return *waveListPtr_; }
383
384 // Get the FieldIo by const reference.
385 template <int D, class FFT, class WLT, class FIT> inline
387 { return *fieldIoPtr_; }
388
389 // Get the FieldIo by const reference.
390 template <int D, class FFT, class WLT, class FIT> inline
392 { return *fieldIoPtr_; }
393
394 // Get the lattice type enumeration value.
395 template <int D, class FFT, class WLT, class FIT> inline
397 const
398 { return lattice_; }
399
400 // Get the groupName string identifier.
401 template <int D, class FFT, class WLT, class FIT>
402 inline std::string Domain<D,FFT,WLT,FIT>::groupName() const
403 { return groupName_; }
404
405 // Has a space group been identified?
406 template <int D, class FFT, class WLT, class FIT>
408 { return hasGroup_; }
409
410 // Private inline member function
411
412 // Get FileMaster as const reference.
413 template <int D, class FFT, class WLT, class FIT> inline
414 FileMaster const & Domain<D,FFT,WLT,FIT>::fileMaster() const
415 {
416 UTIL_CHECK(fileMasterPtr_);
417 return * fileMasterPtr_;
418 }
419
420} // namespace Rp
421} // namespace Pscf
422#endif
Description of a regular grid of points in a periodic domain.
Definition Mesh.h:61
Symmetry-adapted Fourier basis for pseudo-spectral SCFT.
Definition Basis.h:384
Fourier transform wrapper.
Definition cpu/FFT.h:39
Crystallographic space group.
Definition SpaceGroup.h:32
Base template for UnitCell<D> classes, D=1, 2 or 3.
Definition UnitCell.h:56
bool hasBasis() const
Has a symmetry-adapted Fourier basis been initialized?
SpaceGroup< D > const & group() const
Get the SpaceGroup by const reference.
WLT & waveList()
Get the WaveList by non-const reference.
bool hasGroup() const
Has a space group been declared?
void setFileMaster(FileMaster &fileMaster)
Create association with a FileMaster, needed by FieldIo.
FIT & fieldIo()
Get the FieldIo by non-const reference.
Domain()
Constructor.
Basis< D > & basis()
Get the Basis object by non-const reference.
void writeStars(std::string const &filename) const
Output information about stars and symmetrized basis functions.
UnitCell< D > & unitCell()
Get the UnitCell by non-const reference.
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.
std::string groupName() const
Get the group name.
void makeBasis()
Construct basis if not done already.
UnitCell< D >::LatticeSystem lattice() const
Get the lattice type (enumeration value).
Mesh< D > & mesh()
Get the Mesh by non-const reference.
void writeGroup(std::string const &filename) const
Output all elements of the space group.
void readRGridFieldHeader(std::istream &in, int &nMonomer)
Read initialization data from header of an r-grid field file.
void writeWaves(std::string const &filename) const
Output information about waves.
A FileMaster manages input and output files for a simulation.
Definition FileMaster.h:143
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
Periodic fields and crystallography.
Definition complex.cpp:11
Class templates for real-valued periodic fields.
PSCF package top-level namespace.
Utility classes for scientific computation.