mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 21:55:41 -04:00
Threaded ray hist in 10 lines.
This commit is contained in:
parent
7b6ec80acf
commit
c22d5cbc15
1 changed files with 13 additions and 1 deletions
14
src/cell.cpp
14
src/cell.cpp
|
|
@ -608,18 +608,30 @@ CSGCell::contains_complex(Position r, Direction u, int32_t on_surface) const
|
|||
// DAGMC Cell implementation
|
||||
//==============================================================================
|
||||
#ifdef DAGMC
|
||||
|
||||
extern moab::DagMC::RayHistory history;
|
||||
extern Direction last_dir;
|
||||
#pragma omp threadprivate(history, last_dir)
|
||||
moab::DagMC::RayHistory history;
|
||||
Direction last_dir;
|
||||
|
||||
DAGCell::DAGCell() : Cell{} {};
|
||||
|
||||
std::pair<double, int32_t>
|
||||
DAGCell::distance(Position r, Direction u, int32_t on_surface) const
|
||||
{
|
||||
if (u != last_dir) {
|
||||
history.reset();
|
||||
last_dir = u;
|
||||
}
|
||||
|
||||
moab::ErrorCode rval;
|
||||
moab::EntityHandle vol = dagmc_ptr_->entity_by_index(3, dag_index_);
|
||||
moab::EntityHandle hit_surf;
|
||||
double dist;
|
||||
double pnt[3] = {r.x, r.y, r.z};
|
||||
double dir[3] = {u.x, u.y, u.z};
|
||||
rval = dagmc_ptr_->ray_fire(vol, pnt, dir, hit_surf, dist);
|
||||
rval = dagmc_ptr_->ray_fire(vol, pnt, dir, hit_surf, dist, &history);
|
||||
MB_CHK_ERR_CONT(rval);
|
||||
int surf_idx;
|
||||
if (hit_surf != 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue