Skip to content

Refactor remaining interface scalar config fields to plain C++ types - #1659

Draft
Andrea-Havron-NOAA with Copilot wants to merge 5 commits into
refactor-Rcpp-interface-S4-toXPtrfrom
copilot/replace-sharedprimitive-scalar-fields
Draft

Refactor remaining interface scalar config fields to plain C++ types#1659
Andrea-Havron-NOAA with Copilot wants to merge 5 commits into
refactor-Rcpp-interface-S4-toXPtrfrom
copilot/replace-sharedprimitive-scalar-fields

Conversation

Copilot AI commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

This updates the remaining Rcpp interface classes in scope for Step 1 to stop storing scalar configuration values in SharedPrimitive wrappers. The change aligns fleet, recruitment, growth, and distribution interfaces with the migrated population pattern by using plain C++ scalar fields and removing wrapper-style access at interface boundaries.

  • Fleet interface

    • Replaced scalar ID and string config fields with plain types:
      • observed data IDs
      • selectivity ID
      • name
      • observed_landings_units
      • observed_index_units
    • Updated getters/setters and TMB handoff code to use direct values.
  • Recruitment interface

    • Replaced process_id and Beverton-Holt n_years with plain integers.
    • Updated SetRecruitmentProcessID() and add_to_fims_tmb_internal() to stop using .get() / .set().
  • Growth interface

    • Replaced EWAA n_years with a plain integer.
    • Updated make_map(), JSON serialization, and TMB wiring to use direct scalar access.
  • Distribution interfaces

    • Replaced shared scalar config in the distribution base and multinomial interface:
      • input_type_m
      • use_mean_m
      • interface_observed_data_id_m
      • notes
    • Updated normal, lognormal, and multinomial distribution helpers to assign/read plain values directly.
  • R interface compatibility updates

    • Updated affected test/helper code to use direct field assignment for migrated scalar fields (for example, n_years <- ... instead of n_years$set(...)).
    • Added focused coverage for direct assignment of migrated fleet/recruitment scalar fields.
// Before
SharedInt n_years;
this->process_id.set(process_id);
distribution->use_mean = this->use_mean_m.get();

// After
int n_years = 0;
this->process_id = process_id;
distribution->use_mean = this->use_mean_m;

Copilot AI changed the title [WIP] Refactor scalar fields in interface classes to plain C++ types Refactor remaining interface scalar config fields to plain C++ types Jul 22, 2026
Copilot AI requested a review from Andrea-Havron-NOAA July 22, 2026 23:54
@Andrea-Havron-NOAA
Andrea-Havron-NOAA changed the base branch from main to refactor-Rcpp-interface-S4-toXPtr July 22, 2026 23:59
@Andrea-Havron-NOAA

Copy link
Copy Markdown
Collaborator

@copilot, I decided to switch the base branch. Can you cherry-pick 0310425 and b8f5b24 into this PR to bring over the population changes?

Copilot AI commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

@copilot, I decided to switch the base branch. Can you cherry-pick 0310425 and b8f5b24 into this PR to bring over the population chang...

Applied the requested cherry-picks on this branch as 77fed61 and f72c646, and pushed a small follow-up fix in f5a8b65 to update the remaining model glue to the migrated plain population scalars.

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.

Step 1 — Replace SharedPrimitive scalar fields with plain C++ types across all interface classes

2 participants