Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions src/pcms/localization/point_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ AABBox<2> triangle_bbox(const Omega_h::Matrix<2, 3>& coords)
}

template <unsigned dim>
AABBox<dim> simplex_bbox(const Omega_h::Matrix<dim, dim + 1>& coords)
KOKKOS_INLINE_FUNCTION AABBox<dim> simplex_bbox(
const Omega_h::Matrix<dim, dim + 1>& coords)
{
std::array<Real, dim> max;
std::array<Real, dim> min;
Kokkos::Array<Real, dim> max;
Kokkos::Array<Real, dim> min;
for (int j = 0; j < dim; ++j) {
max[j] = coords(j, 0);
min[j] = coords(j, 0);
Expand All @@ -59,8 +60,8 @@ AABBox<dim> simplex_bbox(const Omega_h::Matrix<dim, dim + 1>& coords)
}
}

std::array<Real, dim> center;
std::array<Real, dim> half_width;
Kokkos::Array<Real, dim> center;
Kokkos::Array<Real, dim> half_width;

for (int j = 0; j < dim; ++j) {
center[j] = (max[j] + min[j]) / 2.0;
Expand Down Expand Up @@ -208,8 +209,7 @@ template <int dim>
* 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
Expand All @@ -234,8 +234,7 @@ KOKKOS_FUNCTION bool triangle_intersects_bbox(
}

template <unsigned dim>
[[nodiscard]]
KOKKOS_FUNCTION bool simplex_intersects_bbox(
[[nodiscard]] KOKKOS_FUNCTION bool simplex_intersects_bbox(
const Omega_h::Matrix<dim, dim + 1>& coords, const AABBox<dim>& bbox)
{
return intersects(simplex_bbox<dim>(coords), bbox);
Expand Down
4 changes: 2 additions & 2 deletions src/pcms/utility/bounding_box.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ template <int DIM = 2>
struct AABBox
{
static constexpr int dim = DIM;
std::array<Real, dim> center;
Kokkos::Array<Real, dim> center;
// half length of bounding box
std::array<Real, dim> half_width;
Kokkos::Array<Real, dim> half_width;
};

template <int dim>
Expand Down
2 changes: 1 addition & 1 deletion src/pcms/utility/uniform_grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct UniformGrid
auto index = GetDimensionedIndex(idx);
reverse(index);

std::array<Real, dim> half_width, center;
Kokkos::Array<Real, dim> half_width, center;

for (size_t i = 0; i < dim; ++i) {
half_width[i] = edge_length[i] / divisions[i] / 2;
Expand Down
Loading