18#include <Kokkos_Core.hpp>
30 if (!Kokkos::is_initialized()) {
36 if (Kokkos::is_initialized()) {
42#if defined(KOKKOS_ENABLE_HIP)
44#elif defined(KOKKOS_ENABLE_CUDA)
46#elif defined(KOKKOS_ENABLE_SYCL)
48#elif defined(KOKKOS_ENABLE_OPENMP)
50#elif defined(KOKKOS_ENABLE_THREADS)
52#elif defined(KOKKOS_ENABLE_SERIAL)
64 const double *sourcePoints,
int nSourcePoints,
65 const double *sourceValues,
66 const double *targetPoints,
int nTargetPoints,
67 double *targetValues) {
71 static_cast<unsigned char>(execSpace),
72 static_cast<unsigned char>(rbfFunction),
80 for (
int i = 0; i < nTargetPoints; ++i)
81 targetValues[i] = result.
targetValues[
static_cast<std::size_t
>(i)];
84 }
catch (
const std::exception &e) {
85 std::cerr <<
"pacman_rbf_interpolate_c: " << e.what() <<
"\n";
88 std::cerr <<
"pacman_rbf_interpolate_c: unknown exception\n";
98 const double *sourcePoints,
int nSourcePoints,
99 const double *sourceValues,
const int *connVal,
100 int connValSize,
const int *connOff,
101 int connOffSize,
const int *cellTypes,
102 const double *targetPoints,
int nTargetPoints,
103 double *targetValues,
int *targetStatus) {
107 static_cast<unsigned char>(execSpace),
120 for (
int i = 0; i < nTargetPoints; ++i) {
121 targetValues[i] = result.
targetValues[
static_cast<std::size_t
>(i)];
122 targetStatus[i] = result.
targetStatus[
static_cast<std::size_t
>(i)];
125 }
catch (
const std::exception &e) {
126 std::cerr <<
"pacman_fe_interpolate_c: " << e.what() <<
"\n";
129 std::cerr <<
"pacman_fe_interpolate_c: unknown exception\n";
139 const double *sourcePoints,
int nSourcePoints,
140 const double *sourceValues,
141 const double *targetPoints,
int nTargetPoints,
142 double *targetValues) {
147 static_cast<unsigned char>(execSpace),
154 for (
int i = 0; i < nTargetPoints; ++i)
155 targetValues[i] = result.
targetValues[
static_cast<std::size_t
>(i)];
158 }
catch (
const std::exception &e) {
159 std::cerr <<
"pacman_mls_interpolate_c: " << e.what() <<
"\n";
162 std::cerr <<
"pacman_mls_interpolate_c: unknown exception\n";
179 }
catch (
const std::exception &e) {
180 std::cerr <<
"pacman_vtk_to_pacman_cell_type_c: " << e.what() <<
"\n";
183 std::cerr <<
"pacman_vtk_to_pacman_cell_type_c: unknown exception\n";
190 return static_cast<int>(
192 }
catch (
const std::exception &e) {
193 std::cerr <<
"pacman_vtk_cell_dim_c: " << e.what() <<
"\n";
196 std::cerr <<
"pacman_vtk_cell_dim_c: unknown exception\n";
void pacman_kokkos_initialize_c(void)
Initialize Kokkos with default settings.
int pacman_rbf_interpolate_c(int spaceDimension, int execSpace, int rbfFunction, const double *sourcePoints, int nSourcePoints, const double *sourceValues, const double *targetPoints, int nTargetPoints, double *targetValues)
C shim for PACMAN::rbf_interpolate.
int pacman_mls_interpolate_c(int spaceDimension, int execSpace, const double *sourcePoints, int nSourcePoints, const double *sourceValues, const double *targetPoints, int nTargetPoints, double *targetValues)
C shim for PACMAN::mls_interpolate.
int pacman_best_execspace_c(void)
Return the best execution space available in the current build.
int pacman_fe_interpolate_c(int spaceDimension, int execSpace, int method, const double *sourcePoints, int nSourcePoints, const double *sourceValues, const int *connVal, int connValSize, const int *connOff, int connOffSize, const int *cellTypes, const double *targetPoints, int nTargetPoints, double *targetValues, int *targetStatus)
C shim for PACMAN::fe_interpolate.
void pacman_kokkos_finalize_c(void)
Finalize Kokkos.
int pacman_vtk_to_pacman_cell_type_c(const int *vtkTypes, int *pacmanTypes, int n)
Convert an array of VTK cell-type IDs to PACMAN CellType values.
int pacman_vtk_cell_dim_c(int vtkCellType)
Return the topological dimension for a VTK cell-type ID.
Plain-C shim declarations for the Fortran ISO C bindings interface.
FeInterpolateResult fe_interpolate(int_t spaceDimension, unsigned char execSpace, method_t method, coordinates_t *sourcePoints, int_t nSourcePoints, fp_t *sourceValues, int_t *connVal, int_t connValSize, offset_t *connOff, int_t connOffSize, cell_t *cellTypes, coordinates_t *targetPoints, int_t nTargetPoints, bool fortranIndexing)
C++ interface for finite-elements interpolation.
RbfInterpolateResult rbf_interpolate(int_t spaceDimension, unsigned char execSpace, unsigned char rbfFunction, coordinates_t *sourcePoints, int_t nSourcePoints, fp_t *sourceValues, coordinates_t *targetPoints, int_t nTargetPoints)
C++ interface for RBF-PUM interpolation.
void vtk_to_pacman_cell_type(const int_t *vtkTypes, cell_t *pacmanTypes, int_t n)
Convert an array of VTK cell type IDs to PACMAN CellType enum values.
MLSInterpolateResult MLS_interpolate(int_t spaceDimension, unsigned char execSpace, coordinates_t *sourcePoints, int_t nSourcePoints, fp_t *sourceValues, coordinates_t *targetPoints, int_t nTargetPoints)
C++ interface for Moving Least Squares (MLS) interpolation.
int_t vtk_cell_dim(int_t vtkCellType)
Return the topological dimension for a VTK cell type identifier.
static constexpr const unsigned char OPENMP
static constexpr const unsigned char SERIAL
static constexpr const unsigned char SYCL
static constexpr const unsigned char THREADS
static constexpr const unsigned char HIP
static constexpr const unsigned char CUDA
Result of a finite-elements interpolation call.
std::vector< int_t > targetStatus
TransferStatus code per target point (same underlying int_t as TransferStatus enum).
std::vector< fp_t > targetValues
Interpolated scalar value per target point.
Result of a Moving Least Squares interpolation call.
std::vector< fp_t > targetValues
Interpolated scalar value per target point.
Result of an RBF-PUM interpolation call.
std::vector< fp_t > targetValues
Interpolated scalar value per target point.