aether::user_cell_state_interface< OctreeTraits > Class Template Referenceabstract

#include <user_state.hh>

Public Member Functions

virtual void initialise_cell (const aether::cell_state< octree_traits > &aether_state)=0
 This is called once on creation of the cell. More...
 
virtual void deinitialise_cell (const aether::cell_state< octree_traits > &aether_state)=0
 This is called once when a cell is de-initialised. More...
 
virtual void serialize_to_client (const aether::cell_state< octree_traits > &aether_state, client_writer_type &writer)=0
 This is called by the worker to send messages to the muxer. More...
 
virtual void cell_tick (const aether::cell_state< octree_traits > &aether_state, float delta_time)=0
 This is the basic worker tick function. More...
 
virtual region_type< aether::monostateget_coverage (const aether::cell_state< octree_traits > &aether_state, const std::optional< cell_type > &old_cell)=0
 
virtual std::vector< bool > handover (const aether::cell_state< octree_traits > &aether_state, size_t num_neighbours, const std::optional< cell_type > *neighbour_cells, aether::neighbour_exchange_context &exchange)=0
 
virtual void initialise_world (const aether::cell_state< octree_traits > &aether_state)=0
 This is called to initialise the simulation world. More...
 
virtual std::vector< message::subscriber_topic_typeget_topics (const aether::cell_state< octree_traits > &aether_state)=0
 This is called every tick to specify which messages will be routed to this worker. More...
 
virtual void receive_messages (const aether::cell_state< octree_traits > &aether_state, message_reader_type &reader)=0
 This is called every tick to handle events received from the muxers or other Aether processes. More...
 
virtual void send_messages (const aether::cell_state< octree_traits > &aether_state, message_writer_type &writer)=0
 This function is used to send messages to dispatcher. More...
 
virtual float estimate_load (const aether::cell_state< octree_traits > &aether_state)=0
 The value produced by this is used by the manager to decide if a cell should split or merge. More...
 
virtual bool is_empty () const =0
 Used for debugging purposes to verify that there are no entities in the cell after the cell has beed deleted. More...
 
virtual bool is_idle () const =0
 
virtual std::unique_ptr< external_storage_ifacebuild_external_storage (const aether::cell_state< octree_traits > &aether_state)=0
 Override in order to implement external storage for the cell process. More...
 
virtual std::vector< key_type > get_global_kv_store_queries (const aether::cell_state< octree_traits > &aether_state)=0
 returns a list of keys to querie the value one time More...
 
virtual void global_kv_store_responses (const aether::cell_state< octree_traits > &aether_state, const std::unordered_map< key_type, data_type > &responses)=0
 processess the responses from the global store More...
 
virtual std::unordered_map< key_type, data_type > publish_global_kv_store_data (const aether::cell_state< octree_traits > &aether_state)=0
 publishes data to the store to make it avaliable to other workers More...
 
virtual ~user_cell_state_interface ()
 

Constructor & Destructor Documentation

template<typename OctreeTraits>
virtual aether::user_cell_state_interface< OctreeTraits >::~user_cell_state_interface ( )
inlinevirtual

Member Function Documentation

template<typename OctreeTraits>
virtual std::unique_ptr<external_storage_iface> aether::user_cell_state_interface< OctreeTraits >::build_external_storage ( const aether::cell_state< octree_traits > &  aether_state)
pure virtual

Override in order to implement external storage for the cell process.

See aether::external_storage_base.

template<typename OctreeTraits>
virtual void aether::user_cell_state_interface< OctreeTraits >::cell_tick ( const aether::cell_state< octree_traits > &  aether_state,
float  delta_time 
)
pure virtual

This is the basic worker tick function.

Write your main simulation code here.

template<typename OctreeTraits>
virtual void aether::user_cell_state_interface< OctreeTraits >::deinitialise_cell ( const aether::cell_state< octree_traits > &  aether_state)
pure virtual

This is called once when a cell is de-initialised.

This can occur as part of a merge, or because the cell is empty.

template<typename OctreeTraits>
virtual float aether::user_cell_state_interface< OctreeTraits >::estimate_load ( const aether::cell_state< octree_traits > &  aether_state)
pure virtual

The value produced by this is used by the manager to decide if a cell should split or merge.

By default Aether will try to split the cell if load is larger than 1.0, and merge if it's below 0.2.

