PSCF v1.2
FieldGenerator.h
1#ifndef PSCF_FIELD_GENERATOR_H
2#define PSCF_FIELD_GENERATOR_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 <pscf/sweep/ParameterModifier.h> // base class
12#include <util/param/ParamComposite.h> // base class
13
14namespace Pscf {
15
16 using namespace Util;
17
33 {
34
35 public:
36
40 enum Type {Mask, External, Both, None};
41
46
51
55 void setup();
56
60 void update();
61
84 bool isDependent() const;
85
94 virtual void checkCompatibility() = 0;
95
99 virtual bool updateNeeded() const = 0;
100
104 virtual bool isGenerated() const = 0;
105
122 virtual double stressTerm(int paramId) const
123 { return 0.0; }
124
148 virtual double modifyStress(int paramId, double stress) const
149 { return stress; }
150
156 Type type() const
157 { return type_; }
158
159 protected:
160
164 virtual void allocate() = 0;
165
169 virtual void generate() = 0;
170
179
182
183 };
184
185 // Is this object dependent on the parameters of another FieldGenerator?
186 inline bool FieldGenerator::isDependent() const
187 { return isDependent_; }
188
189}
190#endif
Abstract base class for objects that generate fields for ImposedFields.
virtual void checkCompatibility()=0
Check that the system is compatible with these fields.
Type type() const
Return Type enumeration value (Mask, External, or None)
FieldGenerator()
Constructor.
void setup()
Allocate, check compatibility, calculate, and store the field(s)
~FieldGenerator()
Destructor.
virtual bool isGenerated() const =0
Check whether the field(s) have been generated.
virtual void generate()=0
Generate the field(s) and store where the Iterator can access.
void update()
Check whether system has changed and update the field(s) if necessary.
Type
Enum representing the type of field (mask, external field, or both).
virtual double modifyStress(int paramId, double stress) const
Modify stress value if necessary.
bool isDependent() const
Is this object dependent on the parameters of another FieldGenerator?
virtual void allocate()=0
Allocate container(s) necessary to generate and store field(s)
bool isDependent_
Is this object dependent on the parameters of another FieldGenerator?
virtual bool updateNeeded() const =0
Check whether system has changed such that the field(s) need updating.
Type type_
Type of field (Mask, External, Both, or None)
virtual double stressTerm(int paramId) const
Get contribution to the stress from this imposed field.
Base class allowing subclasses to define sweepable parameters.
An object that can read multiple parameters from file.
PSCF package top-level namespace.
Definition param_pc.dox:1
Utility classes for scientific computation.