Skip to content

Commit

Permalink
Adding find_volume method for compatibility with the DAGMC interface
Browse files Browse the repository at this point in the history
  • Loading branch information
pshriwise committed Aug 17, 2023
1 parent 52b74f1 commit 63ef0cd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/double_down/RTI.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ class RayTracingInterface {
//! \brief Release all Embree scenes and device.
void shutdown();

moab::ErrorCode
find_volume(const double xyz[3],
moab::EntityHandle& volume,
double* uvw=nullptr);

//! \brief Check location \p xyz for containment in the specified \p volume.
//! Performs a point containment query by firing a single ray and checking the dot product
//! of the ray direction and the sense-adjusted normal of the triangle hit. Falls back onto
Expand Down
16 changes: 16 additions & 0 deletions src/RTI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,22 @@ RayTracingInterface::point_in_volume_slow(moab::EntityHandle volume,
return MB_SUCCESS;
}

moab::ErrorCode
RayTracingInterface::find_volume(const double xyz[3],
moab::EntityHandle& volume,
double* uvw) {
int result = 0;
for (int i = 0; i < GTT->num_entities(3); i++) {
moab::EntityHandle vol = GTT->entity_by_index(3, i);
point_in_volume(vol, xyz, result, uvw);
if (result == 1) {
volume = vol;
break;
}
}
return moab::MB_SUCCESS;
}

moab::ErrorCode
RayTracingInterface::point_in_volume(const moab::EntityHandle volume,
const double xyz[3],
Expand Down

0 comments on commit 63ef0cd

Please sign in to comment.