![]() |
PACMAN 0.1.0
Portable Algorithms for Coupling, Mapping, and Adaptive iNterpolation
|
C++ implementation of the plain-C shim for the Fortran bindings. More...
#include "fortran_interface.h"#include "interface.hpp"#include <Kokkos_Core.hpp>#include <cstddef>#include <iostream>#include <stdexcept>Go to the source code of this file.
Functions | |
| void | pacman_kokkos_initialize_c (void) |
| Initialize Kokkos with default settings. | |
| void | pacman_kokkos_finalize_c (void) |
| Finalize Kokkos. | |
| int | pacman_best_execspace_c (void) |
| Return the best execution space available in the current build. | |
| 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_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. | |
| 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_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. | |
C++ implementation of the plain-C shim for the Fortran bindings.
Each function catches all C++ exceptions and returns an integer error code so that Fortran callers receive a clean C ABI with no thrown exceptions crossing the language boundary.
Definition in file fortran_interface.cpp.
| int pacman_best_execspace_c | ( | void | ) |
Return the best execution space available in the current build.
Priority order: HIP > CUDA > SYCL > OpenMP > Threads > Serial. Returns -1 if no execution space is available (should not happen).
Definition at line 41 of file fortran_interface.cpp.
References PACMAN::ExecSpaces::CUDA, PACMAN::ExecSpaces::HIP, PACMAN::ExecSpaces::OPENMP, PACMAN::ExecSpaces::SERIAL, PACMAN::ExecSpaces::SYCL, and PACMAN::ExecSpaces::THREADS.
Referenced by pacman_mod::pacman_best_execspace().
| 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.
Connectivity arrays use CSR format (int32 values). For NEAREST_NEAREST, pass NULL for connVal, connOff, cellTypes and zero for the corresponding size arguments.
| spaceDimension | Geometric dimension (1, 2, or 3). |
| execSpace | Execution-space selector. |
| method | FE method selector (PACMAN_FeMethod). |
| sourcePoints | Row-major source points [nSourcePoints × spaceDimension]. |
| nSourcePoints | Number of source points. |
| sourceValues | Source scalar values, length nSourcePoints. |
| connVal | CSR connectivity values. |
| connValSize | Number of entries in connVal. |
| connOff | CSR connectivity offsets. |
| connOffSize | Number of entries in connOff (= nElems + 1). |
| cellTypes | PACMAN CellType per element, length connOffSize
|
| targetPoints | Row-major target points [nTargetPoints × spaceDimension]. |
| nTargetPoints | Number of target points. |
| targetValues | Caller-allocated output, length nTargetPoints. |
| targetStatus | Caller-allocated status output, length nTargetPoints. |
Definition at line 97 of file fortran_interface.cpp.
References PACMAN::fe_interpolate(), PACMAN::FeInterpolateResult::targetStatus, and PACMAN::FeInterpolateResult::targetValues.
Referenced by pacman_mod::pacman_fe_interpolate().
| void pacman_kokkos_finalize_c | ( | void | ) |
Finalize Kokkos.
Must be called after all interpolation calls are complete.
Definition at line 35 of file fortran_interface.cpp.
Referenced by pacman_mod::pacman_kokkos_finalize().
| void pacman_kokkos_initialize_c | ( | void | ) |
Initialize Kokkos with default settings.
Must be called before any interpolation function and only once.
Definition at line 29 of file fortran_interface.cpp.
Referenced by pacman_mod::pacman_kokkos_initialize().
| 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.
| spaceDimension | Geometric dimension (1, 2, or 3). |
| execSpace | Execution-space selector (PACMAN_ExecSpace). |
| sourcePoints | Row-major source points [nSourcePoints × spaceDimension]. |
| nSourcePoints | Number of source points. |
| sourceValues | Source scalar values, length nSourcePoints. |
| targetPoints | Row-major target points [nTargetPoints × spaceDimension]. |
| nTargetPoints | Number of target points. |
| targetValues | Caller-allocated output, length nTargetPoints. |
Definition at line 138 of file fortran_interface.cpp.
References PACMAN::MLS_interpolate(), and PACMAN::MLSInterpolateResult::targetValues.
Referenced by pacman_mod::pacman_mls_interpolate().
| 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.
Point arrays are row-major: point i occupies elements [i*spaceDimension .. (i+1)*spaceDimension-1]. In Fortran, declare points as REAL(C_DOUBLE) :: pts(spaceDimension, n) (column-major storage = C row-major storage).
| spaceDimension | Geometric dimension (1, 2, or 3). |
| execSpace | Execution-space selector (PACMAN_ExecSpace). |
| rbfFunction | RBF basis-function selector (PACMAN_RbfFunction). |
| sourcePoints | Row-major source points [nSourcePoints × spaceDimension]. |
| nSourcePoints | Number of source points. |
| sourceValues | Source scalar values, length nSourcePoints. |
| targetPoints | Row-major target points [nTargetPoints × spaceDimension]. |
| nTargetPoints | Number of target points. |
| targetValues | Caller-allocated output, length nTargetPoints. |
Definition at line 63 of file fortran_interface.cpp.
References PACMAN::rbf_interpolate(), and PACMAN::RbfInterpolateResult::targetValues.
Referenced by pacman_mod::pacman_rbf_interpolate().
| int pacman_vtk_cell_dim_c | ( | int | vtkCellType | ) |
Return the topological dimension for a VTK cell-type ID.
Equivalent to PACMAN::vtk_cell_dim.
| vtkCellType | VTK cell-type ID. |
Definition at line 188 of file fortran_interface.cpp.
References PACMAN::vtk_cell_dim().
Referenced by pacman_mod::pacman_vtk_cell_dim().
| 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.
Equivalent to PACMAN::vtk_to_pacman_cell_type.
| vtkTypes | Input VTK cell-type IDs, length n. |
| pacmanTypes | Output PACMAN cell-type codes, length n. |
| n | Number of cell types to convert. |
Definition at line 171 of file fortran_interface.cpp.
References PACMAN::vtk_to_pacman_cell_type().
Referenced by pacman_mod::pacman_vtk_to_pacman_cell_type().