Skip to content

Commit

Permalink
Merge branch 'main' into fims_vector
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristineStawitz-NOAA authored Nov 15, 2023
2 parents d280a93 + 36fe2ad commit f4e390f
Show file tree
Hide file tree
Showing 73 changed files with 1,161 additions and 9,382 deletions.
14 changes: 7 additions & 7 deletions inst/include/common/data_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ namespace fims_data_object {
*/
template <typename Type>
struct DataObject : public fims_model_object::FIMSObject<Type> {
static uint32_t id_g; /*!< id of the Data Object >*/
std::vector<Type> data; /*!< vector of the data >*/
size_t dimensions; /*!< dimension of the Data object >*/
size_t imax; /*!<1st dimension of data object >*/
size_t jmax; /*!< 2nd dimension of data object>*/
size_t kmax; /*!< 3rd dimension of data object>*/
size_t lmax; /*!< 4th dimension of data object>*/
static uint32_t id_g; /**< id of the Data Object >*/
std::vector<Type> data; /**< vector of the data >*/
size_t dimensions; /**< dimension of the Data object >*/
size_t imax; /**<1st dimension of data object >*/
size_t jmax; /**< 2nd dimension of data object>*/
size_t kmax; /**< 3rd dimension of data object>*/
size_t lmax; /**< 4th dimension of data object>*/

/**
* Constructs a one-dimensional data object.
Expand Down
2 changes: 1 addition & 1 deletion inst/include/common/def.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! \file def.hpp
/** \file def.hpp
*/

/*
Expand Down
2 changes: 1 addition & 1 deletion inst/include/common/fims_math.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! \file fims_math.hpp
/** \file fims_math.hpp
*/
// note: To document a global C function, typedef, enum or preprocessor
// definition you must first document the file that contains it
Expand Down
18 changes: 9 additions & 9 deletions inst/include/common/information.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! \file information.hpp
/** \file information.hpp
*
* This File is part of the NOAA, National Marine Fisheries Service
* Fisheries Integrated Modeling System project. See LICENSE in the
Expand Down Expand Up @@ -47,38 +47,38 @@ class Information {

// data objects
std::map<uint32_t, std::shared_ptr<fims_data_object::DataObject<Type> > >
data_objects; /*!< map that holds data objects >*/
data_objects; /**< map that holds data objects >*/
typedef typename std::map<
uint32_t, std::shared_ptr<fims_data_object::DataObject<Type> > >::iterator
data_iterator; /**< iterator for the data objects */

// life history modules
std::map<uint32_t, std::shared_ptr<fims_popdy::RecruitmentBase<Type> > >
recruitment_models; /*!<hash map to link each object to its shared
recruitment_models; /**<hash map to link each object to its shared
location in memory*/
typedef typename std::map<
uint32_t, std::shared_ptr<fims_popdy::RecruitmentBase<Type> > >::iterator
recruitment_models_iterator;
/**< iterator for recruitment objects>*/

std::map<uint32_t, std::shared_ptr<fims_popdy::SelectivityBase<Type> > >
selectivity_models; /*!<hash map to link each object to its shared
selectivity_models; /**<hash map to link each object to its shared
location in memory*/
typedef typename std::map<
uint32_t, std::shared_ptr<fims_popdy::SelectivityBase<Type> > >::iterator
selectivity_models_iterator;
/**< iterator for selectivity objects>*/

std::map<uint32_t, std::shared_ptr<fims_popdy::GrowthBase<Type> > >
growth_models; /*!<hash map to link each object to its shared location in
growth_models; /**<hash map to link each object to its shared location in
memory*/
typedef typename std::map<
uint32_t, std::shared_ptr<fims_popdy::GrowthBase<Type> > >::iterator
growth_models_iterator;
/**< iterator for growth objects>*/

std::map<uint32_t, std::shared_ptr<fims_popdy::MaturityBase<Type> > >
maturity_models; /*!<hash map to link each object to its shared location
maturity_models; /**<hash map to link each object to its shared location
in memory*/
typedef typename std::map<
uint32_t, std::shared_ptr<fims_popdy::MaturityBase<Type> > >::iterator
Expand All @@ -87,7 +87,7 @@ class Information {

// fleet modules
std::map<uint32_t, std::shared_ptr<fims_popdy::Fleet<Type> > >
fleets; /*!<hash map to link each object to its shared location in
fleets; /**<hash map to link each object to its shared location in
memory*/
typedef
typename std::map<uint32_t,
Expand All @@ -97,7 +97,7 @@ class Information {

// populations
std::map<uint32_t, std::shared_ptr<fims_popdy::Population<Type> > >
populations; /*!<hash map to link each object to its shared location in
populations; /**<hash map to link each object to its shared location in
memory*/
typedef typename std::map<
uint32_t, std::shared_ptr<fims_popdy::Population<Type> > >::iterator
Expand All @@ -107,7 +107,7 @@ class Information {
// distributions
std::map<uint32_t,
std::shared_ptr<fims_distributions::DistributionsBase<Type> > >
distribution_models; /*!<hash map to link each object to its shared
distribution_models; /**<hash map to link each object to its shared
location in memory*/
typedef typename std::map<
uint32_t,
Expand Down
27 changes: 14 additions & 13 deletions inst/include/common/model.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ template <typename Type>
class Model { // may need singleton
public:
static std::shared_ptr<Model<Type> >
fims_model; /*!< Create a shared fims_model as a pointer to Model*/
fims_model; /**< Create a shared fims_model as a pointer to Model*/
std::shared_ptr<fims_info::Information<Type> >
fims_information; /*!< Create a shared fims_information as a pointer to
fims_information; /**< Create a shared fims_information as a pointer to
Information*/

#ifdef TMB_MODEL
Expand Down Expand Up @@ -80,12 +80,13 @@ class Model { // may need singleton
vector<vector<Type> > cwaa(n_fleets);
vector<vector<Type> > F_mort(n_fleets);
// populations
vector<vector<Type> > naa(n_pops);
vector<vector<Type> > ssb(n_pops);
vector<vector<Type> > biomass(n_pops);
vector<vector<Type> > rec_dev(n_pops);
vector<vector<Type> > recruitment(n_pops);
vector<vector<Type> > M(n_pops);
vector<vector<Type> > naa(n_pops);
vector<vector<Type> > ssb(n_pops);
vector<vector<Type> > biomass(n_pops);
vector<vector<Type> > log_recruit_dev(n_pops);
vector<vector<Type> > recruitment(n_pops);
vector<vector<Type> > M(n_pops);

#endif

// Loop over populations, evaluate, and sum up the recruitment likelihood
Expand Down Expand Up @@ -148,8 +149,8 @@ class Model { // may need singleton
#ifdef TMB_MODEL
naa(pop_idx) = vector<Type>((*it).second->numbers_at_age);
ssb(pop_idx) = vector<Type>((*it).second->spawning_biomass);
rec_dev(pop_idx) =
vector<Type>((*it).second->recruitment->recruit_deviations);
log_recruit_dev(pop_idx) =
vector<Type>((*it).second->recruitment->log_recruit_devs);
recruitment(pop_idx) = vector<Type>((*it).second->expected_recruitment);
biomass(pop_idx) = vector<Type>((*it).second->biomass);
M(pop_idx) = vector<Type>((*it).second->M);
Expand Down Expand Up @@ -181,7 +182,7 @@ class Model { // may need singleton
REPORT_F(jnll, of);
REPORT_F(naa, of);
REPORT_F(ssb, of);
REPORT_F(rec_dev, of);
REPORT_F(log_recruit_dev, of);
REPORT_F(recruitment, of);
REPORT_F(biomass, of);
REPORT_F(M, of);
Expand All @@ -198,15 +199,15 @@ class Model { // may need singleton
vector<Type> NAA = ADREPORTvector(naa);
vector<Type> Biomass = ADREPORTvector(biomass);
vector<Type> SSB = ADREPORTvector(ssb);
vector<Type> RecDev = ADREPORTvector(rec_dev);
vector<Type> LogRecDev = ADREPORTvector(log_recruit_dev);
vector<Type> FMort = ADREPORTvector(F_mort);
vector<Type> ExpectedIndex = ADREPORTvector(exp_index);
vector<Type> CNAA = ADREPORTvector(cnaa);

ADREPORT_F(NAA, of);
ADREPORT_F(Biomass, of);
ADREPORT_F(SSB, of);
ADREPORT_F(RecDev, of);
ADREPORT_F(LogRecDev, of);
ADREPORT_F(FMort, of);
ADREPORT_F(ExpectedIndex, of);
ADREPORT_F(CNAA, of);
Expand Down
8 changes: 4 additions & 4 deletions inst/include/common/model_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ namespace fims_model_object {
*/
template <typename Type>
struct FIMSObject {
uint32_t id; /*!< unique identifier assigned for all fims objects */
std::vector<Type*> parameters; /*!< list of estimable parameters */
uint32_t id; /**< unique identifier assigned for all fims objects */
std::vector<Type*> parameters; /**< list of estimable parameters */
std::vector<Type*>
random_effects_parameters; /*!< list of all random effects parameters */
random_effects_parameters; /**< list of all random effects parameters */
std::vector<Type*>
fixed_effects_parameters; /*!< list of fixed effects parameters */
fixed_effects_parameters; /**< list of fixed effects parameters */

virtual ~FIMSObject() {}
/**
Expand Down
2 changes: 1 addition & 1 deletion inst/include/distributions/functors/distributions_base.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! \file distributions_base.hpp
/** \file distributions_base.hpp
* This File is part of the NOAA, National Marine Fisheries Service
* Fisheries Integrated Modeling System project. See LICENSE in the
* source folder for reuse information.
Expand Down
14 changes: 7 additions & 7 deletions inst/include/distributions/functors/tmb_distributions.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! \file tmb_distributions.hpp
/** \file tmb_distributions.hpp
* This File is part of the NOAA, National Marine Fisheries Service
* Fisheries Integrated Modeling System project.
* Refer to the LICENSE file for reuse information.
Expand All @@ -21,9 +21,9 @@ namespace fims_distributions {
*/
template <typename Type>
struct Dnorm : public DistributionsBase<Type> {
Type x; /*!< observation */
Type mean; /*!< mean of the normal distribution */
Type sd; /*!< standard deviation of the normal distribution, must be strictly
Type x; /**< observation */
Type mean; /**< mean of the normal distribution */
Type sd; /**< standard deviation of the normal distribution, must be strictly
positive.*/

Dnorm() : DistributionsBase<Type>() {}
Expand Down Expand Up @@ -73,9 +73,9 @@ struct Dmultinom : public DistributionsBase<Type> {
*/
template <typename Type>
struct Dlnorm : public DistributionsBase<Type> {
Type x; /*!< observation */
Type meanlog; /*!< mean of the distribution of log(x) */
Type sdlog; /*!< standard deviation of the distribution of log(x) */
Type x; /**< observation */
Type meanlog; /**< mean of the distribution of log(x) */
Type sdlog; /**< standard deviation of the distribution of log(x) */

Dlnorm() : DistributionsBase<Type>() {}

Expand Down
6 changes: 3 additions & 3 deletions inst/include/interface/rcpp/rcpp_interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,9 @@ RCPP_MODULE(fims) {
.constructor()
.field("logit_steep", &BevertonHoltRecruitmentInterface::logit_steep)
.field("log_rzero", &BevertonHoltRecruitmentInterface::log_rzero)
.field("deviations", &BevertonHoltRecruitmentInterface::deviations)
.field("estimate_deviations",
&BevertonHoltRecruitmentInterface::estimate_deviations)
.field("log_devs", &BevertonHoltRecruitmentInterface::log_devs)
.field("estimate_log_devs",
&BevertonHoltRecruitmentInterface::estimate_log_devs)
.method("get_id", &BevertonHoltRecruitmentInterface::get_id)
.field("log_sigma_recruit",
&BevertonHoltRecruitmentInterface::log_sigma_recruit)
Expand Down
18 changes: 9 additions & 9 deletions inst/include/interface/rcpp/rcpp_objects/rcpp_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
class DataInterfaceBase : public FIMSRcppInterfaceBase {
public:
Rcpp::NumericVector observed_data; /*!< The data */
Rcpp::NumericVector observed_data; /**< The data */
static uint32_t id_g; /**< static id of the DataInterfaceBase object */
uint32_t id; /**< local id of the DataInterfaceBase object */
// live objects in C++ are objects that have been created and live in memory
Expand All @@ -42,7 +42,7 @@ class DataInterfaceBase : public FIMSRcppInterfaceBase {
virtual ~DataInterfaceBase() {}

/** @brief get the ID of the interface base object
**/
*/
virtual uint32_t get_id() { return this->id; }

/**@brief add_to_fims_tmb dummy method
Expand All @@ -60,9 +60,9 @@ std::map<uint32_t, DataInterfaceBase*> DataInterfaceBase::live_objects;
*/
class AgeCompDataInterface : public DataInterfaceBase {
public:
int amax; /*!< first dimension of the data */
int ymax; /*!< second dimension of the data */
Rcpp::NumericVector age_comp_data; /*!<the age composition data*/
int amax; /**< first dimension of the data */
int ymax; /**< second dimension of the data */
Rcpp::NumericVector age_comp_data; /**<the age composition data*/

/**
* @brief constructor
Expand All @@ -78,7 +78,7 @@ class AgeCompDataInterface : public DataInterfaceBase {
virtual ~AgeCompDataInterface() {}

/** @brief get the ID of the interface base object
**/
*/
virtual uint32_t get_id() { return this->id; }

#ifdef TMB_MODEL
Expand Down Expand Up @@ -127,8 +127,8 @@ class AgeCompDataInterface : public DataInterfaceBase {
*/
class IndexDataInterface : public DataInterfaceBase {
public:
int ymax; /*!< second dimension of the data */
Rcpp::NumericVector index_data; /*!<the age composition data*/
int ymax; /**< second dimension of the data */
Rcpp::NumericVector index_data; /**<the age composition data*/

/**
* @brief constructor
Expand All @@ -141,7 +141,7 @@ class IndexDataInterface : public DataInterfaceBase {
virtual ~IndexDataInterface() {}

/** @brief get the ID of the interface base object
**/
*/
virtual uint32_t get_id() { return this->id; }

#ifdef TMB_MODEL
Expand Down
32 changes: 16 additions & 16 deletions inst/include/interface/rcpp/rcpp_objects/rcpp_fleet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ objects */

virtual ~FleetInterfaceBase() {}

/** @brief get_id method for child fleet interface objects to inherit **/
/** @brief get_id method for child fleet interface objects to inherit */
virtual uint32_t get_id() = 0;
};

Expand All @@ -52,29 +52,29 @@ std::map<uint32_t, FleetInterfaceBase*> FleetInterfaceBase::live_objects;
*/
class FleetInterface : public FleetInterfaceBase {
int interface_agecomp_likelihood_id_m =
-999; /*!< id of agecomp likelihood component. The "interface_" prefix
-999; /**< id of agecomp likelihood component. The "interface_" prefix
indicates it belongs to the FleetInterface class, and the "_m"
postfix signifies that it's a member variable. */
int interface_index_likelihood_id_m =
-999; /*!< id of index likelihood component*/
-999; /**< id of index likelihood component*/
int interface_observed_agecomp_data_id_m =
-999; /*!< id of observed agecomp data object*/
-999; /**< id of observed agecomp data object*/
int interface_observed_index_data_id_m =
-999; /*!< id of observed index data object*/
int interface_selectivity_id_m = -999; /*!< id of selectivity component*/
-999; /**< id of observed index data object*/
int interface_selectivity_id_m = -999; /**< id of selectivity component*/

public:
bool is_survey = false; /*!< whether this is a survey fleet */
int nages; /*!< number of ages in the fleet data*/
int nyears; /*!< number of years in the fleet data */
double log_q; /*!< log of catchability for the fleet*/
bool is_survey = false; /**< whether this is a survey fleet */
int nages; /**< number of ages in the fleet data*/
int nyears; /**< number of years in the fleet data */
double log_q; /**< log of catchability for the fleet*/
Rcpp::NumericVector
log_Fmort; /*!< log of fishing mortality rate for the fleet*/
bool estimate_F = false; /*!< whether the parameter F should be estimated*/
bool estimate_q = false; /*!< whether the parameter q should be estimated*/
bool random_q = false; /*!< whether q should be a random effect*/
bool random_F = false; /*!< whether F should be a random effect*/
Parameter log_obs_error; /*!< the log of the observation error */
log_Fmort; /**< log of fishing mortality rate for the fleet*/
bool estimate_F = false; /**< whether the parameter F should be estimated*/
bool estimate_q = false; /**< whether the parameter q should be estimated*/
bool random_q = false; /**< whether q should be a random effect*/
bool random_F = false; /**< whether F should be a random effect*/
Parameter log_obs_error; /**< the log of the observation error */

FleetInterface() : FleetInterfaceBase() {}

Expand Down
Loading

0 comments on commit f4e390f

Please sign in to comment.