mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
Making common function for laying ray over unstructured mesh.
This commit is contained in:
parent
6cc00a8420
commit
b6ec54fef5
2 changed files with 33 additions and 4 deletions
|
|
@ -315,8 +315,19 @@ public:
|
|||
void bins_crossed(const Particle* p, std::vector<int>& bins,
|
||||
std::vector<double>& lengths) const;
|
||||
|
||||
|
||||
bool intersects(Position& r0, Position r1, int* ijk);
|
||||
|
||||
|
||||
private:
|
||||
void
|
||||
intersect_track(const moab::CartVect& start,
|
||||
const moab::CartVect& dir,
|
||||
double track_len,
|
||||
std::vector<moab::EntityHandle>& tris,
|
||||
std::vector<double>& intersection_dists) const;
|
||||
|
||||
public:
|
||||
//! Determine which surface bins were crossed by a particle
|
||||
//
|
||||
//! \param[in] p Particle to check
|
||||
|
|
|
|||
26
src/mesh.cpp
26
src/mesh.cpp
|
|
@ -1619,6 +1619,27 @@ UnstructuredMesh::build_tree(const moab::Range& all_tets) {
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
UnstructuredMesh::intersect_track(const moab::CartVect& start,
|
||||
const moab::CartVect& dir,
|
||||
double track_len,
|
||||
std::vector<moab::EntityHandle>& tris,
|
||||
std::vector<double>& intersection_dists) const {
|
||||
|
||||
moab::ErrorCode rval = kdtree_->ray_intersect_triangles(kdtree_root_,
|
||||
1E-03,
|
||||
dir.array(),
|
||||
start.array(),
|
||||
tris,
|
||||
intersection_dists,
|
||||
0,
|
||||
track_len);
|
||||
if (rval != moab::MB_SUCCESS) {
|
||||
fatal_error("Failed to compute tracklengths on umesh: " + filename_);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
UnstructuredMesh::bins_crossed(const Particle* p, std::vector<int>& bins,
|
||||
std::vector<double>& lengths) const {
|
||||
|
|
@ -1640,10 +1661,7 @@ UnstructuredMesh::bins_crossed(const Particle* p, std::vector<int>& bins,
|
|||
std::vector<moab::EntityHandle> tris;
|
||||
std::vector<double> intersections;
|
||||
|
||||
rval = kdtree_->ray_intersect_triangles(kdtree_root_, 1E-03, dir.array(), r0.array(), tris, intersections, 0, track_len);
|
||||
if (rval != moab::MB_SUCCESS) {
|
||||
fatal_error("Failed to compute tracklengths on umesh: " + filename_);
|
||||
}
|
||||
intersect_track(r0, dir, track_len, tris, intersections);
|
||||
|
||||
bins.clear();
|
||||
for (const auto& int_dist : intersections) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue