PSCF v1.5.0
FilmFieldGenMask_c.h
1#ifndef RP_FILM_FIELD_MASK_GEN_C_H
2#define RP_FILM_FIELD_MASK_GEN_C_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/cpp/CPT.h> // template parameter
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
130
134 Rp::System<D,CPT> const & system() const;
135
139 std::string systemSpaceGroup() const;
140
146 RealVec<D> systemLatticeVector(int id) const;
147
152
153 private:
154
156 Rp::System<D,CPT>* sysPtr_;
157
158 };
159
160 // Inline member functions
161
162 // Get parent System by non-const reference.
163 template <int D>
166 {
167 UTIL_CHECK(sysPtr_);
168 return *sysPtr_;
169 }
170
171 // Get parent System by const reference.
172 template <int D>
173 Rp::System<D,CPT> const &
175 {
176 UTIL_CHECK(sysPtr_);
177 return *sysPtr_;
178 }
179
180 // Get space group name for this system.
181 template <int D> inline
182 std::string
184 { return system().domain().groupName(); }
185
186 // Get one of the lattice vectors for this system.
187 template <int D> inline
190 { return system().domain().unitCell().rBasis(id); }
191
192 // Explicit instantiation declarations
193 extern template class FilmFieldGenMask<1,CPT>;
194 extern template class FilmFieldGenMask<2,CPT>;
195 extern template class FilmFieldGenMask<3,CPT>;
196
197} // namespace Rp
198} // namespace Pscf
199
200#endif
Backend identifier class for the C++ serial CPU backend.
Definition CPT.h:32
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.
RealVec< D > systemLatticeVector(int id) const
Get one of the lattice vectors for this system.
Rp::System< D, CPT > & system()
Get the parent System by non-const reference.
void setFlexibleParams() const
Modifies iterator().flexibleParams_ to be compatible with the mask.
double modifyStress(int paramId, double stress) const
Modify stress value in direction normal to the film.
double stress(int paramId) const
Get contribution to the stress from this mask.
std::string systemSpaceGroup() const
Get the space group name for this system.
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.