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"
128template <
typename Type>
153 std::vector<std::shared_ptr<fims_popdy::Population<Type>>>
populations;
159 std::map<uint32_t, std::shared_ptr<fims_popdy::Fleet<Type>>>
fleets;
165 std::shared_ptr<fims_popdy::Fleet<Type>>>::iterator
172 typedef typename std::map<uint32_t, std::map<std::string, fims::Vector<Type>>>
193 typedef typename std::map<uint32_t, std::map<std::string, DimensionInfo>>
210 typename std::map<uint32_t, std::map<std::string, UncertaintyReportInfo>>
263 std::map<uint32_t, std::map<std::string, DimensionInfo>> &
273 std::map<uint32_t, std::map<std::string, DimensionInfo>> &
305 throw std::runtime_error(
306 "GetFleetDerivedQuantities: fleet_derived_quantities is null");
311 std::stringstream
ss;
313 ss <<
"GetFleetDerivedQuantities: fleet_id " <<
fleet_id
314 <<
" not found in fleet_derived_quantities";
315 throw std::out_of_range(
ss.str());
332 std::map<uint32_t, std::map<std::string, fims::Vector<Type>>>>();
355 std::map<uint32_t, std::map<std::string, fims::Vector<Type>>>>();
375 throw std::runtime_error(
376 "GetPopulationDerivedQuantities: population_derived_quantities is "
382 std::ostringstream
ss;
383 ss <<
"GetPopulationDerivedQuantities: population_id " <<
population_id
384 <<
" not found in population_derived_quantities";
385 throw std::out_of_range(
ss.str());
444 std::map<std::string, UncertaintyReportInfo> &
469 std::fill(
v.begin(),
v.end(), value);
492template <
typename Type>
493uint32_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:129
std::shared_ptr< DimensionInfoMap > population_dimension_info
Shared pointer for the population dimension information map.
Definition fishery_model_base.hpp:204
UncertaintyReportInfoMap & GetPopulationUncertaintyReportInfo()
Get the population uncertainty report information.
Definition fishery_model_base.hpp:422
uint32_t GetId()
Get the Id object.
Definition fishery_model_base.hpp:489
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:159
DerivedQuantitiesMap::iterator DerivedQuantitiesMapIterator
Iterator for the derived quantities map.
Definition fishery_model_base.hpp:178
FisheryModelBase()
Construct a new Fishery Model Base object.
Definition fishery_model_base.hpp:231
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:173
std::vector< std::shared_ptr< fims_popdy::Population< Type > > > populations
A vector of populations in the fishery model.
Definition fishery_model_base.hpp:153
virtual void Evaluate()
Evaluate the model.
Definition fishery_model_base.hpp:476
FisheryModelBase(const FisheryModelBase &other)
Construct a new Fishery Model Base object.
Definition fishery_model_base.hpp:243
std::shared_ptr< UncertaintyReportInfoMap > population_uncertainty_report_info
Shared pointer for the population uncertainty report information map.
Definition fishery_model_base.hpp:222
void InitializePopulationDerivedQuantities(uint32_t population_id)
Initialize the derived quantities map for a population.
Definition fishery_model_base.hpp:351
std::string model_type_m
A string specifying the model type.
Definition fishery_model_base.hpp:143
DerivedQuantitiesMap & GetFleetDerivedQuantities()
Get the fleet derived quantities.
Definition fishery_model_base.hpp:283
void InitializeFleetDerivedQuantities(uint32_t fleet_id)
Initialize the derived quantities map for a fleet.
Definition fishery_model_base.hpp:328
std::set< uint32_t > population_ids
Unique identifier for the fishery model.
Definition fishery_model_base.hpp:148
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:302
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:372
std::map< std::string, DimensionInfo > & GetPopulationDimensionInfo(uint32_t population_id)
Get the population dimension information for a specified population.
Definition fishery_model_base.hpp:407
std::shared_ptr< UncertaintyReportInfoMap > fleet_uncertainty_report_info
Shared pointer for the uncertainty report information map.
Definition fishery_model_base.hpp:216
std::shared_ptr< DerivedQuantitiesMap > population_derived_quantities
Shared pointer for the population derived quantities map.
Definition fishery_model_base.hpp:188
virtual void Initialize()
Initialize a model.
Definition fishery_model_base.hpp:453
std::map< uint32_t, std::map< std::string, DimensionInfo > > DimensionInfoMap
Type definitions for dimension information maps.
Definition fishery_model_base.hpp:194
virtual ~FisheryModelBase()
Destroy the Fishery Model Base object.
Definition fishery_model_base.hpp:256
std::map< std::string, DimensionInfo > & GetFleetDimensionInfo(uint32_t fleet_id)
Get the fleet dimension information for a specified fleet.
Definition fishery_model_base.hpp:396
std::map< uint32_t, std::map< std::string, UncertaintyReportInfo > > UncertaintyReportInfoMap
Type definition for the uncertainty report information map.
Definition fishery_model_base.hpp:211
std::map< uint32_t, std::map< std::string, DimensionInfo > > & GetPopulationDimensionInfo()
Get the population dimension information.
Definition fishery_model_base.hpp:274
std::map< std::string, UncertaintyReportInfo > & GetPopulationUncertaintyReportInfo(uint32_t population_id)
Get the population uncertainty report information for a specified population.
Definition fishery_model_base.hpp:445
std::map< uint32_t, std::shared_ptr< fims_popdy::Fleet< Type > > >::iterator fleet_iterator
Fleet-based iterator.
Definition fishery_model_base.hpp:166
std::map< std::string, UncertaintyReportInfo > & GetFleetUncertaintyReportInfo(uint32_t fleet_id)
Get the fleet uncertainty report information for a specified fleet.
Definition fishery_model_base.hpp:432
std::shared_ptr< DimensionInfoMap > fleet_dimension_info
Shared pointer for the fleet dimension information map.
Definition fishery_model_base.hpp:199
std::shared_ptr< DerivedQuantitiesMap > fleet_derived_quantities
Shared pointer for the fleet derived quantities map.
Definition fishery_model_base.hpp:183
DerivedQuantitiesMap & GetPopulationDerivedQuantities()
Get the population derived quantities.
Definition fishery_model_base.hpp:292
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:468
virtual void Report()
Report the model results via TMB.
Definition fishery_model_base.hpp:482
std::map< uint32_t, std::map< std::string, DimensionInfo > > & GetFleetDimensionInfo()
Get the fleet dimension information.
Definition fishery_model_base.hpp:264
UncertaintyReportInfoMap & GetFleetUncertaintyReportInfo()
Get the fleet uncertainty report information.
Definition fishery_model_base.hpp:415
virtual void Prepare()
Prepare the model.
Definition fishery_model_base.hpp:459
The population dynamics of FIMS.
Definition catch_at_age.hpp:41
void clear_internal()
Clears the internal objects.
Definition rcpp_interface.hpp:279
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
Definition fishery_model_base.hpp:78
UncertaintyReportInfo(const UncertaintyReportInfo &other)
Copy constructor.
Definition fishery_model_base.hpp:117
std::string name
Definition fishery_model_base.hpp:82
uint32_t id_m
Definition fishery_model_base.hpp:86
UncertaintyReportInfo()
Default constructor for UncertaintyReportInfo.
Definition fishery_model_base.hpp:99
UncertaintyReportInfo(const std::string &name, uint32_t id, size_t start, size_t length)
Constructor with parameters.
Definition fishery_model_base.hpp:109
size_t start_m
Definition fishery_model_base.hpp:90
size_t length_m
Definition fishery_model_base.hpp:94