Skip to content

Commit

Permalink
Merge pull request #1142 from LLNL/bugfix/han12/debug_mesh_tester
Browse files Browse the repository at this point in the history
Fix mesh tester example and add tests
  • Loading branch information
bmhan12 authored Jul 21, 2023
2 parents e809258 + 7cf73e5 commit a3000a3
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/axom/core/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ endif()
#------------------------------------------------------------------------------
# OpenMP GTests
#------------------------------------------------------------------------------
if (AXOM_ENABLE_OPENMP AND AXOM_USE_RAJA)
if (AXOM_ENABLE_OPENMP AND RAJA_FOUND)
set( core_openmp_tests
core_openmp_map.hpp
)
Expand Down
4 changes: 2 additions & 2 deletions src/axom/quest/detail/Discretize_detail.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ template <typename ExecSpace>
int discrSeg(const Point2D &a,
const Point2D &b,
int levels,
const axom::ArrayView<OctType> &out,
axom::ArrayView<OctType> &out,
int idx)
{
// Assert input assumptions
Expand Down Expand Up @@ -219,7 +219,7 @@ int discrSeg(const Point2D &a,
// with comment "the ends switch each level."
axom::for_all<ExecSpace>(
curr_lvl_count,
AXOM_LAMBDA(axom::IndexType i) {
AXOM_LAMBDA(axom::IndexType i) mutable {
out[next_lvl + i * lvl_factor + 0] =
new_inscribed_prism(out[curr_lvl + i], Q, T, S, R, pa, pb);
out[next_lvl + i * lvl_factor + 1] =
Expand Down
10 changes: 5 additions & 5 deletions src/axom/quest/detail/MeshTester_detail.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ struct CandidateFinderBase
* \note This should be implemented in derived CandidateFinder template
* specializations for each supported acceleration data structure.
*/
virtual axom::Array<IndexType, 1, Space> getCandidates(
virtual axom::ArrayView<IndexType, 1, Space> getCandidates(
axom::Array<IndexType, 1, Space>& offsets,
axom::Array<IndexType, 1, Space>& counts) = 0;

Expand Down Expand Up @@ -219,7 +219,7 @@ void CandidateFinderBase<ExecSpace, FloatType>::findTriMeshIntersections(

// Get CSR arrays for candidate data
IndexArray offsets, counts;
IndexView candidates = getCandidates(offsets, counts).view();
IndexView candidates = getCandidates(offsets, counts);

IndexArray indices(candidates.size());
IndexArray validCandidates(candidates.size());
Expand Down Expand Up @@ -328,7 +328,7 @@ struct CandidateFinder<AccelType::BVH, ExecSpace, FloatType>
using BaseClass::HostSpace;
using BaseClass::Space;

virtual axom::Array<IndexType, 1, Space> getCandidates(
virtual axom::ArrayView<IndexType, 1, Space> getCandidates(
axom::Array<IndexType, 1, Space>& offsets,
axom::Array<IndexType, 1, Space>& counts) override
{
Expand Down Expand Up @@ -417,7 +417,7 @@ struct CandidateFinder<AccelType::ImplicitGrid, ExecSpace, FloatType>
m_resolutions = axom::primal::Point<IndexType, 3>(spatialIndexResolution);
}

virtual axom::Array<IndexType, 1, Space> getCandidates(
virtual axom::ArrayView<IndexType, 1, Space> getCandidates(
axom::Array<IndexType, 1, Space>& offsets,
axom::Array<IndexType, 1, Space>& counts) override
{
Expand Down Expand Up @@ -471,7 +471,7 @@ struct CandidateFinder<AccelType::UniformGrid, ExecSpace, FloatType>
m_resolutions = axom::primal::NumericArray<int, 3>(spatialIndexResolution);
}

virtual axom::Array<IndexType, 1, Space> getCandidates(
virtual axom::ArrayView<IndexType, 1, Space> getCandidates(
axom::Array<IndexType, 1, Space>& offsets,
axom::Array<IndexType, 1, Space>& counts) override
{
Expand Down
33 changes: 33 additions & 0 deletions src/tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,39 @@ if(AXOM_ENABLE_QUEST)
blt_add_target_compile_flags(TO mesh_tester FLAGS "-fgpu-rdc")
blt_add_target_link_flags(TO mesh_tester FLAGS "-fgpu-rdc")
endif()

# Add unit tests
if(AXOM_ENABLE_TESTS AND AXOM_DATA_DIR AND RAJA_FOUND AND UMPIRE_FOUND)

# Run the mesh_tester with the plane_simp_problems.stl example and
# different spatial indexes, raja policies

set(plane_data_dir "${AXOM_DATA_DIR}/quest/plane_simp_problems.stl")

set(_methods "bvh" "implicit" "uniform")

set (_policies "raja_seq")
blt_list_append(TO _policies ELEMENTS "raja_omp" IF AXOM_ENABLE_OPENMP)
blt_list_append(TO _policies ELEMENTS "raja_cuda" IF AXOM_ENABLE_CUDA)

foreach(_method ${_methods})
foreach(_policy ${_policies})

set(_testname "mesh_tester_${_method}_${_policy}")
axom_add_test(
NAME ${_testname}
COMMAND mesh_tester
--infile ${plane_data_dir}
--method ${_method}
--policy ${_policy}
)

set_tests_properties(${_testname} PROPERTIES
PASS_REGULAR_EXPRESSION "5 intersecting tri pairs")
endforeach()
endforeach()
endif()

endif()

#------------------------------------------------------------------------------
Expand Down

0 comments on commit a3000a3

Please sign in to comment.