Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions include/openmc/plot.h
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,12 @@ class SolidRayTracePlot : public RayTracePlot {
class Ray : public GeometryState {

public:
// Initialize from location and direction
Ray(Position r, Direction u) { init_from_r_u(r, u); }

// Initialize from known geometry state
Ray(const GeometryState& p) : GeometryState(p) {}

// Called at every surface intersection within the model
virtual void on_intersection() = 0;

Expand Down
27 changes: 24 additions & 3 deletions src/plot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1667,9 +1667,25 @@ void Ray::trace()
// After phase one is done, we can starting tracing from cell to cell within
// the model. This step can use neighbor lists to accelerate the ray tracing.

// Attempt to initialize the particle. We may have to enter a loop to move
// it up to the edge of the model.
bool inside_cell = exhaustive_find_cell(*this, settings::verbosity >= 10);
bool inside_cell;
// Check for location if the particle is already known
if (lowest_coord().cell() == C_NONE) {
// The geometry position of the particle is either unknown or outside of the
// edge of the model.
if (lowest_coord().universe() == C_NONE) {
// Attempt to initialize the particle. We may have to
// enter a loop to move it up to the edge of the model.
inside_cell = exhaustive_find_cell(*this, settings::verbosity >= 10);
} else {
// It has been already calculated that the current position is outside of
// the edge of the model.
inside_cell = false;
}
} else {
// Availability of the cell means that the particle is located inside the
// edge.
inside_cell = true;
}

// Advance to the boundary of the model
while (!inside_cell) {
Expand Down Expand Up @@ -1750,6 +1766,11 @@ void Ray::trace()
coord(lev).r() += boundary().distance() * coord(lev).u();
}
surface() = boundary().surface();
// Initialize last cells from the current cell, because the cell() variable
// does not contain the data for the case of a single-segment ray
for (int j = 0; j < n_coord(); ++j) {
cell_last(j) = coord(j).cell();
}
n_coord_last() = n_coord();
n_coord() = boundary().coord_level();
if (boundary().lattice_translation()[0] != 0 ||
Expand Down
Loading