diff --git a/inst/extdata/TMB_tests/distributions/test_dlnorm_distribution.hpp b/inst/extdata/TMB_tests/distributions/test_dlnorm_distribution.hpp index 641580ee..c06ca72b 100644 --- a/inst/extdata/TMB_tests/distributions/test_dlnorm_distribution.hpp +++ b/inst/extdata/TMB_tests/distributions/test_dlnorm_distribution.hpp @@ -15,18 +15,18 @@ /** * @brief Model class defines and returns negative log-likelihood (nll) * - * @tparam T + * @tparam Type */ - template + template class Model { - using DataVector = typename ModelTraits::DataVector; + using DataVector = typename ModelTraits::DataVector; public: DataVector logy; /*!< observation */ - T meanlog; /*!< mean of the distribution of log(x) */ - T sdlog; /*!< standard deviation of the distribution of log(x) */ + Type meanlog; /*!< mean of the distribution of log(x) */ + Type sdlog; /*!< standard deviation of the distribution of log(x) */ // Initiate pointer to link .cpp to .hpp - static Model* instance; + static Model* instance; /** @brief Constructor. */ @@ -35,10 +35,10 @@ /** * @brief Create new singleton class * - * @return Model* + * @return Model* */ - static Model* getInstance(){ - return Model::instance; + static Model* getInstance(){ + return Model::instance; } /** @@ -46,12 +46,12 @@ * * @return negative log-likelihood (nll) */ - T evaluate(){ + Type evaluate(){ - T nll = 0; + Type nll = 0; int i; int n = logy.size(); - fims::Dlnorm nll_dlnorm; + fims::Dlnorm nll_dlnorm; nll_dlnorm.meanlog = meanlog; nll_dlnorm.sdlog = sdlog; for(i =0; i < n; i++){ @@ -65,10 +65,10 @@ /** * @brief Create new instance of Model * - * @tparam T + * @tparam Type */ - template - Model* Model::instance = new Model(); + template + Model* Model::instance = new Model(); } diff --git a/inst/extdata/TMB_tests/distributions/test_dmultinom_distribution.hpp b/inst/extdata/TMB_tests/distributions/test_dmultinom_distribution.hpp index 77585861..dc9da61f 100644 --- a/inst/extdata/TMB_tests/distributions/test_dmultinom_distribution.hpp +++ b/inst/extdata/TMB_tests/distributions/test_dmultinom_distribution.hpp @@ -15,17 +15,17 @@ /** * @brief Model class defines and returns negative log-likelihood (nll) * - * @tparam T + * @tparam Type */ - template + template class Model { - using Vector = typename ModelTraits::EigenVector; + using Vector = typename ModelTraits::EigenVector; public: Vector x; /*!< Vector of length K of integers */ Vector p; /*!< Vector of length K, specifying the probability for the K classes (note, unlike in R these must sum to 1). */ // Initiate pointer to link .cpp to .hpp - static Model* instance; + static Model* instance; /** @brief Constructor. */ @@ -34,10 +34,10 @@ /** * @brief Create new singleton class * - * @return Model* + * @return Model* */ - static Model* getInstance(){ - return Model::instance; + static Model* getInstance(){ + return Model::instance; } /** @@ -45,10 +45,10 @@ * * @return negative log-likelihood (nll) */ - T evaluate(){ + Type evaluate(){ - T nll = 0; - fims::Dmultinom nll_dmultinom; + Type nll = 0; + fims::Dmultinom nll_dmultinom; nll_dmultinom.x = x; nll_dmultinom.p = p; nll -= nll_dmultinom.evaluate(true); @@ -59,10 +59,10 @@ /** * @brief Create new instance of Model * - * @tparam T + * @tparam Type */ - template - Model* Model::instance = new Model(); + template + Model* Model::instance = new Model(); } diff --git a/inst/extdata/TMB_tests/distributions/test_dnorm_distribution.hpp b/inst/extdata/TMB_tests/distributions/test_dnorm_distribution.hpp index 7eaf6631..22529299 100644 --- a/inst/extdata/TMB_tests/distributions/test_dnorm_distribution.hpp +++ b/inst/extdata/TMB_tests/distributions/test_dnorm_distribution.hpp @@ -15,18 +15,18 @@ /** * @brief Model class defines and returns negative log-likelihood (nll) * - * @tparam T + * @tparam Type */ - template + template class Model { - using DataVector = typename ModelTraits::DataVector; + using DataVector = typename ModelTraits::DataVector; public: DataVector y; /*!< observation */ - T mean; /*!< mean of the normal distribution */ - T sd; /*!< standard deviation of the normal distribution, must be strictly positive.*/ + Type mean; /*!< mean of the normal distribution */ + Type sd; /*!< standard deviation of the normal distribution, must be strictly positive.*/ // Initiate pointer to link .cpp to .hpp - static Model* instance; + static Model* instance; /** @brief Constructor. */ @@ -35,10 +35,10 @@ /** * @brief Create new singleton class * - * @return Model* + * @return Model* */ - static Model* getInstance(){ - return Model::instance; + static Model* getInstance(){ + return Model::instance; } /** @@ -46,12 +46,12 @@ * * @return negative log-likelihood (nll) */ - T evaluate(){ + Type evaluate(){ - T nll = 0; + Type nll = 0; int i; int n = y.size(); - fims::Dnorm nll_dnorm; + fims::Dnorm nll_dnorm; nll_dnorm.mean = mean; nll_dnorm.sd = sd; for(i =0; i < n; i++){ @@ -65,10 +65,10 @@ /** * @brief Create new instance of Model * - * @tparam T + * @tparam Type */ - template - Model* Model::instance = new Model(); + template + Model* Model::instance = new Model(); } diff --git a/inst/extdata/TMB_tests/distributions/test_fleet_acomp_nll.hpp b/inst/extdata/TMB_tests/distributions/test_fleet_acomp_nll.hpp index 5705b861..fc3ed997 100644 --- a/inst/extdata/TMB_tests/distributions/test_fleet_acomp_nll.hpp +++ b/inst/extdata/TMB_tests/distributions/test_fleet_acomp_nll.hpp @@ -15,21 +15,21 @@ /** * @brief Model class defines and returns negative log-likelihood (nll) * - * @tparam T + * @tparam Type */ - template + template class Model { - using Vector = typename ModelTraits::EigenVector; + using Vector = typename ModelTraits::EigenVector; public: Vector x; /*!< Vector of length K of integers */ Vector p; /*!< Vector of length K, specifying the probability for the K classes (note, unlike in R these must sum to 1). */ // Initiate pointer to link .cpp to .hpp - static Model* instance; + static Model* instance; - ::objective_function *of; + ::objective_function *of; /** @brief Constructor. */ @@ -38,10 +38,10 @@ /** * @brief Create new singleton class * - * @return Model* + * @return Model* */ - static Model* getInstance(){ - return Model::instance; + static Model* getInstance(){ + return Model::instance; } /** @@ -49,17 +49,17 @@ * * @return negative log-likelihood (nll) */ - T evaluate(){ + Type evaluate(){ - T nll = 0.0; + Type nll = 0.0; int n = x.size(); - fims::FleetAgeCompNLL nll_fac; + fims::FleetAgeCompNLL nll_fac; nll_fac.catch_numbers_at_age.resize(n); nll_fac.nyears = 1; nll_fac.nages = 10; - std::shared_ptr> age_comp_data = - std::make_shared>(10, 1); + std::shared_ptr> age_comp_data = + std::make_shared>(10, 1); nll_fac.observed_agecomp_data = age_comp_data; Vector obs; @@ -86,10 +86,10 @@ /** * @brief Create new instance of Model * - * @tparam T + * @tparam Type */ - template - Model* Model::instance = new Model(); + template + Model* Model::instance = new Model(); } diff --git a/inst/extdata/TMB_tests/distributions/test_fleet_index_nll.hpp b/inst/extdata/TMB_tests/distributions/test_fleet_index_nll.hpp index 6cbd7e32..8554d9a5 100644 --- a/inst/extdata/TMB_tests/distributions/test_fleet_index_nll.hpp +++ b/inst/extdata/TMB_tests/distributions/test_fleet_index_nll.hpp @@ -15,21 +15,21 @@ /** * @brief Model class defines and returns negative log-likelihood (nll) * - * @tparam T + * @tparam Type */ - template + template class Model { - using DataVector = typename ModelTraits::DataVector; - using Vector = typename ModelTraits::EigenVector; + using DataVector = typename ModelTraits::DataVector; + using Vector = typename ModelTraits::EigenVector; public: DataVector y; /*!< observation */ Vector mean; /*!< expected fleet index */ - T logsd; /*!< standard deviation of the fleet observation error, must be strictly positive.*/ + Type logsd; /*!< standard deviation of the fleet observation error, must be strictly positive.*/ // Initiate pointer to link .cpp to .hpp - static Model* instance; + static Model* instance; - ::objective_function *of; + ::objective_function *of; /** @brief Constructor. */ @@ -38,10 +38,10 @@ /** * @brief Create new singleton class * - * @return Model* + * @return Model* */ - static Model* getInstance(){ - return Model::instance; + static Model* getInstance(){ + return Model::instance; } /** @@ -49,16 +49,16 @@ * * @return negative log-likelihood (nll) */ - T evaluate(){ + Type evaluate(){ - T nll = 0; + Type nll = 0; int n = y.size(); - fims::FleetIndexNLL nll_fleet_index; + fims::FleetIndexNLL nll_fleet_index; nll_fleet_index.log_obs_error = logsd; - std::shared_ptr> index_data = - std::make_shared>(n); + std::shared_ptr> index_data = + std::make_shared>(n); nll_fleet_index.observed_index_data = index_data; nll_fleet_index.expected_index.resize(n); @@ -80,10 +80,10 @@ /** * @brief Create new instance of Model * - * @tparam T + * @tparam Type */ - template - Model* Model::instance = new Model(); + template + Model* Model::instance = new Model(); } diff --git a/inst/include/common/fims_math.hpp b/inst/include/common/fims_math.hpp index fe636ce5..d1e4f0e9 100644 --- a/inst/include/common/fims_math.hpp +++ b/inst/include/common/fims_math.hpp @@ -210,9 +210,9 @@ inline const T ad_min(const T &a, const T &b, T C = 1e-5) { * @param C default = 1e-5 * @return */ -template -inline const T ad_max(const T &a, const T &b, T C = 1e-5) { - return (a + b + fims::ad_fabs(a - b, C)) * static_cast(.5); +template +inline const Type ad_max(const Type &a, const Type &b, Type C = 1e-5) { + return (a + b + fims::ad_fabs(a - b, C)) * static_cast(.5); } } // namespace fims diff --git a/inst/include/distributions/functors/distributions_base.hpp b/inst/include/distributions/functors/distributions_base.hpp index 8cbd6e9c..b1e8ed0c 100644 --- a/inst/include/distributions/functors/distributions_base.hpp +++ b/inst/include/distributions/functors/distributions_base.hpp @@ -21,11 +21,11 @@ namespace fims { /** @brief Base class for all module_name functors. * - * @tparam T The type of the module_name functor. + * @tparam Type The type of the module_name functor. * */ -template -struct DistributionsBase : public FIMSObject { +template +struct DistributionsBase : public FIMSObject { // id_g is the ID of the instance of the DistributionsBase class. // this is like a memory tracker. // Assigning each one its own ID is a way to keep track of @@ -42,13 +42,13 @@ struct DistributionsBase : public FIMSObject { * independent variable value. * @param do_log Boolean; if true, log densities are returned */ - virtual const T evaluate(const bool& do_log) = 0; + virtual const Type evaluate(const bool& do_log) = 0; }; /** @brief Default id of the singleton distribution class */ -template -uint32_t DistributionsBase::id_g = 0; +template +uint32_t DistributionsBase::id_g = 0; } // namespace fims diff --git a/inst/include/interface/interface.hpp b/inst/include/interface/interface.hpp index 60572f06..9ca15f0a 100644 --- a/inst/include/interface/interface.hpp +++ b/inst/include/interface/interface.hpp @@ -61,15 +61,15 @@ namespace fims { * @brief ModelTraits class that contains the DataVector * and ParameterVector types. */ -template +template struct ModelTraits { - typedef typename CppAD::vector DataVector; /**< This is a vector + typedef typename CppAD::vector DataVector; /**< This is a vector of the data that is differentiable */ - typedef typename CppAD::vector ParameterVector; /**< This is a + typedef typename CppAD::vector ParameterVector; /**< This is a vector of the parameters that is differentiable */ - typedef typename tmbutils::vector + typedef typename tmbutils::vector EigenVector; /**< This is a vector as defined in TMB's namespace Eigen */ - typedef typename tmbutils::matrix + typedef typename tmbutils::matrix EigenMatrix; /**< This is a matrix as defined in TMB's namespace Eigen */ }; #endif /* TMB_MODEL */ diff --git a/inst/include/interface/rcpp/rcpp_objects/rcpp_data.hpp b/inst/include/interface/rcpp/rcpp_objects/rcpp_data.hpp index fff3b008..bebaf4cc 100644 --- a/inst/include/interface/rcpp/rcpp_objects/rcpp_data.hpp +++ b/inst/include/interface/rcpp/rcpp_objects/rcpp_data.hpp @@ -145,10 +145,10 @@ class IndexDataInterface : public DataInterfaceBase { #ifdef TMB_MODEL - template + template bool add_to_fims_tmb_internal() { - std::shared_ptr> data = - std::make_shared>(this->ymax); + std::shared_ptr> data = + std::make_shared>(this->ymax); data->id = this->id; @@ -156,8 +156,8 @@ class IndexDataInterface : public DataInterfaceBase { data->at(y) = this->index_data[y]; } - std::shared_ptr> info = - fims::Information::GetInstance(); + std::shared_ptr> info = + fims::Information::GetInstance(); info->data_objects[this->id] = data; return true; diff --git a/inst/include/interface/rcpp/rcpp_objects/rcpp_selectivity.hpp b/inst/include/interface/rcpp/rcpp_objects/rcpp_selectivity.hpp index 38b601ac..7f1523b2 100644 --- a/inst/include/interface/rcpp/rcpp_objects/rcpp_selectivity.hpp +++ b/inst/include/interface/rcpp/rcpp_objects/rcpp_selectivity.hpp @@ -83,13 +83,13 @@ class LogisticSelectivityInterface : public SelectivityInterfaceBase { #ifdef TMB_MODEL - template + template bool add_to_fims_tmb_internal() { - std::shared_ptr > info = - fims::Information::GetInstance(); + std::shared_ptr > info = + fims::Information::GetInstance(); - std::shared_ptr > selectivity = - std::make_shared >(); + std::shared_ptr > selectivity = + std::make_shared >(); // set relative info selectivity->id = this->id; diff --git a/inst/include/interface/rcpp/rcpp_objects/rcpp_tmb_distribution.hpp b/inst/include/interface/rcpp/rcpp_objects/rcpp_tmb_distribution.hpp index a72d38dc..373d78f3 100644 --- a/inst/include/interface/rcpp/rcpp_objects/rcpp_tmb_distribution.hpp +++ b/inst/include/interface/rcpp/rcpp_objects/rcpp_tmb_distribution.hpp @@ -203,7 +203,7 @@ class DlnormDistributionsInterface : public DistributionsInterfaceBase { * dmultinom_ <- new(fims$TMBDmultinomDistribution) * */ -// template +// template class DmultinomDistributionsInterface : public DistributionsInterfaceBase { public: @@ -239,14 +239,14 @@ class DmultinomDistributionsInterface : public DistributionsInterfaceBase { #ifdef TMB_MODEL - template + template bool add_to_fims_tmb_internal() { - typedef typename fims::ModelTraits::EigenVector Vector; - std::shared_ptr> info = - fims::Information::GetInstance(); + typedef typename fims::ModelTraits::EigenVector Vector; + std::shared_ptr> info = + fims::Information::GetInstance(); - std::shared_ptr> distribution = - std::make_shared>(); + std::shared_ptr> distribution = + std::make_shared>(); distribution->id = this->id; distribution->x = Vector(x.size()); diff --git a/inst/include/population_dynamics/growth/functors/ewaa.hpp b/inst/include/population_dynamics/growth/functors/ewaa.hpp index 75691816..0308c369 100644 --- a/inst/include/population_dynamics/growth/functors/ewaa.hpp +++ b/inst/include/population_dynamics/growth/functors/ewaa.hpp @@ -19,8 +19,8 @@ namespace fims { /** * @brief EWAAgrowth class that returns the EWAA function value. */ -template -struct EWAAgrowth : public GrowthBase { +template +struct EWAAgrowth : public GrowthBase { // add submodule class members here // these include parameters of the submodule // a map looks up values based on a reference key @@ -29,7 +29,7 @@ struct EWAAgrowth : public GrowthBase { std::map ewaa; /*! */ - EWAAgrowth() : GrowthBase() {} + EWAAgrowth() : GrowthBase() {} virtual ~EWAAgrowth() {} @@ -38,8 +38,8 @@ struct EWAAgrowth : public GrowthBase { * * @param a age of the fish, the age vector must start at zero */ - virtual const T evaluate(const double& a) { - T ret = ewaa[a]; + virtual const Type evaluate(const double& a) { + Type ret = ewaa[a]; return ret; } }; diff --git a/inst/include/population_dynamics/growth/functors/growth_base.hpp b/inst/include/population_dynamics/growth/functors/growth_base.hpp index 540568b9..5cca6c16 100644 --- a/inst/include/population_dynamics/growth/functors/growth_base.hpp +++ b/inst/include/population_dynamics/growth/functors/growth_base.hpp @@ -21,10 +21,10 @@ namespace fims { /** * @brief Base class for all growth functors. * - * @tparam T The type of the growth functor. + * @tparam Type The type of the growth functor. * */ -template -struct GrowthBase : public FIMSObject { +template +struct GrowthBase : public FIMSObject { // id_g is the ID of the instance of the growthBase class. // this is like a memory tracker. // Assigning each one its own ID is a way to keep track of @@ -42,11 +42,11 @@ struct GrowthBase : public FIMSObject { * @brief Calculates the growth at the independent variable value. * @param a The age at which to return weight of the fish (in kg). */ - virtual const T evaluate(const double& a) = 0; + virtual const Type evaluate(const double& a) = 0; }; -template -uint32_t GrowthBase::id_g = 0; +template +uint32_t GrowthBase::id_g = 0; } // namespace fims diff --git a/inst/include/population_dynamics/maturity/functors/logistic.hpp b/inst/include/population_dynamics/maturity/functors/logistic.hpp index b7018a2b..61d60ab2 100644 --- a/inst/include/population_dynamics/maturity/functors/logistic.hpp +++ b/inst/include/population_dynamics/maturity/functors/logistic.hpp @@ -19,14 +19,14 @@ namespace fims { * @brief LogisticMaturity class that returns the logistic function value * from fims_math. */ -template -struct LogisticMaturity : public MaturityBase { - T median; /*!< 50% quantile of the value of the quantity of interest (x); e.g. +template +struct LogisticMaturity : public MaturityBase { + Type median; /*!< 50% quantile of the value of the quantity of interest (x); e.g. age at which 50% of the fish are mature */ - T slope; /*!() {} + LogisticMaturity() : MaturityBase() {} /** * @brief Method of the logistic maturity class that implements the @@ -37,8 +37,8 @@ struct LogisticMaturity : public MaturityBase { * @param x The independent variable in the logistic function (e.g., age or * size at maturity). */ - virtual const T evaluate(const T& x) { - return fims::logistic(median, slope, x); + virtual const Type evaluate(const Type& x) { + return fims::logistic(median, slope, x); } }; diff --git a/inst/include/population_dynamics/maturity/functors/maturity_base.hpp b/inst/include/population_dynamics/maturity/functors/maturity_base.hpp index e74b2863..8f4acd99 100644 --- a/inst/include/population_dynamics/maturity/functors/maturity_base.hpp +++ b/inst/include/population_dynamics/maturity/functors/maturity_base.hpp @@ -20,11 +20,11 @@ namespace fims { /** @brief Base class for all maturity functors. * - * @tparam T The type of the maturity functor. + * @tparam Type The type of the maturity functor. */ -template -struct MaturityBase : public FIMSObject { +template +struct MaturityBase : public FIMSObject { // id_g is the ID of the instance of the MaturityBase class. // this is like a memory tracker. // Assigning each one its own ID is a way to keep track of @@ -43,12 +43,12 @@ struct MaturityBase : public FIMSObject { * @param x The independent variable in the maturity function (e.g., logistic * maturity at age or size). */ - virtual const T evaluate(const T& x) = 0; + virtual const Type evaluate(const Type& x) = 0; }; // default id of the singleton maturity class -template -uint32_t MaturityBase::id_g = 0; +template +uint32_t MaturityBase::id_g = 0; } // namespace fims diff --git a/inst/include/population_dynamics/selectivity/functors/double_logistic.hpp b/inst/include/population_dynamics/selectivity/functors/double_logistic.hpp index 38fe577e..a3042778 100644 --- a/inst/include/population_dynamics/selectivity/functors/double_logistic.hpp +++ b/inst/include/population_dynamics/selectivity/functors/double_logistic.hpp @@ -17,22 +17,22 @@ namespace fims { * @brief DoubleLogisticSelectivity class that returns the double logistic * function value from fims_math. */ -template -struct DoubleLogisticSelectivity : public SelectivityBase { - T median_asc; /*!< 50% quantile of the value of the quantity of interest (x) +template +struct DoubleLogisticSelectivity : public SelectivityBase { + Type median_asc; /*!< 50% quantile of the value of the quantity of interest (x) on the ascending limb of the double logistic curve; e.g. age at which 50% of the fish are selected */ - T slope_asc; /*!() {} + DoubleLogisticSelectivity() : SelectivityBase() {} virtual ~DoubleLogisticSelectivity() {} /** @@ -46,8 +46,8 @@ struct DoubleLogisticSelectivity : public SelectivityBase { * @param x The independent variable in the double logistic function (e.g., * age or size in selectivity). */ - virtual const T evaluate(const T &x) { - return fims::double_logistic(median_asc, slope_asc, median_desc, + virtual const Type evaluate(const Type &x) { + return fims::double_logistic(median_asc, slope_asc, median_desc, slope_desc, x); } }; diff --git a/inst/include/population_dynamics/selectivity/functors/logistic.hpp b/inst/include/population_dynamics/selectivity/functors/logistic.hpp index 1edcfec4..dc6fe80a 100644 --- a/inst/include/population_dynamics/selectivity/functors/logistic.hpp +++ b/inst/include/population_dynamics/selectivity/functors/logistic.hpp @@ -20,14 +20,14 @@ namespace fims { * @brief LogisticSelectivity class that returns the logistic function value * from fims_math. */ -template -struct LogisticSelectivity : public SelectivityBase { - T median; /*!< 50% quantile of the value of the quantity of interest (x); e.g. +template +struct LogisticSelectivity : public SelectivityBase { + Type median; /*!< 50% quantile of the value of the quantity of interest (x); e.g. age at which 50% of the fish are selected */ - T slope; /*!() {} + LogisticSelectivity() : SelectivityBase() {} virtual ~LogisticSelectivity() {} @@ -40,8 +40,8 @@ struct LogisticSelectivity : public SelectivityBase { * @param x The independent variable in the logistic function (e.g., age or * size in selectivity). */ - virtual const T evaluate(const T& x) { - return fims::logistic(median, slope, x); + virtual const Type evaluate(const Type& x) { + return fims::logistic(median, slope, x); } }; diff --git a/inst/include/population_dynamics/selectivity/functors/selectivity_base.hpp b/inst/include/population_dynamics/selectivity/functors/selectivity_base.hpp index ae2fa400..bbb439f2 100644 --- a/inst/include/population_dynamics/selectivity/functors/selectivity_base.hpp +++ b/inst/include/population_dynamics/selectivity/functors/selectivity_base.hpp @@ -20,11 +20,11 @@ namespace fims { /** @brief Base class for all selectivity functors. * - * @tparam T The type of the selectivity functor. + * @tparam Type The type of the selectivity functor. */ -template -struct SelectivityBase : public FIMSObject { +template +struct SelectivityBase : public FIMSObject { // id_g is the ID of the instance of the SelectivityBase class. // this is like a memory tracker. // Assigning each one its own ID is a way to keep track of @@ -46,12 +46,12 @@ struct SelectivityBase : public FIMSObject { * @param x The independent variable in the logistic function (e.g., age or * size in selectivity). */ - virtual const T evaluate(const T& x) = 0; + virtual const Type evaluate(const Type& x) = 0; }; // default id of the singleton selectivity class -template -uint32_t SelectivityBase::id_g = 0; +template +uint32_t SelectivityBase::id_g = 0; } // namespace fims diff --git a/inst/templates/module_base_template.hpp b/inst/templates/module_base_template.hpp index 360a9847..1fc00e36 100644 --- a/inst/templates/module_base_template.hpp +++ b/inst/templates/module_base_template.hpp @@ -21,11 +21,11 @@ namespace fims { /* @brief Base class for all {{{ module_type }}} functors. * - * @tparam T The type of the {{{ module_type }}} functor. + * @tparam Type The type of the {{{ module_type }}} functor. * */ -template +template // Change {{{ module_type }}} to CamelCase in the class definition below. -struct {{{ module_type }}}Base : public FIMSObject { +struct {{{ module_type }}}Base : public FIMSObject { // id_g is the ID of the instance of the {{{ module_type }}}Base class. // this is like a memory tracker. @@ -44,13 +44,13 @@ struct {{{ module_type }}}Base : public FIMSObject { * @brief Calculates the {{{ module_type }}} at the independent variable value. * @param x The independent variable in the logistic function (e.g., age or size in {{{ module_type }}}). */ - virtual const T evaluate(const T& x) = 0; + virtual const Type evaluate(const Type& x) = 0; }; -template +template // {{{module_type}}} should be CamelCase below -uint32_t {{{ module_type }}}Base::id_g = 0; +uint32_t {{{ module_type }}}Base::id_g = 0; } diff --git a/inst/templates/module_functor_template.hpp b/inst/templates/module_functor_template.hpp index b6d52a2e..c90f22aa 100644 --- a/inst/templates/module_functor_template.hpp +++ b/inst/templates/module_functor_template.hpp @@ -25,12 +25,12 @@ namespace fims { * from fims_math. */ // {{{module_name}}} and {{{module_type}}} should be CamelCase below -template -struct {{{module_name}}}{{{module_type}}} : public {{{module_type}}}Base { +template +struct {{{module_name}}}{{{module_type}}} : public {{{module_type}}}Base { //add submodule class members here //these include parameters of the submodule - {{{module_name}}}{{{module_type}}}(): {{{module_type}}}Base(){ + {{{module_name}}}{{{module_type}}}(): {{{module_type}}}Base(){ } @@ -39,9 +39,9 @@ struct {{{module_name}}}{{{module_type}}} : public {{{module_type}}}Base { * * @param x description */ - virtual const T evaluate(const T& x) { + virtual const Type evaluate(const Type& x) { //you will need to add class members as arguments to the function below - return fims::{{{module_name}}}(x); + return fims::{{{module_name}}}(x); } };