diff --git a/src/pe/BlockFunctions.h b/src/pe/BlockFunctions.h index c1e8e466d6fb075480b289dbdc545b54013a9d25..8987f473882ae9c6b3c9494a81ddd2e42ff6ffa3 100644 --- a/src/pe/BlockFunctions.h +++ b/src/pe/BlockFunctions.h @@ -45,12 +45,20 @@ bool hasNeighborOwner(const BlockT& block, const Owner& owner) * Looks through all neighboring blocks to find the one whose AABB contains \a pt. * Also checks if \a pt is located in the block itself. * Returns -1 if no valid block is found otherwise the process rank of the containing block is returned. + * + * \attention If periodic boundaries are used you have to make sure the point is mapped to the domain before calling this function! */ template <class BlockT> -Owner findContainingProcess(const BlockT& block, math::Vector3<real_t> pt) +Owner findContainingProcess(const BlockT& block, const math::Vector3<real_t> pt) { + WALBERLA_DEBUG_SECTION() + { + auto pt2 = pt; + block.getBlockStorage().mapToPeriodicDomain(pt2); + WALBERLA_ASSERT_EQUAL(pt, pt2); + } + if (block.getAABB().contains(pt)) return Owner(int_c(block.getProcess()), block.getId().getID()); - if (!block.getBlockStorage().getDomain().contains(pt)) block.getBlockStorage().mapToPeriodicDomain(pt); for( uint_t i = uint_t(0); i != block.getNeighborhoodSize(); ++i ) { if (block.getNeighborAABB(i).contains(pt)) return Owner(int_c(block.getNeighborProcess(i)), block.getNeighborId(i).getID());