Quetzal-CoaTL
The Coalescence Template Library
Loading...
Searching...
No Matches
quetzal::demography::FlowHashMapImplementation< Space, Time, Value > Class Template Reference

#include <quetzal/demography/FlowHashMapImplementation.hpp>

Detailed Description

template<typename Space, typename Time, typename Value>
class quetzal::demography::FlowHashMapImplementation< Space, Time, Value >

Defines a template class to store the demographic flows number across a landscape along time.

Template Parameters
SpaceDemes identifiers.
TimeEqualityComparable, CopyConstructible.
ValueThe type of the population size variable (int, unsigned int, double...)

Classes

struct  key_type
 A class representing the spatio-temporal coordinates of the flow vector (time, origin and destination) More...
 

Public Types

using time_type = Time
 
using coord_type = Space
 
using value_type = Value
 
using map_type = std::unordered_map< const key_type, value_type, key_hash >
 

Public Member Functions

 FlowHashMapImplementation ()=default
 Default constructor.
 
value_type flow_from_to (coord_type const &from, coord_type const &to, time_type t) const
 Retrieves value of the flow from deme i to deme j at time t.
 
void set_flow_from_to (coord_type const &from, coord_type const &to, time_type t, value_type v)
 Retrieves value of the flow from deme i to deme j at time t.
 
void add_to_flow_from_to (coord_type const &from, coord_type const &to, time_type t, value_type v)
 Adds value v to the flow from deme i to deme j at time t.
 
std::unordered_map< coord_type, value_type > const & flow_to (coord_type const &x, time_type t) const
 Retrieves the distribution of the value of the flow converging to deme x at time t.
 
bool flow_to_is_defined (coord_type const &to, time_type const &t) const
 Check if the distribution of the value of the flow converging to deme x at time t is defined.
 
auto begin () const
 Read-only access to the migration history.
 
auto end () const
 Read-only access to the migration history.
 

Member Function Documentation

◆ add_to_flow_from_to()

template<typename Space , typename Time , typename Value >
void quetzal::demography::FlowHashMapImplementation< Space, Time, Value >::add_to_flow_from_to ( coord_type const &  from,
coord_type const &  to,
time_type  t,
value_type  v 
)
inline

Adds value v to the flow from deme i to deme j at time t.

Returns
a reference on the value, initialized with value_type default constructor

◆ begin()

template<typename Space , typename Time , typename Value >
auto quetzal::demography::FlowHashMapImplementation< Space, Time, Value >::begin ( ) const
inline

Read-only access to the migration history.

Returns
An iterator on an object of type map_type

◆ end()

template<typename Space , typename Time , typename Value >
auto quetzal::demography::FlowHashMapImplementation< Space, Time, Value >::end ( ) const
inline

Read-only access to the migration history.

Returns
An iterator on an object of type map_type

◆ flow_to()

template<typename Space , typename Time , typename Value >
std::unordered_map< coord_type, value_type > const & quetzal::demography::FlowHashMapImplementation< Space, Time, Value >::flow_to ( coord_type const &  x,
time_type  t 
) const
inline

Retrieves the distribution of the value of the flow converging to deme x at time t.

Returns
a const reference on an unordered_map with giving the origin deme and the value giving the value of the flow

◆ flow_to_is_defined()

template<typename Space , typename Time , typename Value >
bool quetzal::demography::FlowHashMapImplementation< Space, Time, Value >::flow_to_is_defined ( coord_type const &  to,
time_type const &  t 
) const
inline

Check if the distribution of the value of the flow converging to deme x at time t is defined.

Returns
true if the distribution is defined, else returns false

◆ set_flow_from_to()

template<typename Space , typename Time , typename Value >
void quetzal::demography::FlowHashMapImplementation< Space, Time, Value >::set_flow_from_to ( coord_type const &  from,
coord_type const &  to,
time_type  t,
value_type  v 
)
inline

Retrieves value of the flow from deme i to deme j at time t.

Returns
a reference on the value, initialized with value_type default constructor

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