-
Notifications
You must be signed in to change notification settings - Fork 18
Inline interpolation kernels #557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
greole
wants to merge
4
commits into
develop
Choose a base branch
from
enh/inlineInterpolationSchemes
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
69 changes: 69 additions & 0 deletions
69
include/NeoN/finiteVolume/cellCentred/interpolation/inlineInterpolationKernels.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| // SPDX-FileCopyrightText: 2023 - 2026 NeoN authors | ||
| // | ||
| // SPDX-License-Identifier: MIT | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <variant> | ||
|
|
||
| #include "NeoN/core/parallelAlgorithms.hpp" | ||
| #include "NeoN/core/primitives/scalar.hpp" | ||
| #include "NeoN/core/primitives/label.hpp" | ||
| #include "NeoN/core/view.hpp" | ||
|
|
||
| namespace NeoN::finiteVolume::cellCentred | ||
| { | ||
|
|
||
| /* @brief Device-callable weight kernel for linear interpolation. | ||
| ** Captures the pre-computed geometry weights views (internal + boundary); no virtual dispatch. | ||
| ** The boundary view covers both physical and proc boundary faces in a single contiguous array. | ||
| */ | ||
| struct LinearInlineKernel | ||
| { | ||
| View<const scalar> weights; | ||
| View<const scalar> bWeights; | ||
|
|
||
| NEON_INLINE_FUNCTION scalar weight(localIdx facei, scalar /*flux*/) const | ||
| { | ||
| return weights[facei]; | ||
| } | ||
|
|
||
| NEON_INLINE_FUNCTION scalar boundaryWeight(localIdx bfacei, scalar /*flux*/) const | ||
| { | ||
| return bWeights[bfacei]; | ||
| } | ||
|
|
||
| NEON_INLINE_FUNCTION scalar procBoundaryWeight(localIdx bcfacei, scalar /*flux*/) const | ||
| { | ||
| return bWeights[bcfacei]; | ||
| } | ||
| }; | ||
|
|
||
| /* @brief Device-callable weight kernel for upwind interpolation. | ||
| ** Internal weight: 1 if flux >= 0 (owner upwind), 0 otherwise. | ||
| ** Physical boundary weight: always 1 (value comes from the BC, not interpolated). | ||
| ** Proc boundary weight: flux-sign, matching the coupled internal-face convention. | ||
| */ | ||
| struct UpwindInlineKernel | ||
| { | ||
| NEON_INLINE_FUNCTION scalar weight([[maybe_unused]] localIdx facei, scalar flux) const | ||
| { | ||
| return flux >= scalar(0) ? scalar(1) : scalar(0); | ||
| } | ||
|
|
||
| NEON_INLINE_FUNCTION scalar | ||
| boundaryWeight([[maybe_unused]] localIdx bfacei, [[maybe_unused]] scalar flux) const | ||
| { | ||
| return scalar(1); | ||
| } | ||
|
|
||
| NEON_INLINE_FUNCTION scalar | ||
| procBoundaryWeight([[maybe_unused]] localIdx bcfacei, scalar flux) const | ||
| { | ||
| return flux >= scalar(0) ? scalar(1) : scalar(0); | ||
| } | ||
| }; | ||
|
|
||
| using InlineWeightKernel = std::variant<LinearInlineKernel, UpwindInlineKernel>; | ||
|
|
||
| } // namespace NeoN::finiteVolume::cellCentred | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this makes it incompatible with a plugin architecture, so adding new schemes would require adding to InlineWeightKernel