1#ifndef PSCF_MIX_AND_MATCH_ENV_TMPL_TPP
2#define PSCF_MIX_AND_MATCH_ENV_TMPL_TPP
11#include <util/param/Label.h>
18 template <
class Env,
class FG>
27 template <
class Env,
class FG>
48 template <
class Env,
class FG>
51 bool generatesMask(
false), generatesExt(
false);
57 std::streampos pos = in.tellg();
74 }
else if (fieldGenPtr1_->type() == FG::Mask) {
77 UTIL_THROW(
"fieldGenPtr1_ must have type Mask or External.");
82 UTIL_THROW(
"Object must contain at least one FieldGenerator.");
87 if (fieldGenPtr2_ !=
nullptr) {
93 }
else if (fieldGenPtr2_->type() == FG::Mask) {
97 UTIL_THROW(
"fieldGenPtr2_ must have type Mask or External.");
108 addParamComposite(*fieldGenPtr2_, next);
112 fieldGenPtr2_->readParameters(in);
115 setGenerateBools(generatesMask, generatesExt);
121 template <
class Env,
class FG>
124 if (!needsUpdate())
return;
129 setNeedsUpdateFalse();
135 template <
class Env,
class FG>
143 for (
int i = 0; i < a2.
size(); i++) {
153 template <
class Env,
class FG>
166 if (success) reset();
172 template <
class Env,
class FG>
191 template <
class Env,
class FG>
202 template <
class Env,
class FG>
213 template <
class Env,
class FG>
void setParameter(std::string name, DArray< int > ids, double value, bool &success)
Set the value of a specialized sweep parameter.
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.
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.
MixAndMatchEnvTmpl()
Constructor.
~MixAndMatchEnvTmpl()
Destructor.
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?
Dynamically allocatable contiguous array template.
An automatically growable array, analogous to a std::vector.
int size() const
Return logical size of this array (i.e., current number of elements).
void append(Data const &data)
Append an element to the end of the sequence.
static void clear()
Clear the input buffer.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
PSCF package top-level namespace.