PSCF v1.3.3
DomainTmpl.h
1#ifndef PRDC_DOMAIN_TMPL_H
2#define PRDC_DOMAIN_TMPL_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
13#include <prdc/crystal/UnitCell.h> // member
14#include <pscf/mesh/Mesh.h> // member
15#include <string> // member (groupName)
16
17// Forward declarations
18namespace Util {
19 class FileMaster;
20 template <typename T> class Signal;
21 template <> class Signal<void>;
22}
23namespace Pscf {
24 namespace Prdc {
25 template <int D> class SpaceGroup;
26 template <int D> class Basis;
27 }
28}
29
30namespace Pscf {
31namespace Prdc {
32
33 using namespace Util;
34 using namespace Pscf::Prdc;
35
69 template <int D, class FFT, class WLT, class FIT>
71 {
72
73 public:
74
79
84
87
93 void setFileMaster(FileMaster& fileMaster);
94
100 virtual void readParameters(std::istream& in);
101
111 void readRGridFieldHeader(std::istream& in, int& nMonomer);
112
116 void makeBasis();
117
121
126
130 Mesh<D> const & mesh() const;
131
136
140 UnitCell<D> const & unitCell() const;
141
145 SpaceGroup<D> const & group() const ;
146
151
155 Basis<D> const & basis() const;
156
161
165 FFT const & fft() const;
166
170 WLT& waveList();
171
175 WLT const & waveList() const;
176
180 FIT& fieldIo();
181
185 FIT const & fieldIo() const;
186
190
195
199 std::string groupName() const;
200
204 bool hasGroup() const;
205
209 bool hasBasis() const;
210
214
223 void writeWaves(std::string const & filename) const;
224
233 void writeStars(std::string const & filename) const;
234
240 void writeGroup(std::string const & filename) const;
241
243
244 private:
245
246 // Private member variables
247
251 Mesh<D> mesh_;
252
256 UnitCell<D> unitCell_;
257
261 typename UnitCell<D>::LatticeSystem lattice_;
262
266 std::string groupName_;
267
268 // Pointers to owned and associated objects
269
273 SpaceGroup<D>* groupPtr_;
274
278 Basis<D>* basisPtr_;
279
283 FFT* fftPtr_;
284
288 WLT* waveListPtr_;
289
293 FIT* fieldIoPtr_;
294
298 Signal<void>* signalPtr_;
299
303 FileMaster* fileMasterPtr_;
304
305 // Boolean flags
306
310 bool hasGroup_;
311
315 bool isInitialized_;
316
317 // Private member function
318
319 /*
320 * Get FileMaster as const reference.
321 */
322 FileMaster const & fileMaster() const
323 {
324 UTIL_CHECK(fileMasterPtr_);
325 return * fileMasterPtr_;
326 }
327
328 // Members of parent class with non-dependent names
331
332 };
333
334 // Inline member functions
335
336 // Get the UnitCell by non-const reference.
337 template <int D, class FFT, class WLT, class FIT>
339 { return unitCell_; }
340
341 // Get the UnitCell by const reference.
342 template <int D, class FFT, class WLT, class FIT>
344 { return unitCell_; }
345
346 // Get the Mesh by non-const reference.
347 template <int D, class FFT, class WLT, class FIT>
349 { return mesh_; }
350
351 // Get the Mesh by const reference.
352 template <int D, class FFT, class WLT, class FIT>
354 { return mesh_; }
355
356 // Get the SpaceGroup by const reference.
357 template <int D, class FFT, class WLT, class FIT>
359 { return *groupPtr_; }
360
361 // Get the Basis by non-const reference.
362 template <int D, class FFT, class WLT, class FIT>
364 { return *basisPtr_; }
365
366 // Get the Basis by const reference.
367 template <int D, class FFT, class WLT, class FIT>
369 { return *basisPtr_; }
370
371 // Get the FFT by non-const reference.
372 template <int D, class FFT, class WLT, class FIT>
374 { return *fftPtr_; }
375
376 // Get the FFT by const reference.
377 template <int D, class FFT, class WLT, class FIT>
378 inline FFT const & DomainTmpl<D,FFT,WLT,FIT>::fft() const
379 { return *fftPtr_; }
380
381 // Get the WaveList by non-const reference.
382 template <int D, class FFT, class WLT, class FIT>
384 { return *waveListPtr_; }
385
386 // Get the WaveList by const reference.
387 template <int D, class FFT, class WLT, class FIT>
388 inline WLT const & DomainTmpl<D,FFT,WLT,FIT>::waveList() const
389 { return *waveListPtr_; }
390
391 // Get the FieldIo by const reference.
392 template <int D, class FFT, class WLT, class FIT>
394 { return *fieldIoPtr_; }
395
396 // Get the FieldIo by const reference.
397 template <int D, class FFT, class WLT, class FIT>
398 inline FIT const & DomainTmpl<D,FFT,WLT,FIT>::fieldIo() const
399 { return *fieldIoPtr_; }
400
401 // Get the lattice system enumeration value.
402 template <int D, class FFT, class WLT, class FIT>
403 inline
405 const
406 { return lattice_; }
407
408 // Get the groupName string identifier.
409 template <int D, class FFT, class WLT, class FIT>
410 inline std::string DomainTmpl<D,FFT,WLT,FIT>::groupName() const
411 { return groupName_; }
412
413 // Has a space group been identified?
414 template <int D, class FFT, class WLT, class FIT>
416 { return hasGroup_; }
417
418} // namespace Prdc
419} // namespace Pscf
420#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:383
Fourier transform wrapper.
Definition cpu/FFT.h:38
void writeWaves(std::string const &filename) const
Output information about waves.
WLT & waveList()
Get the WaveList by non-const reference.
Definition DomainTmpl.h:383
DomainTmpl()
Constructor.
void readRGridFieldHeader(std::istream &in, int &nMonomer)
Read initialization data from header of an r-grid field file.
bool hasBasis() const
Has a symmetry-adapted Fourier basis been initialized?
UnitCell< D >::LatticeSystem lattice() const
Get the lattice system (enumeration value).
Definition DomainTmpl.h:404
virtual void readParameters(std::istream &in)
Read body of parameter block (without opening and closing lines).
Basis< D > const & basis() const
Get the Basis by const reference.
Definition DomainTmpl.h:368
Basis< D > & basis()
Get the Basis object by non-const reference.
Definition DomainTmpl.h:363
FIT & fieldIo()
Get the FieldIo by non-const reference.
Definition DomainTmpl.h:393
FFT const & fft() const
Get the FFT object by non-const reference.
Definition DomainTmpl.h:378
void setFileMaster(FileMaster &fileMaster)
Create association with a FileMaster, needed by FieldIo.
std::string groupName() const
Get the group name.
Definition DomainTmpl.h:410
FFT & fft()
Get the FFT by non-const reference.
Definition DomainTmpl.h:373
SpaceGroup< D > const & group() const
Get the SpaceGroup by const reference.
Definition DomainTmpl.h:358
UnitCell< D > & unitCell()
Get the UnitCell by non-const reference.
Definition DomainTmpl.h:338
void writeStars(std::string const &filename) const
Output information about stars and symmetrized basis functions.
bool hasGroup() const
Has a space group been declared?
Definition DomainTmpl.h:415
Mesh< D > & mesh()
Get the Mesh by non-const reference.
Definition DomainTmpl.h:348
Mesh< D > const & mesh() const
Get the Mesh by const reference.
Definition DomainTmpl.h:353
WLT const & waveList() const
Get the WaveList by const reference.
Definition DomainTmpl.h:388
void writeGroup(std::string const &filename) const
Output all elements of the space group.
UnitCell< D > const & unitCell() const
Get the UnitCell by const reference.
Definition DomainTmpl.h:343
~DomainTmpl()
Destructor.
void makeBasis()
Construct basis if not done already.
FIT const & fieldIo() const
Get the FieldIo by const reference.
Definition DomainTmpl.h:398
Crystallographic space group.
Definition SpaceGroup.h:32
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
Periodic fields and crystallography.
Definition CField.cpp:11
PSCF package top-level namespace.
Utility classes for scientific computation.