Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastián Barschkis <sebbas@sebbas.org>2021-06-18 13:18:21 +0300
committerSebastián Barschkis <sebbas@sebbas.org>2021-06-18 13:18:21 +0300
commitadefdbc9dfa34eed505820fdd8a1569a19eb0cb7 (patch)
tree49dc3d174290ab143b8de6fb7a4ac4b9c7c0a699 /extern/mantaflow/preprocessed/kernel.h
parent7c681477094e16dd386201c364337dc068ec595a (diff)
Fluid: Optimization for FLIP neighbor search radius
Contributed by @erik85 in D11400. The idea from this patch was placed in a more generic context: A new FOR macro has been added that loops over the neighbors of a cell within a given radius.
Diffstat (limited to 'extern/mantaflow/preprocessed/kernel.h')
-rw-r--r--extern/mantaflow/preprocessed/kernel.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/extern/mantaflow/preprocessed/kernel.h b/extern/mantaflow/preprocessed/kernel.h
index 90e30cd21e1..dbcc2342a11 100644
--- a/extern/mantaflow/preprocessed/kernel.h
+++ b/extern/mantaflow/preprocessed/kernel.h
@@ -71,6 +71,19 @@ class ParticleBase;
for (int j = bnd; j < (grid).getSizeY() - bnd; ++j) \
for (int i = bnd; i < (grid).getSizeX() - bnd; ++i)
+#define FOR_NEIGHBORS_BND(grid, radius, bnd) \
+ for (int zj = ((grid).is3D() ? std::max(bnd, k - radius) : 0); \
+ zj <= ((grid).is3D() ? std::min(k + radius, (grid).getSizeZ() - 1 - bnd) : 0); \
+ zj++) \
+ for (int yj = std::max(bnd, j - radius); \
+ yj <= std::min(j + radius, (grid).getSizeY() - 1 - bnd); \
+ yj++) \
+ for (int xj = std::max(bnd, i - radius); \
+ xj <= std::min(i + radius, (grid).getSizeX() - 1 - bnd); \
+ xj++)
+
+#define FOR_NEIGHBORS(grid, radius) FOR_NEIGHBORS_BND(grid, radius, 0)
+
//! Basic data structure for kernel data, initialized based on kernel type (e.g. single, idx, etc).
struct KernelBase {
int maxX, maxY, maxZ, minZ, maxT, minT;