LLNL / axom

CS infrastructure components for HPC applications
BSD 3-Clause "New" or "Revised" License
152 stars 27 forks source link

Separate templated and non-template code in DistributedClosestPointImpl #1347

Closed gunney1 closed 3 months ago

gunney1 commented 3 months ago

Separate templated and non-template code in DistributedClostetPointImpl

The refactoring simplifies the code and follows the separation of template and non-template code used in the marching cubes implementation. It helps the optimization I'm implementing in DistributedClosestPointImpl.

Motivation

Before this re-factoring, DistributedClosestPointImpl is templated on DIM and has BVH objects that are templated on DIM and ExecSpace. We had separate pointers for all possible dimensions and execution spaces. There was a lot of trivial-yet-clunky code to pick the correct pointers.

After the refactoring, DistributedClosestPointImpl contains no templated code. Its template code has been pushed down to the new class DistributedClosestPointExec, which is templated on dimension and execution space. The templated class has just one BVH, which is instantiated for the same dimension and execution space. We don't need separate pointers for all the cases--just a pointer to the base class DistributedClosesePointImpl. We only look at the dimension and execution space when allocating the DistributedClosestPointExec object.