From bd738feda94166be3272450fbb0adcf9c6f3a25d Mon Sep 17 00:00:00 2001 From: rprat-pro Date: Mon, 9 Nov 2026 20:41:16 +0100 Subject: [PATCH 1/2] fix reset weight --- .../experimental/polyhedron/nbh_gpu/nbh_gpu_driver.hpp | 1 + .../exaDEM/experimental/polyhedron/nbh_gpu/nbh_gpu_pccp.hpp | 6 ++++++ src/polyhedron/nbh_polyhedron.cpp | 1 + 3 files changed, 8 insertions(+) diff --git a/src/experimental/include/exaDEM/experimental/polyhedron/nbh_gpu/nbh_gpu_driver.hpp b/src/experimental/include/exaDEM/experimental/polyhedron/nbh_gpu/nbh_gpu_driver.hpp index 9677e96a..06cce9fe 100644 --- a/src/experimental/include/exaDEM/experimental/polyhedron/nbh_gpu/nbh_gpu_driver.hpp +++ b/src/experimental/include/exaDEM/experimental/polyhedron/nbh_gpu/nbh_gpu_driver.hpp @@ -96,6 +96,7 @@ struct ClassifyDriverInteractionsFunc { ONIKA_HOST_DEVICE_FUNC inline void operator()(PlaceholderInteraction& item, int sub_i, int sub_j) { item.pair_.pi_.sub_ = sub_i; item.pair_.pj_.sub_ = sub_j; + item[attr::weight] = 1.0; auto& container = interaction_classifier_accessor_.get_typed_accessor(item.type()); container.set(prefix_[item.type()]++, item); } diff --git a/src/experimental/include/exaDEM/experimental/polyhedron/nbh_gpu/nbh_gpu_pccp.hpp b/src/experimental/include/exaDEM/experimental/polyhedron/nbh_gpu/nbh_gpu_pccp.hpp index c6c9c676..8fdb6cc5 100644 --- a/src/experimental/include/exaDEM/experimental/polyhedron/nbh_gpu/nbh_gpu_pccp.hpp +++ b/src/experimental/include/exaDEM/experimental/polyhedron/nbh_gpu/nbh_gpu_pccp.hpp @@ -444,6 +444,7 @@ __global__ __launch_bounds__(64, 10) void FillInteractionsPPKernel( item.pair_.pj_.sub_ = j; item.pair_.type_ = InteractionTypeId::VertexVertex; item.pair_.swap_ = false; + item[attr::weight] = 1.0; interactions[InteractionTypeId::VertexVertex].set(prefix[0]++, item); } } @@ -456,6 +457,7 @@ __global__ __launch_bounds__(64, 10) void FillInteractionsPPKernel( item.pair_.pj_.sub_ = j; item.pair_.type_ = InteractionTypeId::VertexEdge; item.pair_.swap_ = false; + item[attr::weight] = 1.0; interactions[InteractionTypeId::VertexEdge].set(prefix[1]++, item); } } @@ -468,6 +470,7 @@ __global__ __launch_bounds__(64, 10) void FillInteractionsPPKernel( item.pair_.pj_.sub_ = j; item.pair_.type_ = InteractionTypeId::VertexFace; item.pair_.swap_ = false; + item[attr::weight] = 1.0; interactions[InteractionTypeId::VertexFace].set(prefix[2]++, item); } } @@ -485,6 +488,7 @@ __global__ __launch_bounds__(64, 10) void FillInteractionsPPKernel( item.pair_.pj_.sub_ = j; item.pair_.type_ = InteractionTypeId::EdgeEdge; item.pair_.swap_ = false; + item[attr::weight] = 1.0; interactions[InteractionTypeId::EdgeEdge].set(prefix[3]++, item); } } @@ -506,6 +510,7 @@ __global__ __launch_bounds__(64, 10) void FillInteractionsPPKernel( item.pair_.pi_.sub_ = j; item.pair_.pj_.sub_ = i; item.pair_.type_ = InteractionTypeId::VertexEdge; + item[attr::weight] = 1.0; interactions[InteractionTypeId::VertexEdge].set(prefix[1]++, item); } } @@ -517,6 +522,7 @@ __global__ __launch_bounds__(64, 10) void FillInteractionsPPKernel( item.pair_.pi_.sub_ = j; item.pair_.pj_.sub_ = i; item.pair_.type_ = InteractionTypeId::VertexFace; + item[attr::weight] = 1.0; interactions[InteractionTypeId::VertexFace].set(prefix[2]++, item); } } diff --git a/src/polyhedron/nbh_polyhedron.cpp b/src/polyhedron/nbh_polyhedron.cpp index 80bc3f94..07668367 100644 --- a/src/polyhedron/nbh_polyhedron.cpp +++ b/src/polyhedron/nbh_polyhedron.cpp @@ -172,6 +172,7 @@ class UpdateGridCellInteractionPolyhedron : public OperatorNode { auto add_contact = [&manager](PlaceholderInteraction& item, int sub_i, int sub_j) -> void { item.pair_.pi_.sub_ = sub_i; item.pair_.pj_.sub_ = sub_j; + item[attr::weight] = 1.0; manager.add_item(item); }; From 6eee8c775f575282680ab5fc14be4402c12da701 Mon Sep 17 00:00:00 2001 From: rprat-pro Date: Mon, 9 Nov 2026 21:26:30 +0100 Subject: [PATCH 2/2] use reset instead of weight --- .../polyhedron/nbh_gpu/nbh_gpu_driver.hpp | 2 +- .../experimental/polyhedron/nbh_gpu/nbh_gpu_pccp.hpp | 12 ++++++------ src/polyhedron/nbh_polyhedron.cpp | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/experimental/include/exaDEM/experimental/polyhedron/nbh_gpu/nbh_gpu_driver.hpp b/src/experimental/include/exaDEM/experimental/polyhedron/nbh_gpu/nbh_gpu_driver.hpp index 06cce9fe..1b9e93d2 100644 --- a/src/experimental/include/exaDEM/experimental/polyhedron/nbh_gpu/nbh_gpu_driver.hpp +++ b/src/experimental/include/exaDEM/experimental/polyhedron/nbh_gpu/nbh_gpu_driver.hpp @@ -96,7 +96,7 @@ struct ClassifyDriverInteractionsFunc { ONIKA_HOST_DEVICE_FUNC inline void operator()(PlaceholderInteraction& item, int sub_i, int sub_j) { item.pair_.pi_.sub_ = sub_i; item.pair_.pj_.sub_ = sub_j; - item[attr::weight] = 1.0; + item.reset(); auto& container = interaction_classifier_accessor_.get_typed_accessor(item.type()); container.set(prefix_[item.type()]++, item); } diff --git a/src/experimental/include/exaDEM/experimental/polyhedron/nbh_gpu/nbh_gpu_pccp.hpp b/src/experimental/include/exaDEM/experimental/polyhedron/nbh_gpu/nbh_gpu_pccp.hpp index 8fdb6cc5..4e1a6502 100644 --- a/src/experimental/include/exaDEM/experimental/polyhedron/nbh_gpu/nbh_gpu_pccp.hpp +++ b/src/experimental/include/exaDEM/experimental/polyhedron/nbh_gpu/nbh_gpu_pccp.hpp @@ -444,7 +444,7 @@ __global__ __launch_bounds__(64, 10) void FillInteractionsPPKernel( item.pair_.pj_.sub_ = j; item.pair_.type_ = InteractionTypeId::VertexVertex; item.pair_.swap_ = false; - item[attr::weight] = 1.0; + item.reset(); interactions[InteractionTypeId::VertexVertex].set(prefix[0]++, item); } } @@ -457,7 +457,7 @@ __global__ __launch_bounds__(64, 10) void FillInteractionsPPKernel( item.pair_.pj_.sub_ = j; item.pair_.type_ = InteractionTypeId::VertexEdge; item.pair_.swap_ = false; - item[attr::weight] = 1.0; + item.reset(); interactions[InteractionTypeId::VertexEdge].set(prefix[1]++, item); } } @@ -470,7 +470,7 @@ __global__ __launch_bounds__(64, 10) void FillInteractionsPPKernel( item.pair_.pj_.sub_ = j; item.pair_.type_ = InteractionTypeId::VertexFace; item.pair_.swap_ = false; - item[attr::weight] = 1.0; + item.reset(); interactions[InteractionTypeId::VertexFace].set(prefix[2]++, item); } } @@ -488,7 +488,7 @@ __global__ __launch_bounds__(64, 10) void FillInteractionsPPKernel( item.pair_.pj_.sub_ = j; item.pair_.type_ = InteractionTypeId::EdgeEdge; item.pair_.swap_ = false; - item[attr::weight] = 1.0; + item.reset(); interactions[InteractionTypeId::EdgeEdge].set(prefix[3]++, item); } } @@ -510,7 +510,7 @@ __global__ __launch_bounds__(64, 10) void FillInteractionsPPKernel( item.pair_.pi_.sub_ = j; item.pair_.pj_.sub_ = i; item.pair_.type_ = InteractionTypeId::VertexEdge; - item[attr::weight] = 1.0; + item.reset(); interactions[InteractionTypeId::VertexEdge].set(prefix[1]++, item); } } @@ -522,7 +522,7 @@ __global__ __launch_bounds__(64, 10) void FillInteractionsPPKernel( item.pair_.pi_.sub_ = j; item.pair_.pj_.sub_ = i; item.pair_.type_ = InteractionTypeId::VertexFace; - item[attr::weight] = 1.0; + item.reset(); interactions[InteractionTypeId::VertexFace].set(prefix[2]++, item); } } diff --git a/src/polyhedron/nbh_polyhedron.cpp b/src/polyhedron/nbh_polyhedron.cpp index 07668367..6329834e 100644 --- a/src/polyhedron/nbh_polyhedron.cpp +++ b/src/polyhedron/nbh_polyhedron.cpp @@ -172,7 +172,7 @@ class UpdateGridCellInteractionPolyhedron : public OperatorNode { auto add_contact = [&manager](PlaceholderInteraction& item, int sub_i, int sub_j) -> void { item.pair_.pi_.sub_ = sub_i; item.pair_.pj_.sub_ = sub_j; - item[attr::weight] = 1.0; + item.reset(); manager.add_item(item); };