Skip to content

Commit

Permalink
Rename background_vol_ids to implicit_vol_ids for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
elliottbiondo committed Jan 30, 2025
1 parent 07e10be commit 74f8804
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 24 deletions.
4 changes: 2 additions & 2 deletions src/orange/detail/BIHBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ BIHBuilder::BIHBuilder(Storage* storage)
*/
BIHTree
BIHBuilder::operator()(VecBBox&& bboxes,
BIHBuilder::SetLocalVolId const& background_vol_ids)
BIHBuilder::SetLocalVolId const& implicit_vol_ids)
{
CELER_EXPECT(!bboxes.empty());

Expand All @@ -53,7 +53,7 @@ BIHBuilder::operator()(VecBBox&& bboxes,
{
LocalVolumeId id(i);

if (background_vol_ids.find(id) != background_vol_ids.end())
if (implicit_vol_ids.find(id) != implicit_vol_ids.end())
{
// Background volume, do not include bbox in tree
}
Expand Down
3 changes: 1 addition & 2 deletions src/orange/detail/BIHBuilder.hh
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ class BIHBuilder
explicit BIHBuilder(Storage* storage);

// Create BIH Nodes
BIHTree
operator()(VecBBox&& bboxes, SetLocalVolId const& background_vol_ids);
BIHTree operator()(VecBBox&& bboxes, SetLocalVolId const& implicit_vol_ids);

private:
/// TYPES ///
Expand Down
6 changes: 3 additions & 3 deletions src/orange/detail/UnitInserter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ UniverseId UnitInserter::operator()(UnitInput&& inp)
std::vector<VolumeRecord> vol_records(inp.volumes.size());
std::vector<std::set<LocalVolumeId>> connectivity(inp.surfaces.size());
std::vector<FastBBox> bboxes;
BIHBuilder::SetLocalVolId background_vol_ids;
BIHBuilder::SetLocalVolId implicit_vol_ids;
for (auto i : range(inp.volumes.size()))
{
vol_records[i] = this->insert_volume(unit.surfaces, inp.volumes[i]);
Expand All @@ -303,7 +303,7 @@ UniverseId UnitInserter::operator()(UnitInput&& inp)
// Create a set of background volume ids for BIH construction
if (inp.volumes[i].flags & VolumeRecord::Flags::implicit_vol)
{
background_vol_ids.insert(id_cast<LocalVolumeId>(i));
implicit_vol_ids.insert(id_cast<LocalVolumeId>(i));
}

// Add oriented bounding zone record
Expand Down Expand Up @@ -337,7 +337,7 @@ UniverseId UnitInserter::operator()(UnitInput&& inp)
// Create BIH tree
CELER_VALIDATE(std::all_of(bboxes.begin(), bboxes.end(), LogicalTrue{}),
<< "not all bounding boxes have been assigned");
unit.bih_tree = build_bih_tree_(std::move(bboxes), background_vol_ids);
unit.bih_tree = build_bih_tree_(std::move(bboxes), implicit_vol_ids);

// Save connectivity
{
Expand Down
16 changes: 8 additions & 8 deletions test/orange/detail/BIHBuilder.test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class BIHBuilderTest : public ::celeritas::test::Test

protected:
std::vector<FastBBox> bboxes_;
BIHBuilder::SetLocalVolId background_vol_ids_;
BIHBuilder::SetLocalVolId implicit_vol_ids_;
BIHTreeData<Ownership::value, MemSpace::host> storage_;
};

Expand Down Expand Up @@ -84,7 +84,7 @@ TEST_F(BIHBuilderTest, basic)
bboxes_.push_back({{0, -1, 0}, {5, 0, 100}});

BIHBuilder build(&storage_);
auto bih_tree = build(std::move(bboxes_), background_vol_ids_);
auto bih_tree = build(std::move(bboxes_), implicit_vol_ids_);

ASSERT_EQ(1, bih_tree.inf_vol_ids.size());
EXPECT_EQ(LocalVolumeId{0},
Expand Down Expand Up @@ -273,7 +273,7 @@ TEST_F(BIHBuilderTest, grid)
bboxes_.push_back({{2, 3, 0}, {3, 4, 100}});

BIHBuilder build(&storage_);
auto bih_tree = build(std::move(bboxes_), background_vol_ids_);
auto bih_tree = build(std::move(bboxes_), implicit_vol_ids_);
ASSERT_EQ(1, bih_tree.inf_vol_ids.size());
EXPECT_EQ(LocalVolumeId{0},
storage_.local_volume_ids[bih_tree.inf_vol_ids[0]]);
Expand Down Expand Up @@ -481,7 +481,7 @@ TEST_F(BIHBuilderTest, single_finite_volume)
bboxes_.push_back({{0, 0, 0}, {1, 1, 1}});

BIHBuilder build(&storage_);
auto bih_tree = build(std::move(bboxes_), background_vol_ids_);
auto bih_tree = build(std::move(bboxes_), implicit_vol_ids_);

ASSERT_EQ(0, bih_tree.inf_vol_ids.size());
ASSERT_EQ(0, bih_tree.inner_nodes.size());
Expand All @@ -499,7 +499,7 @@ TEST_F(BIHBuilderTest, multiple_nonpartitionable_volumes)
bboxes_.push_back({{0, 0, 0}, {1, 1, 1}});

BIHBuilder build(&storage_);
auto bih_tree = build(std::move(bboxes_), background_vol_ids_);
auto bih_tree = build(std::move(bboxes_), implicit_vol_ids_);

ASSERT_EQ(0, bih_tree.inf_vol_ids.size());
ASSERT_EQ(0, bih_tree.inner_nodes.size());
Expand All @@ -517,7 +517,7 @@ TEST_F(BIHBuilderTest, single_infinite_volume)
bboxes_.push_back(FastBBox::from_infinite());

BIHBuilder build(&storage_);
auto bih_tree = build(std::move(bboxes_), background_vol_ids_);
auto bih_tree = build(std::move(bboxes_), implicit_vol_ids_);

ASSERT_EQ(0, bih_tree.inner_nodes.size());
ASSERT_EQ(1, bih_tree.leaf_nodes.size());
Expand All @@ -533,7 +533,7 @@ TEST_F(BIHBuilderTest, multiple_infinite_volumes)
bboxes_.push_back(FastBBox::from_infinite());

BIHBuilder build(&storage_);
auto bih_tree = build(std::move(bboxes_), background_vol_ids_);
auto bih_tree = build(std::move(bboxes_), implicit_vol_ids_);

ASSERT_EQ(0, bih_tree.inner_nodes.size());
ASSERT_EQ(1, bih_tree.leaf_nodes.size());
Expand All @@ -556,7 +556,7 @@ TEST_F(BIHBuilderTest, TEST_IF_CELERITAS_DEBUG(semi_finite_volumes))
bboxes_.push_back(FastBBox{{-inff, 0, 0}, {inff, 1, 1}});

BIHBuilder build(&storage_);
EXPECT_THROW(build(std::move(bboxes_), background_vol_ids_), DebugError);
EXPECT_THROW(build(std::move(bboxes_), implicit_vol_ids_), DebugError);
}

//---------------------------------------------------------------------------//
Expand Down
14 changes: 7 additions & 7 deletions test/orange/detail/BIHEnclosingVolFinder.test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class BIHEnclosingVolFinderTest : public Test

BIHTreeData<Ownership::value, MemSpace::host> storage_;
BIHTreeData<Ownership::const_reference, MemSpace::host> ref_storage_;
BIHBuilder::SetLocalVolId background_vol_ids_;
BIHBuilder::SetLocalVolId implicit_vol_ids_;

static constexpr bool valid_vol_id_(LocalVolumeId vol_id)
{
Expand Down Expand Up @@ -73,7 +73,7 @@ TEST_F(BIHEnclosingVolFinderTest, basic)
bboxes_.push_back({{0, -1, 0}, {5, 0, 100}});

BIHBuilder bih(&storage_);
auto bih_tree = bih(std::move(bboxes_), background_vol_ids_);
auto bih_tree = bih(std::move(bboxes_), implicit_vol_ids_);

ref_storage_ = storage_;
BIHEnclosingVolFinder find_volume(bih_tree, ref_storage_);
Expand Down Expand Up @@ -115,7 +115,7 @@ TEST_F(BIHEnclosingVolFinderTest, grid)
}

BIHBuilder bih(&storage_);
auto bih_tree = bih(std::move(bboxes_), background_vol_ids_);
auto bih_tree = bih(std::move(bboxes_), implicit_vol_ids_);

ref_storage_ = storage_;
BIHEnclosingVolFinder find_volume(bih_tree, ref_storage_);
Expand Down Expand Up @@ -143,7 +143,7 @@ TEST_F(BIHEnclosingVolFinderTest, single_finite_volume)
bboxes_.push_back({{0, 0, 0}, {1, 1, 1}});

BIHBuilder bih(&storage_);
auto bih_tree = bih(std::move(bboxes_), background_vol_ids_);
auto bih_tree = bih(std::move(bboxes_), implicit_vol_ids_);

ref_storage_ = storage_;
BIHEnclosingVolFinder find_volume(bih_tree, ref_storage_);
Expand All @@ -157,7 +157,7 @@ TEST_F(BIHEnclosingVolFinderTest, multiple_nonpartitionable_volumes)
bboxes_.push_back({{0, 0, 0}, {1, 1, 1}});

BIHBuilder bih(&storage_);
auto bih_tree = bih(std::move(bboxes_), background_vol_ids_);
auto bih_tree = bih(std::move(bboxes_), implicit_vol_ids_);

ref_storage_ = storage_;
BIHEnclosingVolFinder find_volume(bih_tree, ref_storage_);
Expand All @@ -171,7 +171,7 @@ TEST_F(BIHEnclosingVolFinderTest, single_infinite_volume)
bboxes_.push_back(FastBBox::from_infinite());

BIHBuilder bih(&storage_);
auto bih_tree = bih(std::move(bboxes_), background_vol_ids_);
auto bih_tree = bih(std::move(bboxes_), implicit_vol_ids_);

ref_storage_ = storage_;
BIHEnclosingVolFinder find_volume(bih_tree, ref_storage_);
Expand All @@ -185,7 +185,7 @@ TEST_F(BIHEnclosingVolFinderTest, multiple_infinite_volumes)
bboxes_.push_back(FastBBox::from_infinite());

BIHBuilder bih(&storage_);
auto bih_tree = bih(std::move(bboxes_), background_vol_ids_);
auto bih_tree = bih(std::move(bboxes_), implicit_vol_ids_);

ref_storage_ = storage_;
BIHEnclosingVolFinder find_volume(bih_tree, ref_storage_);
Expand Down
4 changes: 2 additions & 2 deletions test/orange/detail/BIHIntersectingVolFinder.test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ class BIHIntersectingVolFinderTest : public Test
bboxes_.push_back({{0, -1, 0}, {5, 0, 100}});

BIHBuilder build(&storage_);
BIHBuilder::SetLocalVolId background_vol_ids_;
bih_tree_ = build(std::move(bboxes_), background_vol_ids_);
BIHBuilder::SetLocalVolId implicit_vol_ids_;
bih_tree_ = build(std::move(bboxes_), implicit_vol_ids_);
ref_storage_ = storage_;
}

Expand Down

0 comments on commit 74f8804

Please sign in to comment.