FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
0119 — ExternalWakes and WakeCaster: use EnvironmentFacade::HoldWakes; one ambient-lookup helper in WakeCaster
ID 0119
Class ARCHITECTURE
Severity 1
Status ready

Models: —

Found: 2026-10-20 architecture review (908a4bd); owner ruled "default ok" on the whole plan 2026-10-20

Source plan: plans/arch-2026-10-20/not-implemented/f4-wake-receiver-marenv.md and plans/arch-2026-10-20/not-implemented/f5-cast-rebuild-policy.md (workspace fhsim_workspace)

Kind: Bit for bit refactor. Take when passing; rides with: the next fhsim_environment wake feature.

Evidence

F4 usage sites of the recipe (SelectWakes(EnclosingRegion(...)).Hold(...)):

  • src/environment/ExternalWakes.cpp:113-118: environment.SelectWakes(EnclosingRegion(m_positions, T, m_binding.cutoff), query), then selection.Hold(T, m_positions, ownTags).
  • src/environment/WakeCaster.cpp:584: m_environment->SelectWakes(marenv::wake::EnclosingRegion(centroids, T), query).Hold(T, centroids), exact tier.

F5: the ambient-current lookup with the IsUsable test is written three times in src/environment/WakeCaster.cpp: :485-489 (loop over rebuild sources, GetAmbientCurrent(T, source.centroid, source.ambient)), :714-718 (AmbientCurrentAtSource, marenv::IsUsable(m_environment->GetAmbientCurrent(T, source, current))) and :722-729 (CurrentLookupFails).

Effect

None for users. Small duplication that the next wake change must keep in step.

Possible fix

(F4) Switch both sites to EnvironmentFacade::HoldWakes once it exists (MENV-0069; this one depends on it). (F5) One local helper in WakeCaster.cpp for the ambient lookup; it stays local, because the rebuild policy differs by ruling Q8.

Test that would prove it

ExternalWakes_Test, BodyWake_Test and the wake regressions, byte compared before and after.

Risk

Low. Bit for bit; the F4 part waits for the marenv API addition and its patch bump.