Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace "volid" with "vol_id" throughout ORANGE #1486

Merged
merged 8 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/orange/OrangeData.hh
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@ struct OrientedBoundingZoneRecord

// Transformation from the OBZ coordinate system to the unit coordinate
// system
TransformId transform_id;
TransformId trans_id;

//! True if assigned
explicit CELER_FUNCTION operator bool() const
{
return offset_ids[0] && offset_ids[1] && transform_id;
return offset_ids[0] && offset_ids[1] && trans_id;
}
};

Expand Down Expand Up @@ -337,11 +337,11 @@ struct BIHTreeData
/*!
* Persistent data used by ORANGE implementation.
*
* Most data will be accessed through the invidual units, which reference data
* in the "storage" below. The type and index for a universe ID will determine
* the class type and data of the Tracker to instantiate. If *only* simple
* units are present, then the \c simple_units data structure will just be
* equal to a range (with the total number of universes present). Use
* Most data will be accessed through the individual units, which reference
* data in the "storage" below. The type and index for a universe ID will
* determine the class type and data of the Tracker to instantiate. If *only*
* simple units are present, then the \c simple_units data structure will just
* be equal to a range (with the total number of universes present). Use
* `universe_types` to switch on the type of universe; then `universe_indices`
* to index into `simple_units` or `rect_arrays` or ...
*/
Expand Down
4 changes: 2 additions & 2 deletions src/orange/OrangeInput.hh
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ struct OrientedBoundingZoneInput
//! Outer bounding box
BBox outer;
//! Local to global transformation
TransformId transform_id;
TransformId trans_id;

//! Whether the obz definition is valid
explicit operator bool() const { return inner && outer && transform_id; }
explicit operator bool() const { return inner && outer && trans_id; }
};

//---------------------------------------------------------------------------//
Expand Down
10 changes: 5 additions & 5 deletions src/orange/OrangeInputIO.json.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ void from_json(nlohmann::json const& j, VolumeInput& value)
std::vector<LocalSurfaceId::size_type> temp_faces;
j.at("faces").get_to(temp_faces);
value.faces.reserve(temp_faces.size());
for (auto surfid : temp_faces)
for (auto surf_id : temp_faces)
{
CELER_ASSERT(surfid != LocalSurfaceId{}.unchecked_get());
value.faces.emplace_back(surfid);
CELER_ASSERT(surf_id != LocalSurfaceId{}.unchecked_get());
value.faces.emplace_back(surf_id);
}

// Read scalars, including optional flags
Expand Down Expand Up @@ -180,9 +180,9 @@ void to_json(nlohmann::json& j, VolumeInput const& value)
// Convert faces from OpaqueId
std::vector<LocalSurfaceId::size_type> temp_faces;
temp_faces.reserve(value.faces.size());
for (auto surfid : value.faces)
for (auto surf_id : value.faces)
{
temp_faces.emplace_back(surfid.unchecked_get());
temp_faces.emplace_back(surf_id.unchecked_get());
}
j["faces"] = std::move(temp_faces);

Expand Down
28 changes: 14 additions & 14 deletions src/orange/OrangeTrackView.hh
Original file line number Diff line number Diff line change
Expand Up @@ -284,14 +284,14 @@ OrangeTrackView::operator=(Initializer_t const& init)
};

// Recurse into daughter universes starting with the outermost universe
UniverseId uid = top_universe_id();
UniverseId univ_id = top_universe_id();
DaughterId daughter_id;
LevelId level{0};
do
{
TrackerVisitor visit_tracker{params_};
auto tinit = visit_tracker(
[&local](auto&& t) { return t.initialize(local); }, uid);
[&local](auto&& t) { return t.initialize(local); }, univ_id);

if (!tinit.volume || tinit.surface)
{
Expand All @@ -307,7 +307,7 @@ OrangeTrackView::operator=(Initializer_t const& init)
msg << "started on a surface ("
<< tinit.surface.id().unchecked_get() << ")";
}
msg << " in universe " << uid.unchecked_get()
msg << " in universe " << univ_id.unchecked_get()
<< " at local position " << repr(local.pos);
#endif
// Mark as failed and place in local "exterior" to end the search
Expand All @@ -320,18 +320,18 @@ OrangeTrackView::operator=(Initializer_t const& init)
lsa.vol() = tinit.volume;
lsa.pos() = local.pos;
lsa.dir() = local.dir;
lsa.universe() = uid;
lsa.universe() = univ_id;

daughter_id = visit_tracker(
[&tinit](auto&& t) { return t.daughter(tinit.volume); }, uid);
[&tinit](auto&& t) { return t.daughter(tinit.volume); }, univ_id);

