mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-25 20:45:35 -04:00
Adding a bounding box method to the universe class.
This commit is contained in:
parent
470e26c783
commit
08239a98d2
2 changed files with 22 additions and 2 deletions
|
|
@ -65,6 +65,8 @@ public:
|
|||
//! \param group_id An HDF5 group id.
|
||||
void to_hdf5(hid_t group_id) const;
|
||||
|
||||
BoundingBox bounding_box() const;
|
||||
|
||||
std::unique_ptr<UniversePartitioner> partitioner_;
|
||||
};
|
||||
|
||||
|
|
|
|||
22
src/cell.cpp
22
src/cell.cpp
|
|
@ -208,6 +208,19 @@ Universe::to_hdf5(hid_t universes_group) const
|
|||
close_group(group);
|
||||
}
|
||||
|
||||
BoundingBox Universe::bounding_box() const {
|
||||
BoundingBox bbox;
|
||||
if (cells_.size() == 0) {
|
||||
bbox = {-INFTY, INFTY, -INFTY, -INFTY, INFTY};
|
||||
} else {
|
||||
for (const auto& cell : cells_) {
|
||||
auto& c = model::cells[cell];
|
||||
bbox.update(c->bounding_box());
|
||||
}
|
||||
}
|
||||
return bbox;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
// Cell implementation
|
||||
//==============================================================================
|
||||
|
|
@ -569,9 +582,14 @@ CSGCell::to_hdf5(hid_t cell_group) const
|
|||
|
||||
BoundingBox CSGCell::bounding_box() const {
|
||||
BoundingBox bbox;
|
||||
for (int32_t token : rpn_) {
|
||||
bbox.update(model::surfaces[abs(token)-1]->bounding_box(token > 0));
|
||||
if (rpn_.size() == 0) {
|
||||
bbox = {-INFTY, INFTY, -INFTY, INFTY, -INFTY, INFTY};
|
||||
} else {
|
||||
for (int32_t token : rpn_) {
|
||||
bbox.update(model::surfaces[abs(token)-1]->bounding_box(token > 0));
|
||||
}
|
||||
}
|
||||
return bbox;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue