Skip to content

Simplify management of LevelIndexSet's in GeometryGrid

In the present version the GeometryGrid::LevelIndexSets are stored as a std::vector<LevelIndexSet* Allocator>. Once accessed, the LevelIndexSet is dynamically allocated using new. Surprisingly the custom allocator is used for the std::vector of pointers itself, but not for the pointed-to LevelIndexSets.

With this patch this is changed from raw pointers to std::unique_ptr. Since the each LevelIndexSet has a single pointer as it's only member, it's also pointless to use a custom allocator for the vector storing maxLevel()+1 many of them - which is thus removed.

In principle this could be simplified further by storing LevelIndexSets by value. Each of them just contains a HostIndexSet and explicitly provides support for manual management (nullptr initialization, check for beein set, reset) of this pointer. Unfortunately IndexSets cannot be copied and thus we cannot resize a vector of them.

Merge request reports

Loading