18 #if !defined(__FLECSI_PRIVATE__) 19 #error Do not include this file directly! 22 #include "../entity_storage.hh" 23 #include "../index_space.hh" 34 template<
class TREE_TYPE>
38 static constexpr
size_t num_partitions = 5;
40 using entity_t =
typename TREE_TYPE::entity_t;
41 using node_t =
typename TREE_TYPE::node_t;
42 using tree_entity_t =
typename TREE_TYPE::tree_entity_t;
54 std::array<entity_partition_index_spaces_t, num_partitions>
55 entity_partition_index_spaces;
67 std::array<tree_entity_partition_index_spaces_t, num_partitions>
68 tree_entity_partition_index_spaces;
80 std::array<node_partition_index_spaces_t, num_partitions>
81 node_partition_index_spaces;
87 void finalize_storage() {
96 tree_entity_t * buf_tree_entity,
97 id_t * buf_id_tree_entity,
98 size_t num_entities) {
99 entity_index_space.
storage()->set_buffer(buf_entity, num_entities);
100 entity_index_space.
id_storage().set_buffer(buf_id_entity, num_entities);
101 tree_entity_index_space.
storage()->set_buffer(
102 buf_tree_entity, num_entities);
103 tree_entity_index_space.
id_storage().set_buffer(
104 buf_id_tree_entity, num_entities);
111 node_index_space.
storage()->set_buffer(buf, num_nodes);
117 template<
class... ARG_TYPES>
119 size_t entity = entity_index_space.
size();
121 static_cast<entity_t *
>(entity_index_space.
storage()->buffer()) + entity;
122 auto ent =
new(placement_ptr) entity_t(std::forward<ARG_TYPES>(args)...);
123 id_t global_id = id_t::make<0, 0>(entity);
124 ent->template set_global_id(global_id);
125 auto & id_storage = entity_index_space.
id_storage();
126 id_storage[entity] = global_id;
127 entity_index_space.
pushed();
void init_entities(entity_t *buf_entity, id_t *buf_id_entity, tree_entity_t *buf_tree_entity, id_t *buf_id_tree_entity, size_t num_entities)
Initialize the entitiy index space.
Definition: storage.hh:94
void init_nodes(node_t *buf, size_t num_nodes)
Definition: storage.hh:110
entity_t * make_entity(ARG_TYPES &&... args)
Definition: storage.hh:118
storage_t * storage()
Return the storage object.
Definition: index_space.hh:627
Definition: storage.hh:35
const id_storage_t & id_storage() const
Return the index storage object.
Definition: index_space.hh:1087
void pushed()
Called if an index was added to storage internally.
Definition: index_space.hh:1490
size_t size() const
Get the size of the index space.
Definition: index_space.hh:973
Definition: control.hh:31