PSCF v1.5.0
FilmFieldGenMask_u.h
1#ifndef RPG_MASK_GEN_FILM_U_H
2#define RPG_MASK_GEN_FILM_U_H
3
4/*
5* PSCF - Polymer Self-Consistent Field
6*
7* Copyright 2015 - 2026, David Morse (morse012@um.edu) and co-authors
8* Distributed under the terms of the GNU General Public License.
9*/
10
11#include <rp/environment/FilmFieldGenMaskBase.h> // base class
12#include <pscf/backend/cuda/CUT.h> // template argument
13#include <rp/system/System.h>
14
15// Forward declarations
16namespace Pscf {
17 namespace Rp {
18 template <int D, class T> class FilmFieldGenMask;
19 template <int D, class T> class System;
20 }
21}
22
23namespace Pscf {
24namespace Rp {
25
26 using namespace Util;
27
41 template <int D>
43 : public FilmFieldGenMaskBase<D>
44 {
45
46 public:
47
52
59
64
83 double stress(int paramId) const;
84
107 double modifyStress(int paramId, double stress) const;
108
113
114 protected:
115
119 void compute();
120
124 void setFlexibleParams() const;
125
133 System<D,CUT> const & system() const;
134
138 std::string systemSpaceGroup() const;
139
145 RealVec<D> systemLatticeVector(int id) const;
146
151
152 private:
153
155 System<D,CUT>* sysPtr_;
156
157 };
158
159 // Inline member functions
160
161 // Get parent System by non-const reference.
162 template <int D> inline
165 {
166 UTIL_CHECK(sysPtr_);
167 return *sysPtr_;
168 }
169
170 // Get parent System by const reference.
171 template <int D> inline
172 System<D,CUT> const &
174 {
175 UTIL_CHECK(sysPtr_);
176 return *sysPtr_;
177 }
178
179 // Get space group name for this system.
180 template <int D> inline
181 std::string
183 { return system().domain().groupName(); }
184
185 // Get one of the lattice vectors for this system.
186 template <int D> inline
189 { return system().domain().unitCell().rBasis(id); }
190
191 // Explicit instantiation declarations
192 extern template class FilmFieldGenMask<1,CUT>;
193 extern template class FilmFieldGenMask<2,CUT>;
194 extern template class FilmFieldGenMask<3,CUT>;
195
196} // namespace Rp
197} // namespace Pscf
198
199#endif
Backend identifier class for the GPU-enabled CUDA backend.
Definition CUT.h:31
A RealVec<D, T> is D-component vector with elements of floating type T.
Definition RealVec.h:28
double excludedThickness() const
Get value of excludedThickness.
double fBulk_
Reference free energy used to calculate stress normal to the film.
int normalVecId() const
Get value of normalVecId.
double interfaceThickness() const
Get value of interfaceThickness.
bool hasFBulk() const
Check whether a value of fBulk was provided.
FSArray< bool, 6 > modifyFlexibleParams(FSArray< bool, 6 > current, UnitCell< D > const &cell) const
Modifies a flexibleParams array to be compatible with this mask.
RealVec< D > normalVecCurrent_
The lattice vector normal to the film used to generate these fields.
double stress(int paramId) const
Get contribution to the stress from this mask.
void setFlexibleParams() const
Modifies iterator().flexibleParams_ to be compatible with the mask.
RealVec< D > systemLatticeVector(int id) const
Get one of the lattice vectors for this system.
double modifyStress(int paramId, double stress) const
Modify stress value in direction normal to the film.
std::string systemSpaceGroup() const
Get the space group name for this system.
System< D, CUT > & system()
Get the System associated with this object by reference.
void compute()
Compute the field and store where the System can access.
Base class template for classes that represent a complete system.
void setClassName(const char *className)
Set class name string.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
Definition global.h:68
Code for programs that simulate real-valued periodic fields.
Definition param_pc.dox:2
PSCF package top-level namespace.