tekka
pbf::Individual Class Reference

Individual class. More...

#include <individual.hpp>

Public Member Functions

 Individual ()=delete
 Alias.
 
 Individual (bool is_male) noexcept
 for initial population
 
 Individual (const std::shared_ptr< Individual > &father, const std::shared_ptr< Individual > &mother, int_fast32_t year, bool is_male) noexcept
 for sexual reproduction
 
 Individual (const Individual &)=delete
 
double death_rate (const int_fast32_t year, const int_fast32_t season) const
 Finite death rate per quarter year: \( d = 1 - \exp(- M - eF) \).
 
uint_fast32_t migrate (uint_fast32_t loc, int_fast32_t year, URBG &)
 Generate random number for new location.
 
void trace_back (std::ostream &ost, std::unordered_map< const Individual *, uint_fast32_t > *ids, uint_fast32_t loc, int_fast32_t year) const
 Write ancestors recursively.
 
std::ostream & write (std::ostream &) const
 Write all the data members in TSV.
 
std::ostream & write (std::ostream &, const std::unordered_map< const Individual *, uint_fast32_t > &) const
 Write all the data members in TSV with translated IDs.
 
Getter functions
int_fast32_t age (const int_fast32_t year) const noexcept
 Age in the given year.
 
double weight (int_fast32_t year) const noexcept
 Weight for year age.
 
bool is_male () const noexcept
 Just returns is_male_.
 

Static Public Member Functions

static std::ostream & write_trace_back_header (std::ostream &)
 Write column names for trace_back()
 
static std::ostream & write_names (std::ostream &)
 Write column names for write()
 
static void set_dependent_static (const uint_fast32_t years)
 Set static variables that depend on others.
 
static bool is_ready (const uint_fast32_t years)
 Test if static variables are ready.
 
static double DEATH_RATE (const int_fast32_t q_age, const int_fast32_t year)
 Finite death rate per quarter year.
 

Static Public Attributes

static constexpr int_fast32_t MAX_AGE = 80
 No individual lives longer than this.
 
static IndividualJson JSON
 Parameters shared among instances (JSON file).
 

Private Types

using PairDestDist = std::pair<int_fast32_t, std::discrete_distribution<uint_fast32_t>>
 Alias for readability.
 

Static Private Member Functions

static void set_static_migration ()
 Prepare MIGRATION_DESTINATION_.
 
static void set_static_mortality ()
 Prepare mortality vectors.
 
static void set_static_weight ()
 Prepare WEIGHT_FOR_AGE_.
 

Private Attributes

const std::shared_ptr< Individualfather_ = nullptr
 Pointer to father.
 
const std::shared_ptr< Individualmother_ = nullptr
 Pointer to mother.
 
int_fast32_t birth_year_ = -4
 Year of birth.
 
const bool is_male_
 Sex.
 

Static Private Attributes

static std::vector< double > FISHING_COEF_
 Fluctuation of fishing mortality by year.
 
static std::vector< double > WEIGHT_FOR_AGE_
 year version of IndividualJson::weight_for_age
 
static std::vector< std::vector< PairDestDist > > MIGRATION_DESTINATION_
 Discrete distributions for migration.
 

Friends

std::ostream & operator<< (std::ostream &ost, const Individual &x)
 Shortcut of Individual::write.
 

Detailed Description

Individual class.


The documentation for this class was generated from the following files: