Adding support for a position hint to get_contained_cells for acceleration

This commit is contained in:
Patrick Shriwise 2022-01-28 11:26:48 -06:00
parent f8488e59e8
commit 2332dd2fae
4 changed files with 62 additions and 30 deletions

View file

@ -172,11 +172,12 @@ public:
//! \return Map with cell indexes as keys and
//! instances as values
std::unordered_map<int32_t, vector<int32_t>> get_contained_cells(
int32_t instance = 0) const;
int32_t instance = 0, Position* hint = nullptr) const;
protected:
//! Determine the path to this cell instance in the geometry hierarchy
vector<ParentCell> find_parent_cells(int32_t instance) const;
vector<ParentCell> find_parent_cells(
int32_t instance, Position* hint = nullptr) const;
//! Inner function for retrieving contained cells
void get_contained_cells_inner(

View file

@ -99,6 +99,11 @@ public:
virtual void get_indices(
Position r, Direction u, array<int, 3>& result) const = 0;
//! \brief Compute the the flat index for a set of lattice cell indices
//! \param i_xyz The indices for a lattice cell
//! \return Flat index into the universes vector
virtual int get_flat_index(const array<int, 3>& i_xyz) const = 0;
//! \brief Get coordinates local to a lattice tile.
//! \param r A 3D Cartesian coordinate.
//! \param i_xyz The indices for a lattice tile.
@ -210,6 +215,8 @@ public:
void get_indices(Position r, Direction u, array<int, 3>& result) const;
int get_flat_index(const array<int, 3>& i_xyz) const;
Position get_local_position(Position r, const array<int, 3>& i_xyz) const;
int32_t& offset(int map, array<int, 3> const& i_xyz);
@ -245,6 +252,8 @@ public:
void get_indices(Position r, Direction u, array<int, 3>& result) const;
int get_flat_index(const array<int, 3>& i_xyz) const;
Position get_local_position(Position r, const array<int, 3>& i_xyz) const;
bool is_valid_index(int indx) const;