Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
bd8b1b7
Refactor GridPointSearch to support dimensional template specialization.
matthew-mccall Mar 21, 2025
e7c0d3c
Switch `optional` to `unique_ptr`
matthew-mccall Mar 21, 2025
8341005
Add 3D grid point search functionality and refactor 2D implementation
matthew-mccall Apr 5, 2025
479402a
Replace custom barycentric_from_global with Omega_h implementation
matthew-mccall Apr 11, 2025
a026505
Add bbox_verts_within_simplex function and virtual destructor
matthew-mccall Apr 11, 2025
ca77662
Refactor point search to support 3D grids.
matthew-mccall Apr 11, 2025
300e2d5
Add REGION dimensionality to point search
matthew-mccall Apr 18, 2025
7d955e9
Refactor edge and vertex search loops in 2D grid point localization
matthew-mccall Oct 8, 2025
9d76b10
Reversed algorithm logic and implemented tolerances
matthew-mccall Oct 8, 2025
34d2ceb
Refactor point search tolerances handling and rename Result fields
matthew-mccall Oct 30, 2025
6410f48
Refactor GridPointSearch2D result assignment logic and update toleran…
matthew-mccall Oct 30, 2025
b8ca69b
Refactor edge handling in GridPointSearch2D and extend test cases
matthew-mccall Nov 5, 2025
a1e8094
Ran clang format
matthew-mccall Nov 5, 2025
a662bcc
fix narrowing conversion
matthew-mccall Nov 5, 2025
8f59ed7
Correctly initialize initial min and max for n dimensions
matthew-mccall Nov 10, 2025
0494b01
correct wording for 3D meshes
matthew-mccall Nov 10, 2025
b3c9ace
update TODO comment in omega_h_field.h
matthew-mccall Nov 10, 2025
3e21a53
Update OmegaHField2 to use GridPointSearch2D
matthew-mccall Nov 12, 2025
64871de
Apply minor formatting adjustments and line splits in point_search an…
matthew-mccall Nov 19, 2025
30e903e
Remove unused `KOKKOS_FUNCTION` annotation and correct TODO comment i…
matthew-mccall Nov 19, 2025
c6905c4
Replace `GridPointSearch` with `GridPointSearch2D` in `omega_h_field2…
matthew-mccall Dec 10, 2025
faf9a02
Refactor `distance_from_line` to use vector-based formulation and sim…
matthew-mccall Dec 10, 2025
f210169
Refactor `normal_intersects_segment` to use vector-based approach, si…
matthew-mccall Feb 10, 2026
53c73fc
Fix `PointSearchTolerances` initialization in `test_point_search.cpp`…
matthew-mccall Feb 19, 2026
a01e55d
Apply minor formatting fixes and update variable types in `distance_f…
matthew-mccall Feb 26, 2026
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,14 +121,14 @@ 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_;
Omega_h::Int dim_;

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 @@ -161,7 +161,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 @@ -302,7 +302,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 @@ -26,14 +26,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();
pcms::printInfo("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 @@ -119,7 +119,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 @@ -130,7 +130,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