PSCF v1.1
fd1d/domain/Domain.h
1#ifndef FD1D_DOMAIN_H
2#define FD1D_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#include "GeometryMode.h" // member
13#include <util/containers/DArray.h> // function parameter
14
15namespace Pscf {
16namespace Fd1d {
17
18 using namespace Util;
19
26 class Domain : public ParamComposite
27 {
28
29 public:
30
35
39 Domain();
40
44 ~Domain();
45
48
52 void readParameters(std::istream& in);
53
61 void setPlanarParameters(double xMin, double xMax, int nx);
62
72 double xMin, double xMax,
73 int nx);
74
81 void setCylinderParameters(double xMax, int nx);
82
89 void setSphereParameters(double xMax, int nx);
90
94
98 double xMin() const;
99
103 double xMax() const;
104
111 double volume() const;
112
116 double dx() const;
117
121 int nx() const;
122
126 GeometryMode const & mode() const;
127
137 bool isShell() const;
138
142
149 double spatialAverage(Field const & f) const;
150
158 double innerProduct(Field const & f, Field const & g) const;
159
161
162 private:
163
167 double xMin_;
168
172 double xMax_;
173
177 double dx_;
178
182 double volume_;
183
187 int nx_;
188
192 GeometryMode mode_;
193
197 bool isShell_;
198
202 mutable DArray<double> work_;
203
207 void computeVolume();
208
209 };
210
211 // Inline member functions
212
213 inline int Domain::nx() const
214 { return nx_; }
215
216 inline double Domain::dx() const
217 { return dx_; }
218
219 inline double Domain::xMin() const
220 { return xMin_; }
221
222 inline double Domain::xMax() const
223 { return xMax_; }
224
225 inline double Domain::volume() const
226 { return volume_; }
227
228 inline GeometryMode const & Domain::mode() const
229 { return mode_; }
230
231 inline bool Domain::isShell() const
232 { return isShell_; }
233
234} // namespace Fd1d
235} // namespace Pscf
236#endif
One-dimensional spatial domain and discretization grid.
double dx() const
Get spatial grid step size.
bool isShell() const
Is this a cylindrical or spherical shell?
DArray< double > Field
Generic field type (base class)
double spatialAverage(Field const &f) const
Compute spatial average of a field.
void setSphereParameters(double xMax, int nx)
Set grid parameters for a sphere.
double xMin() const
Get minimum spatial coordinate.
void setShellParameters(GeometryMode mode, double xMin, double xMax, int nx)
Set grid parameters for a cylindrical or spherical shell.
double xMax() const
Get maximum spatial coordinate.
void setPlanarParameters(double xMin, double xMax, int nx)
Set grid parameters for a planar domain.
GeometryMode const & mode() const
Get coordinate system flag (Planar, Cylindrical or Spherical).
void readParameters(std::istream &in)
Read all parameters and initialize.
int nx() const
Get number of spatial grid points, including both endpoints.
void setCylinderParameters(double xMax, int nx)
Set grid parameters for a cylinder.
double volume() const
Get generalized volume of domain.
double innerProduct(Field const &f, Field const &g) const
Compute inner product of two real fields.
Dynamically allocatable contiguous array template.
Definition: DArray.h:32
An object that can read multiple parameters from file.
GeometryMode
Enumeration of geometrical modes for functions of one coordinate.
Definition: GeometryMode.h:30
C++ namespace for polymer self-consistent field theory (PSCF).
Utility classes for scientific computation.
Definition: accumulators.mod:1