feat: multi-field API — set!(fun, ϕ), op!, and grid/field compatibili… - #102
Open
ExpandingMan wants to merge 1 commit into
Open
ExpandingMan wants to merge 1 commit into
ExpandingMan wants to merge 1 commit into
Conversation
…ty checks Expand the package for contexts that combine several fields at once. - `set!` now takes the function first: `set!(fun, ϕ)`. This is breaking (0.1 → 0.2) and makes the `do`-block form read naturally. Every call site in src, ext, test, docs, examples, benchmarks and the README is updated; the multi-device method in the MDLA extension becomes `set!(fun, x, P)` for consistency. - New `op!(fun, ϕ, ϕs...; check=true)`: pointwise in-place update of `ϕ` from the cell coordinates and the current values of `ϕ` and any number of other fields, on `Field`s and forest fields alike. - Compatibility checks for multi-field functions: grid `==` (same discretization, device ignored), `same_layout`, `compatible`, `check_compatible`, `check_layout`, with a first-mismatch property walk, an identity fast path, an out-of-line throw, and regrid-currency checks for forest fields. Variadic forms recurse over the argument tuple and measure 0 B under `--check-bounds=yes`. - Unified leaf interface: `nleaves`, `leaf_grid`, `block`, `_block_array` and `_require_current` on `CartesianGrid`/`Field`, so per-block sweeps can be written once against `AbstractGrid`/`AbstractField`. - Docstrings for `set!`, `op!` and grid `==`; new names exported; benchmark compat bumped to 0.2. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
…ty checks
Expand the package for contexts that combine several fields at once.
set!now takes the function first:set!(fun, ϕ). This is breaking (0.1 → 0.2) and makes thedo-block form read naturally. Every call site in src, ext, test, docs, examples, benchmarks and the README is updated; the multi-device method in the MDLA extension becomesset!(fun, x, P)for consistency.op!(fun, ϕ, ϕs...; check=true): pointwise in-place update ofϕfrom the cell coordinates and the current values ofϕand any number of other fields, onFields and forest fields alike.==(same discretization, device ignored),same_layout,compatible,check_compatible,check_layout, with a first-mismatch property walk, an identity fast path, an out-of-line throw, and regrid-currency checks for forest fields. Variadic forms recurse over the argument tuple and measure 0 B under--check-bounds=yes.nleaves,leaf_grid,block,_block_arrayand_require_currentonCartesianGrid/Field, so per-block sweeps can be written once againstAbstractGrid/AbstractField.set!,op!and grid==; new names exported; benchmark compat bumped to 0.2.This is WIP,
map!may be causing issues with enzyme.