diff options
Diffstat (limited to 'transfer.h')
-rw-r--r-- | transfer.h | 26 |
1 files changed, 16 insertions, 10 deletions
@@ -36,25 +36,26 @@ enum GridTransferOperator { }; /** - * A 2-dimensional grid with regular spacing. + * An N-dimensional grid with regular spacing. */ -typedef struct RegularGrid2D { +typedef struct RegularGrid { /** * Indices of the grid origin, relative to coordinate origin. - * (o0, o1) = (start[0] * step[0], start[1] * step[1]) + * For each dimension i=0..N-1: + * o_i = start[i] * step[i] */ - ptrdiff_t start[2]; + ptrdiff_t *start; /** * Number of points in the domain. */ - size_t size[2]; + size_t *size; /** * Size of the step between neighbouring grid points. */ - double step[2]; -} RegularGrid2D; + double *step; +} RegularGrid; typedef struct GridTransferContext { /** @@ -77,14 +78,19 @@ typedef struct GridTransferContext { enum GridTransferOperator op; /** + * Number of dimensions. + */ + unsigned int nb_dims; + + /** * Source grid geometry, must be filled by the caller. */ - RegularGrid2D src; + RegularGrid src; /** * Destination grid geometry, must be filled by the caller. */ - RegularGrid2D dst; + RegularGrid dst; /** * Allow extrapolating this many points beyond the source rectangle. @@ -98,7 +104,7 @@ typedef struct GridTransferContext { * * @return newly allocated transfer context on success, NULL on failure */ -GridTransferContext *mg2di_gt_alloc(enum GridTransferOperator op); +GridTransferContext *mg2di_gt_alloc(unsigned int dims, enum GridTransferOperator op); /** * Initialize the tranfer context after all the parameters have been set. |