Add StyledHook + graph-level terminate!#226
Open
gpeairs wants to merge 2 commits into
Open
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
8d79c83 to
327263d
Compare
Adds a `StyledHook{T, H<:Hook{T}, S} <: Hook{T}` wrapper that augments any
`Hook` with a carried path-style object, plus graph-level `terminate!`
methods that use the carried style (or an explicit `style=` kwarg) to
attach a termination cap to a schematic node's hook.
327263d to
ce37a1f
Compare
simlapointe
approved these changes
May 22, 2026
Contributor
simlapointe
left a comment
There was a problem hiding this comment.
Overall looks good to me. Two comments below; one of them might be a small bug but not sure it would arise in practice.
| function hooks(rc::RouteComponent{T}) where {T} | ||
| p0 = StyledHook( | ||
| PointHook(rc.r.p0, rc.r.α0), | ||
| Paths.nextstyle(reverse(rc.sty[1], zero(T))) |
Contributor
There was a problem hiding this comment.
Not sure, but given src/paths/contstyles/trace.jl does reverse(s::GeneralTrace, 0) produce GeneralTrace(t -> width(s, -t)), evaluating at negative path lengths?
| p0_hook(pa::Path, right_handed=true) = HandedPointHook(p0(pa), α0(pa), right_handed) | ||
| p0_hook(pa::Path, right_handed=true) = StyledHook( | ||
| HandedPointHook(p0(pa), α0(pa), right_handed), | ||
| isempty(pa.nodes) ? nothing : nextstyle(without_attachments(reverse(pa[1]).sty)) |
Contributor
There was a problem hiding this comment.
Nit: this computes both a reversed segment and a reversed style, but only style is used so segment reversal is wasted work.
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.
Adds a
StyledHook{T, H<:Hook{T}, S} <: Hook{T}wrapper that augments anyHookwith a carried path-style object, plus graph-levelterminate!methods that use the carried style (or an explicitstyle=kwarg) to attach a termination cap to a schematic node's hook. ExportsStyledHookandhook_styleat the top level.PathandRouteComponenthooks are nowStyledHookscarrying the style at the start or end of the path. Forp1hooks, this is justnextstyle(ornothingfor empty paths). Forp0hooks, this is computed asnextstyleon the reversal of the initial node (ornothingfor empty paths), so this PR also implementsreversefor Path styles that still needed it.Also contains the same fix for RouteComponent
p1hook direction as in #213.StyledHookcan be used to verify style agreement for fused components, andterminate!can be useful in constructing truncated models for simulation.