Skip to content

File bubbles-bones.hpp

File List > epiworld > globalevents > bubbles-bones.hpp

Go to the documentation of this file

#ifndef EPIWORLD_GLOBALEVENTS_BUBBLES_BONES_HPP
#define EPIWORLD_GLOBALEVENTS_BUBBLES_BONES_HPP

// Standard library headers (vector, memory, string, unordered_map, utility,
// algorithm, stdexcept) are included at global scope by epiworld.hpp; this file
// is only ever included from within `namespace epiworld`, so it must not
// re-include system headers here.
#include "../config.hpp"

enum class BubbleFlavor {
    Household,
    Peer
};

struct BubbleState {
    std::vector< int > bubble_id;  
    int last_sim_id = -1;          
    int last_epoch  = -1;          
};

template<typename TSeq = EPI_DEFAULT_TSEQ>
class Bubbles {
private:

    std::vector< size_t > household_id;
    BubbleFlavor flavor;
    size_t group_size;               
    size_t max_households;           
    epiworld_double transmission_factor; 
    int start_day;
    int end_day;
    int rewire_every;
    std::string name;
    std::string param_name;          
    std::shared_ptr< BubbleState > state;

    void compute_partition(Model<TSeq> * model) const;
    void partition_household(Model<TSeq> * model) const;
    void partition_peer(Model<TSeq> * model) const;

public:

    Bubbles(
        std::vector< size_t > household_id,
        BubbleFlavor flavor,
        size_t group_size,
        epiworld_double transmission_factor = 0.0,
        int start_day = 0,
        int end_day = -1,
        int rewire_every = 0,
        std::string name = "Social bubble",
        size_t max_households = 2u,
        std::string param_name = "Bubble transmission factor"
    );

    void deploy(Model<TSeq> & model);

    std::shared_ptr< BubbleState > get_state() const;

    const std::vector< int > & get_bubble_id() const;

    BubbleFlavor get_flavor() const;

    const std::string & get_param_name() const;

};

#endif