diff options
Automatically apply prepareLattice for all grids
Diffstat (limited to 'src')
-rw-r--r-- | src/refinement/grid2D.h | 1 | ||||
-rw-r--r-- | src/refinement/grid2D.hh | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/refinement/grid2D.h b/src/refinement/grid2D.h index adfcd55..6cbbf6f 100644 --- a/src/refinement/grid2D.h +++ b/src/refinement/grid2D.h @@ -144,6 +144,7 @@ public: RefiningGrid2D<T,DESCRIPTOR>& refine(Vector<T,2> origin, Vector<T,2> extend, bool addCouplers=true); + void forEachGrid(std::function<void(Grid2D<T,DESCRIPTOR>&)>&& f); void forEachGrid(const std::string& id, std::function<void(Grid2D<T,DESCRIPTOR>&,const std::string&)>&& f); std::size_t getActiveVoxelN() const; diff --git a/src/refinement/grid2D.hh b/src/refinement/grid2D.hh index 6d16648..fdf6461 100644 --- a/src/refinement/grid2D.hh +++ b/src/refinement/grid2D.hh @@ -259,6 +259,15 @@ Vector<T,2> Grid2D<T,DESCRIPTOR>::alignExtendToGrid(Vector<T,2> extend) const } template <typename T, template<typename> class DESCRIPTOR> +void Grid2D<T,DESCRIPTOR>::forEachGrid(std::function<void(Grid2D<T,DESCRIPTOR>&)>&& f) +{ + f(*this); + for (auto& grid : _fineGrids) { + grid->forEachGrid(std::forward<decltype(f)>(f)); + } +} + +template <typename T, template<typename> class DESCRIPTOR> void Grid2D<T,DESCRIPTOR>::forEachGrid( const std::string& id, std::function<void(Grid2D<T,DESCRIPTOR>&,const std::string&)>&& f) |