Skip to content

Return the expanded lattice with and without the computed parameters#80

Merged
DavidSagan merged 1 commit into
mainfrom
expanded-minus-dependent
Jul 25, 2026
Merged

Return the expanded lattice with and without the computed parameters#80
DavidSagan merged 1 commit into
mainfrom
expanded-minus-dependent

Conversation

@DavidSagan

Copy link
Copy Markdown
Member

parse_and_expand_PALS now returns five trees rather than four.

  • full_expanded — the lattice the bookkeeper finishes: every dependent parameter computed and present. Each element carries its ReferenceP, FloorP and s_position, the derived members of every parameter family it uses (Kn1L alongside Kn1, voltage alongside gradient, …) and the non-zero defaults of the groups it carries; each branch is capped with a branch_end Placeholder holding its final reference and floor.
  • expanded — that same tree pruned back to the author's inputs. A parameter is kept when it was present before run_element_bookkeeper first ran, or when a post-expand_lattice set wrote it. Everything else the bookkeeper produced is dropped, along with any group left empty and the branch_end elements.

expanded is full_expanded with nodes removed rather than an earlier snapshot, so a parameter present in both holds the same value in both, with every set and ABSOLUTE controller applied. Use it to see the inputs rather than their consequences, or to write a lattice back out without the derived values.

API

The tree that took the old expanded name now takes full_expanded: node_link.full_expanded, build_correspondence_map(original, combined, full_expanded, leftover) and get_lattice_parameter_value(full_expanded, leftover, …). expanded takes no part in the correspondence — it is a pruned copy, not a step in the derivation chain, so its nodes are located by path.

struct lattices gained full_expanded between expanded and leftover, so callers binding it by layout need updating. PALSJulia follows in a companion PR.

Tests

New tests/test_expanded_minus_dependent.cpp (9 cases) pins the boundary between the two trees: an authored ReferenceP the bookkeeper completes, one authored member of a multipole family with the rest derived, an authored RFP gradient plus materialized defaults, and an element holding nothing but its kind. The existing suites follow the rename.

Full suite: 1291 assertions in 236 test cases, all passing.

🤖 Generated with Claude Code

parse_and_expand_PALS now hands back five trees rather than four. The
lattice the bookkeeper finishes is `full_expanded`: every dependent
parameter computed and present — ReferenceP, FloorP and s_position on
each element, the derived members of every parameter family it uses, the
non-zero defaults of the groups it carries, and a branch_end Placeholder
capping each branch.

`expanded` is that same tree pruned back to the author's inputs. A
parameter is kept when it was present before the bookkeeper first ran, or
when a post-`expand_lattice` `set` wrote it; everything else the
bookkeeper produced is dropped, along with any group left empty and the
branch_end elements. It is full_expanded with nodes removed rather than
an earlier snapshot, so a parameter in both trees holds the same value in
both, with every `set` and ABSOLUTE controller applied.

The trees that took the old `expanded` name now take `full_expanded`:
node_link, build_correspondence_map and get_lattice_parameter_value all
name it. `expanded` takes no part in the correspondence — it is a pruned
copy, not a step in the derivation chain, so its nodes are found by path.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@DavidSagan
DavidSagan merged commit 4c950a4 into main Jul 25, 2026
3 checks passed
@DavidSagan
DavidSagan deleted the expanded-minus-dependent branch July 25, 2026 22:46
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.

1 participant