File coordinates_accessor.hxx¶
Defines
-
COORDINATES_ACCESSOR_H__¶
-
COORD_FN1(symbol)¶
Create functions to access data e.g. dx(index) by casting the Offset to an int and passing to lookup function
e.g. COORD_FN1(dx) defines a function BoutReal dx(int index) const {…}
-
COORD_FN(...)¶
Generates lookup functions for each symbol Macro should accept up to 10 arguments
e.g. COORD_FN(dx, dy) produces two functions BoutReal dx(int index) const {…} BoutReal dy(int index) const {…}
-
struct CoordinatesAccessor¶
- #include <coordinates_accessor.hxx>
Provide (hopefully) fast access to Coordinates data e.g. grid spacing, metric tensors etc.
Contains only two member variables:
data a BoutReal pointer
mesh_nz an int
data is striped, so that quantities at a given grid cell are packed together.
Example
auto coord_acc = CoordinatesAccessor(mesh->getCoordinates()); coord_acc.dx(index) -> BoutReal at cell index
Notes
Data from Coordinates is copied into an array which is cached. CoordinatesAccessors created with the same Coordinates pointer will re-use the same array without copying the data again. -> If Coordinates data is changed, the cache should be cleared by calling CoordinatesAccessor::clear()
Public Types
-
enum Offset¶
Offsets of each coordinates variable into the striped array.
Values:
-
enumerator dx¶
-
enumerator dy¶
-
enumerator dz¶
-
enumerator d1_dx¶
-
enumerator d1_dy¶
-
enumerator d1_dz¶
-
enumerator J¶
-
enumerator B¶
-
enumerator Byup¶
-
enumerator Bydown¶
-
enumerator G1¶
-
enumerator G3¶
-
enumerator g11¶
-
enumerator g12¶
-
enumerator g13¶
-
enumerator g22¶
-
enumerator g23¶
-
enumerator g33¶
-
enumerator g_11¶
-
enumerator g_12¶
-
enumerator g_13¶
-
enumerator g_22¶
-
enumerator g_23¶
-
enumerator g_33¶
-
enumerator end¶
-
enumerator dx¶
Public Functions
-
CoordinatesAccessor() = delete¶
-
explicit CoordinatesAccessor(const Coordinates *coords)¶
Constructor from Coordinates Copies data from coords, doesn’t modify it
-
inline BoutReal lookup(int index, int offset) const¶
Lookup value in data array, based on the cell index and the variable offset
-
inline BoutReal dx(int index) const
-
inline BoutReal dy(int index) const
-
inline BoutReal dz(int index) const
-
inline BoutReal d1_dx(int index) const
-
inline BoutReal d1_dy(int index) const
-
inline BoutReal d1_dz(int index) const
-
inline BoutReal J(int index) const
-
inline BoutReal B(int index) const
-
inline BoutReal Byup(int index) const
-
inline BoutReal Bydown(int index) const
-
inline BoutReal G1(int index) const
-
inline BoutReal G3(int index) const
-
inline BoutReal g11(int index) const
-
inline BoutReal g12(int index) const
-
inline BoutReal g13(int index) const
-
inline BoutReal g22(int index) const
-
inline BoutReal g23(int index) const
-
inline BoutReal g33(int index) const
-
inline BoutReal g_11(int index) const
-
inline BoutReal g_12(int index) const
-
inline BoutReal g_13(int index) const
-
inline BoutReal g_22(int index) const
-
inline BoutReal g_23(int index) const
-
inline BoutReal g_33(int index) const
Public Members
-
BoutReal *data¶
Underlying data pointer. This array includes all Coordinates fields interleaved
-
int mesh_nz¶
For converting from 3D to 2D index.
Public Static Functions
-
static std::size_t clear(const Coordinates *coords = nullptr)¶
Clear the cache of Coordinates data
By default this clears everything; if only a specific Coordinates should be removed then that can be specified.
Returns the number of data arrays removed (mainly to assist in testing)