Adding bbox defs for cells.

This commit is contained in:
Patrick Shriwise 2019-06-21 00:27:18 -05:00
parent 446e78cb87
commit 470e26c783
4 changed files with 20 additions and 0 deletions

View file

@ -217,6 +217,8 @@ public:
std::pair<double, int32_t>
distance(Position r, Direction u, int32_t on_surface) const;
BoundingBox bounding_box() const;
void to_hdf5(hid_t group_id) const;
};
#endif

View file

@ -139,6 +139,8 @@ public:
void to_hdf5(hid_t group_id) const;
virtual BoundingBox bounding_box(bool pos_side) const = 0;
protected:
virtual void to_hdf5_inner(hid_t group_id) const = 0;
};
@ -159,6 +161,8 @@ public:
//! Get the bounding box of this surface.
BoundingBox bounding_box(bool pos_side) const;
void to_hdf5(hid_t group_id) const;
moab::DagMC* dagmc_ptr_;
int32_t dag_index_;
};
@ -188,6 +192,9 @@ public:
//! boundary condition.
virtual bool periodic_translate(const PeriodicSurface* other, Position& r,
Direction& u) const = 0;
//! Get the bounding box for this surface.
virtual BoundingBox bounding_box(bool pos_side) const = 0;
};
//==============================================================================

View file

@ -698,6 +698,16 @@ bool DAGCell::contains(Position r, Direction u, int32_t on_surface) const
void DAGCell::to_hdf5(hid_t group_id) const { return; }
BoundingBox DAGCell::bounding_box() const
{
moab::ErrorCode rval;
moab::EntityHandle vol = dagmc_ptr_->entity_by_index(3, dag_index_);
double min[3], max[3];
rval = dagmc_ptr_->getobb(vol, min, max);
MB_CHK_ERR_CONT(rval);
return {min[0], max[0], min[1], max[1], min[2], max[2]};
}
#endif
//==============================================================================

View file

@ -282,6 +282,7 @@ BoundingBox DAGSurface::bounding_box(bool pos_side) const
}
void DAGSurface::to_hdf5(hid_t group_id) const {}
#endif
//==============================================================================
// PeriodicSurface implementation