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

FieldValuePtr(BoutReal *val)
FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args)

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: A (possibly empty) list of arguments to the generator function

BoutReal generate(double x, double y, double z, double t)

Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs

Private Members

BoutReal *ptr
class FieldSin : public FieldGenerator
#include <fieldgenerators.hxx>

Sine function field generator.

Public Functions

FieldSin(FieldGeneratorPtr g)
FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args)

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: A (possibly empty) list of arguments to the generator function

BoutReal generate(double x, double y, double z, double t)

Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs

std::string str() const

Create a string representation of the generator, for debugging output.

Private Members

FieldGeneratorPtr gen
class FieldCos : public FieldGenerator
#include <fieldgenerators.hxx>

Cosine function field generator.

Public Functions

FieldCos(FieldGeneratorPtr g)
FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args)

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: A (possibly empty) list of arguments to the generator function

BoutReal generate(double x, double y, double z, double t)

Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs

std::string str() const

Create a string representation of the generator, for debugging output.

Private Members

FieldGeneratorPtr gen
template<single_arg_op Op>
class FieldGenOneArg : public FieldGenerator

Public Functions

FieldGenOneArg(FieldGeneratorPtr g)

< Template for single-argument function

FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args)

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: A (possibly empty) list of arguments to the generator function

BoutReal generate(double x, double y, double z, double t)

Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs

std::string str() const

Create a string representation of the generator, for debugging output.

Private Members

FieldGeneratorPtr gen
template<double_arg_op Op>
class FieldGenTwoArg : public FieldGenerator

Public Functions

FieldGenTwoArg(FieldGeneratorPtr a, FieldGeneratorPtr b)

< Template for two-argument function

FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args)

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: A (possibly empty) list of arguments to the generator function

BoutReal generate(double x, double y, double z, double t)

Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs

std::string str() const

Create a string representation of the generator, for debugging output.

class FieldATan : public FieldGenerator
#include <fieldgenerators.hxx>

Arc (Inverse) tangent. Either one or two argument versions.

Public Functions

FieldATan(FieldGeneratorPtr a, FieldGeneratorPtr b = nullptr)
FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args)

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: A (possibly empty) list of arguments to the generator function

BoutReal generate(double x, double y, double z, double t)

Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs

class FieldSinh : public FieldGenerator
#include <fieldgenerators.hxx>

Hyperbolic sine function.

Public Functions

FieldSinh(FieldGeneratorPtr g)
FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args)

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: A (possibly empty) list of arguments to the generator function

BoutReal generate(double x, double y, double z, double t)

Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs

Private Members

FieldGeneratorPtr gen
class FieldCosh : public FieldGenerator
#include <fieldgenerators.hxx>

Hyperbolic cosine.

Public Functions

FieldCosh(FieldGeneratorPtr g)
FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args)

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: A (possibly empty) list of arguments to the generator function

BoutReal generate(double x, double y, double z, double t)

Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs

Private Members

FieldGeneratorPtr gen
class FieldTanh : public FieldGenerator
#include <fieldgenerators.hxx>

Hyperbolic tangent.

Public Functions

FieldTanh(FieldGeneratorPtr g = nullptr)
FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args)

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: A (possibly empty) list of arguments to the generator function

BoutReal generate(double x, double y, double z, double t)

Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs

Private Members

FieldGeneratorPtr gen
class FieldGaussian : public FieldGenerator
#include <fieldgenerators.hxx>

Gaussian distribution, taking mean and width arguments.

Public Functions

FieldGaussian(FieldGeneratorPtr xin, FieldGeneratorPtr sin)
FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args)

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: A (possibly empty) list of arguments to the generator function

BoutReal generate(double x, double y, double z, double t)

Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs

class FieldAbs : public FieldGenerator
#include <fieldgenerators.hxx>

Absolute value.

Public Functions

FieldAbs(FieldGeneratorPtr g)
FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args)

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: A (possibly empty) list of arguments to the generator function

