9#ifndef FIMS_MODELS_FISHERY_MODEL_BASE_HPP
10#define FIMS_MODELS_FISHERY_MODEL_BASE_HPP
12#include "../../common/model_object.hpp"
13#include "../../common/fims_math.hpp"
14#include "../../common/fims_vector.hpp"
15#include "../../population_dynamics/population/population.hpp"
76template <
typename Type>
101 std::vector<std::shared_ptr<fims_popdy::Population<Type>>>
populations;
107 std::map<uint32_t, std::shared_ptr<fims_popdy::Fleet<Type>>>
fleets;
113 std::shared_ptr<fims_popdy::Fleet<Type>>>::iterator
120 typedef typename std::map<uint32_t, std::map<std::string, fims::Vector<Type>>>
141 typedef typename std::map<uint32_t, std::map<std::string, DimensionInfo>>
193 std::map<uint32_t, std::map<std::string, DimensionInfo>> &
203 std::map<uint32_t, std::map<std::string, DimensionInfo>> &
235 throw std::runtime_error(
236 "GetFleetDerivedQuantities: fleet_derived_quantities is null");
241 std::stringstream
ss;
243 ss <<
"GetFleetDerivedQuantities: fleet_id " <<
fleet_id
244 <<
" not found in fleet_derived_quantities";
245 throw std::out_of_range(
ss.str());
262 std::map<uint32_t, std::map<std::string, fims::Vector<Type>>>>();
285 std::map<uint32_t, std::map<std::string, fims::Vector<Type>>>>();
305 throw std::runtime_error(
306 "GetPopulationDerivedQuantities: population_derived_quantities is "
312 std::ostringstream
ss;
313 ss <<
"GetPopulationDerivedQuantities: population_id " <<
population_id
314 <<
" not found in population_derived_quantities";
315 throw std::out_of_range(
ss.str());
362 std::fill(
v.begin(),
v.end(), value);
385template <
typename Type>
386uint32_t FisheryModelBase<Type>::id_g = 0;
Definition fims_vector.hpp:27
FisheryModelBase is a base class for fishery models in FIMS.
Definition fishery_model_base.hpp:77
std::shared_ptr< DimensionInfoMap > population_dimension_info
Shared pointer for the population dimension information map.
Definition fishery_model_base.hpp:152
uint32_t GetId()
Get the Id object.
Definition fishery_model_base.hpp:382
std::map< uint32_t, std::shared_ptr< fims_popdy::Fleet< Type > > > fleets
A map of fleets in the fishery model, indexed by fleet id. Unique instances to eliminate duplicate in...
Definition fishery_model_base.hpp:107
DerivedQuantitiesMap::iterator DerivedQuantitiesMapIterator
Iterator for the derived quantities map.
Definition fishery_model_base.hpp:126
FisheryModelBase()
Construct a new Fishery Model Base object.
Definition fishery_model_base.hpp:161
std::map< uint32_t, std::map< std::string, fims::Vector< Type > > > DerivedQuantitiesMap
Type definitions for derived quantities and dimension information maps.
Definition fishery_model_base.hpp:121
std::vector< std::shared_ptr< fims_popdy::Population< Type > > > populations
A vector of populations in the fishery model.
Definition fishery_model_base.hpp:101
virtual void Evaluate()
Evaluate the model.
Definition fishery_model_base.hpp:369
FisheryModelBase(const FisheryModelBase &other)
Construct a new Fishery Model Base object.
Definition fishery_model_base.hpp:173
void InitializePopulationDerivedQuantities(uint32_t population_id)
Initialize the derived quantities map for a population.
Definition fishery_model_base.hpp:281
std::string model_type_m
A string specifying the model type.
Definition fishery_model_base.hpp:91
DerivedQuantitiesMap & GetFleetDerivedQuantities()
Get the fleet derived quantities.
Definition fishery_model_base.hpp:213
void InitializeFleetDerivedQuantities(uint32_t fleet_id)
Initialize the derived quantities map for a fleet.
Definition fishery_model_base.hpp:258
std::set< uint32_t > population_ids
Unique identifier for the fishery model.
Definition fishery_model_base.hpp:96
std::map< std::string, fims::Vector< Type > > & GetFleetDerivedQuantities(uint32_t fleet_id)
Get the fleet derived quantities for a specified fleet.
Definition fishery_model_base.hpp:232
std::map< std::string, fims::Vector< Type > > & GetPopulationDerivedQuantities(uint32_t population_id)
Get the population derived quantities for a specified population.
Definition fishery_model_base.hpp:302
std::map< std::string, DimensionInfo > & GetPopulationDimensionInfo(uint32_t population_id)
Get the population dimension information for a specified population.
Definition fishery_model_base.hpp:337
std::shared_ptr< DerivedQuantitiesMap > population_derived_quantities
Shared pointer for the population derived quantities map.
Definition fishery_model_base.hpp:136
virtual void Initialize()
Initialize a model.
Definition fishery_model_base.hpp:346
std::map< uint32_t, std::map< std::string, DimensionInfo > > DimensionInfoMap
Type definitions for dimension information maps.
Definition fishery_model_base.hpp:142
virtual ~FisheryModelBase()
Destroy the Fishery Model Base object.
Definition fishery_model_base.hpp:186
std::map< std::string, DimensionInfo > & GetFleetDimensionInfo(uint32_t fleet_id)
Get the fleet dimension information for a specified fleet.
Definition fishery_model_base.hpp:326
std::map< uint32_t, std::map< std::string, DimensionInfo > > & GetPopulationDimensionInfo()
Get the population dimension information.
Definition fishery_model_base.hpp:204
std::map< uint32_t, std::shared_ptr< fims_popdy::Fleet< Type > > >::iterator fleet_iterator
Fleet-based iterator.
Definition fishery_model_base.hpp:114
std::shared_ptr< DimensionInfoMap > fleet_dimension_info
Shared pointer for the fleet dimension information map.
Definition fishery_model_base.hpp:147
std::shared_ptr< DerivedQuantitiesMap > fleet_derived_quantities
Shared pointer for the fleet derived quantities map.
Definition fishery_model_base.hpp:131
DerivedQuantitiesMap & GetPopulationDerivedQuantities()
Get the population derived quantities.
Definition fishery_model_base.hpp:222
virtual void ResetVector(fims::Vector< Type > &v, Type value=0.0)
Reset a vector from start to end with a value.
Definition fishery_model_base.hpp:361
virtual void Report()
Report the model results via TMB.
Definition fishery_model_base.hpp:375
std::map< uint32_t, std::map< std::string, DimensionInfo > > & GetFleetDimensionInfo()
Get the fleet dimension information.
Definition fishery_model_base.hpp:194
virtual void Prepare()
Prepare the model.
Definition fishery_model_base.hpp:352
The population dynamics of FIMS.
Definition catch_at_age.hpp:41
void clear_internal()
Clears the internal objects.
Definition rcpp_interface.hpp:239
FIMSObject struct that defines member types and returns the unique id.
Definition model_object.hpp:25
Structure to hold dimension information for derived quantities.
Definition fishery_model_base.hpp:25
fims::Vector< int > dims
Definition fishery_model_base.hpp:28
std::string name
Definition fishery_model_base.hpp:26
DimensionInfo()
Default constructor for dimension information.
Definition fishery_model_base.hpp:35
DimensionInfo(const DimensionInfo &other)
Definition fishery_model_base.hpp:51
int ndims
Definition fishery_model_base.hpp:27
fims::Vector< double > se_values_m
Definition fishery_model_base.hpp:30
DimensionInfo(const std::string &name, const fims::Vector< int > &dims, const fims::Vector< std::string > &dim_names)
Constructor with parameters.
Definition fishery_model_base.hpp:44
DimensionInfo & operator=(const DimensionInfo &other)
Assignment operator for DimensionInfo.
Definition fishery_model_base.hpp:60
fims::Vector< std::string > dim_names
Definition fishery_model_base.hpp:29