cppyabm  1.0.17
An agent-based library to integrate C++ and Python
Public Member Functions | Public Attributes | List of all members
Patch< ENV, AGENT, PATCH > Struct Template Reference

Base class for patch. More...

#include <bases.h>

Public Member Functions

 Patch (shared_ptr< ENV > env, MESH_ITEM mesh_item)
 
virtual ~Patch ()
 
virtual void step ()
 
void set_agent (shared_ptr< AGENT > agent)
 To define patch behavior. More...
 
shared_ptr< AGENT > get_agent ()
 Assigns agent to the patch. More...
 
bool empty ()
 
void remove_agent ()
 Removes agent from the patch. More...
 
shared_ptr< PATCH > empty_neighbor (bool quiet=false)
 Returns an arbitrary adjacent patch without an agent. More...
 
vector< shared_ptr< AGENT > > find_neighbor_agents (bool include_self=true)
 Returns agents in one patch neighbors. More...
 
 Patch (shared_ptr< ENV > env, MESH_ITEM mesh_item)
 
virtual ~Patch ()
 
virtual void step ()
 
void set_agent (shared_ptr< AGENT > agent)
 To define patch behavior. More...
 
shared_ptr< AGENT > get_agent ()
 Assigns agent to the patch. More...
 
bool empty ()
 
void remove_agent ()
 Removes agent from the patch. More...
 
shared_ptr< PATCH > empty_neighbor (bool quiet=false)
 Returns an arbitrary adjacent patch without an agent. More...
 
vector< shared_ptr< AGENT > > find_neighbor_agents (bool include_self=true)
 Returns agents in one patch neighbors. More...
 

Public Attributes

unsigned agent_count = 0
 Keeps the record of residing agents count. More...
 
std::weak_ptr< AGENT > agent
 Pointer to stores agents. More...
 
std::shared_ptr< ENV > env
 Pointer to the simulation environment. More...
 
bool on_border = false
 whether the patch residing on the border of the domain More...
 
unsigned index
 unique index that associate patch to mesh More...
 
unsigned layer_index
 the index of the layer in which the patch is residing More...
 
vector< double > coords
 the coordinates of the patch More...
 
vector< unsigned > neighbors_indices
 the indices of the neighbor patches More...
 
vector< shared_ptr< PATCH > > neighbors
 list of neighbor patches More...
 

Detailed Description

template<class ENV, class AGENT, class PATCH>
struct Patch< ENV, AGENT, PATCH >

Base class for patch.

Patch class abstracts non-movable discrete elements of the simulation domain.

Definition at line 28 of file bases.h.

Constructor & Destructor Documentation

◆ Patch() [1/2]

template<class ENV , class AGENT , class PATCH >
Patch< ENV, AGENT, PATCH >::Patch ( shared_ptr< ENV >  env,
MESH_ITEM  mesh_item 
)
inline

Definition at line 29 of file bases.h.

◆ ~Patch() [1/2]

template<class ENV , class AGENT , class PATCH >
virtual Patch< ENV, AGENT, PATCH >::~Patch ( )
inlinevirtual

Definition at line 48 of file bases.h.

◆ Patch() [2/2]

template<class ENV , class AGENT , class PATCH >
Patch< ENV, AGENT, PATCH >::Patch ( shared_ptr< ENV >  env,
MESH_ITEM  mesh_item 
)
inline

Definition at line 29 of file bases.h.

◆ ~Patch() [2/2]

template<class ENV , class AGENT , class PATCH >
virtual Patch< ENV, AGENT, PATCH >::~Patch ( )
inlinevirtual

Definition at line 48 of file bases.h.

Member Function Documentation

◆ empty() [1/2]

template<class ENV , class AGENT , class PATCH >
bool Patch< ENV, AGENT, PATCH >::empty ( )
inline

Definition at line 69 of file bases.h.

◆ empty() [2/2]

template<class ENV , class AGENT , class PATCH >
bool Patch< ENV, AGENT, PATCH >::empty ( )
inline

Definition at line 69 of file bases.h.

◆ empty_neighbor() [1/2]

template<class ENV , class AGENT , class PATCH >
shared_ptr<PATCH> Patch< ENV, AGENT, PATCH >::empty_neighbor ( bool  quiet = false)

Returns an arbitrary adjacent patch without an agent.

◆ empty_neighbor() [2/2]

template<class ENV , class AGENT , class PATCH >
shared_ptr<PATCH> Patch< ENV, AGENT, PATCH >::empty_neighbor ( bool  quiet = false)