BoutReal generate(double x, double y, double z, double t)

Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs

Private Members

FieldGeneratorPtr gen
class FieldSqrt : public FieldGenerator
#include <fieldgenerators.hxx>

Square root function.

Public Functions

FieldSqrt(FieldGeneratorPtr g)
FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args)

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: A (possibly empty) list of arguments to the generator function

BoutReal generate(double x, double y, double z, double t)

Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs

Private Members

FieldGeneratorPtr gen
class FieldHeaviside : public FieldGenerator
#include <fieldgenerators.hxx>

Heaviside function, switches between 0 and 1.

Public Functions

FieldHeaviside(FieldGeneratorPtr g)
FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args)

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: A (possibly empty) list of arguments to the generator function

BoutReal generate(double x, double y, double z, double t)

Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs

std::string str() const

Create a string representation of the generator, for debugging output.

Private Members

FieldGeneratorPtr gen
class FieldErf : public FieldGenerator
#include <fieldgenerators.hxx>

Generator for the error function erf.

Public Functions

FieldErf(FieldGeneratorPtr g)
FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args)

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: A (possibly empty) list of arguments to the generator function

BoutReal generate(double x, double y, double z, double t)

Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs

Private Members

FieldGeneratorPtr gen
class FieldMin : public FieldGenerator
#include <fieldgenerators.hxx>

Minimum.

Public Functions

FieldMin()
FieldMin(const std::list<FieldGeneratorPtr> args)
FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args)

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: A (possibly empty) list of arguments to the generator function

BoutReal generate(double x, double y, double z, double t)

Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs

Private Members

std::list<FieldGeneratorPtr> input
class FieldMax : public FieldGenerator
#include <fieldgenerators.hxx>

Maximum.

Public Functions

FieldMax()
FieldMax(const std::list<FieldGeneratorPtr> args)
FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args)

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: A (possibly empty) list of arguments to the generator function

BoutReal generate(double x, double y, double z, double t)

Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs

Private Members

std::list<FieldGeneratorPtr> input
class FieldRound : public FieldGenerator
#include <fieldgenerators.hxx>

Generator to round to the nearest integer.

Public Functions

FieldRound(FieldGeneratorPtr g)
FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args)

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: A (possibly empty) list of arguments to the generator function

BoutReal generate(double x, double y, double z, double t)

Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs

Private Members

FieldGeneratorPtr gen
class FieldBallooning : public FieldGenerator

Public Functions

FieldBallooning(Mesh *m, FieldGeneratorPtr a = nullptr, int n = 3)
FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args)

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: A (possibly empty) list of arguments to the generator function

BoutReal generate(double x, double y, double z, double t)

Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs

Private Members

Mesh *mesh
FieldGeneratorPtr arg
int ball_n
class FieldMixmode : public FieldGenerator

Public Functions

FieldMixmode(FieldGeneratorPtr a = nullptr, BoutReal seed = 0.5)
FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args)

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: A (possibly empty) list of arguments to the generator function

BoutReal generate(double x, double y, double z, double t)

Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs

Private Functions

BoutReal genRand(BoutReal seed)

Generate a random number between 0 and 1 (exclusive) given an arbitrary seed value

This PRNG has no memory, i.e. you need to call it with a different seed each time.

Private Members

FieldGeneratorPtr arg
BoutReal phase[14]
class FieldTanhHat : public FieldGenerator

Public Functions

FieldTanhHat(FieldGeneratorPtr xin, FieldGeneratorPtr widthin, FieldGeneratorPtr centerin, FieldGeneratorPtr steepnessin)
FieldGeneratorPtr clone(const std::list<FieldGeneratorPtr> args)

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: A (possibly empty) list of arguments to the generator function

BoutReal generate(double x, double y, double z, double t)

Generate a value at the given coordinates (x,y,z,t) This should be deterministic, always returning the same value given the same inputs