18 const std::vector<std::shared_ptr<TraceRay>> & threaded_trace_ray)
20 ray_tracing_study.comm(), ray_tracing_study.parameters(),
"ParallelRayStudy"),
21 _ray_tracing_study(ray_tracing_study),
22 _threaded_trace_ray(threaded_trace_ray)
29 for (
auto it = begin; it != end; ++it)
31 std::shared_ptr<Ray> & ray = *it;
34 if (!ray->shouldContinue())
41 mooseAssert(ray->currentElem()->processor_id() !=
_pid,
42 "Continuing Ray not going to another processor");
51 return !ray->shouldContinue();
66 mooseAssert(ray->shouldContinue(),
"Tracing Ray that should not continue");
69 if (ray->currentElem()->processor_id() ==
_pid)
76 std::stringstream oss;
79 if (error == MoveWorkError::DURING_EXECUTION_DISABLED)
81 oss <<
"Rays are being added to the buffer during propagation.\n\n";
82 oss <<
"This capability must be enabled by setting the parameter\n";
83 oss <<
"'allow_new_work_during_execution' to true.";
85 else if (error == MoveWorkError::PRE_EXECUTION_AND_EXECUTION_ONLY)
86 oss <<
"Rays can only be added to the buffer during generateRays() and tracing.";
87 else if (error == MoveWorkError::PRE_EXECUTION_ONLY)
88 oss <<
"Rays can only be added to the buffer during generateRays().";
89 else if (error == MoveWorkError::PRE_EXECUTION_THREAD_0_ONLY)
90 oss <<
"Rays can only be added on thread 0 during generateRays() (not thread safe)";
95 oss <<
"\n\n" << (*ray)->getInfo();
virtual void onCompleteRay(const std::shared_ptr< Ray > &ray)
Entry point for acting on a ray when it is completed (shouldContinue() == false)
void mooseError(Args &&... args)
const std::vector< std::shared_ptr< TraceRay > > & _threaded_trace_ray
The TraceRay objects that do the tracing for each thread.
const processor_id_type _pid
This rank.
void moveParallelDataToBuffer(std::shared_ptr< Ray > &data, const processor_id_type dest_pid)
Moves parallel data objects to the send buffer to be communicated to processor dest_pid.
bool workIsComplete(const std::shared_ptr< Ray > &ray) override
Can be overridden to denote if a piece of work is not complete yet.
void moveContinuingWorkToBuffer(std::shared_ptr< Ray > &Work)
Moves work that is considered continuing for the purposes of the execution algorithm into the buffer...
MoveWorkError
Enum for providing useful errors during work addition in moveWorkError().
void moveWorkError(const MoveWorkError error, const std::shared_ptr< Ray > *ray) const override
const std::string & type() const
Basic datastructure for a ray that will traverse the mesh.
RayTracingStudy & _ray_tracing_study
The RayTracingStudy.
ParallelRayStudy(RayTracingStudy &study, const std::vector< std::shared_ptr< TraceRay >> &threaded_trace_ray)
MooseUtils::Buffer< std::shared_ptr< Ray > >::iterator work_iterator
MooseUtils::Buffer< std::shared_ptr< Ray > >::iterator parallel_data_iterator
void executeWork(const std::shared_ptr< Ray > &ray, const THREAD_ID tid) override
Pure virtual to be overridden that executes a single object of work on a given thread.
void postReceiveParallelData(const parallel_data_iterator begin, const parallel_data_iterator end) override
void postExecuteChunk(const work_iterator begin, const work_iterator end) override
Base class for Ray tracing studies that will generate Rays and then propagate all of them to terminat...