Skip to content

api: fix injection expression indices#2927

Merged
mloubout merged 2 commits into
mainfrom
interp-inject-coeff
May 12, 2026
Merged

api: fix injection expression indices#2927
mloubout merged 2 commits into
mainfrom
interp-inject-coeff

Conversation

@mloubout
Copy link
Copy Markdown
Contributor

No description provided.

@mloubout mloubout added the API api (symbolics, types, ...) label May 11, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.35%. Comparing base (91d8596) to head (a0b7fc0).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2927   +/-   ##
=======================================
  Coverage   83.35%   83.35%           
=======================================
  Files         248      248           
  Lines       51734    51734           
  Branches     4463     4463           
=======================================
+ Hits        43122    43124    +2     
+ Misses       7859     7858    -1     
+ Partials      753      752    -1     
Flag Coverage Δ
pytest-gpu-aomp-amdgpuX 68.70% <100.00%> (ø)
pytest-gpu-gcc- 78.05% <100.00%> (+0.01%) ⬆️
pytest-gpu-icx- 78.00% <100.00%> (+0.03%) ⬆️
pytest-gpu-nvc-nvidiaX 69.24% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread devito/operations/interpolators.py Outdated
# List of indirection indices for all adjacent grid points
idx_subs, temps = self._interp_idx(fields, implicit_dims=implicit_dims,
pos_only=variables, subdomain=subdomain)
finterp = fields + as_tuple(variables) if interp_expr else fields
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.

nitpicking, it'd read better with an explicit

if inter_expr:
    <stmt0>
    <stmt1>
else:
     ...

Comment thread devito/operations/interpolators.py Outdated
@check_radius
@check_coords
def inject(self, field, expr, implicit_dims=None):
def inject(self, field, expr, implicit_dims=None, interp_expr=False):
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.

the docstring should be updated now

also, if interp_expr is a boolean, maybe it could be given a more representative name, because for a good couple of minutes, while scrolling up and down through the PR, I thought it was an expression

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.

Seconded

Comment thread devito/operations/interpolators.py Outdated
__rargs__ = ('field', 'expr', 'implicit_dims') + UnevaluatedSparseOperation.__rargs__

def __new__(cls, field, expr, implicit_dims, interpolator):
def __new__(cls, field, expr, implicit_dims, interpolator, interp_expr=False):
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.

btw, don't we need the equivalent for Interpolation too?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No we don't. Interpolation is by definition "interpolate whole expr" so it doesn't have a way to ignore terms

@mloubout mloubout changed the title api: add option to apply interp indices to function coeffs at inject api: fix injection expression indices May 12, 2026
@mloubout mloubout merged commit ddb2459 into main May 12, 2026
42 checks passed
@mloubout mloubout deleted the interp-inject-coeff branch May 12, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API api (symbolics, types, ...)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants