Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
42bf41c
Refactor GridPointSearch to support dimensional template specialization.
matthew-mccall Mar 21, 2025
2e6c364
Switch `optional` to `unique_ptr`
matthew-mccall Mar 21, 2025
b848d2e
Add 3D grid point search functionality and refactor 2D implementation
matthew-mccall Apr 5, 2025
8f1dfa9
Replace custom barycentric_from_global with Omega_h implementation
matthew-mccall Apr 11, 2025
19fd482
Add bbox_verts_within_simplex function and virtual destructor
matthew-mccall Apr 11, 2025
1ae1472
Refactor point search to support 3D grids.
matthew-mccall Apr 11, 2025
ab88b05
Add REGION dimensionality to point search
matthew-mccall Apr 18, 2025
ca5caa0
Refactor edge and vertex search loops in 2D grid point localization
matthew-mccall Oct 8, 2025
26bd542
Reversed algorithm logic and implemented tolerances
matthew-mccall Oct 8, 2025
dc655c4
Refactor point search tolerances handling and rename Result fields
matthew-mccall Oct 30, 2025
18e3fab
Refactor GridPointSearch2D result assignment logic and update toleran…
matthew-mccall Oct 30, 2025
bccb55e
Refactor edge handling in GridPointSearch2D and extend test cases
matthew-mccall Nov 5, 2025
c1f9e4f
Ran clang format
matthew-mccall Nov 5, 2025
23678a5
fix narrowing conversion
matthew-mccall Nov 5, 2025
2e7e4e1
Correctly initialize initial min and max for n dimensions
matthew-mccall Nov 10, 2025
879586f
correct wording for 3D meshes
matthew-mccall Nov 10, 2025
30b7e54
correct working for 3D meshes
matthew-mccall Nov 10, 2025
32e886f
update TODO comment in omega_h_field.h
matthew-mccall Nov 10, 2025
a88e058
Update OmegaHField2 to use GridPointSearch2D
matthew-mccall Nov 12, 2025
c0a3180
Apply minor formatting adjustments and line splits in point_search an…
matthew-mccall Nov 19, 2025
9c458a7
Remove unused `KOKKOS_FUNCTION` annotation and correct TODO comment i…
matthew-mccall Nov 19, 2025
2926a79
Replace `GridPointSearch` with `GridPointSearch2D` in `omega_h_field2…
matthew-mccall Dec 10, 2025
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
9 changes: 4 additions & 5 deletions src/pcms/adapter/omega_h/omega_h_field.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,13 @@ class OmegaHField
void ConstructSearch(int nx, int ny)
{
PCMS_FUNCTION_TIMER;
search_ = GridPointSearch(mesh_, nx, ny);
search_ = std::make_unique<GridPointSearch2D>(mesh_, nx, ny);
}
// pass through to search function
[[nodiscard]] auto Search(Kokkos::View<Real* [2]> points) const
{
PCMS_FUNCTION_TIMER;
PCMS_ALWAYS_ASSERT(search_.has_value() &&
PCMS_ALWAYS_ASSERT(search_ != nullptr &&
"search data structure must be constructed before use");
return (*search_)(points);
}
Expand Down Expand Up @@ -220,9 +220,8 @@ class OmegaHField
private:
std::string name_;
Omega_h::Mesh& mesh_;
// TODO make this a pointer and introduce base class to Search for alternative
// search methods
std::optional<GridPointSearch> search_;
// TODO: introduce base class to Search for alternative search methods
std::unique_ptr<PointLocalizationSearch2D> search_;
// bitmask array that specifies a filter on the field
Omega_h::Read<LO> mask_;
LO size_;
Expand Down
12 changes: 6 additions & 6 deletions src/pcms/adapter/omega_h/omega_h_field2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ struct ComputeOffsetsFunctor
struct CountPointsPerElementFunctor
{
Kokkos::View<LO*> elem_counts_;
Kokkos::View<GridPointSearch::Result*> search_results_;
Kokkos::View<GridPointSearch2D::Result*> search_results_;

CountPointsPerElementFunctor(
Kokkos::View<LO*> elem_counts,
Kokkos::View<GridPointSearch::Result*> search_results)
Kokkos::View<GridPointSearch2D::Result*> search_results)
: elem_counts_(elem_counts), search_results_(search_results)
{
}
Expand All @@ -121,13 +121,13 @@ struct FillCoordinatesAndIndicesFunctor
Kokkos::View<LO*> offsets_;
Kokkos::View<Real**> coordinates_;
Kokkos::View<LO*> indices_;
Kokkos::View<GridPointSearch::Result*> search_results_;
Kokkos::View<GridPointSearch2D::Result*> search_results_;

FillCoordinatesAndIndicesFunctor(
Omega_h::Mesh& mesh, Kokkos::View<LO*> elem_counts,
Kokkos::View<LO*> offsets, Kokkos::View<Real**> coordinates,
Kokkos::View<LO*> indices,
Kokkos::View<GridPointSearch::Result*> search_results)
Kokkos::View<GridPointSearch2D::Result*> search_results)
: mesh_(mesh),
elem_counts_(elem_counts),
offsets_(offsets),
Expand Down Expand Up @@ -158,7 +158,7 @@ struct OmegaHField2LocalizationHint
{
OmegaHField2LocalizationHint(
Omega_h::Mesh& mesh,
Kokkos::View<GridPointSearch::Result*, HostMemorySpace> search_results)
Kokkos::View<GridPointSearch2D::Result*, HostMemorySpace> search_results)
: offsets_("", mesh.nelems() + 1),
coordinates_("", search_results.size(), mesh.dim() + 1),
indices_("", search_results.size())
Expand Down Expand Up @@ -299,7 +299,7 @@ LocalizationHint OmegaHField2::GetLocalizationHint(
coordinates.data_handle(), coordinates.extent(0), coordinates.extent(1));
deep_copy_mismatch_layouts(coords, coordinates_host);
auto results = search_(coords);
Kokkos::View<GridPointSearch::Result*, HostMemorySpace> results_h(
Kokkos::View<GridPointSearch2D::Result*, HostMemorySpace> results_h(
"results_h", results.size());
Kokkos::deep_copy(results_h, results);
auto hint = std::make_shared<OmegaHField2LocalizationHint>(mesh_, results_h);
Expand Down
2 changes: 1 addition & 1 deletion src/pcms/adapter/omega_h/omega_h_field2.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class OmegaHField2 : public FieldT<Real>
const OmegaHFieldLayout& layout_;
Omega_h::Mesh& mesh_;
std::unique_ptr<MeshFieldBackend> mesh_field_;
GridPointSearch search_;
GridPointSearch2D search_;
Kokkos::View<Real*, HostMemorySpace> dof_holder_data_;
};

Expand Down
10 changes: 5 additions & 5 deletions src/pcms/interpolator/adj_search.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ Omega_h::Real calculateDistance(const Omega_h::Real* p1,
}

inline void checkTargetPoints(
const Kokkos::View<pcms::GridPointSearch::Result*>& results)
const Kokkos::View<pcms::GridPointSearch2D::Result*>& results)
{
Kokkos::fence();
printf("INFO: Checking target points...\n");
auto check_target_points = OMEGA_H_LAMBDA(Omega_h::LO i)
{
if (results(i).tri_id < 0) {
OMEGA_H_CHECK_PRINTF(results(i).tri_id >= 0,
if (results(i).element_id < 0) {
OMEGA_H_CHECK_PRINTF(results(i).element_id >= 0,
"ERROR: Source cell id not found for target %d\n",
i);
printf("%d, ", i);
Expand Down Expand Up @@ -117,7 +117,7 @@ inline void FindSupports::adjBasedSearch(
});
Kokkos::fence();

pcms::GridPointSearch search_cell(source_mesh, 10, 10);
pcms::GridPointSearch2D search_cell(source_mesh, 10, 10);
auto results = search_cell(target_points);
checkTargetPoints(results);

Expand All @@ -128,7 +128,7 @@ inline void FindSupports::adjBasedSearch(
Track visited;
Omega_h::Real cutoffDistance = radii2[id];

Omega_h::LO source_cell_id = results(id).tri_id;
Omega_h::LO source_cell_id = results(id).element_id;
OMEGA_H_CHECK_PRINTF(
source_cell_id >= 0,
"ERROR: Source cell id not found for target %d (%f,%f)\n", id,
Expand Down
Loading