Returns an arbitrary adjacent patch without an agent.

◆ find_neighbor_agents() [1/2]

template<class ENV , class AGENT , class PATCH >
vector<shared_ptr<AGENT> > Patch< ENV, AGENT, PATCH >::find_neighbor_agents ( bool  include_self = true)

Returns agents in one patch neighbors.

◆ find_neighbor_agents() [2/2]

template<class ENV , class AGENT , class PATCH >
vector<shared_ptr<AGENT> > Patch< ENV, AGENT, PATCH >::find_neighbor_agents ( bool  include_self = true)

Returns agents in one patch neighbors.

◆ get_agent() [1/2]

template<class ENV , class AGENT , class PATCH >
shared_ptr<AGENT> Patch< ENV, AGENT, PATCH >::get_agent ( )
inline

Assigns agent to the patch.

Definition at line 60 of file bases.h.

◆ get_agent() [2/2]

template<class ENV , class AGENT , class PATCH >
shared_ptr<AGENT> Patch< ENV, AGENT, PATCH >::get_agent ( )
inline

Assigns agent to the patch.

Definition at line 60 of file bases.h.

◆ remove_agent() [1/2]

template<class ENV , class AGENT , class PATCH >
void Patch< ENV, AGENT, PATCH >::remove_agent ( )
inline

Removes agent from the patch.

Definition at line 78 of file bases.h.

◆ remove_agent() [2/2]

template<class ENV , class AGENT , class PATCH >
void Patch< ENV, AGENT, PATCH >::remove_agent ( )
inline

Removes agent from the patch.

Definition at line 78 of file bases.h.

◆ set_agent() [1/2]

template<class ENV , class AGENT , class PATCH >
void Patch< ENV, AGENT, PATCH >::set_agent ( shared_ptr< AGENT >  agent)
inline

To define patch behavior.

Definition at line 53 of file bases.h.

◆ set_agent() [2/2]

template<class ENV , class AGENT , class PATCH >
void Patch< ENV, AGENT, PATCH >::set_agent ( shared_ptr< AGENT >  agent)
inline

To define patch behavior.

Definition at line 53 of file bases.h.

◆ step() [1/2]

template<class ENV , class AGENT , class PATCH >
virtual void Patch< ENV, AGENT, PATCH >::step ( )
inlinevirtual

Definition at line 50 of file bases.h.

◆ step() [2/2]

template<class ENV , class AGENT , class PATCH >
virtual void Patch< ENV, AGENT, PATCH >::step ( )
inlinevirtual

Definition at line 50 of file bases.h.

Member Data Documentation

◆ agent

template<class ENV , class AGENT , class PATCH >
std::weak_ptr< AGENT > Patch< ENV, AGENT, PATCH >::agent

Pointer to stores agents.

Definition at line 87 of file bases.h.

◆ agent_count

template<class ENV , class AGENT , class PATCH >
unsigned Patch< ENV, AGENT, PATCH >::agent_count = 0

Keeps the record of residing agents count.

Definition at line 86 of file bases.h.

◆ coords

template<class ENV , class AGENT , class PATCH >
vector< double > Patch< ENV, AGENT, PATCH >::coords

the coordinates of the patch

Definition at line 93 of file bases.h.

◆ env

template<class ENV , class AGENT , class PATCH >
std::shared_ptr< ENV > Patch< ENV, AGENT, PATCH >::env

Pointer to the simulation environment.

Definition at line 88 of file bases.h.

◆ index

template<class ENV , class AGENT , class PATCH >
unsigned Patch< ENV, AGENT, PATCH >::index

unique index that associate patch to mesh

Definition at line 91 of file bases.h.

◆ layer_index

template<class ENV , class AGENT , class PATCH >
unsigned Patch< ENV, AGENT, PATCH >::layer_index

the index of the layer in which the patch is residing

Definition at line 92 of file bases.h.

◆ neighbors

template<class ENV , class AGENT , class PATCH >
vector< shared_ptr< PATCH > > Patch< ENV, AGENT, PATCH >::neighbors

list of neighbor patches

Definition at line 95 of file bases.h.

◆ neighbors_indices

template<class ENV , class AGENT , class PATCH >
vector< unsigned > Patch< ENV, AGENT, PATCH >::neighbors_indices

the indices of the neighbor patches

Definition at line 94 of file bases.h.

◆ on_border

template<class ENV , class AGENT , class PATCH >
bool Patch< ENV, AGENT, PATCH >::on_border = false

whether the patch residing on the border of the domain

Definition at line 90 of file bases.h.


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