FIMS  v0.8.0
Loading...
Searching...
No Matches
sr_beverton_holt.hpp
Go to the documentation of this file.
1
10#ifndef FIMS_POPULATION_DYNAMICS_RECRUITMENT_SR_BEVERTON_HOLT_HPP
11#define FIMS_POPULATION_DYNAMICS_RECRUITMENT_SR_BEVERTON_HOLT_HPP
12
13#include "recruitment_base.hpp"
14#include "../../../common/fims_vector.hpp"
15
16namespace fims_popdy {
17
25template <typename Type>
26struct SRBevertonHolt : public RecruitmentBase<Type> {
27 // Here we define the members that will be used in the Beverton--Holt
28 // stock--recruitment function. These members are needed by the Beverton--Holt
29 // stock--recruitment function but will not be common to all recruitment
30 // functions like spawners is below.
37
38 virtual ~SRBevertonHolt() {}
39
49 virtual const Type evaluate_mean(const Type& spawners, const Type& phi_0) {
51 Type steep;
52 Type steep_lo = static_cast<Type>(0.2);
53 Type steep_hi = static_cast<Type>(1.0);
54 Type rzero;
55
56 // Transform input parameters
57 steep = fims_math::inv_logit(steep_lo, steep_hi, this->logit_steep[0]);
58 rzero = fims_math::exp(this->log_rzero[0]);
59
60 recruits = (static_cast<Type>(0.8) * rzero * steep * spawners) /
61 (static_cast<Type>(0.2) * phi_0 * rzero *
62 (static_cast<Type>(1.0) - steep) +
63 spawners * (steep - static_cast<Type>(0.2)));
64
65 return recruits;
66 }
67
71 virtual const Type evaluate_process(size_t pos) { return 0; }
72
77 std::map<std::string, fims::Vector<fims::Vector<Type>>>& report_vectors) {
78 report_vectors["logit_steep"].emplace_back(this->logit_steep);
79 report_vectors["log_rzero"].emplace_back(this->log_rzero);
80 report_vectors["log_r"].emplace_back(this->log_r);
81 report_vectors["log_devs"].emplace_back(this->log_recruit_devs);
82 }
83
85 std::map<std::string, size_t>& report_vector_count) {
86 report_vector_count["logit_steep"] += 1;
87 report_vector_count["log_rzero"] += 1;
88 report_vector_count["log_r"] += 1;
89 report_vector_count["log_recruit_devs"] += 1;
90 }
91};
92
93} // namespace fims_popdy
94
95#endif /* FIMS_POPULATION_DYNAMICS_RECRUITMENT_SR_BEVERTON_HOLT_HPP */
Definition fims_vector.hpp:27
The population dynamics of FIMS.
Definition catch_at_age.hpp:41
void clear_internal()
Clears the internal objects.
Definition rcpp_interface.hpp:279
Serves as the parent class where recruitment functions are called.
Base class for all recruitment functors.
Definition recruitment_base.hpp:28
fims::Vector< Type > log_rzero
Definition recruitment_base.hpp:36
fims::Vector< Type > log_r
Definition recruitment_base.hpp:38
fims::Vector< Type > log_recruit_devs
Definition recruitment_base.hpp:31
BevertonHolt class that returns the Beverton–Holt stock–recruitment from fims_math.
Definition sr_beverton_holt.hpp:26
virtual void get_report_vector_count(std::map< std::string, size_t > &report_vector_count)
Get the report vector count object. used to get the length of each report vector for populating the U...
Definition sr_beverton_holt.hpp:84
fims::Vector< Type > logit_steep
Definition sr_beverton_holt.hpp:31
virtual void create_report_vectors(std::map< std::string, fims::Vector< fims::Vector< Type > > > &report_vectors)
Create a map of report vectors for the recruitment object.
Definition sr_beverton_holt.hpp:76
virtual const Type evaluate_process(size_t pos)
Definition sr_beverton_holt.hpp:71
virtual const Type evaluate_mean(const Type &spawners, const Type &phi_0)
Beverton–Holt implementation of the stock–recruitment function.
Definition sr_beverton_holt.hpp:49