Skip to content

Commit

Permalink
Merge pull request #42 from pshriwise/find-vol
Browse files Browse the repository at this point in the history
Adding find_volume method for compatibility with the DAGMC interface
  • Loading branch information
ebknudsen authored Aug 17, 2023
2 parents 52b74f1 + 1e710de commit 636242f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
7 changes: 6 additions & 1 deletion 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,
const 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 All @@ -115,7 +120,7 @@ class RayTracingInterface {
const double xyz[3],
int& result,
const double *uvw,
const moab::GeomQueryTool::RayHistory *history,
const moab::GeomQueryTool::RayHistory *history=nullptr,
double overlap_tol = 0.0);


Expand Down
19 changes: 19 additions & 0 deletions src/RTI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,25 @@ RayTracingInterface::point_in_volume_slow(moab::EntityHandle volume,
return MB_SUCCESS;
}

moab::ErrorCode
RayTracingInterface::find_volume(const double xyz[3],
moab::EntityHandle& volume,
const double* uvw) {
int result = 0;
moab::Range vols;
moab::ErrorCode rval = GTT->get_gsets_by_dimension(3, vols);
if (rval != moab::MB_SUCCESS) return rval;
for (moab::EntityHandle vol : vols) {
rval = point_in_volume(vol, xyz, result, uvw);
if (rval != moab::MB_SUCCESS) return rval;
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 636242f

Please sign in to comment.