Helper object for claiming Rays. More...
#include <ClaimRays.h>
Public Member Functions | |
ClaimRays (RayTracingStudy &study, const std::vector< std::shared_ptr< Ray >> &rays, std::vector< std::shared_ptr< Ray >> &local_rays, const bool do_exchange) | |
Constructor. More... | |
virtual void | meshChanged () override |
Call on mesh changes to reinit the necessary data structures. More... | |
void | claim () |
Claim the Rays. More... | |
const Parallel::Communicator & | comm () const |
processor_id_type | n_processors () const |
processor_id_type | processor_id () const |
Static Public Member Functions | |
static InputParameters | validParams () |
Protected Member Functions | |
virtual void | init () |
Initialize the object. More... | |
virtual void | preClaim () |
Entry point before claim() More... | |
virtual void | postClaim () |
Entry point after claim() More... | |
virtual void | prePossiblyClaimRay (const std::shared_ptr< Ray > &) |
Entry point before possibly claiming a Ray. More... | |
virtual void | postClaimRay (std::shared_ptr< Ray > &ray, const Elem *elem) |
Entry point for acting on a Ray after it is claimed. More... | |
virtual RayID | getID (const std::shared_ptr< Ray > &ray) const |
Gets an ID associated with the Ray for claiming purposes. More... | |
const libMesh::BoundingBox & | inflatedBoundingBox (const processor_id_type pid) const |
Get the inflated bounding box for rank . More... | |
Protected Attributes | |
MooseMesh & | _mesh |
The mesh. More... | |
const processor_id_type | _pid |
This processor ID. More... | |
const bool | _do_exchange |
Whether or not the Rays need to be initially exchanged. More... | |
RayTracingStudy & | _study |
The RayTracingStudy. More... | |
ParallelStudy< std::shared_ptr< Ray >, Ray > & | _parallel_study |
The ParallelStudy, used as the context for communicating rays. More... | |
const Parallel::Communicator & | _communicator |
FEProblemBase & | _mci_feproblem |
Private Member Functions | |
void | buildBoundingBoxes () |
Builds the bounding boxes (_inflated_bboxes). More... | |
void | buildPointNeighbors () |
Build the map of elements to all of their point neighbors. More... | |
void | possiblyClaim (const std::shared_ptr< Ray > &obj) |
Possibly claim a Ray. More... | |
void | verifyClaiming () |
Verifies that the claiming process succeeded. More... | |
const Elem * | claimPoint (const Point &point, const RayID id, const Elem *elem) |
Try to claim a spatial point. More... | |
Private Attributes | |
const std::vector< std::shared_ptr< Ray > > & | _rays |
The Rays that need to be searched to possibly claimed. More... | |
std::vector< std::shared_ptr< Ray > > & | _local_rays |
The local Rays that are claimed. More... | |
std::unique_ptr< libMesh::PointLocatorBase > | _point_locator = nullptr |
The point locator. More... | |
std::vector< libMesh::BoundingBox > | _inflated_bboxes |
The inflated bounding boxes for all processors. More... | |
std::unordered_map< dof_id_type, std::vector< const Elem * > > | _elem_point_neighbors |
Map of point neighbors for each element. More... | |
bool | _needs_init |
Whether or not an init is needed (bounding boxes, neighbors) More... | |
Helper object for claiming Rays.
Definition at line 34 of file ClaimRays.h.
ClaimRays::ClaimRays | ( | RayTracingStudy & | study, |
const std::vector< std::shared_ptr< Ray >> & | rays, | ||
std::vector< std::shared_ptr< Ray >> & | local_rays, | ||
const bool | do_exchange | ||
) |
Constructor.
study | The RayTracingStudy |
parallel_study | The base parallel study |
mesh | The MooseMesh |
rays | The vector of Rays that need to be claimed |
local_rays | Insertion point for Rays that have been claimed |
do_exchange | Whether or not an exchange is needed, i.e., if "rays" still needs to be filled by objects on other processors |
Definition at line 24 of file ClaimRays.C.
|
private |
Builds the bounding boxes (_inflated_bboxes).
Definition at line 181 of file ClaimRays.C.
Referenced by init().
|
private |
Build the map of elements to all of their point neighbors.
TODO: Move this eventually into MooseMesh, MeshBase, or FEProblemBase
Definition at line 201 of file ClaimRays.C.
Referenced by init().
void ClaimRays::claim | ( | ) |
Claim the Rays.
do_exchange
sets whether or not an exchange is needed, i.e., if _rays still needs to be filled by objects on other processors
Definition at line 42 of file ClaimRays.C.
Referenced by RepeatableRayStudyBase::claimRaysInternal(), and TestPICRayStudy::generateRays().
|
private |
Try to claim a spatial point.
point | The point to claim |
id | An ID associated with the point |
elem | The local element to first consider for this processor's ownership |
Definition at line 108 of file ClaimRays.C.
Referenced by possiblyClaim().
Gets an ID associated with the Ray for claiming purposes.
Defaults to the Ray's ID.
To break ties in claiming (when multiple processors have elements that contain a point, say on an element's side on a processor boundary), we pick the smallest element ID when this ID is even and the largest element ID is odd. It is possible that the same Rays can be generated with different IDs, in which case the user may want to use a different ID for this process.
Definition at line 99 of file ClaimRays.h.
Referenced by possiblyClaim(), and verifyClaiming().
|
inlineprotected |
Get the inflated bounding box for rank .
Definition at line 104 of file ClaimRays.h.
Referenced by claim().
|
protectedvirtual |
Initialize the object.
Definition at line 168 of file ClaimRays.C.
Referenced by claim().
|
overridevirtual |
Call on mesh changes to reinit the necessary data structures.
Reimplemented from MeshChangedInterface.
Definition at line 175 of file ClaimRays.C.
Possibly claim a Ray.
Definition at line 94 of file ClaimRays.C.
Referenced by claim().
|
inlineprotectedvirtual |
Entry point for acting on a Ray after it is claimed.
Definition at line 145 of file ClaimRays.C.
Referenced by possiblyClaim().
|
inlineprotectedvirtual |
|
inlineprotectedvirtual |
Entry point before possibly claiming a Ray.
Definition at line 82 of file ClaimRays.h.
Referenced by possiblyClaim().
|
private |
Verifies that the claiming process succeeded.
That is, all Rays were claimed once and only once.
Definition at line 226 of file ClaimRays.C.
Referenced by claim().
|
protected |
Whether or not the Rays need to be initially exchanged.
Definition at line 115 of file ClaimRays.h.
Referenced by claim().
|
private |
Map of point neighbors for each element.
Definition at line 168 of file ClaimRays.h.
Referenced by buildPointNeighbors(), and claimPoint().
|
private |
The inflated bounding boxes for all processors.
Definition at line 165 of file ClaimRays.h.
Referenced by buildBoundingBoxes(), and inflatedBoundingBox().
|
private |
The local Rays that are claimed.
Definition at line 159 of file ClaimRays.h.
Referenced by claim(), possiblyClaim(), and verifyClaiming().
|
protected |
The mesh.
Definition at line 110 of file ClaimRays.h.
Referenced by buildBoundingBoxes(), buildPointNeighbors(), claim(), and postClaimRay().
|
private |
Whether or not an init is needed (bounding boxes, neighbors)
Definition at line 171 of file ClaimRays.h.
Referenced by claim(), and meshChanged().
|
protected |
The ParallelStudy, used as the context for communicating rays.
Definition at line 120 of file ClaimRays.h.
Referenced by claim().
|
protected |
This processor ID.
Definition at line 112 of file ClaimRays.h.
Referenced by claim(), claimPoint(), and verifyClaiming().
|
private |
|
private |
The Rays that need to be searched to possibly claimed.
Definition at line 157 of file ClaimRays.h.
Referenced by claim(), and verifyClaiming().
|
protected |
The RayTracingStudy.
Definition at line 118 of file ClaimRays.h.
Referenced by claim(), postClaimRay(), and verifyClaiming().