Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
10 changes: 4 additions & 6 deletions src/pcms/adapter/omega_h/omega_h_field.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,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() &&
"search data structure must be constructed before use");
PCMS_ALWAYS_ASSERT(search_ != nullptr && "search data structure must be constructed before use");
return (*search_)(points);
}

Expand Down Expand Up @@ -219,9 +218,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 make this a pointer and 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
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 @@ -118,7 +118,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 @@ -129,7 +129,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