if (daughter_id)
{
auto const& daughter = params_.daughters[daughter_id];
// Apply "transform down" based on stored transform
apply_transform(transform_down_local, daughter.transform_id);
apply_transform(transform_down_local, daughter.trans_id);
// Update universe and increase level depth
uid = daughter.universe_id;
univ_id = daughter.universe_id;
++level;
}

Expand Down Expand Up @@ -734,7 +734,7 @@ CELER_FUNCTION void OrangeTrackView::cross_boundary()
local.pos = t.transform_down(local.pos);
local.dir = t.rotate_down(local.dir);
};
apply_transform(transform_down_local, daughter.transform_id);
apply_transform(transform_down_local, daughter.trans_id);
universe = daughter.universe_id;
}

Expand Down Expand Up @@ -964,15 +964,15 @@ OrangeTrackView::find_next_step_impl(detail::Intersection isect)
LevelId min_level{0};

// Find the nearest intersection from level 0 to current level
// inclusive, prefering the shallowest level (i.e., lowest uid)
// inclusive, prefering the shallowest level (i.e., lowest univ_id)
for (auto levelid : range(LevelId{1}, this->level() + 1))
{
auto uid = this->make_lsa(levelid).universe();
auto univ_id = this->make_lsa(levelid).universe();
auto local_isect = visit_tracker(
[local_state = this->make_local_state(levelid), &isect](auto&& t) {
return t.intersect(local_state, isect.distance);
},
uid);
univ_id);

