File fieldperp.hxx¶
Functions
-
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<>
inline 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 ®ion =
"RGN_NOX") Check if the data is valid.
-
void invalidateGuards(FieldPerp &var)
Force guard cells of passed field
var
to NaN.
-
template<>
inline std::string toString(const FieldPerp &val)¶ toString template specialisation Defined in utils.hxx
-
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 Functions
-
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) = default¶
Copy constructor. After this the data will be shared (non unique)
-
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(Array<BoutReal> data, Mesh *fieldmesh, CELL_LOC location_in = CELL_CENTRE, int yindex_in = -1, DirectionTypes directions_in = {YDirectionType::Standard, ZDirectionType::Standard})¶
-
~FieldPerp() override = default¶
-
const Region<IndPerp> &getRegion(REGION region) const¶
Return a Region<IndPerp> reference to use to iterate over this field.
-
inline int getIndex() const¶
Return the y index at which this field is defined. This value is local to each processor
-
int getGlobalIndex() const¶
Return the globally defined y index if it’s either an interior (grid) point, or a boundary point. Otherwise, return -1 to indicate a guard cell or an invalid value
-
inline FieldPerp &setIndex(int y)¶
Set the (local) y index at which this field is defined
This is used in arithmetic operations
-
FieldPerp &setIndexFromGlobal(int y_global)¶
Set the (local) y index at which this field is defined from a globally defined y index
Only use the global y index if it’s either an interior (grid) point, or a boundary point. Otherwise, sets yindex to -1 to indicate a guard cell or an invalid value
-
inline virtual FieldPerp &setLocation(CELL_LOC new_location) override¶
Set variable location for staggered grids to
- Parameters
new_location – Throws BoutException if new_location is not
CELL_CENTRE
and staggered grids are turned off and checks are on. If checks are off, silently sets location toCELL_CENTRE
instead.
-
inline virtual FieldPerp &setDirectionY(YDirectionType d) override¶
-
inline bool isAllocated() const¶
True if the underlying data array is allocated.
-
inline 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
-
inline 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
-
inline const BoutReal &operator()(int jx, int jz) const¶
Const (read-only) access to the underlying data array.
-
inline BoutReal &operator()(int jx, int jy, int jz)¶
Access to the underlying data array. (X,Y,Z) indices for consistency with other field types
-
FieldPerp &operator+=(const FieldPerp &rhs)¶
Addition, modifying in-place. This loops over the entire domain, including guard/boundary cells
-
FieldPerp &operator-=(const FieldPerp &rhs)¶
Subtraction, modifying in place. This loops over the entire domain, including guard/boundary cells
-
FieldPerp &operator*=(const FieldPerp &rhs)¶
Multiplication, modifying in place. This loops over the entire domain, including guard/boundary cells
-
FieldPerp &operator/=(const FieldPerp &rhs)¶
Division, modifying in place. This loops over the entire domain, including guard/boundary cells
-
inline virtual int getNx() const override¶
Return the number of nx points
-
inline virtual int getNy() const override¶
Return the number of ny points
-
inline virtual int getNz() const override¶
Return the number of nz points
-
inline virtual bool is3D() const override¶
True if variable is 3D.
-
FieldPerp(Mesh *fieldmesh = nullptr, CELL_LOC location_in = CELL_CENTRE, int yindex_in = -1, DirectionTypes directions_in = {YDirectionType::Standard, ZDirectionType::Standard})¶