Commit 1c80bd93 authored by Sebastian Eibl's avatar Sebastian Eibl
Browse files

[REFACTOR] initialization of BlockForestDomain

moved initialization of BlockForestDomain into refresh function
This way the BlockForestDomain can be refreshed (e.g. as part of
the load balancing) without recreating it.
parent 668979ee
......@@ -32,6 +32,12 @@ namespace domain {
/// \post neighborSubdomains_ is sorted by rank
BlockForestDomain::BlockForestDomain(const std::shared_ptr<blockforest::BlockForest>& blockForest)
: blockForest_(blockForest)
{
refresh();
}
/// \post neighborSubdomains_ is sorted by rank
void BlockForestDomain::refresh()
{
ownRank_ = mpi::MPIManager::instance()->rank();
......@@ -41,6 +47,9 @@ BlockForestDomain::BlockForestDomain(const std::shared_ptr<blockforest::BlockFor
if (blockForest_->empty()) return;
localAABBs_.clear();
neighborSubdomains_.clear();
neighborProcesses_.clear();
unionOfLocalAABBs_ = blockForest_->begin()->getAABB();
for (auto& iBlk : *blockForest_)
{
......
......@@ -35,6 +35,14 @@ class BlockForestDomain : public IDomain
public:
BlockForestDomain(const std::shared_ptr<blockforest::BlockForest>& blockForest);
/**
* @brief If the BlockForest is changed this function has to be called in order to
* update all interal caches!
*
* Updates the local caches for local and neighbor AABBs.
*/
void refresh();
bool isContainedInProcessSubdomain(const uint_t rank, const Vec3& pt) const override;
bool isContainedInLocalSubdomain(const Vec3& pt, const real_t& radius) const override;
/// Is the sphere defined by \p pt and \p radius completely inside the local subdomin?
......@@ -48,6 +56,7 @@ public:
bool intersectsWithProcessSubdomain(const uint_t rank, const Vec3& pt, const real_t& radius) const override;
void correctParticlePosition(Vec3& pt) const override;
const math::AABB& getUnionOfLocalAABBs() const {return unionOfLocalAABBs_;}
size_t getNumLocalAABBs() const {return localAABBs_.size();}
size_t getNumNeighborSubdomains() const {return neighborSubdomains_.size();}
size_t getNumNeighborProcesses() const {return neighborProcesses_.size();}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment