Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
55c3aa5
Refactor GridPointSearch to support dimensional template specialization.
matthew-mccall Mar 21, 2025
40c9ecb
Switch `optional` to `unique_ptr`
matthew-mccall Mar 21, 2025
40a86e8
Add 3D grid point search functionality and refactor 2D implementation
matthew-mccall Apr 5, 2025
29c2b05
Replace custom barycentric_from_global with Omega_h implementation
matthew-mccall Apr 11, 2025
c27347f
Add bbox_verts_within_simplex function and virtual destructor
matthew-mccall Apr 11, 2025
379f87c
Refactor point search to support 3D grids.
matthew-mccall Apr 11, 2025
66e3a14
Add REGION dimensionality to point search
matthew-mccall Apr 18, 2025
e0d2c53
Refactor edge and vertex search loops in 2D grid point localization
matthew-mccall Oct 8, 2025
1beba36
Reversed algorithm logic and implemented tolerances
matthew-mccall Oct 8, 2025
fdcb8fc
Refactor point search tolerances handling and rename Result fields
matthew-mccall Oct 30, 2025
a5a8285
Refactor GridPointSearch2D result assignment logic and update toleran…
matthew-mccall Oct 30, 2025
429e71f
Refactor edge handling in GridPointSearch2D and extend test cases
matthew-mccall Nov 5, 2025
e2e1ca1
Ran clang format
matthew-mccall Nov 5, 2025
8a33f77
fix narrowing conversion
matthew-mccall Nov 5, 2025
4a725bb
Correctly initialize initial min and max for n dimensions
matthew-mccall Nov 10, 2025
12a4dc8
correct wording for 3D meshes
matthew-mccall Nov 10, 2025
e57b392
update TODO comment in omega_h_field.h
matthew-mccall Nov 10, 2025
f21e70e
Update OmegaHField2 to use GridPointSearch2D
matthew-mccall Nov 12, 2025
df4442e
Apply minor formatting adjustments and line splits in point_search an…
matthew-mccall Nov 19, 2025
da4ca61
Remove unused `KOKKOS_FUNCTION` annotation and correct TODO comment i…
matthew-mccall Nov 19, 2025
33625cf
Replace `GridPointSearch` with `GridPointSearch2D` in `omega_h_field2…
matthew-mccall Dec 10, 2025
0c7fbcd
Refactor `distance_from_line` to use vector-based formulation and sim…
matthew-mccall Dec 10, 2025
63b9cd9
Refactor `normal_intersects_segment` to use vector-based approach, si…
matthew-mccall Feb 10, 2026
39c1fed
Fix `PointSearchTolerances` initialization in `test_point_search.cpp`…
matthew-mccall Feb 19, 2026
f26275c
Apply minor formatting fixes and update variable types in `distance_f…
matthew-mccall Feb 26, 2026
d0f9e2e
Add `fuzz` parameter to `GridPointSearch3D` for adjustable tolerance …
matthew-mccall Mar 4, 2026
0ee12fc
Apply minor formatting adjustments and line splits in `point_search.c…
matthew-mccall Mar 4, 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,
OutOfBoundsMode mode)
: mode_(mode), num_valid_(0), num_missing_(0)
{
Expand Down Expand Up @@ -355,7 +355,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>(
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 @@ -61,7 +61,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
4 changes: 2 additions & 2 deletions src/pcms/create_field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ CreateUniformGridBinaryFieldFromGrid<2>(Omega_h::Mesh& mesh,
const LO num_vertices = (grid.divisions[0] + 1) * (grid.divisions[1] + 1);

// Create GridPointSearch for point-in-mesh queries
GridPointSearch point_search(mesh, grid.divisions[0], grid.divisions[1]);
GridPointSearch2D point_search(mesh, grid.divisions[0], grid.divisions[1]);

// Create array of grid vertex points
Kokkos::View<Real* [dim]> vertices("vertices", num_vertices);
Expand Down Expand Up @@ -80,7 +80,7 @@ CreateUniformGridBinaryFieldFromGrid<2>(Omega_h::Mesh& mesh,
// Create binary data as Real values (0.0 or 1.0)
Kokkos::View<Real*, HostMemorySpace> binary_data("binary_data", num_vertices);
for (LO i = 0; i < num_vertices; ++i) {
binary_data(i) = (results_h(i).tri_id >= 0) ? 1.0 : 0.0;
binary_data(i) = (results_h(i).element_id >= 0) ? 1.0 : 0.0;
}
fprintf(stderr, "Generated binary inside/outside data for grid vertices.\n");

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