Skip to content

Namespace sampler

Namespace List > sampler

Functions for sampling viruses.

Public Functions

Type Name
std::function< Virus< TSeq > *(Agent< TSeq > *, Model< TSeq > *)> make_sample_virus_neighbors (std::vector< epiworld_fast_uint > exclude={})
Make a function to sample from neighbors.
std::function< void(Agent< TSeq > *, Model< TSeq > *)> make_update_susceptible (std::vector< epiworld_fast_uint > exclude={})
Make a function to sample from neighbors.
Virus< TSeq > * sample_virus_single (Agent< TSeq > * p, Model< TSeq > * m)
Sample from neighbors pool of viruses (at most one)

Public Functions Documentation

function make_sample_virus_neighbors

Make a function to sample from neighbors.

template<typename TSeq>
inline std::function< Virus < TSeq > *( Agent < TSeq > *, Model < TSeq > *)> sampler::make_sample_virus_neighbors (
    std::vector< epiworld_fast_uint > exclude={}
) 

This is akin to the function default_update_susceptible, with the difference that it will create a function that supports excluding states from the sampling frame. For example, individuals who have acquired a virus can be excluded if in incubation state.

Template parameters:

  • TSeq

Parameters:

  • exclude unsigned vector of states that need to be excluded from the sampling

Returns:

Virus<TSeq>* of the selected virus. If none selected (or none available,) returns a nullptr;


function make_update_susceptible

Make a function to sample from neighbors.

template<typename TSeq>
inline std::function< void ( Agent < TSeq > *, Model < TSeq > *)> sampler::make_update_susceptible (
    std::vector< epiworld_fast_uint > exclude={}
) 

This is akin to the function default_update_susceptible, with the difference that it will create a function that supports excluding states from the sampling frame. For example, individuals who have acquired a virus can be excluded if in incubation state.

Template parameters:

  • TSeq

Parameters:

  • exclude unsigned vector of states that need to be excluded from the sampling

Returns:

Virus<TSeq>* of the selected virus. If none selected (or none available,) returns a nullptr;


function sample_virus_single

Sample from neighbors pool of viruses (at most one)

template<typename TSeq>
inline Virus < TSeq > * sampler::sample_virus_single (
    Agent < TSeq > * p,
    Model < TSeq > * m
) 

This function samples at most one virus from the pool of viruses from its neighbors. If no virus is selected, the function returns a nullptr, otherwise it returns a pointer to the selected virus.

This can be used to build a new update function (EPI_NEW_UPDATEFUN.)

Template parameters:

  • TSeq

Parameters:

  • p Pointer to person
  • m Pointer to the model

Returns:

Virus<TSeq>* of the selected virus. If none selected (or none available,) returns a nullptr;



The documentation for this class was generated from the following file epiworld-src/include/epiworld/agent-meat-virus-sampling.hpp