mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Adding error checks to dagmc calls.
This commit is contained in:
parent
b7eb82b6be
commit
b149adde0f
2 changed files with 15 additions and 9 deletions
12
src/cell.cpp
12
src/cell.cpp
|
|
@ -598,12 +598,12 @@ CSGCell::contains_complex(Position r, Direction u, int32_t on_surface) const
|
|||
CADCell::CADCell() : Cell{} {};
|
||||
|
||||
std::pair<double, int32_t> CADCell::distance(Position p, Direction u, int32_t on_surface) const {
|
||||
|
||||
moab::ErrorCode rval;
|
||||
moab::EntityHandle vol = dagmc_ptr->entity_by_id(3, id_);
|
||||
moab::EntityHandle hit_surf;
|
||||
double dist;
|
||||
dagmc_ptr->ray_fire(vol, p.xyz, u.xyz, hit_surf, dist);
|
||||
|
||||
rval = dagmc_ptr->ray_fire(vol, p.xyz, u.xyz, hit_surf, dist);
|
||||
MB_CHK_ERR_CONT(rval);
|
||||
int surf_idx;
|
||||
if(hit_surf != 0) {
|
||||
surf_idx = dagmc_ptr->index_by_handle(hit_surf);
|
||||
|
|
@ -619,12 +619,12 @@ std::pair<double, int32_t> CADCell::distance(Position p, Direction u, int32_t on
|
|||
}
|
||||
|
||||
bool CADCell::contains(Position p, Direction u, int32_t on_surface) const {
|
||||
|
||||
moab::ErrorCode rval;
|
||||
moab::EntityHandle vol = dagmc_ptr->entity_by_id(3, id_);
|
||||
|
||||
int result = 0;
|
||||
dagmc_ptr->point_in_volume(vol, p.xyz, result, u.xyz);
|
||||
|
||||
rval = dagmc_ptr->point_in_volume(vol, p.xyz, result, u.xyz);
|
||||
MB_CHK_ERR_CONT(rval);
|
||||
return bool(result);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -256,25 +256,31 @@ double CADSurface::evaluate(Position r) const
|
|||
}
|
||||
|
||||
double CADSurface::distance(Position p, Direction u, bool coincident) const {
|
||||
moab::ErrorCode rval;
|
||||
moab::EntityHandle surf = dagmc_ptr->entity_by_id(2, id_);
|
||||
moab::EntityHandle hit_surf;
|
||||
double dist;
|
||||
dagmc_ptr->ray_fire(surf, p.xyz, u.xyz, hit_surf, dist, NULL, 0, 0);
|
||||
rval = dagmc_ptr->ray_fire(surf, p.xyz, u.xyz, hit_surf, dist, NULL, 0, 0);
|
||||
MB_CHK_ERR_CONT(rval);
|
||||
if (dist < 0.0) dist = INFTY;
|
||||
return dist;
|
||||
}
|
||||
|
||||
Direction CADSurface::normal(Position p) const {
|
||||
moab::ErrorCode rval;
|
||||
Direction u;
|
||||
moab::EntityHandle surf = dagmc_ptr->entity_by_id(2, id_);
|
||||
dagmc_ptr->get_angle(surf, p.xyz, u.xyz);
|
||||
rval = dagmc_ptr->get_angle(surf, p.xyz, u.xyz);
|
||||
MB_CHK_ERR_CONT(rval);
|
||||
return u;
|
||||
}
|
||||
|
||||
BoundingBox CADSurface::bounding_box() const {
|
||||
moab::ErrorCode rval;
|
||||
moab::EntityHandle surf = dagmc_ptr->entity_by_id(2, id_);
|
||||
double min[3], max[3];
|
||||
dagmc_ptr->getobb(surf, min, max);
|
||||
rval = dagmc_ptr->getobb(surf, min, max);
|
||||
MB_CHK_ERR_CONT(rval);
|
||||
return BoundingBox(min[0], max[0], min[1], max[1], min[2], max[2]);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue