Skip to content

Inline interpolation kernels#557

Draft
greole wants to merge 4 commits into
developfrom
enh/inlineInterpolationSchemes
Draft

Inline interpolation kernels#557
greole wants to merge 4 commits into
developfrom
enh/inlineInterpolationSchemes

Conversation

@greole

@greole greole commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

This PR introduces device-callable inline interpolation weight kernels to avoid precomputing weight fields and to eliminate virtual dispatch inside Kokkos assembly kernels. The divergence and fused div+laplacian implicit assemblers are refactored to obtain a concrete kernel via inlineWeightKernel(...) and dispatch it with std::visit.

@github-actions

Copy link
Copy Markdown

Thank you for your PR, here are some useful tips:

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces device-callable inline interpolation weight kernels to avoid precomputing weight fields and to eliminate virtual dispatch inside Kokkos assembly kernels. The divergence and fused div+laplacian implicit assemblers are refactored to obtain a concrete kernel via inlineWeightKernel(...) and dispatch it with std::visit.

Changes:

  • Added InlineWeightKernel (std::variant) plus LinearInlineKernel / UpwindInlineKernel device-callable implementations.
  • Extended SurfaceInterpolationFactory with a new pure-virtual inlineWeightKernel(...) API and implemented it for linear, upwind, and linearUpwind.
  • Refactored gaussGreenDiv and gaussGreenDivLaplacian implicit assembly paths to compute weights inline via the kernel (removing weight-field plumbing).

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/finiteVolume/cellCentred/operators/gaussGreenDivLaplacian.cpp Refactors fused operator assembly to use inline weight kernels via std::visit.
src/finiteVolume/cellCentred/operators/gaussGreenDiv.cpp Refactors implicit div assembly (internal/boundary/proc) to compute weights inline.
include/NeoN/finiteVolume/cellCentred/interpolation/upwind.hpp Implements inlineWeightKernel() for upwind interpolation.
include/NeoN/finiteVolume/cellCentred/interpolation/surfaceInterpolation.hpp Adds new pure-virtual inlineWeightKernel() API and forwards it through SurfaceInterpolation.
include/NeoN/finiteVolume/cellCentred/interpolation/linearUpwind.hpp Implements inlineWeightKernel() for linearUpwind (upwind weights + explicit correction).
include/NeoN/finiteVolume/cellCentred/interpolation/linear.hpp Implements inlineWeightKernel() for linear (captures geometry weights views).
include/NeoN/finiteVolume/cellCentred/interpolation/inlineInterpolationKernels.hpp New header defining the inline weight kernel types and the InlineWeightKernel variant.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 298 to 300
// Decompose face flux via linear interpolation:
// ownFluxContrib = w * F_f — part attributed to the owner cell value
// neiFluxContrib = (1-w) * F_f — part attributed to the neighbor cell value
Comment on lines +95 to +99
/* @brief Returns a device-callable weight kernel for use inside Kokkos kernels.
* The kernel computes the face interpolation weight inline per face without virtual dispatch.
*/
virtual InlineWeightKernel inlineWeightKernel(const SurfaceField<scalar>& flux) const = 0;

@greole greole force-pushed the enh/inlineInterpolationSchemes branch from 0465179 to 5069101 Compare July 14, 2026 07:20
@greole greole changed the title inline kernels inline interpolation kernels Jul 14, 2026
@greole greole changed the title inline interpolation kernels Inline interpolation kernels Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants