From d0efd825cbf1828ae5628e99c960c8e025156c7a Mon Sep 17 00:00:00 2001 From: Sebastian Eibl <sebastian.eibl@fau.de> Date: Tue, 23 Jan 2018 10:14:29 +0100 Subject: [PATCH] adjusted weight assignment --- src/pe/amr/InfoCollection.cpp | 25 ++++++++++++++++++- .../WeightAssignmentFunctor.h | 4 +-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/pe/amr/InfoCollection.cpp b/src/pe/amr/InfoCollection.cpp index f568a3cca..4a725d32d 100644 --- a/src/pe/amr/InfoCollection.cpp +++ b/src/pe/amr/InfoCollection.cpp @@ -41,11 +41,34 @@ void createWithNeighborhood(const BlockForest& bf, const BlockDataID storageID, BodyStorage const & localStorage = (*storage)[StorageType::LOCAL]; BodyStorage const & shadowStorage = (*storage)[StorageType::SHADOW]; ic.insert( InfoCollection::value_type(block->getId(), BlockInfo(localStorage.size(), shadowStorage.size())) ); - for( uint_t nb = uint_t(0); nb < block->getNeighborhoodSize(); ++nb ) { bs.sendBuffer( block->getNeighborProcess(nb) ) << InfoCollection::value_type(block->getId(), BlockInfo(localStorage.size(), shadowStorage.size())); } + + for (uint_t branchID = 0; branchID < 8; ++branchID) + { + const auto childID = BlockID(block->getId(), branchID); + const auto childAABB = bf.getAABBFromBlockId(childID); + uint_t local = 0; + for (auto bodyIt = localStorage.begin(); bodyIt != localStorage.end(); ++bodyIt) + { + if (childAABB.contains(bodyIt->getPosition())) + ++local; + } + uint_t shadow = 0; + for (auto bodyIt = shadowStorage.begin(); bodyIt != shadowStorage.end(); ++bodyIt) + { + if (childAABB.contains(bodyIt->getPosition())) + ++shadow; + } + ic.insert( InfoCollection::value_type(childID, BlockInfo(local, shadow)) ); + + for( uint_t nb = uint_t(0); nb < block->getNeighborhoodSize(); ++nb ) + { + bs.sendBuffer( block->getNeighborProcess(nb) ) << InfoCollection::value_type(childID, BlockInfo(local, shadow)); + } + } } // size of buffer is unknown and changes with each send diff --git a/src/pe/amr/weight_assignment/WeightAssignmentFunctor.h b/src/pe/amr/weight_assignment/WeightAssignmentFunctor.h index 4f5b897e8..3a6b5d9b2 100644 --- a/src/pe/amr/weight_assignment/WeightAssignmentFunctor.h +++ b/src/pe/amr/weight_assignment/WeightAssignmentFunctor.h @@ -50,9 +50,9 @@ public: if (block->sourceBlockIsLarger()) { - auto infoIt = ic_->find( block->getId().getFatherId() ); + auto infoIt = ic_->find( block->getId()/*.getFatherId()*/ ); WALBERLA_ASSERT_UNEQUAL( infoIt, ic_->end() ); - it->second = PhantomBlockWeight( double_c(infoIt->second.numberOfLocalBodies) / double_c(8) + baseWeight ); + it->second = PhantomBlockWeight( double_c(infoIt->second.numberOfLocalBodies) + baseWeight ); continue; } -- GitLab