Skip to content

Commit

Permalink
track REAL_TYPE with TMBAD
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrea-Havron-NOAA committed Jan 10, 2025
1 parent 19adde8 commit 5330a62
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 12 deletions.
24 changes: 12 additions & 12 deletions inst/include/interface/rcpp/rcpp_interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,13 +307,13 @@ std::string get_output() {
*/
Rcpp::NumericVector get_fixed_parameters_vector() {
// base model
std::shared_ptr<fims_info::Information < TMB_FIMS_REAL_TYPE>> d0 =
std::shared_ptr<fims_info::Information < TMB_FIMS_REAL_TYPE>> info =
fims_info::Information<TMB_FIMS_REAL_TYPE>::GetInstance();

Rcpp::NumericVector p;

for (size_t i = 0; i < d0->fixed_effects_parameters.size(); i++) {
p.push_back(*d0->fixed_effects_parameters[i]);
for (size_t i = 0; i < info->fixed_effects_parameters.size(); i++) {
p.push_back(*info->fixed_effects_parameters[i]);
}

return p;
Expand All @@ -326,13 +326,13 @@ Rcpp::NumericVector get_fixed_parameters_vector() {
*/
Rcpp::NumericVector get_random_parameters_vector() {
// base model
std::shared_ptr<fims_info::Information < TMB_FIMS_REAL_TYPE>> d0 =
std::shared_ptr<fims_info::Information < TMB_FIMS_REAL_TYPE>> info =
fims_info::Information<TMB_FIMS_REAL_TYPE>::GetInstance();

Rcpp::NumericVector p;

for (size_t i = 0; i < d0->random_effects_parameters.size(); i++) {
p.push_back(*d0->random_effects_parameters[i]);
for (size_t i = 0; i < info->random_effects_parameters.size(); i++) {
p.push_back(*info->random_effects_parameters[i]);
}

return p;
Expand All @@ -346,10 +346,10 @@ Rcpp::NumericVector get_random_parameters_vector() {
*/
Rcpp::List get_parameter_names(Rcpp::List pars) {
// base model
std::shared_ptr<fims_info::Information < TMB_FIMS_REAL_TYPE>> d0 =
std::shared_ptr<fims_info::Information < TMB_FIMS_REAL_TYPE>> info =
fims_info::Information<TMB_FIMS_REAL_TYPE>::GetInstance();

pars.attr("names") = d0->parameter_names;
pars.attr("names") = info->parameter_names;

return pars;
}
Expand All @@ -361,9 +361,9 @@ Rcpp::List get_parameter_names(Rcpp::List pars) {
*/
template <typename Type>
void clear_internal() {
std::shared_ptr<fims_info::Information < Type>> d0 =
std::shared_ptr<fims_info::Information < Type>> info =
fims_info::Information<Type>::GetInstance();
d0->Clear();
info->Clear();
}

/**
Expand Down
3 changes: 3 additions & 0 deletions inst/include/interface/rcpp/rcpp_objects/rcpp_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ class AgeCompDataInterface : public DataInterfaceBase {
*/
virtual bool add_to_fims_tmb() {
#ifdef TMBAD_FRAMEWORK
this->add_to_fims_tmb_internal<TMB_FIMS_REAL_TYPE>();
this->add_to_fims_tmb_internal<TMBAD_FIMS_TYPE>();
#else

Expand Down Expand Up @@ -282,6 +283,7 @@ class LengthCompDataInterface : public DataInterfaceBase {
*/
virtual bool add_to_fims_tmb() {
#ifdef TMBAD_FRAMEWORK
this->add_to_fims_tmb_internal<TMB_FIMS_REAL_TYPE>();
this->add_to_fims_tmb_internal<TMBAD_FIMS_TYPE>();
#else
this->add_to_fims_tmb_internal<TMB_FIMS_REAL_TYPE>();
Expand Down Expand Up @@ -382,6 +384,7 @@ class IndexDataInterface : public DataInterfaceBase {
*/
virtual bool add_to_fims_tmb() {
#ifdef TMBAD_FRAMEWORK
this->add_to_fims_tmb_internal<TMB_FIMS_REAL_TYPE>();
this->add_to_fims_tmb_internal<TMBAD_FIMS_TYPE>();
#else
this->add_to_fims_tmb_internal<TMB_FIMS_REAL_TYPE>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,7 @@ class DmultinomDistributionsInterface : public DistributionsInterfaceBase {

virtual bool add_to_fims_tmb() {
#ifdef TMBAD_FRAMEWORK
this->add_to_fims_tmb_internal<TMB_FIMS_REAL_TYPE>();
this->add_to_fims_tmb_internal<TMBAD_FIMS_TYPE>();
#else
this->add_to_fims_tmb_internal<TMB_FIMS_REAL_TYPE>();
Expand Down
1 change: 1 addition & 0 deletions inst/include/interface/rcpp/rcpp_objects/rcpp_growth.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ class EWAAGrowthInterface : public GrowthInterfaceBase {
*/
virtual bool add_to_fims_tmb() {
#ifdef TMBAD_FRAMEWORK
this->add_to_fims_tmb_internal<TMB_FIMS_REAL_TYPE>();
this->add_to_fims_tmb_internal<TMBAD_FIMS_TYPE>();
#else
this->add_to_fims_tmb_internal<TMB_FIMS_REAL_TYPE>();
Expand Down
1 change: 1 addition & 0 deletions inst/include/interface/rcpp/rcpp_objects/rcpp_maturity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ class LogisticMaturityInterface : public MaturityInterfaceBase {
virtual bool add_to_fims_tmb() {
FIMS_INFO_LOG("adding Maturity object to TMB");
#ifdef TMBAD_FRAMEWORK
this->add_to_fims_tmb_internal<TMB_FIMS_REAL_TYPE>();
this->add_to_fims_tmb_internal<TMBAD_FIMS_TYPE>();
#else
this->add_to_fims_tmb_internal<TMB_FIMS_REAL_TYPE>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ class PopulationInterface : public PopulationInterfaceBase {
virtual bool add_to_fims_tmb() {
FIMS_INFO_LOG("adding Population object to TMB");
#ifdef TMBAD_FRAMEWORK
this->add_to_fims_tmb_internal<TMB_FIMS_REAL_TYPE>();
this->add_to_fims_tmb_internal<TMBAD_FIMS_TYPE>();
#else
this->add_to_fims_tmb_internal<TMB_FIMS_REAL_TYPE>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ class BevertonHoltRecruitmentInterface : public RecruitmentInterfaceBase {
virtual bool add_to_fims_tmb() {
FIMS_INFO_LOG("adding Recruitment object to TMB");
#ifdef TMBAD_FRAMEWORK
this->add_to_fims_tmb_internal<TMB_FIMS_REAL_TYPE>();
this->add_to_fims_tmb_internal<TMBAD_FIMS_TYPE>();
#else
this->add_to_fims_tmb_internal<TMB_FIMS_REAL_TYPE>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ class DoubleLogisticSelectivityInterface : public SelectivityInterfaceBase {
*/
virtual bool add_to_fims_tmb() {
#ifdef TMBAD_FRAMEWORK
this->add_to_fims_tmb_internal<TMB_FIMS_REAL_TYPE>();
this->add_to_fims_tmb_internal<TMBAD_FIMS_TYPE>();
#else
this->add_to_fims_tmb_internal<TMB_FIMS_REAL_TYPE>();
Expand Down

0 comments on commit 5330a62

Please sign in to comment.