feat: Add multipath sequential modeling via PathSpec builder API - #372
Merged
Conversation
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.
This feature introduces a second way to build a
SequentialModelalongside the existingfrom_surface_specs()convenience constructor: thePathSpecbuilder API.Each
PathSpecholds an ordered sequence ofPathSurfaceRefentries, either New(SurfaceSpec) to introduce a surface into a sharedSurfaceStore, orShared(i)to reference a surface already committed by an earlier path. This allows multiple optical paths to share surfaces (e.g. both arms of a beam splitter share the same physical BS surface object and its placement).PathSpec is a plain struct with public fields:
BeamSplitteris now purely geometric: path_kind is removed from bothSurfaceSpec::BeamSplitterand theBeamSplitterstruct. Arm selection (Transmitting vs. Reflecting) is declared per traversal inPathSpec::beam_splitter_armsand exposed per iterator step viaStep::bs_arm. Thebeam_splitter_armsfield in the example above lists whether beam splitters should be transmitting or reflecting for this particular path. They are evaluated in order of the beam splitters specifiedThe existing
from_surface_specs()constructor and all single-path models are unchanged. The GUI continues to use the convenience path.For the moment, the feature isn't so useful as the Views only operate on the first path found. This is intended as a first step in an incremental implementation.