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 class 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
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)