From 960c33b2dec20a735dc7896501c451c444443677 Mon Sep 17 00:00:00 2001 From: Cameron Smith Date: Mon, 16 Mar 2026 11:46:26 -0400 Subject: [PATCH 1/2] need host/device fn, use kokkos array --- src/pcms/localization/point_search.cpp | 9 +++++---- src/pcms/utility/bounding_box.h | 4 ++-- src/pcms/utility/uniform_grid.h | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/pcms/localization/point_search.cpp b/src/pcms/localization/point_search.cpp index 17bec5a0..2a1d9ba3 100644 --- a/src/pcms/localization/point_search.cpp +++ b/src/pcms/localization/point_search.cpp @@ -44,10 +44,11 @@ AABBox<2> triangle_bbox(const Omega_h::Matrix<2, 3>& coords) } template +KOKKOS_INLINE_FUNCTION AABBox simplex_bbox(const Omega_h::Matrix& coords) { - std::array max; - std::array min; + Kokkos::Array max; + Kokkos::Array min; for (int j = 0; j < dim; ++j) { max[j] = coords(j, 0); min[j] = coords(j, 0); @@ -59,8 +60,8 @@ AABBox simplex_bbox(const Omega_h::Matrix& coords) } } - std::array center; - std::array half_width; + Kokkos::Array center; + Kokkos::Array half_width; for (int j = 0; j < dim; ++j) { center[j] = (max[j] + min[j]) / 2.0; diff --git a/src/pcms/utility/bounding_box.h b/src/pcms/utility/bounding_box.h index 9bc7ca0b..32a0c21b 100644 --- a/src/pcms/utility/bounding_box.h +++ b/src/pcms/utility/bounding_box.h @@ -10,9 +10,9 @@ template struct AABBox { static constexpr int dim = DIM; - std::array center; + Kokkos::Array center; // half length of bounding box - std::array half_width; + Kokkos::Array half_width; }; template diff --git a/src/pcms/utility/uniform_grid.h b/src/pcms/utility/uniform_grid.h index 5fa07a24..1a478fec 100644 --- a/src/pcms/utility/uniform_grid.h +++ b/src/pcms/utility/uniform_grid.h @@ -58,7 +58,7 @@ struct UniformGrid auto index = GetDimensionedIndex(idx); reverse(index); - std::array half_width, center; + Kokkos::Array half_width, center; for (size_t i = 0; i < dim; ++i) { half_width[i] = edge_length[i] / divisions[i] / 2; From 79c41261b61df1a5b96e7f5965b476a7e081cd3f Mon Sep 17 00:00:00 2001 From: Cameron Smith Date: Mon, 16 Mar 2026 13:44:31 -0400 Subject: [PATCH 2/2] attempt to fix formatting this is using clang-format from llvm 16 instead of 18 the CI suggested --- src/pcms/localization/point_search.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/pcms/localization/point_search.cpp b/src/pcms/localization/point_search.cpp index 2a1d9ba3..97d025c1 100644 --- a/src/pcms/localization/point_search.cpp +++ b/src/pcms/localization/point_search.cpp @@ -44,8 +44,8 @@ AABBox<2> triangle_bbox(const Omega_h::Matrix<2, 3>& coords) } template -KOKKOS_INLINE_FUNCTION -AABBox simplex_bbox(const Omega_h::Matrix& coords) +KOKKOS_INLINE_FUNCTION AABBox simplex_bbox( + const Omega_h::Matrix& coords) { Kokkos::Array max; Kokkos::Array min; @@ -209,8 +209,7 @@ template * Check if a triangle element represented by 3 coordinates in two dimensions * intersects with a bounding box */ -[[nodiscard]] -KOKKOS_FUNCTION bool triangle_intersects_bbox( +[[nodiscard]] KOKKOS_FUNCTION bool triangle_intersects_bbox( const Omega_h::Matrix<2, 3>& coords, const AABBox<2>& bbox, Real fuzz) { // triangle and grid cell bounding box intersect @@ -235,8 +234,7 @@ KOKKOS_FUNCTION bool triangle_intersects_bbox( } template -[[nodiscard]] -KOKKOS_FUNCTION bool simplex_intersects_bbox( +[[nodiscard]] KOKKOS_FUNCTION bool simplex_intersects_bbox( const Omega_h::Matrix& coords, const AABBox& bbox) { return intersects(simplex_bbox(coords), bbox);