if (local_isect.distance < isect.distance)
{
Expand Down Expand Up @@ -1156,8 +1156,8 @@ CELER_FORCEINLINE_FUNCTION auto OrangeTrackView::make_lsa() const -> LSA
/*!
* Make a LevelStateAccessor for the current thread and a given level.
*/
CELER_FORCEINLINE_FUNCTION auto
OrangeTrackView::make_lsa(LevelId level) const -> LSA
CELER_FORCEINLINE_FUNCTION auto OrangeTrackView::make_lsa(LevelId level) const
-> LSA
{
return LSA(&states_, track_slot_, level);
}
Expand All @@ -1182,7 +1182,7 @@ CELER_FUNCTION DaughterId OrangeTrackView::get_daughter(LSA const& lsa)
CELER_FUNCTION TransformId OrangeTrackView::get_transform(DaughterId daughter_id)
{
CELER_EXPECT(daughter_id);
return params_.daughters[daughter_id].transform_id;
return params_.daughters[daughter_id].trans_id;
}

//---------------------------------------------------------------------------//
Expand Down
2 changes: 1 addition & 1 deletion src/orange/OrangeTypes.hh
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ enum class ZOrder : size_type
struct Daughter
{
UniverseId universe_id;
TransformId transform_id;
TransformId trans_id;
};

//---------------------------------------------------------------------------//
Expand Down
8 changes: 4 additions & 4 deletions src/orange/detail/BIHBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,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 @@ -63,7 +63,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 @@ -79,8 +79,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 @@ -95,7 +95,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 @@ -208,7 +208,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 @@ -226,7 +226,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
4 changes: 2 additions & 2 deletions src/orange/detail/BIHIntersectingVolFinder.hh
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ BIHIntersectingVolFinder::visit_leaf(BIHLeafNode const& leaf_node,
Intersection min_intersection,
F&& visit_vol) const -> Intersection
{
for (auto id : view_.leaf_volids(leaf_node))
for (auto id : view_.leaf_vol_ids(leaf_node))
{
auto const& bbox = view_.bbox(id);

Expand All @@ -268,7 +268,7 @@ BIHIntersectingVolFinder::visit_inf_vols(Intersection min_intersection,
BIHIntersectingVolFinder::Ray ray,
F&& visit_vol) const -> Intersection
{
for (auto id : view_.inf_volids())
for (auto id : view_.inf_vol_ids())
{
auto intersection = visit_vol(id, ray, min_intersection.distance);
if (intersection && intersection.distance < min_intersection.distance)
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 @@ -41,12 +41,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 @@ -112,21 +112,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
8 changes: 4 additions & 4 deletions src/orange/detail/DepthCalculator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ size_type DepthCalculator::operator()(RectArrayInput const& u)
/*!
* Check cache or calculate.
*/
size_type DepthCalculator::operator()(UniverseId uid)
size_type DepthCalculator::operator()(UniverseId univ_id)
{
CELER_EXPECT(uid < num_univ_);
CELER_EXPECT(univ_id < num_univ_);
// Check for cached value
auto&& [iter, inserted] = depths_.insert({uid, {}});
auto&& [iter, inserted] = depths_.insert({univ_id, {}});
if (inserted)
{
// Visit and save value
iter->second = visit_univ_(*this, uid.unchecked_get());
iter->second = visit_univ_(*this, univ_id.unchecked_get());
}

// Return cached value
Expand Down
2 changes: 1 addition & 1 deletion src/orange/detail/DepthCalculator.hh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class DepthCalculator
std::unordered_map<UniverseId, size_type> depths_;

// Check cache or calculate
size_type operator()(UniverseId uid);
size_type operator()(UniverseId univ_id);
};

//---------------------------------------------------------------------------//
Expand Down
8 changes: 4 additions & 4 deletions src/orange/detail/OrientedBoundingZone.hh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace detail
* coordinate system.
*
* Consequently, points in the unit's coordinate system must be first
* transformed by \c transform_id into the OBZ coordinate system (resulting in
* transformed by \c trans_id into the OBZ coordinate system (resulting in
* "trans_pos"), then offset, i.e. translated, by \c inner_offset_id or
* \c outer_offset_id into the inner or outer bbox coordinate system (resulting
* in "offset_pos"). It is noted that these offset positions are always
Expand Down Expand Up @@ -266,7 +266,7 @@ CELER_FUNCTION Real3 OrientedBoundingZone::translate(Real3 const& pos)
TransformVisitor apply_transform(*sp_.transforms, *sp_.reals);
auto transform_down = [&pos](auto&& t) { return t.transform_down(pos); };

return apply_transform(transform_down, obz_record_.transform_id);
return apply_transform(transform_down, obz_record_.trans_id);
}

//---------------------------------------------------------------------------//
Expand All @@ -276,8 +276,8 @@ CELER_FUNCTION Real3 OrientedBoundingZone::translate(Real3 const& pos)
* This function also reflects the point into quadrant one.
*/
CELER_FUNCTION auto
OrientedBoundingZone::apply_offset(Real3 const& trans_pos,
BBoxType bbt) -> OffsetPos
OrientedBoundingZone::apply_offset(Real3 const& trans_pos, BBoxType bbt)
-> OffsetPos
{
TransformVisitor apply_transform(*sp_.transforms, *sp_.reals);
auto transform_down
Expand Down
2 changes: 1 addition & 1 deletion src/orange/detail/RectArrayInserter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ UniverseId RectArrayInserter::operator()(RectArrayInput const& inp)
{
Daughter d;
d.universe_id = daughter_input.universe_id;
d.transform_id = insert_transform_(daughter_input.transform);
d.trans_id = insert_transform_(daughter_input.transform);
daughters.push_back(d);
}
record.daughters = ItemMap<LocalVolumeId, DaughterId>(
Expand Down
4 changes: 2 additions & 2 deletions src/orange/detail/UnitInserter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ void UnitInserter::process_obz_record(VolumeRecord* vol_record,
obz_record.offset_ids = {inner_offset_id, outer_offset_id};

// Set transformation
obz_record.transform_id = obz_input.transform_id;
obz_record.trans_id = obz_input.trans_id;

// Save the OBZ record to the volume record
vol_record->obz_id = obz_records_.push_back(obz_record);
Expand All @@ -494,7 +494,7 @@ void UnitInserter::process_daughter(VolumeRecord* vol_record,
{
Daughter daughter;
daughter.universe_id = daughter_input.universe_id;
daughter.transform_id = insert_transform_(daughter_input.transform);
daughter.trans_id = insert_transform_(daughter_input.transform);

vol_record->daughter_id = daughters_.push_back(daughter);
vol_record->flags |= VolumeRecord::embedded_universe;
Expand Down
4 changes: 2 additions & 2 deletions src/orange/orangeinp/CsgTreeIO.json.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ void to_json(nlohmann::json& j, CsgUnit const& unit)
{
auto entry = nlohmann::json{
{"exterior", reg.bounds.exterior},
{"transform", reg.transform_id.unchecked_get()},
{"transform", reg.trans_id.unchecked_get()},
};
if (reg.bounds.interior)
{
Expand Down Expand Up @@ -141,7 +141,7 @@ void to_json(nlohmann::json& j, CsgUnit const& unit)
else if (auto* d = std::get_if<Daughter>(&unit.fills[i]))
{
entry["universe"] = d->universe_id.unchecked_get();
entry["transform"] = d->transform_id.unchecked_get();
entry["transform"] = d->trans_id.unchecked_get();
}
result.push_back(entry);
}
Expand Down
Loading
Loading