GridXY¶
Overview¶
-
struct GridXY¶
Structure to hold 2D grid data.
The
omdi::GridXYstruct stores pointers to the X and Y coordinate axes of a regular 2D grid, along with the grid dimensions and a pointer to the associated scalar dataz.All pointer members are non-owning; the caller is responsible for ensuring that the pointed-to data remains valid for the lifetime of the
omdi::GridXYinstance.
Usage example¶
Basic usage with externally owned data:
constexpr std::size_t nx = 3;
constexpr std::size_t ny = 2;
float xs[nx] = {0.0f, 1.0f, 2.0f};
float ys[ny] = {0.0f, 1.0f};
float zs[nx * ny] = {
0.0f, 1.0f,
2.0f, 3.0f,
4.0f, 5.0f
};
auto grid = omdi::GridXY(xs, ys, nx, ny, zs);
Data members¶
-
const float *const GridXY::x¶
Pointer to the X coordinates array.
Typically points to an array of length
omdi::GridXY::nx, containing monotonically increasing X coordinates.
-
const float *const GridXY::y¶
Pointer to the Y coordinates array.
Typically points to an array of length
omdi::GridXY::ny, containing monotonically increasing Y coordinates.
Constructor¶
-
GridXY::GridXY(const float *x, const float *y, std::size_t nx, std::size_t ny, const float *z)¶
Construct a
omdi::GridXYfrom raw pointers and sizes.- Parameters:
x – Pointer to the X coordinate array (length
nx).y – Pointer to the Y coordinate array (length
ny).nx – Number of grid points along the X axis.
ny – Number of grid points along the Y axis.
z – Pointer to the scalar grid data (typically of size
nx * ny).
Notes¶
omdi::GridXYdoes not allocate or own memory; it simply stores pointers and sizes.The layout (row-major vs. column-major) of
omdi::GridXY::zis application-defined and should be documented wherever the grid is used.