Skip to content

Added BVH accelerated point localization and updated localization API - #345

Open
HelenW42 wants to merge 19 commits into
SCOREC:developfrom
HelenW42:point_search
Open

Added BVH accelerated point localization and updated localization API#345
HelenW42 wants to merge 19 commits into
SCOREC:developfrom
HelenW42:point_search

Conversation

@HelenW42

Copy link
Copy Markdown
Collaborator

This PR uses ArborX::BVH to provide accelerated point localization and refactors the previous localization API (pcms::PointLocalizationSearch) to no longer use templates.

@jacobmerson jacobmerson left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few initial things to work on. I will return to this in a little while with some additional feedback.


#include <any>

#include <ArborX.hpp>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to make sure that we can build without ArborX. This will require adding a configure-time option PCMS_ENABLE_ARBORX to the CMakeLists.txt as well as an entry in configuration.h.in.

#include <ArborX.hpp>
#include <ArborX_Triangle.hpp>
#include <detail/ArborX_PairValueIndex.hpp>
#include <detail/ArborX_AttachIndices.hpp>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to carefully review if APIs from detail are needed. Typically things in detail files or namespaces are internal implementation details and liable to change without notice.

Comment on lines +12 to +16
#include <Omega_h_mesh.hpp>
#include <Omega_h_bbox.hpp>
#include <Omega_h_shape.hpp>
#include <Omega_h_matrix.hpp>
#include <Omega_h_simplex.hpp>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure we only include these if PCMS is built with Omega_h. I.e., use #IFDEF PCMS_ENABLE_OMEGA_H

namespace detail
{

/**

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed in the header, or can it be moved to the .cpp file?

* compatability with ArborX::BVH
*/
template <int dim>
struct Omega_h_Mesh_Adapt

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be moved to the CPP file? It seems like an implementation detail we don't want to expose in the header.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Rather than commenting on every instance I think most of what's here can be moved to the .cpp file since it is specific template instantiations that are only used to drive the implementation of the localization class.
  2. We are slowly moving all header files over to .hpp since this is a new file, let's use the .hpp extension.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit confused about the current file naming (I understand that much of this was inherited). I think we should roughly have the following:

  • localization.hpp: include base class pure virtual interface for localization
  • uniform_grid_localization.hpp: class definition for uniform grid-based localization inheriting from the base class.
  • arbor_x_localization.hpp: class definition for ArborX
  • associated .cpp files

We should ameks sure that as much code as possible is in the .cpp file rather than the header file. This a) makes it easier for the consumer to know how to interact with the library, b) limits the likelyhood of conflicts from consumers c) increases the compile performance

Kokkos::parallel_for("copy_coords", n_pts, copy_functor);

auto results_d = search(coords_d);
auto results_d = search.apply(coords);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure any methods have PascalCase (capitalize the first letter of every word).

mesh_localization.cpp
point_localization.cpp
)
find_package(ArborX REQUIRED)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only require this if PCMS_ENABLE_ARBORX=ON

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants