PSCF v1.3
FilmFieldGenExtBase.h
1#ifndef PRDC_FILM_FIELD_GEN_EXT_BASE_H
2#define PRDC_FILM_FIELD_GEN_EXT_BASE_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 <prdc/environment/FieldGenerator.h> // Base class
12#include <pscf/math/RealVec.h> // member
13#include <util/containers/DArray.h> // member
14
15#include <string>
16
17// Forward declarations
18namespace Util {
19 template <typename T> class GArray;
20}
21namespace Pscf {
22 struct ParameterType;
23}
24
25
26namespace Pscf {
27namespace Prdc {
28
29 using namespace Util;
30
49 template <int D>
51 {
52
53 public:
54
59
64
70 void readParameters(std::istream& in);
71
75 bool needsUpdate() const;
76
89 void checkCompatibility();
90
96 bool hasSymmetricWalls() const;
97
103 bool isAthermal() const;
104
112
124 void setParameter(std::string name, DArray<int> ids, double value,
125 bool& success);
126
137 double getParameter(std::string name, DArray<int> ids, bool& success)
138 const;
139
143 DArray<double> const & chiBottom() const;
144
148 DArray<double> const & chiTop() const;
149
155 double chiBottom(int s) const;
156
162 double chiTop(int s) const;
163
167 int normalVecId() const;
168
172 double interfaceThickness() const;
173
177 double excludedThickness() const;
178
193 virtual double stress(int paramId) const = 0;
194
195 using ParameterModifier::setParameter; // overloaded method
196 using ParameterModifier::getParameter; // overloaded method
197
198 protected:
199
203 virtual void compute() = 0;
204
208 virtual std::string systemSpaceGroup() const = 0;
209
215 virtual RealVec<D> systemLatticeVector(int id) const = 0;
216
220 virtual int systemNMonomer() const = 0;
221
232
243
254
257
258 private:
259
261 int normalVecId_;
262
264 double interfaceThickness_;
265
267 double excludedThickness_;
268
274 DArray<double> chiBottom_;
275
281 DArray<double> chiTop_;
282
283 };
284
285 // Inline member functions
286
287 // Get chiBottom array by const reference
288 template <int D>
290 { return chiBottom_; }
291
292 // Get chiTop array by const reference
293 template <int D>
295 { return chiTop_; }
296
297 // Get the chi parameter between the bottom wall and species s
298 template <int D>
299 inline double FilmFieldGenExtBase<D>::chiBottom(int s) const
300 { return chiBottom_[s]; }
301
302 // Get the chi parameter between the top wall and species s
303 template <int D>
304 inline double FilmFieldGenExtBase<D>::chiTop(int s) const
305 { return chiTop_[s]; }
306
307 // Get value of normalVecId.
308 template <int D>
310 { return normalVecId_; }
311
312 // Get value of interfaceThickness.
313 template <int D>
315 { return interfaceThickness_; }
316
317 // Get value of excludedThickness.
318 template <int D>
320 { return excludedThickness_; }
321
322 #ifndef PRDC_FILM_FIELD_GEN_EXT_BASE_TPP
323 // Suppress implicit instantiation
324 extern template class FilmFieldGenExtBase<1>;
325 extern template class FilmFieldGenExtBase<2>;
326 extern template class FilmFieldGenExtBase<3>;
327 #endif
328
329}
330}
331#endif
Type type_
Type of field (Mask, External, or None).
bool isDependent_
Is this object dependent on parameters of another FieldGeneratorBase?
virtual void setParameter(std::string name, DArray< int > ids, double value, bool &success)
Set the value of a specialized sweep parameter.
virtual double getParameter(std::string name, DArray< int > ids, bool &success) const
Get the value of a specialized sweep parameter.
Base class Field Generator for external fields in thin-film systems.
DArray< double > chiTopCurrent_
The chiTop array used to generate the current external fields.
DArray< double > const & chiTop() const
Get const chiTop array by reference.
DArray< double > chiBottomCurrent_
The chiBottom array used to generate the current external fields.
double getParameter(std::string name, DArray< int > ids, bool &success) const
Get the value of a specialized sweep parameter.
double excludedThickness() const
Get value of excludedThickness.
DArray< double > const & chiBottom() const
Get const chiBottom matrix by reference.
virtual int systemNMonomer() const =0
Get the number of monomer species for this system.
bool isAthermal() const
Are the walls athermal?
void setParameter(std::string name, DArray< int > ids, double value, bool &success)
Set the value of a specialized sweep parameter.
double interfaceThickness() const
Get value of interfaceThickness.
void checkCompatibility()
Check that the system is compatible with these fields.
RealVec< D > normalVecCurrent_
The lattice vector normal to the film used to generate these fields.
int normalVecId() const
Get value of normalVecId.
bool needsUpdate() const
Check whether system has changed such that the fields need updating.
virtual std::string systemSpaceGroup() const =0
Get the space group name for this system.
virtual RealVec< D > systemLatticeVector(int id) const =0
Get one of the lattice vectors for this system.
GArray< ParameterType > getParameterTypes()
Return specialized sweep parameter types to add to the Sweep object.
virtual double stress(int paramId) const =0
Get contribution to the stress from these external fields.
void readParameters(std::istream &in)
Read parameters and initialize.
virtual void compute()=0
Compute the field(s) and store where the System can access.
bool hasSymmetricWalls() const
Are the walls chemically identical?
A RealVec<D, T> is D-component vector with elements of floating type T.
Definition RealVec.h:28
Dynamically allocatable contiguous array template.
Definition DArray.h:32
An automatically growable array, analogous to a std::vector.
Definition GArray.h:34
Periodic fields and crystallography.
Definition CField.cpp:11
PSCF package top-level namespace.
Definition param_pc.dox:1
Utility classes for scientific computation.
Declaration of a specialized sweep parameter type.