diff --git a/src/orange/detail/BIHBuilder.cc b/src/orange/detail/BIHBuilder.cc index ff60a2c956..6a8f5d32cc 100644 --- a/src/orange/detail/BIHBuilder.cc +++ b/src/orange/detail/BIHBuilder.cc @@ -47,7 +47,7 @@ BIHTree BIHBuilder::operator()(VecBBox&& bboxes) // Separate infinite bounding boxes from finite VecIndices indices; - VecIndices inf_volids; + VecIndices inf_vol_ids; for (auto i : range(temp_.bboxes.size())) { LocalVolumeId id(i); @@ -64,7 +64,7 @@ BIHTree BIHBuilder::operator()(VecBBox&& bboxes) * \todo make an exception for "EXTERIOR" volume and remove the * "infinite volume" exceptions? */ - inf_volids.push_back(id); + inf_vol_ids.push_back(id); } else { @@ -80,8 +80,8 @@ BIHTree BIHBuilder::operator()(VecBBox&& bboxes) tree.bboxes = ItemMap( bboxes_.insert_back(temp_.bboxes.begin(), temp_.bboxes.end())); - tree.inf_volids - = local_volume_ids_.insert_back(inf_volids.begin(), inf_volids.end()); + tree.inf_vol_ids = local_volume_ids_.insert_back(inf_vol_ids.begin(), + inf_vol_ids.end()); if (!indices.empty()) { diff --git a/src/orange/detail/BIHData.hh b/src/orange/detail/BIHData.hh index 8eb2d0d7e3..b6ade50f28 100644 --- a/src/orange/detail/BIHData.hh +++ b/src/orange/detail/BIHData.hh @@ -96,7 +96,7 @@ struct BIHTree ItemRange leaf_nodes; //! Local volumes that have infinite bounding boxes - ItemRange inf_volids; + ItemRange inf_vol_ids; explicit CELER_FUNCTION operator bool() const { diff --git a/src/orange/detail/BIHEnclosingVolFinder.hh b/src/orange/detail/BIHEnclosingVolFinder.hh index 7f467d8ebe..68f1b240c4 100644 --- a/src/orange/detail/BIHEnclosingVolFinder.hh +++ b/src/orange/detail/BIHEnclosingVolFinder.hh @@ -209,7 +209,7 @@ template CELER_FUNCTION LocalVolumeId BIHEnclosingVolFinder::visit_leaf( BIHLeafNode const& leaf_node, Real3 const& pos, F&& is_inside) const { - for (auto id : view_.leaf_volids(leaf_node)) + for (auto id : view_.leaf_vol_ids(leaf_node)) { if (this->visit_bbox(id, pos) && is_inside(id)) { @@ -227,7 +227,7 @@ template CELER_FUNCTION LocalVolumeId BIHEnclosingVolFinder::visit_inf_vols(F&& is_inside) const { - for (auto id : view_.inf_volids()) + for (auto id : view_.inf_vol_ids()) { if (is_inside(id)) { diff --git a/src/orange/detail/BIHView.hh b/src/orange/detail/BIHView.hh index 11b5b7558c..2cedd9ab1b 100644 --- a/src/orange/detail/BIHView.hh +++ b/src/orange/detail/BIHView.hh @@ -42,12 +42,12 @@ class BIHView // Get the bbox for a given vol_id. inline CELER_FUNCTION FastBBox const& bbox(LocalVolumeId vol_id) const; - // Get the volids on a given leaf node + // Get the vol_ids on a given leaf node inline CELER_FUNCTION Span - leaf_volids(BIHLeafNode const& leaf) const; + leaf_vol_ids(BIHLeafNode const& leaf) const; - // Get the inf_volids - inline CELER_FUNCTION Span inf_volids() const; + // Get the inf_vol_ids + inline CELER_FUNCTION Span inf_vol_ids() const; private: //// DATA //// @@ -113,21 +113,21 @@ CELER_FUNCTION FastBBox const& BIHView::bbox(LocalVolumeId vol_id) const //---------------------------------------------------------------------------// /*! - * Get the volids on a given leaf node. + * Get the vol_ids on a given leaf node. */ CELER_FUNCTION Span -BIHView::leaf_volids(BIHLeafNode const& leaf) const +BIHView::leaf_vol_ids(BIHLeafNode const& leaf) const { return storage_.local_volume_ids[leaf.vol_ids]; } //---------------------------------------------------------------------------// /*! - * Get the inf_volids. + * Get the inf_vol_ids. */ -CELER_FUNCTION Span BIHView::inf_volids() const +CELER_FUNCTION Span BIHView::inf_vol_ids() const { - return storage_.local_volume_ids[tree_.inf_volids]; + return storage_.local_volume_ids[tree_.inf_vol_ids]; } //---------------------------------------------------------------------------// diff --git a/src/orange/univ/RectArrayTracker.hh b/src/orange/univ/RectArrayTracker.hh index 6f3ce79324..4d1c1bbb73 100644 --- a/src/orange/univ/RectArrayTracker.hh +++ b/src/orange/univ/RectArrayTracker.hh @@ -232,12 +232,12 @@ RectArrayTracker::intersect(LocalState const& state, * always always occurs along a line parallel to an axis. */ CELER_FUNCTION real_type RectArrayTracker::safety(Real3 const& pos, - LocalVolumeId volid) const + LocalVolumeId vol_id) const { - CELER_EXPECT(volid && volid.get() < this->num_volumes()); + CELER_EXPECT(vol_id && vol_id.get() < this->num_volumes()); VolumeInverseIndexer to_coords(record_.dims); - auto coords = to_coords(volid.unchecked_get()); + auto coords = to_coords(vol_id.unchecked_get()); real_type min_dist = numeric_limits::infinity(); diff --git a/src/orange/univ/SimpleUnitTracker.hh b/src/orange/univ/SimpleUnitTracker.hh index b1ae943666..93da60514d 100644 --- a/src/orange/univ/SimpleUnitTracker.hh +++ b/src/orange/univ/SimpleUnitTracker.hh @@ -293,11 +293,11 @@ SimpleUnitTracker::intersect(LocalState const& state, * necessarily slow down the simulation. */ CELER_FUNCTION real_type SimpleUnitTracker::safety(Real3 const& pos, - LocalVolumeId volid) const + LocalVolumeId vol_id) const { - CELER_EXPECT(volid); + CELER_EXPECT(vol_id); - VolumeView vol = this->make_local_volume(volid); + VolumeView vol = this->make_local_volume(vol_id); if (!vol.simple_safety()) { // Has a tricky surface: we can't use the simple algorithm to calculate diff --git a/test/orange/OrangeGeoTestBase.cc b/test/orange/OrangeGeoTestBase.cc index 1b318f59f8..c458b48e71 100644 --- a/test/orange/OrangeGeoTestBase.cc +++ b/test/orange/OrangeGeoTestBase.cc @@ -308,22 +308,22 @@ std::string OrangeGeoTestBase::id_to_label(LocalSurfaceId surfid) const * Volume name (or sentinel if no volume). */ std::string -OrangeGeoTestBase::id_to_label(UniverseId uid, LocalVolumeId volid) const +OrangeGeoTestBase::id_to_label(UniverseId uid, LocalVolumeId vol_id) const { - if (!volid) + if (!vol_id) return "[none]"; detail::UniverseIndexer ui(this->params().host_ref().universe_indexer_data); - return params_->volumes().at(ui.global_volume(uid, volid)).name; + return params_->volumes().at(ui.global_volume(uid, vol_id)).name; } //---------------------------------------------------------------------------// /*! * Volume name (or sentinel if no volume) within UniverseId{0}. */ -std::string OrangeGeoTestBase::id_to_label(LocalVolumeId volid) const +std::string OrangeGeoTestBase::id_to_label(LocalVolumeId vol_id) const { - return this->id_to_label(UniverseId{0}, volid); + return this->id_to_label(UniverseId{0}, vol_id); } //---------------------------------------------------------------------------// diff --git a/test/orange/OrangeGeoTestBase.hh b/test/orange/OrangeGeoTestBase.hh index 7f89ca8642..a461e510c4 100644 --- a/test/orange/OrangeGeoTestBase.hh +++ b/test/orange/OrangeGeoTestBase.hh @@ -109,10 +109,10 @@ class OrangeGeoTestBase : public OrangeTestBase std::string id_to_label(LocalSurfaceId surfid) const; // Cell name (or sentinel if no surface) - std::string id_to_label(UniverseId uid, LocalVolumeId volid) const; + std::string id_to_label(UniverseId uid, LocalVolumeId vol_id) const; // Cell name (or sentinel if no surface) within UniverseId{0} - std::string id_to_label(LocalVolumeId volid) const; + std::string id_to_label(LocalVolumeId vol_id) const; // Print geometry description void describe(std::ostream& os) const; diff --git a/test/orange/detail/BIHBuilder.test.cc b/test/orange/detail/BIHBuilder.test.cc index 30a09cdbd1..4dc4c96ca0 100644 --- a/test/orange/detail/BIHBuilder.test.cc +++ b/test/orange/detail/BIHBuilder.test.cc @@ -85,9 +85,9 @@ TEST_F(BIHBuilderTest, basic) BIHBuilder build(&storage_); auto bih_tree = build(std::move(bboxes_)); - ASSERT_EQ(1, bih_tree.inf_volids.size()); + ASSERT_EQ(1, bih_tree.inf_vol_ids.size()); EXPECT_EQ(LocalVolumeId{0}, - storage_.local_volume_ids[bih_tree.inf_volids[0]]); + storage_.local_volume_ids[bih_tree.inf_vol_ids[0]]); // Test bounding box storage auto bbox1 = storage_.bboxes[bih_tree.bboxes[LocalVolumeId{2}]]; @@ -273,9 +273,9 @@ TEST_F(BIHBuilderTest, grid) BIHBuilder build(&storage_); auto bih_tree = build(std::move(bboxes_)); - ASSERT_EQ(1, bih_tree.inf_volids.size()); + ASSERT_EQ(1, bih_tree.inf_vol_ids.size()); EXPECT_EQ(LocalVolumeId{0}, - storage_.local_volume_ids[bih_tree.inf_volids[0]]); + storage_.local_volume_ids[bih_tree.inf_vol_ids[0]]); // Test nodes auto inner_nodes = bih_tree.inner_nodes; @@ -482,7 +482,7 @@ TEST_F(BIHBuilderTest, single_finite_volume) BIHBuilder build(&storage_); auto bih_tree = build(std::move(bboxes_)); - ASSERT_EQ(0, bih_tree.inf_volids.size()); + ASSERT_EQ(0, bih_tree.inf_vol_ids.size()); ASSERT_EQ(0, bih_tree.inner_nodes.size()); ASSERT_EQ(1, bih_tree.leaf_nodes.size()); @@ -500,7 +500,7 @@ TEST_F(BIHBuilderTest, multiple_nonpartitionable_volumes) BIHBuilder build(&storage_); auto bih_tree = build(std::move(bboxes_)); - ASSERT_EQ(0, bih_tree.inf_volids.size()); + ASSERT_EQ(0, bih_tree.inf_vol_ids.size()); ASSERT_EQ(0, bih_tree.inner_nodes.size()); ASSERT_EQ(1, bih_tree.leaf_nodes.size()); @@ -520,10 +520,10 @@ TEST_F(BIHBuilderTest, single_infinite_volume) ASSERT_EQ(0, bih_tree.inner_nodes.size()); ASSERT_EQ(1, bih_tree.leaf_nodes.size()); - ASSERT_EQ(1, bih_tree.inf_volids.size()); + ASSERT_EQ(1, bih_tree.inf_vol_ids.size()); EXPECT_EQ(LocalVolumeId{0}, - storage_.local_volume_ids[bih_tree.inf_volids[0]]); + storage_.local_volume_ids[bih_tree.inf_vol_ids[0]]); } TEST_F(BIHBuilderTest, multiple_infinite_volumes) @@ -536,12 +536,12 @@ TEST_F(BIHBuilderTest, multiple_infinite_volumes) ASSERT_EQ(0, bih_tree.inner_nodes.size()); ASSERT_EQ(1, bih_tree.leaf_nodes.size()); - ASSERT_EQ(2, bih_tree.inf_volids.size()); + ASSERT_EQ(2, bih_tree.inf_vol_ids.size()); EXPECT_EQ(LocalVolumeId{0}, - storage_.local_volume_ids[bih_tree.inf_volids[0]]); + storage_.local_volume_ids[bih_tree.inf_vol_ids[0]]); EXPECT_EQ(LocalVolumeId{1}, - storage_.local_volume_ids[bih_tree.inf_volids[1]]); + storage_.local_volume_ids[bih_tree.inf_vol_ids[1]]); } TEST_F(BIHBuilderTest, TEST_IF_CELERITAS_DEBUG(semi_finite_volumes)) diff --git a/test/orange/detail/BIHEnclosingVolFinder.test.cc b/test/orange/detail/BIHEnclosingVolFinder.test.cc index 762b919854..c93af7abfe 100644 --- a/test/orange/detail/BIHEnclosingVolFinder.test.cc +++ b/test/orange/detail/BIHEnclosingVolFinder.test.cc @@ -35,11 +35,11 @@ class BIHEnclosingVolFinderTest : public Test BIHTreeData storage_; BIHTreeData ref_storage_; - static constexpr bool valid_volid_(LocalVolumeId vol_id) + static constexpr bool valid_vol_id_(LocalVolumeId vol_id) { return static_cast(vol_id); }; - static constexpr bool odd_volid_(LocalVolumeId vol_id) + static constexpr bool odd_vol_id_(LocalVolumeId vol_id) { return vol_id.unchecked_get() % 2 != 0; }; @@ -78,12 +78,12 @@ TEST_F(BIHEnclosingVolFinderTest, basic) ref_storage_ = storage_; BIHEnclosingVolFinder find_volume(bih_tree, ref_storage_); - EXPECT_EQ(LocalVolumeId{0}, find_volume({0.8, 0.5, 110}, valid_volid_)); - EXPECT_EQ(LocalVolumeId{1}, find_volume({0.8, 0.5, 30}, valid_volid_)); - EXPECT_EQ(LocalVolumeId{2}, find_volume({2.0, 0.6, 40}, valid_volid_)); - EXPECT_EQ(LocalVolumeId{3}, find_volume({2.9, 0.7, 50}, valid_volid_)); - EXPECT_EQ(LocalVolumeId{4}, find_volume({2.9, -0.7, 50}, valid_volid_)); - EXPECT_EQ(LocalVolumeId{5}, find_volume({2.9, -0.7, 50}, odd_volid_)); + EXPECT_EQ(LocalVolumeId{0}, find_volume({0.8, 0.5, 110}, valid_vol_id_)); + EXPECT_EQ(LocalVolumeId{1}, find_volume({0.8, 0.5, 30}, valid_vol_id_)); + EXPECT_EQ(LocalVolumeId{2}, find_volume({2.0, 0.6, 40}, valid_vol_id_)); + EXPECT_EQ(LocalVolumeId{3}, find_volume({2.9, 0.7, 50}, valid_vol_id_)); + EXPECT_EQ(LocalVolumeId{4}, find_volume({2.9, -0.7, 50}, valid_vol_id_)); + EXPECT_EQ(LocalVolumeId{5}, find_volume({2.9, -0.7, 50}, odd_vol_id_)); } //---------------------------------------------------------------------------// @@ -120,7 +120,7 @@ TEST_F(BIHEnclosingVolFinderTest, grid) ref_storage_ = storage_; BIHEnclosingVolFinder find_volume(bih_tree, ref_storage_); - EXPECT_EQ(LocalVolumeId{0}, find_volume({0.8, 0.5, 110}, valid_volid_)); + EXPECT_EQ(LocalVolumeId{0}, find_volume({0.8, 0.5, 110}, valid_vol_id_)); size_type index{1}; for (auto i : range(3)) @@ -129,7 +129,7 @@ TEST_F(BIHEnclosingVolFinderTest, grid) { constexpr real_type half{0.5}; EXPECT_EQ(LocalVolumeId{index++}, - find_volume({half + i, half + j, 30}, valid_volid_)); + find_volume({half + i, half + j, 30}, valid_vol_id_)); } } } @@ -148,7 +148,7 @@ TEST_F(BIHEnclosingVolFinderTest, single_finite_volume) ref_storage_ = storage_; BIHEnclosingVolFinder find_volume(bih_tree, ref_storage_); - EXPECT_EQ(LocalVolumeId{0}, find_volume({0.5, 0.5, 0.5}, valid_volid_)); + EXPECT_EQ(LocalVolumeId{0}, find_volume({0.5, 0.5, 0.5}, valid_vol_id_)); } TEST_F(BIHEnclosingVolFinderTest, multiple_nonpartitionable_volumes) @@ -162,8 +162,8 @@ TEST_F(BIHEnclosingVolFinderTest, multiple_nonpartitionable_volumes) ref_storage_ = storage_; BIHEnclosingVolFinder find_volume(bih_tree, ref_storage_); - EXPECT_EQ(LocalVolumeId{0}, find_volume({0.5, 0.5, 0.5}, valid_volid_)); - EXPECT_EQ(LocalVolumeId{1}, find_volume({0.5, 0.5, 0.5}, odd_volid_)); + EXPECT_EQ(LocalVolumeId{0}, find_volume({0.5, 0.5, 0.5}, valid_vol_id_)); + EXPECT_EQ(LocalVolumeId{1}, find_volume({0.5, 0.5, 0.5}, odd_vol_id_)); } TEST_F(BIHEnclosingVolFinderTest, single_infinite_volume) @@ -176,7 +176,7 @@ TEST_F(BIHEnclosingVolFinderTest, single_infinite_volume) ref_storage_ = storage_; BIHEnclosingVolFinder find_volume(bih_tree, ref_storage_); - EXPECT_EQ(LocalVolumeId{0}, find_volume({0.5, 0.5, 0.5}, valid_volid_)); + EXPECT_EQ(LocalVolumeId{0}, find_volume({0.5, 0.5, 0.5}, valid_vol_id_)); } TEST_F(BIHEnclosingVolFinderTest, multiple_infinite_volumes) @@ -190,8 +190,8 @@ TEST_F(BIHEnclosingVolFinderTest, multiple_infinite_volumes) ref_storage_ = storage_; BIHEnclosingVolFinder find_volume(bih_tree, ref_storage_); - EXPECT_EQ(LocalVolumeId{0}, find_volume({0.5, 0.5, 0.5}, valid_volid_)); - EXPECT_EQ(LocalVolumeId{1}, find_volume({0.5, 0.5, 0.5}, odd_volid_)); + EXPECT_EQ(LocalVolumeId{0}, find_volume({0.5, 0.5, 0.5}, valid_vol_id_)); + EXPECT_EQ(LocalVolumeId{1}, find_volume({0.5, 0.5, 0.5}, odd_vol_id_)); } //---------------------------------------------------------------------------// diff --git a/test/orange/univ/RectArrayTracker.test.cc b/test/orange/univ/RectArrayTracker.test.cc index 4580004677..7eed69ab71 100644 --- a/test/orange/univ/RectArrayTracker.test.cc +++ b/test/orange/univ/RectArrayTracker.test.cc @@ -56,7 +56,7 @@ class RectArrayTrackerTest : public OrangeGeoTestBase // Prepare for initialization across a surface LocalState make_state_crossing(Real3 pos, Real3 dir, - LocalVolumeId volid, + LocalVolumeId vol_id, LocalSurfaceId surfid, Sense sense); @@ -93,10 +93,10 @@ LocalState RectArrayTrackerTest::make_state(Real3 pos, Real3 dir) * Initialize inside a volume. */ LocalState -RectArrayTrackerTest::make_state(Real3 pos, Real3 dir, LocalVolumeId volid) +RectArrayTrackerTest::make_state(Real3 pos, Real3 dir, LocalVolumeId vol_id) { LocalState state = this->make_state(pos, dir); - state.volume = volid; + state.volume = vol_id; return state; } @@ -108,11 +108,11 @@ RectArrayTrackerTest::make_state(Real3 pos, Real3 dir, LocalVolumeId volid) */ LocalState RectArrayTrackerTest::make_state_crossing(Real3 pos, Real3 dir, - LocalVolumeId volid, + LocalVolumeId vol_id, LocalSurfaceId surfid, Sense sense) { - LocalState state = this->make_state(pos, dir, volid); + LocalState state = this->make_state(pos, dir, vol_id); state.surface = {surfid, sense}; return state; } @@ -334,26 +334,26 @@ TEST_F(RectArrayTrackerTest, safety) SCOPED_TRACE("In volume {0, 0, 0}"); { - auto volid = LocalVolumeId{0}; - - EXPECT_SOFT_EQ(2.5, tracker.safety({0.11, 0.5, 0.5}, volid)); - EXPECT_SOFT_EQ(0.08, tracker.safety({2.92, 0.5, 0.5}, volid)); - EXPECT_SOFT_EQ(2.5, tracker.safety({0.5, 0.11, 0.5}, volid)); - EXPECT_SOFT_EQ(0.08, tracker.safety({0.5, 2.92, 0.5}, volid)); - EXPECT_SOFT_EQ(2.5, tracker.safety({0.5, 0.11, 0.01}, volid)); - EXPECT_SOFT_EQ(0.02, tracker.safety({0.5, 2.92, 4.98}, volid)); + auto vol_id = LocalVolumeId{0}; + + EXPECT_SOFT_EQ(2.5, tracker.safety({0.11, 0.5, 0.5}, vol_id)); + EXPECT_SOFT_EQ(0.08, tracker.safety({2.92, 0.5, 0.5}, vol_id)); + EXPECT_SOFT_EQ(2.5, tracker.safety({0.5, 0.11, 0.5}, vol_id)); + EXPECT_SOFT_EQ(0.08, tracker.safety({0.5, 2.92, 0.5}, vol_id)); + EXPECT_SOFT_EQ(2.5, tracker.safety({0.5, 0.11, 0.01}, vol_id)); + EXPECT_SOFT_EQ(0.02, tracker.safety({0.5, 2.92, 4.98}, vol_id)); } SCOPED_TRACE("In volume {2, 2, 1}"); { - auto volid = LocalVolumeId{21}; - - EXPECT_SOFT_EQ(0.04, tracker.safety({6.04, 6.5, 5.5}, volid)); - EXPECT_SOFT_EQ(0.02, tracker.safety({11.98, 6.5, 5.02}, volid)); - EXPECT_SOFT_EQ(0.04, tracker.safety({6.5, 6.04, 5.5}, volid)); - EXPECT_SOFT_EQ(0.02, tracker.safety({6.5, 8.98, 5.5}, volid)); - EXPECT_SOFT_EQ(0.01, tracker.safety({6.5, 6.04, 5.01}, volid)); - EXPECT_SOFT_EQ(0.01, tracker.safety({6.01, 8.98, 9.99}, volid)); + auto vol_id = LocalVolumeId{21}; + + EXPECT_SOFT_EQ(0.04, tracker.safety({6.04, 6.5, 5.5}, vol_id)); + EXPECT_SOFT_EQ(0.02, tracker.safety({11.98, 6.5, 5.02}, vol_id)); + EXPECT_SOFT_EQ(0.04, tracker.safety({6.5, 6.04, 5.5}, vol_id)); + EXPECT_SOFT_EQ(0.02, tracker.safety({6.5, 8.98, 5.5}, vol_id)); + EXPECT_SOFT_EQ(0.01, tracker.safety({6.5, 6.04, 5.01}, vol_id)); + EXPECT_SOFT_EQ(0.01, tracker.safety({6.01, 8.98, 9.99}, vol_id)); } }