PSCF v1.3
MixAndMatchEnvTmpl.h
1#ifndef PSCF_MIX_AND_MATCH_ENV_TMPL_H
2#define PSCF_MIX_AND_MATCH_ENV_TMPL_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 <util/param/ParamComposite.h> // base class of parent Env
12#include <pscf/sweep/ParameterModifier.h> // base class of parent Env
13#include <string>
14#include <iostream>
15
16namespace Pscf {
17
18 using namespace Util;
19
58 template <class Env, class FG>
59 class MixAndMatchEnvTmpl : public Env
60 {
61
62 public:
63
68
73
79 void readParameters(std::istream& in);
80
84 void generate();
85
89 FG const & fieldGenerator1() const;
90
94 FG const & fieldGenerator2() const;
95
99 bool hasFieldGenerator2() const;
100
105
114 void setParameter(std::string name, DArray<int> ids, double value,
115 bool& success);
116
124 double getParameter(std::string name, DArray<int> ids, bool& success)
125 const;
126
127 using Env::reset;
128 using Env::needsUpdate;
129 using ParameterModifier::setParameter; // overloaded method
130 using ParameterModifier::getParameter; // overloaded method
133
134 protected:
135
136 using Env::setNeedsUpdateFalse;
137 using Env::setGenerateBools;
138
157 virtual void createGenerators() = 0;
158
165
174
175 };
176
177}
178#include "MixAndMatchEnvTmpl.tpp"
179#endif
void setParameter(std::string name, DArray< int > ids, double value, bool &success)
Set the value of a specialized sweep parameter.
FG const & fieldGenerator2() const
Get the second FieldGenerator (if any) by const reference.
FG * fieldGenPtr1_
Pointer to the first FieldGenerator object (required).
GArray< ParameterType > getParameterTypes()
Get specialized sweep parameter types to add to a Sweep object.
double getParameter(std::string name, DArray< int > ids, bool &success) const
Get the value of a specialized sweep parameter.
FG * fieldGenPtr2_
Pointer to the second FieldGenerator object (optional).
void generate()
Checks if fields need to be (re)generated.
void readParameters(std::istream &in)
Read parameters from input stream.
FG const & fieldGenerator1() const
Get the first FieldGenerator by const reference.
virtual void createGenerators()=0
Create FieldGenerator objects for mask and/or external field.
bool hasFieldGenerator2() const
Does a second FieldGenerator exist?
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.
Definition DArray.h:32
An automatically growable array, analogous to a std::vector.
Definition GArray.h:34
void addParamComposite(ParamComposite &child, bool next=true)
Add a child ParamComposite object to the format array.
void setClassName(const char *className)
Set class name string.
PSCF package top-level namespace.
Definition param_pc.dox:1