Skip to content

Commit

Permalink
Replace volid with vol_id throughout ORANGE
Browse files Browse the repository at this point in the history
  • Loading branch information
elliottbiondo committed Nov 5, 2024
1 parent 3269bef commit fa61437
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 77 deletions.
8 changes: 4 additions & 4 deletions src/orange/detail/BIHBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
{
Expand All @@ -80,8 +80,8 @@ BIHTree BIHBuilder::operator()(VecBBox&& bboxes)
tree.bboxes = ItemMap<LocalVolumeId, FastBBoxId>(
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())
{
Expand Down
2 changes: 1 addition & 1 deletion src/orange/detail/BIHData.hh
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ struct BIHTree
ItemRange<BIHLeafNode> leaf_nodes;

//! Local volumes that have infinite bounding boxes
ItemRange<LocalVolumeId> inf_volids;
ItemRange<LocalVolumeId> inf_vol_ids;

explicit CELER_FUNCTION operator bool() const
{
Expand Down
4 changes: 2 additions & 2 deletions src/orange/detail/BIHEnclosingVolFinder.hh
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ template<class F>
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))
{
Expand All @@ -227,7 +227,7 @@ template<class F>
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))
{
Expand Down
18 changes: 9 additions & 9 deletions src/orange/detail/BIHView.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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<LocalVolumeId const>
leaf_volids(BIHLeafNode const& leaf) const;
leaf_vol_ids(BIHLeafNode const& leaf) const;

// Get the inf_volids
inline CELER_FUNCTION Span<LocalVolumeId const> inf_volids() const;
// Get the inf_vol_ids
inline CELER_FUNCTION Span<LocalVolumeId const> inf_vol_ids() const;

private:
//// DATA ////
Expand Down Expand Up @@ -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<LocalVolumeId const>
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<LocalVolumeId const> BIHView::inf_volids() const
CELER_FUNCTION Span<LocalVolumeId const> BIHView::inf_vol_ids() const
{
return storage_.local_volume_ids[tree_.inf_volids];
return storage_.local_volume_ids[tree_.inf_vol_ids];
}

//---------------------------------------------------------------------------//
Expand Down
6 changes: 3 additions & 3 deletions src/orange/univ/RectArrayTracker.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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<real_type>::infinity();

Expand Down
6 changes: 3 additions & 3 deletions src/orange/univ/SimpleUnitTracker.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions test/orange/OrangeGeoTestBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

//---------------------------------------------------------------------------//
Expand Down
4 changes: 2 additions & 2 deletions test/orange/OrangeGeoTestBase.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
22 changes: 11 additions & 11 deletions test/orange/detail/BIHBuilder.test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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}]];
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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());

Expand All @@ -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());

Expand All @@ -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)
Expand All @@ -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))
Expand Down
32 changes: 16 additions & 16 deletions test/orange/detail/BIHEnclosingVolFinder.test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ class BIHEnclosingVolFinderTest : public Test
BIHTreeData<Ownership::value, MemSpace::host> storage_;
BIHTreeData<Ownership::const_reference, MemSpace::host> ref_storage_;

static constexpr bool valid_volid_(LocalVolumeId vol_id)
static constexpr bool valid_vol_id_(LocalVolumeId vol_id)
{
return static_cast<bool>(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;
};
Expand Down Expand Up @@ -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_));
}

//---------------------------------------------------------------------------//
Expand Down Expand Up @@ -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))
Expand All @@ -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_));
}
}
}
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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_));
}

//---------------------------------------------------------------------------//
Expand Down
Loading

0 comments on commit fa61437

Please sign in to comment.