Utopia 2
Framework for studying models of complex & adaptive systems.
Loading...
Searching...
No Matches
Classes | Namespaces | Enumerations | Functions | Variables
select.hh File Reference
#include <map>
#include <set>
#include <unordered_set>
#include <random>
#include <algorithm>
#include <type_traits>
#include <armadillo>
#include <yaml-cpp/yaml.h>
#include <spdlog/spdlog.h>
#include "types.hh"
#include "exceptions.hh"
#include "entity.hh"
#include "cell.hh"
#include "agent.hh"
#include "logging.hh"
#include "../data_io/cfg_utils.hh"
Include dependency graph for select.hh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Utopia::is_cell_manager< M >
 Metafunction to determine whether a Manager is a CellManager. More...
 
struct  Utopia::is_agent_manager< M >
 Metafunction to determine whether a Manager is an AgentManager. More...
 

Namespaces

namespace  Utopia
 

Enumerations

enum class  Utopia::SelectionMode {
  Utopia::SelectionMode::condition = 0 , Utopia::SelectionMode::sample = 1 , Utopia::SelectionMode::probability = 2 , Utopia::SelectionMode::clustered_simple = 20 ,
  Utopia::SelectionMode::position = 100 , Utopia::SelectionMode::boundary = 101 , Utopia::SelectionMode::lanes = 102
}
 Possible selection modes; availability depends on choice of manager. More...
 

Functions

std::string Utopia::selection_mode_to_string (const SelectionMode &mode)
 Given a SelectionMode enum value, return the corresponding string key.
 
template<class Manager , class Container = EntityContainer<typename Manager::Entity>>
Container Utopia::select_entities (const Manager &mngr, const DataIO::Config &sel_cfg)
 Select entities according to parameters specified in a configuration.
 
template<SelectionMode mode, class Manager , class Container = EntityContainer<typename Manager::Entity>, class Condition = std::function<bool(const std::shared_ptr<typename Manager::Entity>&)>, typename std::enable_if_t< mode==SelectionMode::condition, int > = 0>
Container Utopia::select_entities (const Manager &mngr, const Condition &condition)
 Return a container with entities that match the given condition.
 
template<SelectionMode mode, class Manager , class Container = EntityContainer<typename Manager::Entity>, typename std::enable_if_t< mode==SelectionMode::sample, int > = 0>
Container Utopia::select_entities (const Manager &mngr, const int num_entities)
 Select a sample of entities randomly.
 
template<SelectionMode mode, class Manager , class Container = EntityContainer<typename Manager::Entity>, typename std::enable_if_t< mode==SelectionMode::probability, int > = 0>
Container Utopia::select_entities (const Manager &mngr, const double probability)
 Select entities with a certain probability.
 
template<SelectionMode mode, class Manager , class Container = EntityContainer<typename Manager::Entity>, typename std::enable_if_t< mode==SelectionMode::position, int > = 0>
Container Utopia::select_entities (const Manager &mngr, const std::vector< typename Manager::SpaceVec > &positions)
 Selects cells at given positions in space.
 
template<SelectionMode mode, class Manager , class Container = EntityContainer<typename Manager::Entity>, typename std::enable_if_t< mode==SelectionMode::boundary, int > = 0>
Container Utopia::select_entities (const Manager &mngr, const std::string &boundary)
 Selects cells on a boundary.
 
template<SelectionMode mode, class Manager , class Container = EntityContainer<typename Manager::Entity>, typename std::enable_if_t< mode==SelectionMode::lanes, int > = 0>
Container Utopia::select_entities (const Manager &mngr, const unsigned int num_vertical, const unsigned int num_horizontal, const std::pair< double, double > permeability={0., 0.}, const std::pair< unsigned int, unsigned int > gate_width={0, 0})
 Selects horizontal or vertical lanes of cells.
 
template<SelectionMode mode, class Manager , class Container = EntityContainer<typename Manager::Entity>, typename std::enable_if_t< mode==SelectionMode::clustered_simple, int > = 0>
Container Utopia::select_entities (const Manager &mngr, const double p_seed, const double p_attach, const unsigned int num_passes)
 Selects cells that are clustered using a simple clustering algorithm.
 

Variables

const std::map< std::string, SelectionModeUtopia::selection_mode_map
 A map from strings to Select enum values.