Loading [MathJax]/extensions/TeX/AMSsymbols.js
PSCF v1.2
ImposedFieldsTmpl.h
1#ifndef PSCF_IMPOSED_FIELDS_TMPL_H
2#define PSCF_IMPOSED_FIELDS_TMPL_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/iterator/FieldGenerator.h>
12#include <util/param/ParamComposite.h>
13#include <util/param/Factory.h>
14#include <string>
15
16namespace Pscf {
17
18 using namespace Util;
19
34 {
35
36 public:
37
42
47
53 void readParameters(std::istream& in);
54
58 void setup();
59
63 void update();
64
98 double correctedStress(int paramId, double stress) const;
99
103 std::string type() const;
104
108 FieldGenerator const & fieldGenerator1() const;
109 FieldGenerator const & fieldGenerator2() const;
110
115
124 void setParameter(std::string name, DArray<int> ids, double value,
125 bool& success);
126
134 double getParameter(std::string name, DArray<int> ids, bool& success)
135 const;
136
137 using ParameterModifier::setParameter; // overloaded method
138 using ParameterModifier::getParameter; // overloaded method
139
140 protected:
141
160 virtual void createGenerators() = 0;
161
182 virtual double modifyStress(int paramId, double stress) const;
183
191
201
202 private:
203
205 std::string type_;
206
207 };
208}
209#endif
Abstract base class for objects that generate fields for ImposedFields.
Base class defining mask & external fields to impose on the calculation.
virtual double modifyStress(int paramId, double stress) const
Modify the stress value if necessary.
void readParameters(std::istream &in)
Read parameters from input stream.
void update()
Check whether system has changed, update the field(s) if necessary.
FieldGenerator const & fieldGenerator1() const
Return const references to the FieldGenerator child objects.
void setup()
Allocate, check compatibility, calculate, and store the field(s).
virtual void createGenerators()=0
Create FieldGenerator objects for mask and/or external field.
void setParameter(std::string name, DArray< int > ids, double value, bool &success)
Set the value of a specialized sweep parameter.
double correctedStress(int paramId, double stress) const
Correct the stress value if necessary.
double getParameter(std::string name, DArray< int > ids, bool &success) const
Get the value of a specialized sweep parameter.
FieldGenerator * fieldGenPtr2_
Pointer to the second FieldGenerator object (optional).
FieldGenerator * fieldGenPtr1_
Pointer to the first FieldGenerator object (required).
GArray< ParameterType > getParameterTypes()
Return specialized sweep parameter types to add to a Sweep object.
std::string type() const
Get the type string associated with this object.
Base class allowing subclasses to define sweepable parameters.
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.
Dynamically allocatable contiguous array template.
An automatically growable array, analogous to a std::vector.
Definition GArray.h:34
An object that can read multiple parameters from file.
PSCF package top-level namespace.
Definition param_pc.dox:1
Utility classes for scientific computation.