Skip to content
Snippets Groups Projects
Commit 1fb3a6aa authored by Sebastian Eibl's avatar Sebastian Eibl
Browse files

[API] added warning and assertion to findContainingProcess for points out of domain

parent 9354e6e0
Branches
Tags
No related merge requests found
......@@ -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());
......
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