FIMS  v0.10.0
Loading...
Searching...
No Matches
age_specific.hpp
Go to the documentation of this file.
1
8#ifndef POPULATION_DYNAMICS_AGE_SPECIFIC_SELECTIVITY_HPP
9#define POPULATION_DYNAMICS_AGE_SPECIFIC_SELECTIVITY_HPP
10
11// #include "../../../interface/interface.hpp"
12#include "../../../common/fims_math.hpp"
13#include "../../../common/fims_vector.hpp"
14#include "selectivity_base.hpp"
15
16namespace fims_popdy {
17
48template <typename Type>
56
60 size_t n_ages;
61
65 size_t min_age;
66
68
69 virtual ~AgeSpecificSelectivity() {}
70
89 virtual const Type evaluate(const Type &x) {
90 Type a = static_cast<Type>(0.0);
91 Type b = static_cast<Type>(1.0);
92 double x_temp = fims_math::Value(x);
93 size_t x_final = static_cast<size_t>(x_temp);
94 size_t i_age = x_final - min_age;
95 return fims_math::inv_logit<Type>(a, b, logit_sel_at_age[i_age]);
96 }
97
102 virtual const Type evaluate(const Type &x, size_t pos) {
103 Type a = static_cast<Type>(0.0);
104 Type b = static_cast<Type>(1.0);
105 double x_temp = fims_math::Value(x);
106 size_t x_final = static_cast<size_t>(x_temp);
107 size_t i_age_year = pos * n_ages + x_final - min_age;
108 return fims_math::inv_logit<Type>(
109 a, b, logit_sel_at_age.get_force_scalar_wrap(i_age_year));
110 }
111};
112
113} // namespace fims_popdy
114
115#endif /* POPULATION_DYNAMICS_AGE_SPECIFIC_SELECTIVITY_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:236
Declares the SelectivityBase class which is the base class for all selectivity functors.
Age-specific selectivity calculated using one parameter per age bin.
Definition age_specific.hpp:49
size_t min_age
Minimum modeled age, used to map input age to logit_sel_at_age.
Definition age_specific.hpp:65
virtual const Type evaluate(const Type &x, size_t pos)
Calculates selectivity for an age using its age-specific parameter.
Definition age_specific.hpp:102
virtual const Type evaluate(const Type &x)
Calculates selectivity for an age using its age-specific parameter.
Definition age_specific.hpp:89
size_t n_ages
Stores the number of modeled age bins.
Definition age_specific.hpp:60
fims::Vector< Type > logit_sel_at_age
Stores the age-specific selectivity parameters on the logit scale.
Definition age_specific.hpp:55
Base class for all selectivity functors.
Definition selectivity_base.hpp:24