diff options
author | Anton Khirnov <anton@khirnov.net> | 2019-05-10 14:57:57 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2019-05-17 09:44:36 +0200 |
commit | f430bdb2823ac7596c4db24f230e37fda0bc55ff (patch) | |
tree | aedc57d605dd1ce239a25db9db15dde6530625e2 | |
parent | 7a4e7a23022fee5431e039e385a96a5244ea4fb9 (diff) |
transfer: add API documentation
-rw-r--r-- | transfer.h | 54 |
1 files changed, 52 insertions, 2 deletions
@@ -35,27 +35,77 @@ enum GridTransferOperator { }; typedef struct RegularGrid2D { - size_t size[2]; - double step[2]; + /** + * Number of points in the domain. + */ + size_t size[2]; + + /** + * Size of the step between neighbouring grid points. + */ + double step[2]; } RegularGrid2D; typedef struct GridTransferContext { + /** + * Private data, not to be accessed by the caller. + */ void *priv; + /** + * Thread pool for parallel execution, must be set by the caller. + */ TPContext *tp; + /** + * CPU feature flags, must be set by the caller. + */ int cpuflags; + /** + * The operator used, set by mg2di_gt_alloc(). + */ enum GridTransferOperator op; + /** + * Source grid geometry, must be filled by the caller. + */ RegularGrid2D src; + + /** + * Destination grid geometry, must be filled by the caller. + */ RegularGrid2D dst; } GridTransferContext; +/** + * Allocate the transfer context for the given transfer operator. + * + * @return newly allocated transfer context on success, NULL on failure + */ GridTransferContext *mg2di_gt_alloc(enum GridTransferOperator op); + +/** + * Initialize the tranfer context after all the parameters have been set. + * + * @return 0 on success, a negative error code on failure + */ int mg2di_gt_init(GridTransferContext *ctx); +/** + * Free the transfer context and everything associated with it. + * Write NULL in the supplied pointer. + */ void mg2di_gt_free(GridTransferContext **ctx); +/** + * Execute the transfer. + * + * @param ctx transfer context + * @param dst destination data, must match the dst grid in the transfer context + * @param src source data, must match the src grid in the transfer context + * + * @return 0 on success, a negative error code on failure. + */ int mg2di_gt_transfer(GridTransferContext *ctx, NDArray *dst, const NDArray *src); |