From 9a833c9fb1b9757cdbc9bcb17c5eaa47371fb41a Mon Sep 17 00:00:00 2001
From: Sebastian Eibl <sebastian.eibl@fau.de>
Date: Fri, 9 Aug 2019 16:52:47 +0200
Subject: [PATCH] [UPDATE] updated documentation of AssocToBlock kernel

---
 src/mesa_pd/kernel/AssocToBlock.h | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/src/mesa_pd/kernel/AssocToBlock.h b/src/mesa_pd/kernel/AssocToBlock.h
index a795a3051..9936d57c6 100644
--- a/src/mesa_pd/kernel/AssocToBlock.h
+++ b/src/mesa_pd/kernel/AssocToBlock.h
@@ -18,12 +18,6 @@
 //
 //======================================================================================================================
 
-//======================================================================================================================
-//
-//  THIS FILE IS GENERATED - PLEASE CHANGE THE TEMPLATE !!!
-//
-//======================================================================================================================
-
 #pragma once
 
 #include <mesa_pd/data/DataTypes.h>
@@ -35,6 +29,16 @@ namespace walberla {
 namespace mesa_pd {
 namespace kernel {
 
+/**
+ * Kernel which updates the currentBlock property of all local properties.
+ * All particles are checked against the blocks in the BlockForest and the property
+ * is set accordingly.
+ *
+ * \attention This kernel must only be run on local particles. Ghost particles do not have
+ * a corresponding block!
+ * \post currentBlock property of all local particles is up-to-date.
+ * \ingroup mesa_pd_kernel
+ */
 class AssocToBlock
 {
 public:
@@ -72,7 +76,17 @@ inline void AssocToBlock::operator()(const size_t idx,
       }
    }
 
-   WALBERLA_CHECK_NOT_NULLPTR(currentBlock, ac.getPosition(idx) << "\n" << bf_->begin()->getAABB());
+   //cannot happen if called only for local particles!
+   //no "owning" block was found within the BlockForest...
+   if  (currentBlock == nullptr)
+   {
+      WALBERLA_LOG_DEVEL( ac.getPosition(idx) );
+      for (auto& blk : bf_->getBlockMap())
+      {
+         WALBERLA_LOG_DEVEL(blk.second->getAABB());
+      }
+   }
+   WALBERLA_CHECK_NOT_NULLPTR(currentBlock, ac.getPosition(idx));
 }
 
 } //namespace kernel
-- 
GitLab