template<typename OctreeTraits>
virtual region_type<aether::monostate> aether::user_cell_state_interface< OctreeTraits >::get_coverage ( const aether::cell_state< octree_traits > &  aether_state,
const std::optional< cell_type > &  old_cell 
)
pure virtual
Returns
aether::region representing the area of the cell
template<typename OctreeTraits>
virtual std::vector<key_type> aether::user_cell_state_interface< OctreeTraits >::get_global_kv_store_queries ( const aether::cell_state< octree_traits > &  aether_state)
pure virtual

returns a list of keys to querie the value one time

template<typename OctreeTraits>
virtual std::vector<message::subscriber_topic_type> aether::user_cell_state_interface< OctreeTraits >::get_topics ( const aether::cell_state< octree_traits > &  aether_state)
pure virtual

This is called every tick to specify which messages will be routed to this worker.

In addition to messages explicitly directed to this worker, the worker will also receive messages directed to topics this worker has subscribed to, such as messages intended for a particular aether::message::topic::entity_id or aether::message::topic::user_id. Specifying one of more instances of a aether::message::topic::user_id enables this worker to receive messages from the muxer.

Messages for which there are no subscribed Aether processes can be received by specifying the aether::message::topic::unclaimed_events topic.

template<typename OctreeTraits>
virtual void aether::user_cell_state_interface< OctreeTraits >::global_kv_store_responses ( const aether::cell_state< octree_traits > &  aether_state,
const std::unordered_map< key_type, data_type > &  responses 
)
pure virtual

processess the responses from the global store

template<typename OctreeTraits>
virtual std::vector<bool> aether::user_cell_state_interface< OctreeTraits >::handover ( const aether::cell_state< octree_traits > &  aether_state,
size_t  num_neighbours,
const std::optional< cell_type > *  neighbour_cells,
aether::neighbour_exchange_context &  exchange 
)
pure virtual
template<typename OctreeTraits>
virtual void aether::user_cell_state_interface< OctreeTraits >::initialise_cell ( const aether::cell_state< octree_traits > &  aether_state)
pure virtual

This is called once on creation of the cell.

It is not called when a cell changes size.

template<typename OctreeTraits>
virtual void aether::user_cell_state_interface< OctreeTraits >::initialise_world ( const aether::cell_state< octree_traits > &  aether_state)
pure virtual

This is called to initialise the simulation world.

It's run only on first worker (and after its cell is initialised).

Example usage: creating the world volume or the initial agents.

template<typename OctreeTraits>
virtual bool aether::user_cell_state_interface< OctreeTraits >::is_empty ( ) const
pure virtual

Used for debugging purposes to verify that there are no entities in the cell after the cell has beed deleted.

Implemented in aether::entity_based_user_state_adapter< EntityUserState >.

template<typename OctreeTraits>
virtual bool aether::user_cell_state_interface< OctreeTraits >::is_idle ( ) const
pure virtual
Returns
true when the cell can to be deinitialized.

By default the cells are deinitialized when they don't own any agents and there are no ghost agents nearby which could be moved into the cell

Implemented in aether::entity_based_user_state_adapter< EntityUserState >.

template<typename OctreeTraits>
virtual std::unordered_map<key_type, data_type> aether::user_cell_state_interface< OctreeTraits >::publish_global_kv_store_data ( const aether::cell_state< octree_traits > &  aether_state)
pure virtual

publishes data to the store to make it avaliable to other workers

template<typename OctreeTraits>
virtual void aether::user_cell_state_interface< OctreeTraits >::receive_messages ( const aether::cell_state< octree_traits > &  aether_state,
message_reader_type &  reader 
)
pure virtual

This is called every tick to handle events received from the muxers or other Aether processes.

It's up to the user code to distinguish between the two. The reader enables the user code to read multiple messages.

template<typename OctreeTraits>
virtual void aether::user_cell_state_interface< OctreeTraits >::send_messages ( const aether::cell_state< octree_traits > &  aether_state,
message_writer_type &  writer 
)
pure virtual

This function is used to send messages to dispatcher.

It might be used for example to communicate with Global State.

template<typename OctreeTraits>
virtual void aether::user_cell_state_interface< OctreeTraits >::serialize_to_client ( const aether::cell_state< octree_traits > &  aether_state,
client_writer_type &  writer 
)
pure virtual

This is called by the worker to send messages to the muxer.

This is used to send information to the clients.