From d215c872bbdf8ba733f9a9fbd586374b841fdfb5 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 23 Mar 2019 17:55:57 +0100 Subject: Add a new separate module for grid transfers/interpolation. --- transfer.h | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 transfer.h (limited to 'transfer.h') diff --git a/transfer.h b/transfer.h new file mode 100644 index 0000000..f9d0870 --- /dev/null +++ b/transfer.h @@ -0,0 +1,58 @@ +/* + * Grid transfer operators + * Copyright 2018 Anton Khirnov + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef MG2D_TRANSFER_H +#define MG2D_TRANSFER_H + +#include +#include + +#include "ndarray.h" + +enum GridTransferOperator { + GRID_TRANSFER_LAGRANGE_1, + GRID_TRANSFER_LAGRANGE_3, + GRID_TRANSFER_FW_1, +}; + +typedef struct RegularGrid2D { + size_t size[2]; + double step[2]; +} RegularGrid2D; + +typedef struct GridTransferContext { + void *priv; + + TPContext *tp; + int cpuflags; + + enum GridTransferOperator op; + + RegularGrid2D src; + RegularGrid2D dst; +} GridTransferContext; + +GridTransferContext *mg2di_gt_alloc(enum GridTransferOperator op); +int mg2di_gt_init(GridTransferContext *ctx); + +void mg2di_gt_free(GridTransferContext **ctx); + +int mg2di_gt_transfer(GridTransferContext *ctx, + NDArray *dst, const NDArray *src); + +#endif // MG2D_TRANSFER_H -- cgit v1.2.3