Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
647d4af
Refactor GridPointSearch to support dimensional template specialization.
matthew-mccall Mar 21, 2025
05e9c2b
Switch `optional` to `unique_ptr`
matthew-mccall Mar 21, 2025
c356deb
Add 3D grid point search functionality and refactor 2D implementation
matthew-mccall Apr 5, 2025
9242768
Replace custom barycentric_from_global with Omega_h implementation
matthew-mccall Apr 11, 2025
639a27a
Add bbox_verts_within_simplex function and virtual destructor
matthew-mccall Apr 11, 2025
d0a5554
Refactor point search to support 3D grids.
matthew-mccall Apr 11, 2025
5f38bc5
Add REGION dimensionality to point search
matthew-mccall Apr 18, 2025
c9db6ec
Refactor edge and vertex search loops in 2D grid point localization
matthew-mccall Oct 8, 2025
cbed232
Reversed algorithm logic and implemented tolerances
matthew-mccall Oct 8, 2025
79a89f6
Refactor point search tolerances handling and rename Result fields
matthew-mccall Oct 30, 2025
a873b51
Refactor GridPointSearch2D result assignment logic and update toleran…
matthew-mccall Oct 30, 2025
e7754ce
Refactor edge handling in GridPointSearch2D and extend test cases
matthew-mccall Nov 5, 2025
197d20b
Ran clang format
matthew-mccall Nov 5, 2025
6c8aac7
fix narrowing conversion
matthew-mccall Nov 5, 2025
75fb6e3
Correctly initialize initial min and max for n dimensions
matthew-mccall Nov 10, 2025
2474af0
correct wording for 3D meshes
matthew-mccall Nov 10, 2025
f4ea99b
update TODO comment in omega_h_field.h
matthew-mccall Nov 10, 2025
0e42811
Update OmegaHField2 to use GridPointSearch2D
matthew-mccall Nov 12, 2025
1703e5d
Apply minor formatting adjustments and line splits in point_search an…
matthew-mccall Nov 19, 2025
52b125f
Remove unused `KOKKOS_FUNCTION` annotation and correct TODO comment i…
matthew-mccall Nov 19, 2025
893caaa
Replace `GridPointSearch` with `GridPointSearch2D` in `omega_h_field2…
matthew-mccall Dec 10, 2025
5d51aee
Refactor `distance_from_line` to use vector-based formulation and sim…
matthew-mccall Dec 10, 2025
969e461
Refactor `normal_intersects_segment` to use vector-based approach, si…
matthew-mccall Feb 10, 2026
68c9eab
Fix `PointSearchTolerances` initialization in `test_point_search.cpp`…
matthew-mccall Feb 19, 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,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 @@ -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