PSCF v1.1
pspc/field/Domain.h
1#ifndef PSPC_DOMAIN_H
2#define PSPC_DOMAIN_H
3
4/*
5* PSCF - Polymer Self-Consistent Field Theory
6*
7* Copyright 2016 - 2022, 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 <pspc/field/FieldIo.h> // member
14#include <pspc/field/FFT.h> // member
15
16#include <pscf/crystal/Basis.h> // member
17#include <pscf/crystal/SpaceGroup.h> // member
18#include <pscf/crystal/UnitCell.h> // member
19#include <pscf/mesh/Mesh.h> // member
20
21#include <string>
22
23namespace Pscf {
24namespace Pspc
25{
26
27 using namespace Util;
28
45 template <int D>
46 class Domain : public ParamComposite
47 {
48
49 public:
50
53
57 Domain();
58
62 ~Domain();
63
69 void setFileMaster(FileMaster& fileMaster);
70
76 virtual void readParameters(std::istream& in);
77
86 void readRGridFieldHeader(std::istream& in, int& nMonomer);
87
95 void setUnitCell(UnitCell<D> const & unitCell);
96
106 FSArray<double, 6> const & parameters);
107
116 void setUnitCell(FSArray<double, 6> const & parameters);
117
121 void makeBasis();
122
126
131
135 UnitCell<D> const & unitCell() const;
136
140 Mesh<D>& mesh();
141
145 Mesh<D> const & mesh() const;
146
150 SpaceGroup<D> const & group() const ;
151
155 Basis<D>& basis();
156
160 Basis<D> const & basis() const ;
161
165 FFT<D>& fft();
166
170 FFT<D> const & fft() const;
171
176
180 FieldIo<D> const & fieldIo() const;
181
185 typename UnitCell<D>::LatticeSystem lattice() const;
186
190 std::string groupName() const;
191
193
194 private:
195
196 // Private member variables
197
201 UnitCell<D> unitCell_;
202
206 Mesh<D> mesh_;
207
211 SpaceGroup<D> group_;
212
216 Basis<D> basis_;
217
221 FFT<D> fft_;
222
226 FieldIo<D> fieldIo_;
227
231 typename UnitCell<D>::LatticeSystem lattice_;
232
236 std::string groupName_;
237
241 bool hasFileMaster_;
242
246 bool isInitialized_;
247
248 // members of parent class with non-dependent names
251
252 };
253
254 // Inline member functions
255
256 // Get the UnitCell<D> object by non-const reference.
257 template <int D>
259 { return unitCell_; }
260
261 // Get the UnitCell<D> object by const reference.
262 template <int D>
263 inline UnitCell<D> const & Domain<D>::unitCell() const
264 { return unitCell_; }
265
266 // Get the Mesh<D> object by reference.
267 template <int D>
269 { return mesh_; }
270
271 // Get the Mesh<D> object by const reference.
272 template <int D>
273 inline Mesh<D> const & Domain<D>::mesh() const
274 { return mesh_; }
275
276 // Get the SpaceGroup<D> object by const reference.
277 template <int D>
278 inline SpaceGroup<D> const & Domain<D>::group() const
279 { return group_; }
280
281 // Get the Basis<D> object by non-const reference.
282 template <int D>
284 { return basis_; }
285
286 // Get the Basis<D> object by const reference.
287 template <int D>
288 inline Basis<D> const & Domain<D>::basis() const
289 { return basis_; }
290
291 // Get the FFT<D> object.
292 template <int D>
294 { return fft_; }
295
296 // Get the FFT<D> object.
297 template <int D>
298 inline FFT<D> const & Domain<D>::fft() const
299 { return fft_; }
300
301 // Get the FieldIo<D> object.
302 template <int D>
304 { return fieldIo_; }
305
306 // Get the FieldIo<D> object by const reference.
307 template <int D>
308 inline FieldIo<D> const & Domain<D>::fieldIo() const
309 { return fieldIo_; }
310
311 // Get the lattice system enumeration value
312 template <int D>
313 inline
315 const
316 { return lattice_; }
317
318 // Get the groupName string.
319 template <int D>
320 inline std::string Domain<D>::groupName() const
321 { return groupName_; }
322
323 #ifndef PSPC_DOMAIN_TPP
324 // Suppress implicit instantiation
325 extern template class Domain<1>;
326 extern template class Domain<2>;
327 extern template class Domain<3>;
328 #endif
329
330} // namespace Pspc
331} // namespace Pscf
332#endif
Symmetry-adapted Fourier basis for pseudo-spectral scft.
Definition: Basis.h:346
Description of a regular grid of points in a periodic domain.
Definition: Mesh.h:61
Spatial domain and spatial discretization for a periodic structure.
std::string groupName() const
Get group name.
virtual void readParameters(std::istream &in)
Read body of parameter block (without opening and closing lines).
FieldIo< D > & fieldIo()
Get associated FieldIo object.
Basis< D > & basis()
Get associated Basis object by reference.
SpaceGroup< D > const & group() const
Get associated SpaceGroup object by const reference.
void setFileMaster(FileMaster &fileMaster)
Create association with a FileMaster, needed by FieldIo.
void setUnitCell(UnitCell< D > const &unitCell)
Set unit cell.
UnitCell< D >::LatticeSystem lattice() const
Get lattice system.
Mesh< D > & mesh()
Get spatial discretization mesh by reference.
void readRGridFieldHeader(std::istream &in, int &nMonomer)
Read header of an r-grid field file to initialize this Domain.
FFT< D > & fft()
Get associated FFT object.
void makeBasis()
Construct basis if not done already.
UnitCell< D > & unitCell()
Get UnitCell (i.e., lattice type and parameters) by reference.
Fourier transform wrapper for real data.
File input/output operations and format conversions for fields.
Crystallographic space group.
Definition: SpaceGroup.h:30
Base template for UnitCell<D> classes, D=1, 2 or 3.
Definition: UnitCell.h:44
A fixed capacity (static) contiguous array with a variable logical size.
Definition: FSArray.h:38
A FileMaster manages input and output files for a simulation.
Definition: FileMaster.h:143
An object that can read multiple parameters from file.
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.
C++ namespace for polymer self-consistent field theory (PSCF).
Utility classes for scientific computation.
Definition: accumulators.mod:1