File fieldperp.hxx

Functions

FieldPerp operator+(const FieldPerp &lhs, const FieldPerp &rhs)
FieldPerp operator+(const FieldPerp &lhs, const Field3D &rhs)
FieldPerp operator+(const FieldPerp &lhs, const Field2D &rhs)
FieldPerp operator+(const FieldPerp &lhs, BoutReal rhs)
FieldPerp operator+(BoutReal lhs, const FieldPerp &rhs)
FieldPerp operator-(const FieldPerp &lhs, const FieldPerp &rhs)
FieldPerp operator-(const FieldPerp &lhs, const Field3D &rhs)
FieldPerp operator-(const FieldPerp &lhs, const Field2D &rhs)
FieldPerp operator-(const FieldPerp &lhs, BoutReal rhs)
FieldPerp operator-(BoutReal lhs, const FieldPerp &rhs)
FieldPerp operator*(const FieldPerp &lhs, const FieldPerp &rhs)
FieldPerp operator*(const FieldPerp &lhs, const Field3D &rhs)
FieldPerp operator*(const FieldPerp &lhs, const Field2D &rhs)
FieldPerp operator*(const FieldPerp &lhs, BoutReal rhs)
FieldPerp operator*(BoutReal lhs, const FieldPerp &rhs)
FieldPerp operator/(const FieldPerp &lhs, const FieldPerp &rhs)
FieldPerp operator/(const FieldPerp &lhs, const Field3D &rhs)
FieldPerp operator/(const FieldPerp &lhs, const Field2D &rhs)
FieldPerp operator/(const FieldPerp &lhs, BoutReal rhs)
FieldPerp operator/(BoutReal lhs, const FieldPerp &rhs)
FieldPerp operator-(const FieldPerp &f)

Unary minus. Returns the negative of given field, iterates over whole domain including guard/boundary cells.

const FieldPerp sliceXZ(const Field3D &f, int y)

Create a FieldPerp by slicing a 3D field at a given y.

template<>
FieldPerp emptyFrom<FieldPerp>(const FieldPerp &f)

Return an empty shell field of some type derived from Field, with metadata copied and a data array that is allocated but not initialised.

void checkData(const FieldPerp &f, const std::string &region = "RGN_NOX")

Check if the data is valid.

void checkData(const FieldPerp &f, REGION region)
void invalidateGuards(FieldPerp &var)

Force guard cells of passed field var to NaN.

class FieldPerp : public Field
#include <fieldperp.hxx>

Represents a 2D field perpendicular to the magnetic field at a particular index in Y, which only varies in X-Z.

Primarily used inside field solvers

Public Types

using ind_type = IndPerp

Public Functions

FieldPerp::FieldPerp(Mesh * fieldmesh = nullptr, CELL_LOC location_in = CELL_CENTRE, int yindex_in = -1, DirectionTypes directions_in = {YDirectionType::Standard, ZDirectionType::Standard})

Constructor

FieldPerp(const FieldPerp &f)

Copy constructor. After this the data will be shared (non unique)

FieldPerp(FieldPerp &&rhs)

Move constructor

FieldPerp(BoutReal val, Mesh *localmesh = nullptr)

Constructor. This creates a FieldPerp using the global Mesh pointer (mesh) allocates data, and assigns the value val to all points including boundary cells.

~FieldPerp()
FieldPerp &operator=(const FieldPerp &rhs)

Assignment operators

FieldPerp &operator=(FieldPerp &&rhs)
FieldPerp &operator=(BoutReal rhs)
const Region<IndPerp> &getRegion(REGION region) const

Return a Region<IndPerp> reference to use to iterate over this field.

const Region<IndPerp> &getRegion(const std::string &region_name) const
Region<IndPerp>::RegionIndices::const_iterator begin() const
Region<IndPerp>::RegionIndices::const_iterator end() const
BoutReal &operator[](const IndPerp &d)
const BoutReal &operator[](const IndPerp &d) const
BoutReal &operator[](const Ind3D &d)
const BoutReal &operator[](const Ind3D &d) const
int getIndex() const

Returns the y index at which this field is defined

FieldPerp &setIndex(int y)

Sets the y index at which this field is defined

This is used in arithmetic operations

FieldPerp &setLocation(CELL_LOC location)
FieldPerp &setDirectionY(YDirectionType d)
FieldPerp &allocate()

Ensure that data array is allocated and unique

bool isAllocated() const

True if the underlying data array is allocated.

const BoutReal *operator[](int jx) const
BoutReal *operator[](int jx)

Returns a C-style array (pointer to first element) in Z at a given X index. Used mainly for FFT routines

BoutReal &operator()(int jx, int jz)

Access to the underlying data array at a given x,z index

If CHECK > 2 then bounds checking is performed, otherwise no checks are performed

const BoutReal &operator()(int jx, int jz) const

Const (read-only) access to the underlying data array.

BoutReal &operator()(int jx, int jy, int jz)

Access to the underlying data array. (X,Y,Z) indices for consistency with other field types

const BoutReal &operator()(int jx, int jy, int jz) const
FieldPerp &operator+=(const FieldPerp &rhs)

Addition, modifying in-place. This loops over the entire domain, including guard/boundary cells

FieldPerp &operator+=(const Field3D &rhs)
FieldPerp &operator+=(const Field2D &rhs)
FieldPerp &operator+=(BoutReal rhs)
FieldPerp &operator-=(const FieldPerp &rhs)

Subtraction, modifying in place. This loops over the entire domain, including guard/boundary cells

FieldPerp &operator-=(const Field3D &rhs)
FieldPerp &operator-=(const Field2D &rhs)
FieldPerp &operator-=(BoutReal rhs)
FieldPerp &operator*=(const FieldPerp &rhs)

Multiplication, modifying in place. This loops over the entire domain, including guard/boundary cells

FieldPerp &operator*=(const Field3D &rhs)
FieldPerp &operator*=(const Field2D &rhs)
FieldPerp &operator*=(BoutReal rhs)
FieldPerp &operator/=(const FieldPerp &rhs)

Division, modifying in place. This loops over the entire domain, including guard/boundary cells

FieldPerp &operator/=(const Field3D &rhs)
FieldPerp &operator/=(const Field2D &rhs)
FieldPerp &operator/=(BoutReal rhs)
int getNx() const

Return the number of nx points

int getNy() const

Return the number of ny points

int getNz() const

Return the number of nz points

Private Members

int yindex = {-1}

The Y index at which this FieldPerp is defined.

int nx = {-1}

The size of the data array.

int nz = {-1}
Array<BoutReal> data

The underlying data array.