Skip to content

Remove facade methods from TargetCalculator#6838

Merged
totto82 merged 2 commits intoOPM:masterfrom
hakonhagland:refact_tgcalc
Mar 2, 2026
Merged

Remove facade methods from TargetCalculator#6838
totto82 merged 2 commits intoOPM:masterfrom
hakonhagland:refact_tgcalc

Conversation

@hakonhagland
Copy link
Copy Markdown
Contributor

@hakonhagland hakonhagland commented Feb 18, 2026

Builds on #6837 which should be merged first.

  • Remove groupTarget() forwarding method from both TargetCalculator and InjectionTargetCalculator. Call sites now call GroupStateHelper::getProductionGroupTarget() / getInjectionGroupTarget() directly, making the data flow explicit.

  • Remove guideTargetMode() from both calculators, replacing the 6 call sites in GroupStateHelper.cpp with the existing getProductionGuideTargetMode() /
    getInjectionGuideTargetMode() methods, eliminating duplicate switch logic. InjectionTargetCalculator drops from 3 to 1 member (pos_).

  • Slim down TargetCalculator from 4 to 3 members by removing group_ (only used in the removed groupTarget()).

  • Slim down InjectionTargetCalculator from 7 to 1 member by removing group_, resv_coeff_, injection_phase_, cmode_, groupStateHelper_, and target_. Only
    pos_ remains.

  • Simplify InjectionTargetCalculator constructor from 4 parameters to 2 (groupStateHelper, injection_phase). The groupStateHelper reference is used during
    construction only (not stored).

@hakonhagland hakonhagland added the manual:irrelevant This PR is a minor fix and should not appear in the manual label Feb 18, 2026
@hakonhagland
Copy link
Copy Markdown
Contributor Author

jenkins build this serial please

@hakonhagland hakonhagland marked this pull request as draft February 18, 2026 06:58
@hakonhagland
Copy link
Copy Markdown
Contributor Author

Putting this in draft mode until #6837 has been merged

@hakonhagland hakonhagland changed the title Remove groupTarget() facade method from TargetCalculator Remove facade methods from TargetCalculator Feb 18, 2026
Remove the groupTarget() forwarding method from both
TargetCalculator and InjectionTargetCalculator. Call sites
now call GroupStateHelper::getProductionGroupTarget() or
getInjectionGroupTarget() directly, making the data flow
explicit.

With groupTarget() gone, several members become unused:
- TargetCalculator: remove group_ (4 → 3 members)
- InjectionTargetCalculator: remove group_, resv_coeff_,
  injection_phase_, cmode_ (7 → 3 members)

The InjectionTargetCalculator constructor is simplified
from 4 parameters to 2 (groupStateHelper, injection_phase).

Pure refactoring — no behavioral change.
Remove the guideTargetMode() method from both
TargetCalculator and InjectionTargetCalculator. Call sites
in GroupStateHelper.cpp now call the existing
getProductionGuideTargetMode() / getInjectionGuideTargetMode()
methods on GroupStateHelper directly, eliminating the
duplicate switch logic.
@hakonhagland
Copy link
Copy Markdown
Contributor Author

jenkins build this serial please

@hakonhagland hakonhagland marked this pull request as ready for review February 20, 2026 15:28
@totto82
Copy link
Copy Markdown
Member

totto82 commented Mar 2, 2026

Thanks for the cleanup. With this, there is not much left in the TargetCalculator.

@totto82 totto82 merged commit 23cb568 into OPM:master Mar 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

manual:irrelevant This PR is a minor fix and should not appear in the manual

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants