From 55631b83f804b9ea6eaa3bfd26fad90779828e36 Mon Sep 17 00:00:00 2001 From: "Paul P.H. Wilson" Date: Thu, 7 Jan 2021 13:13:52 -0600 Subject: [PATCH 01/12] Add function to expose find_volume in DAGMC --- news/PR-0718.rst | 13 +++++++++++++ src/dagmc/DagMC.cpp | 8 ++++++++ src/dagmc/DagMC.hpp | 3 +++ 3 files changed, 24 insertions(+) create mode 100644 news/PR-0718.rst diff --git a/news/PR-0718.rst b/news/PR-0718.rst new file mode 100644 index 0000000000..2846553f7b --- /dev/null +++ b/news/PR-0718.rst @@ -0,0 +1,13 @@ +**Added:** + +* exposed the new find_volume() method that is implemented in MOAB GQT + +**Changed:** None + +**Deprecated:** None + +**Removed:** None + +**Fixed:** None + +**Security:** None diff --git a/src/dagmc/DagMC.cpp b/src/dagmc/DagMC.cpp index c086c44027..40430157c7 100644 --- a/src/dagmc/DagMC.cpp +++ b/src/dagmc/DagMC.cpp @@ -811,6 +811,14 @@ ErrorCode DagMC::point_in_volume_slow(EntityHandle volume, const double xyz[3], return rval; } +ErrorCode find_volume(const double xyz[3], EntityHandle& volume, + const double* uvw = NULL) { + + ErrorCode rval = ray_tracer->find_volume( xyz, volume, uvw); + return rval; + +} + // detemine distance to nearest surface ErrorCode DagMC::closest_to_location(EntityHandle volume, const double coords[3], double& result, diff --git a/src/dagmc/DagMC.hpp b/src/dagmc/DagMC.hpp index 5ecce3c584..85f0d51410 100644 --- a/src/dagmc/DagMC.hpp +++ b/src/dagmc/DagMC.hpp @@ -226,6 +226,9 @@ class DagMC { ErrorCode point_in_volume_slow(const EntityHandle volume, const double xyz[3], int& result); + ErrorCode find_volume(const double xyz[3], EntityHandle& volume, + const double* uvw = NULL); + ErrorCode test_volume_boundary(const EntityHandle volume, const EntityHandle surface, const double xyz[3], const double uvw[3], From 204a7c099ee5b47ad33eb618b95595d7b55ebc67 Mon Sep 17 00:00:00 2001 From: "Paul P.H. Wilson" Date: Thu, 7 Jan 2021 13:22:18 -0600 Subject: [PATCH 02/12] whitespace changes for astyle --- src/dagmc/DagMC.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/dagmc/DagMC.cpp b/src/dagmc/DagMC.cpp index 40430157c7..3aa7dd44b2 100644 --- a/src/dagmc/DagMC.cpp +++ b/src/dagmc/DagMC.cpp @@ -812,11 +812,9 @@ ErrorCode DagMC::point_in_volume_slow(EntityHandle volume, const double xyz[3], } ErrorCode find_volume(const double xyz[3], EntityHandle& volume, - const double* uvw = NULL) { - + const double* uvw = NULL) { ErrorCode rval = ray_tracer->find_volume( xyz, volume, uvw); return rval; - } // detemine distance to nearest surface From f25ed8ddda22568d754b5d150b1365f6444a5bb7 Mon Sep 17 00:00:00 2001 From: "Paul P.H. Wilson" Date: Thu, 7 Jan 2021 13:24:50 -0600 Subject: [PATCH 03/12] add DagMC scope and a comment --- src/dagmc/DagMC.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/dagmc/DagMC.cpp b/src/dagmc/DagMC.cpp index 3aa7dd44b2..884cdd6ecf 100644 --- a/src/dagmc/DagMC.cpp +++ b/src/dagmc/DagMC.cpp @@ -811,8 +811,9 @@ ErrorCode DagMC::point_in_volume_slow(EntityHandle volume, const double xyz[3], return rval; } -ErrorCode find_volume(const double xyz[3], EntityHandle& volume, - const double* uvw = NULL) { +// find a which volume contains the current point +ErrorCode DagMC::find_volume(const double xyz[3], EntityHandle& volume, + const double* uvw = NULL) { ErrorCode rval = ray_tracer->find_volume( xyz, volume, uvw); return rval; } From db455506499741614b0befc4e07d3c8511309b73 Mon Sep 17 00:00:00 2001 From: "Paul P.H. Wilson" Date: Thu, 7 Jan 2021 13:26:41 -0600 Subject: [PATCH 04/12] try a more verbose astyle failure --- CI/circleci/housekeeping.sh | 43 +++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 CI/circleci/housekeeping.sh diff --git a/CI/circleci/housekeeping.sh b/CI/circleci/housekeeping.sh new file mode 100755 index 0000000000..06b337d335 --- /dev/null +++ b/CI/circleci/housekeeping.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +set -ex + +source ${docker_env} + +cd ${dagmc_build_dir} + +# Check for news file if this is a PR into svalinn/DAGMC +if [ "${REPO_SLUG}" == "svalinn/DAGMC" ] && \ + [ "${PULL_REQUEST}" != "false" ]; then + news_file=$(printf 'news/PR-%04u.rst' ${PULL_REQUEST}) + if [ -f "${news_file}" ]; then + echo "News file ${news_file} found!" + else + echo "ERROR: News file ${news_file} not found. Please create a news file." + exit 1 + fi +fi + +# Run astyle check +astyle --options=astyle_google.ini \ + --exclude=src/gtest \ + --exclude=src/mcnp/mcnp5/Source \ + --exclude=src/mcnp/mcnp6/Source \ + --ignore-exclude-errors \ + --suffix=none \ + --recursive \ + --verbose \ + --formatted \ + "*.cc" "*.cpp" "*.h" "*.hh" "*.hpp" +astyle_diffs=`git status --porcelain` +if [ -z "${astyle_diffs}" ]; then + echo "Style guide checker passed!" +else + echo "ERROR: Style guide checker failed. Please run astyle." + # echo "astyle_diffs: ${astyle_diffs}" + git diff + exit 1 +fi + +# Build documentation +make html From eb121baab532b92702f125bd0d0db6620f9b8ef5 Mon Sep 17 00:00:00 2001 From: "Paul P.H. Wilson" Date: Thu, 7 Jan 2021 13:28:21 -0600 Subject: [PATCH 05/12] whitespace fix and add output to astyle failures --- news/PR-0718.rst | 4 +++- src/dagmc/DagMC.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/news/PR-0718.rst b/news/PR-0718.rst index 2846553f7b..99633d2d79 100644 --- a/news/PR-0718.rst +++ b/news/PR-0718.rst @@ -2,7 +2,9 @@ * exposed the new find_volume() method that is implemented in MOAB GQT -**Changed:** None +**Changed:** + +* changed housekeeping test to show differences on failure **Deprecated:** None diff --git a/src/dagmc/DagMC.cpp b/src/dagmc/DagMC.cpp index 884cdd6ecf..871fa17703 100644 --- a/src/dagmc/DagMC.cpp +++ b/src/dagmc/DagMC.cpp @@ -814,7 +814,7 @@ ErrorCode DagMC::point_in_volume_slow(EntityHandle volume, const double xyz[3], // find a which volume contains the current point ErrorCode DagMC::find_volume(const double xyz[3], EntityHandle& volume, const double* uvw = NULL) { - ErrorCode rval = ray_tracer->find_volume( xyz, volume, uvw); + ErrorCode rval = ray_tracer->find_volume(xyz, volume, uvw); return rval; } From a7a2e76c89fb0690f0139727a02ebbf9d4e7c082 Mon Sep 17 00:00:00 2001 From: "Paul P.H. Wilson" Date: Thu, 7 Jan 2021 13:36:54 -0600 Subject: [PATCH 06/12] add simple test --- src/dagmc/tests/dagmc_simple_test.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/dagmc/tests/dagmc_simple_test.cpp b/src/dagmc/tests/dagmc_simple_test.cpp index 9d46f47fb9..e5560d97e8 100644 --- a/src/dagmc/tests/dagmc_simple_test.cpp +++ b/src/dagmc/tests/dagmc_simple_test.cpp @@ -156,6 +156,16 @@ TEST_F(DagmcSimpleTest, dagmc_point_in) { EXPECT_EQ(expect_result, result); } +TEST_F(DagmcSimpleTest, dagmc_find_volume) { + int vol_idx = 1; + int vol_dim = 3; + double xyz[3] = {0.0, 0.0, 0.0}; + EntityHandle expected_vol_h = DAG->entity_by_index(vol_dim, vol_idx); + ErrorCode rval=DAG->find_volume(xyz, vol_h); + EXPECT_EQ(rval, MB_SUCCESS); + EXPECT_EQ(expected_vol_h, vol_h); +} + TEST_F(DagmcSimpleTest, dagmc_test_obb_retreval_rayfire) { // make new dagmc std::cout << "test_obb_retreval and ray_fire" << std::endl; From 3281757aa1cbf1651e9f5af76e60ea6513502065 Mon Sep 17 00:00:00 2001 From: "Paul P.H. Wilson" Date: Thu, 7 Jan 2021 13:38:32 -0600 Subject: [PATCH 07/12] whitespace in test --- src/dagmc/tests/dagmc_simple_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dagmc/tests/dagmc_simple_test.cpp b/src/dagmc/tests/dagmc_simple_test.cpp index e5560d97e8..9993d3a663 100644 --- a/src/dagmc/tests/dagmc_simple_test.cpp +++ b/src/dagmc/tests/dagmc_simple_test.cpp @@ -161,7 +161,7 @@ TEST_F(DagmcSimpleTest, dagmc_find_volume) { int vol_dim = 3; double xyz[3] = {0.0, 0.0, 0.0}; EntityHandle expected_vol_h = DAG->entity_by_index(vol_dim, vol_idx); - ErrorCode rval=DAG->find_volume(xyz, vol_h); + ErrorCode rval = DAG->find_volume(xyz, vol_h); EXPECT_EQ(rval, MB_SUCCESS); EXPECT_EQ(expected_vol_h, vol_h); } From 99a7542dcadc0b85c40510cf94b00b25067f3ff5 Mon Sep 17 00:00:00 2001 From: "Paul P.H. Wilson" Date: Thu, 7 Jan 2021 13:46:25 -0600 Subject: [PATCH 08/12] remove default arg from implementation --- src/dagmc/DagMC.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dagmc/DagMC.cpp b/src/dagmc/DagMC.cpp index 871fa17703..83c97634d8 100644 --- a/src/dagmc/DagMC.cpp +++ b/src/dagmc/DagMC.cpp @@ -813,7 +813,7 @@ ErrorCode DagMC::point_in_volume_slow(EntityHandle volume, const double xyz[3], // find a which volume contains the current point ErrorCode DagMC::find_volume(const double xyz[3], EntityHandle& volume, - const double* uvw = NULL) { + const double* uvw) { ErrorCode rval = ray_tracer->find_volume(xyz, volume, uvw); return rval; } From 01ffb8cb23ae6f94ee2b5d96a4417b379e269a39 Mon Sep 17 00:00:00 2001 From: "Paul P.H. Wilson" Date: Mon, 1 Nov 2021 21:05:22 -0500 Subject: [PATCH 09/12] remove housekeeping script again from rebase --- CI/circleci/housekeeping.sh | 43 ------------------------------------- 1 file changed, 43 deletions(-) delete mode 100755 CI/circleci/housekeeping.sh diff --git a/CI/circleci/housekeeping.sh b/CI/circleci/housekeeping.sh deleted file mode 100755 index 06b337d335..0000000000 --- a/CI/circleci/housekeeping.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -set -ex - -source ${docker_env} - -cd ${dagmc_build_dir} - -# Check for news file if this is a PR into svalinn/DAGMC -if [ "${REPO_SLUG}" == "svalinn/DAGMC" ] && \ - [ "${PULL_REQUEST}" != "false" ]; then - news_file=$(printf 'news/PR-%04u.rst' ${PULL_REQUEST}) - if [ -f "${news_file}" ]; then - echo "News file ${news_file} found!" - else - echo "ERROR: News file ${news_file} not found. Please create a news file." - exit 1 - fi -fi - -# Run astyle check -astyle --options=astyle_google.ini \ - --exclude=src/gtest \ - --exclude=src/mcnp/mcnp5/Source \ - --exclude=src/mcnp/mcnp6/Source \ - --ignore-exclude-errors \ - --suffix=none \ - --recursive \ - --verbose \ - --formatted \ - "*.cc" "*.cpp" "*.h" "*.hh" "*.hpp" -astyle_diffs=`git status --porcelain` -if [ -z "${astyle_diffs}" ]; then - echo "Style guide checker passed!" -else - echo "ERROR: Style guide checker failed. Please run astyle." - # echo "astyle_diffs: ${astyle_diffs}" - git diff - exit 1 -fi - -# Build documentation -make html From 53436b0984b99ff694987bc31d37ca0e9cd0a22c Mon Sep 17 00:00:00 2001 From: "Paul P.H. Wilson" Date: Mon, 1 Nov 2021 21:10:48 -0500 Subject: [PATCH 10/12] combine updates in Changelog --- doc/CHANGELOG.rst | 2 ++ news/PR-0718.rst | 15 --------------- 2 files changed, 2 insertions(+), 15 deletions(-) delete mode 100644 news/PR-0718.rst diff --git a/doc/CHANGELOG.rst b/doc/CHANGELOG.rst index c7ee747a8a..c60d30fb14 100644 --- a/doc/CHANGELOG.rst +++ b/doc/CHANGELOG.rst @@ -74,6 +74,8 @@ v3.2.1 * DagMC methods for creation and removal of the graveyard volume (#714) * CI build and test now support MacOS (shared build, no pymoab, no Double Down) (#780) * Added GitHub style citation file (CITATION.cff) (#790) + * exposed the new find_volume() method that is implemented in MOAB GQT (#718) + **Changed:** diff --git a/news/PR-0718.rst b/news/PR-0718.rst deleted file mode 100644 index 99633d2d79..0000000000 --- a/news/PR-0718.rst +++ /dev/null @@ -1,15 +0,0 @@ -**Added:** - -* exposed the new find_volume() method that is implemented in MOAB GQT - -**Changed:** - -* changed housekeeping test to show differences on failure - -**Deprecated:** None - -**Removed:** None - -**Fixed:** None - -**Security:** None From 4a75e3e2cf247dbd5b31986bea04ffd1b9fd3e18 Mon Sep 17 00:00:00 2001 From: "Paul P.H. Wilson" Date: Mon, 1 Nov 2021 21:21:33 -0500 Subject: [PATCH 11/12] add missing variable declaration --- src/dagmc/tests/dagmc_simple_test.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dagmc/tests/dagmc_simple_test.cpp b/src/dagmc/tests/dagmc_simple_test.cpp index 9993d3a663..a7ff3cb0b0 100644 --- a/src/dagmc/tests/dagmc_simple_test.cpp +++ b/src/dagmc/tests/dagmc_simple_test.cpp @@ -160,6 +160,7 @@ TEST_F(DagmcSimpleTest, dagmc_find_volume) { int vol_idx = 1; int vol_dim = 3; double xyz[3] = {0.0, 0.0, 0.0}; + EntityHandle vol_h; EntityHandle expected_vol_h = DAG->entity_by_index(vol_dim, vol_idx); ErrorCode rval = DAG->find_volume(xyz, vol_h); EXPECT_EQ(rval, MB_SUCCESS); From 46ac3eedd1f295d58ea78730aced66e5d58c562a Mon Sep 17 00:00:00 2001 From: "Paul P.H. Wilson" Date: Sun, 14 Nov 2021 12:06:26 -0600 Subject: [PATCH 12/12] added version guards until we can require version --- src/dagmc/DagMC.cpp | 2 ++ src/dagmc/DagMC.hpp | 3 ++- src/dagmc/tests/dagmc_simple_test.cpp | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/dagmc/DagMC.cpp b/src/dagmc/DagMC.cpp index 83c97634d8..8f92ca8672 100644 --- a/src/dagmc/DagMC.cpp +++ b/src/dagmc/DagMC.cpp @@ -811,12 +811,14 @@ ErrorCode DagMC::point_in_volume_slow(EntityHandle volume, const double xyz[3], return rval; } +#if MOAB_VERSION_MAJOR == 5 && MOAB_VERSION_MINOR > 2 // find a which volume contains the current point ErrorCode DagMC::find_volume(const double xyz[3], EntityHandle& volume, const double* uvw) { ErrorCode rval = ray_tracer->find_volume(xyz, volume, uvw); return rval; } +#endif // detemine distance to nearest surface ErrorCode DagMC::closest_to_location(EntityHandle volume, diff --git a/src/dagmc/DagMC.hpp b/src/dagmc/DagMC.hpp index 85f0d51410..3273eafb88 100644 --- a/src/dagmc/DagMC.hpp +++ b/src/dagmc/DagMC.hpp @@ -225,9 +225,10 @@ class DagMC { ErrorCode point_in_volume_slow(const EntityHandle volume, const double xyz[3], int& result); - +#if MOAB_VERSION_MAJOR == 5 && MOAB_VERSION_MINOR > 2 ErrorCode find_volume(const double xyz[3], EntityHandle& volume, const double* uvw = NULL); +#endif ErrorCode test_volume_boundary(const EntityHandle volume, const EntityHandle surface, diff --git a/src/dagmc/tests/dagmc_simple_test.cpp b/src/dagmc/tests/dagmc_simple_test.cpp index a7ff3cb0b0..ee1525a524 100644 --- a/src/dagmc/tests/dagmc_simple_test.cpp +++ b/src/dagmc/tests/dagmc_simple_test.cpp @@ -156,6 +156,7 @@ TEST_F(DagmcSimpleTest, dagmc_point_in) { EXPECT_EQ(expect_result, result); } +#if MOAB_VERSION_MAJOR == 5 && MOAB_VERSION_MINOR > 2 TEST_F(DagmcSimpleTest, dagmc_find_volume) { int vol_idx = 1; int vol_dim = 3; @@ -166,6 +167,7 @@ TEST_F(DagmcSimpleTest, dagmc_find_volume) { EXPECT_EQ(rval, MB_SUCCESS); EXPECT_EQ(expected_vol_h, vol_h); } +#endif TEST_F(DagmcSimpleTest, dagmc_test_obb_retreval_rayfire) { // make new dagmc