From 7d6a8e5a92c522cf7c5bebf76934d0c338ba6cc0 Mon Sep 17 00:00:00 2001 From: Sebastian Eibl <sebastian.eibl@fau.de> Date: Mon, 2 Sep 2019 14:51:36 +0200 Subject: [PATCH] optimized performance of InfoCollection generation --- src/mesa_pd/domain/InfoCollection.h | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/mesa_pd/domain/InfoCollection.h b/src/mesa_pd/domain/InfoCollection.h index d7796df85..be0d280ff 100644 --- a/src/mesa_pd/domain/InfoCollection.h +++ b/src/mesa_pd/domain/InfoCollection.h @@ -55,23 +55,24 @@ void createWithNeighborhood(Accessor& ac, const BlockForest& bf, pe::InfoCollect ++info.computationalWeight; } - } - - for (uint_t branchID = 0; branchID < 8; ++branchID) - { - const auto childID = BlockID(block->getId(), branchID); - const auto childAABB = bf.getAABBFromBlockId(childID); - pe::BlockInfo& childInfo = ic[childID]; - if (childAABB.contains(ac.getPosition(idx))) + for (uint_t branchID = 0; branchID < 8; ++branchID) { - if (data::particle_flags::isSet( ac.getFlags(idx), data::particle_flags::GHOST)) - { - ++childInfo.communicationWeight; - } else + const auto childID = BlockID(block->getId(), branchID); + const auto childAABB = bf.getAABBFromBlockId(childID); + pe::BlockInfo& childInfo = ic[childID]; + if (childAABB.contains(ac.getPosition(idx))) { - ++childInfo.computationalWeight; + if (data::particle_flags::isSet( ac.getFlags(idx), data::particle_flags::GHOST)) + { + ++childInfo.communicationWeight; + } else + { + ++childInfo.computationalWeight; + } + break; //particle can only be located within one child } } + break; //particle can only be located within one block } } } -- GitLab