File fieldgenerators.hxx#
These classes are used by FieldFactory
Typedefs
-
using single_arg_op = BoutReal (*)(BoutReal)#
Template class to define generators around a C function.
-
using double_arg_op = BoutReal (*)(BoutReal, BoutReal)#
Template for a FieldGenerator with two input arguments.
-
class FieldValuePtr : public FieldGenerator#
- #include <fieldgenerators.hxx>
Creates a Field Generator using a pointer to value WARNING: The value pointed to must remain in scope until this generator is finished
Public Functions
-
inline virtual FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args) override#
Virtual constructor. Makes a copy of this FieldGenerator, initialised with the given list of arguments. It is up to the implementations to test whether the correct number of arguments is passed.
- Parameters:
args – [in] A (possibly empty) list of arguments to the generator function
-
inline virtual BoutReal generate(const bout::generator::Context&) override#
Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs
Note: The default implementations of generate call each other; the implementor of a FieldGenerator type must implement one of them or an infinite recursion results. This is for backward compatibility for users and implementors. In a future version this function will be made pure virtual.
-
inline virtual FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args) override#
-
template<single_arg_op Op>
class FieldGenOneArg : public FieldGenerator# Public Functions
-
inline FieldGenOneArg(FieldGeneratorPtr g, const std::string &name = "function")#
< Template for single-argument function
-
inline virtual FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args) override#
Virtual constructor. Makes a copy of this FieldGenerator, initialised with the given list of arguments. It is up to the implementations to test whether the correct number of arguments is passed.
- Parameters:
args – [in] A (possibly empty) list of arguments to the generator function
-
inline virtual BoutReal generate(const bout::generator::Context &pos) override#
Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs
Note: The default implementations of generate call each other; the implementor of a FieldGenerator type must implement one of them or an infinite recursion results. This is for backward compatibility for users and implementors. In a future version this function will be made pure virtual.
Private Members
-
inline FieldGenOneArg(FieldGeneratorPtr g, const std::string &name = "function")#
-
template<double_arg_op Op>
class FieldGenTwoArg : public FieldGenerator# Public Functions
-
inline FieldGenTwoArg(FieldGeneratorPtr a, FieldGeneratorPtr b, const std::string &name = "function")#
< Template for two-argument function
-
inline virtual FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args) override#
Virtual constructor. Makes a copy of this FieldGenerator, initialised with the given list of arguments. It is up to the implementations to test whether the correct number of arguments is passed.
- Parameters:
args – [in] A (possibly empty) list of arguments to the generator function
-
inline virtual BoutReal generate(const bout::generator::Context &pos) override#
Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs
Note: The default implementations of generate call each other; the implementor of a FieldGenerator type must implement one of them or an infinite recursion results. This is for backward compatibility for users and implementors. In a future version this function will be made pure virtual.
Private Members
-
inline FieldGenTwoArg(FieldGeneratorPtr a, FieldGeneratorPtr b, const std::string &name = "function")#
-
class FieldATan : public FieldGenerator#
- #include <fieldgenerators.hxx>
Arc (Inverse) tangent. Either one or two argument versions.
Public Functions
-
inline FieldATan(FieldGeneratorPtr a, FieldGeneratorPtr b = nullptr)#
-
inline virtual FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args) override#
Virtual constructor. Makes a copy of this FieldGenerator, initialised with the given list of arguments. It is up to the implementations to test whether the correct number of arguments is passed.
- Parameters:
args – [in] A (possibly empty) list of arguments to the generator function
-
inline virtual BoutReal generate(const bout::generator::Context &pos) override#
Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs
Note: The default implementations of generate call each other; the implementor of a FieldGenerator type must implement one of them or an infinite recursion results. This is for backward compatibility for users and implementors. In a future version this function will be made pure virtual.
-
inline FieldATan(FieldGeneratorPtr a, FieldGeneratorPtr b = nullptr)#
-
class FieldGaussian : public FieldGenerator#
- #include <fieldgenerators.hxx>
Gaussian distribution, taking mean and width arguments.
Public Functions
-
inline FieldGaussian(FieldGeneratorPtr xin, FieldGeneratorPtr sin)#
-
virtual FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args) override#
Virtual constructor. Makes a copy of this FieldGenerator, initialised with the given list of arguments. It is up to the implementations to test whether the correct number of arguments is passed.
- Parameters:
args – [in] A (possibly empty) list of arguments to the generator function
-
virtual BoutReal generate(const bout::generator::Context &pos) override#
Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs
Note: The default implementations of generate call each other; the implementor of a FieldGenerator type must implement one of them or an infinite recursion results. This is for backward compatibility for users and implementors. In a future version this function will be made pure virtual.
-
inline FieldGaussian(FieldGeneratorPtr xin, FieldGeneratorPtr sin)#
-
class FieldHeaviside : public FieldGenerator#
- #include <fieldgenerators.hxx>
Heaviside function, switches between 0 and 1.
Public Functions
-
inline FieldHeaviside(FieldGeneratorPtr g)#
-
virtual FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args) override#
Virtual constructor. Makes a copy of this FieldGenerator, initialised with the given list of arguments. It is up to the implementations to test whether the correct number of arguments is passed.
- Parameters:
args – [in] A (possibly empty) list of arguments to the generator function
-
virtual BoutReal generate(const bout::generator::Context &pos) override#
Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs
Note: The default implementations of generate call each other; the implementor of a FieldGenerator type must implement one of them or an infinite recursion results. This is for backward compatibility for users and implementors. In a future version this function will be made pure virtual.
Private Members
-
inline FieldHeaviside(FieldGeneratorPtr g)#
-
class FieldMin : public FieldGenerator#
- #include <fieldgenerators.hxx>
Minimum.
Public Functions
-
FieldMin() = default#
-
inline FieldMin(const std::list<FieldGeneratorPtr> args)#
-
inline virtual FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args) override#
Virtual constructor. Makes a copy of this FieldGenerator, initialised with the given list of arguments. It is up to the implementations to test whether the correct number of arguments is passed.
- Parameters:
args – [in] A (possibly empty) list of arguments to the generator function
-
inline virtual BoutReal generate(const bout::generator::Context &pos) override#
Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs
Note: The default implementations of generate call each other; the implementor of a FieldGenerator type must implement one of them or an infinite recursion results. This is for backward compatibility for users and implementors. In a future version this function will be made pure virtual.
Private Members
-
std::list<FieldGeneratorPtr> input#
-
FieldMin() = default#
-
class FieldMax : public FieldGenerator#
- #include <fieldgenerators.hxx>
Maximum.
Public Functions
-
FieldMax() = default#
-
inline FieldMax(const std::list<FieldGeneratorPtr> args)#
-
inline virtual FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args) override#
Virtual constructor. Makes a copy of this FieldGenerator, initialised with the given list of arguments. It is up to the implementations to test whether the correct number of arguments is passed.
- Parameters:
args – [in] A (possibly empty) list of arguments to the generator function
-
inline virtual BoutReal generate(const bout::generator::Context &pos) override#
Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs
Note: The default implementations of generate call each other; the implementor of a FieldGenerator type must implement one of them or an infinite recursion results. This is for backward compatibility for users and implementors. In a future version this function will be made pure virtual.
Private Members
-
std::list<FieldGeneratorPtr> input#
-
FieldMax() = default#
-
class FieldClamp : public FieldGenerator#
- #include <fieldgenerators.hxx>
Clamp
Force a value to be in specified range Also called
clip
e.g. in NumPy, but in C++17 std::clamp is in <algorithm>Note that the result is not well defined if low > high
Public Functions
-
FieldClamp() = default#
-
inline FieldClamp(FieldGeneratorPtr value, FieldGeneratorPtr low, FieldGeneratorPtr high)#
-
inline virtual FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args) override#
Virtual constructor. Makes a copy of this FieldGenerator, initialised with the given list of arguments. It is up to the implementations to test whether the correct number of arguments is passed.
- Parameters:
args – [in] A (possibly empty) list of arguments to the generator function
-
inline virtual BoutReal generate(const bout::generator::Context &pos) override#
Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs
Note: The default implementations of generate call each other; the implementor of a FieldGenerator type must implement one of them or an infinite recursion results. This is for backward compatibility for users and implementors. In a future version this function will be made pure virtual.
Private Members
-
FieldGeneratorPtr value#
The value to be clamped.
-
FieldGeneratorPtr high#
The range within which the result will be.
-
FieldClamp() = default#
-
class FieldRound : public FieldGenerator#
- #include <fieldgenerators.hxx>
Generator to round to the nearest integer.
Public Functions
-
inline FieldRound(FieldGeneratorPtr g)#
-
inline virtual FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args) override#
Virtual constructor. Makes a copy of this FieldGenerator, initialised with the given list of arguments. It is up to the implementations to test whether the correct number of arguments is passed.
- Parameters:
args – [in] A (possibly empty) list of arguments to the generator function
-
inline virtual BoutReal generate(const bout::generator::Context &pos) override#
Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs
Note: The default implementations of generate call each other; the implementor of a FieldGenerator type must implement one of them or an infinite recursion results. This is for backward compatibility for users and implementors. In a future version this function will be made pure virtual.
Private Members
-
inline FieldRound(FieldGeneratorPtr g)#
-
class FieldBallooning : public FieldGenerator#
Public Functions
-
inline FieldBallooning(Mesh *m, FieldGeneratorPtr a = nullptr, int n = 3)#
-
virtual FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args) override#
Virtual constructor. Makes a copy of this FieldGenerator, initialised with the given list of arguments. It is up to the implementations to test whether the correct number of arguments is passed.
- Parameters:
args – [in] A (possibly empty) list of arguments to the generator function
-
virtual BoutReal generate(const bout::generator::Context &pos) override#
Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs
Note: The default implementations of generate call each other; the implementor of a FieldGenerator type must implement one of them or an infinite recursion results. This is for backward compatibility for users and implementors. In a future version this function will be made pure virtual.
-
inline FieldBallooning(Mesh *m, FieldGeneratorPtr a = nullptr, int n = 3)#
-
class FieldMixmode : public FieldGenerator#
Public Functions
-
FieldMixmode(FieldGeneratorPtr a = nullptr, BoutReal seed = 0.5)#
-
virtual FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args) override#
Virtual constructor. Makes a copy of this FieldGenerator, initialised with the given list of arguments. It is up to the implementations to test whether the correct number of arguments is passed.
- Parameters:
args – [in] A (possibly empty) list of arguments to the generator function
-
virtual BoutReal generate(const bout::generator::Context &pos) override#
Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs
Note: The default implementations of generate call each other; the implementor of a FieldGenerator type must implement one of them or an infinite recursion results. This is for backward compatibility for users and implementors. In a future version this function will be made pure virtual.
Private Functions
-
FieldMixmode(FieldGeneratorPtr a = nullptr, BoutReal seed = 0.5)#
-
class FieldTanhHat : public FieldGenerator#
Public Functions
-
inline FieldTanhHat(FieldGeneratorPtr xin, FieldGeneratorPtr widthin, FieldGeneratorPtr centerin, FieldGeneratorPtr steepnessin)#
-
virtual FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args) override#
Virtual constructor. Makes a copy of this FieldGenerator, initialised with the given list of arguments. It is up to the implementations to test whether the correct number of arguments is passed.
- Parameters:
args – [in] A (possibly empty) list of arguments to the generator function
-
virtual BoutReal generate(const bout::generator::Context &pos) override#
Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs
Note: The default implementations of generate call each other; the implementor of a FieldGenerator type must implement one of them or an infinite recursion results. This is for backward compatibility for users and implementors. In a future version this function will be made pure virtual.
-
inline FieldTanhHat(FieldGeneratorPtr xin, FieldGeneratorPtr widthin, FieldGeneratorPtr centerin, FieldGeneratorPtr steepnessin)#
-
class FieldWhere : public FieldGenerator#
Public Functions
-
inline FieldWhere(FieldGeneratorPtr test, FieldGeneratorPtr gt0, FieldGeneratorPtr lt0)#
-
inline virtual FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args) override#
Virtual constructor. Makes a copy of this FieldGenerator, initialised with the given list of arguments. It is up to the implementations to test whether the correct number of arguments is passed.
- Parameters:
args – [in] A (possibly empty) list of arguments to the generator function
-
inline virtual double generate(const bout::generator::Context &pos) override#
Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs
Note: The default implementations of generate call each other; the implementor of a FieldGenerator type must implement one of them or an infinite recursion results. This is for backward compatibility for users and implementors. In a future version this function will be made pure virtual.
-
inline FieldWhere(FieldGeneratorPtr test, FieldGeneratorPtr gt0, FieldGeneratorPtr lt0)#