12 #include "libmesh/parallel_sync.h" 23 params.addParam<
bool>(
"add_duplicate_ray",
false,
"Add a duplicate Ray to the buffer");
24 params.addParam<
bool>(
25 "add_local_non_unique_id_ray",
false,
"Add two Rays on each processor with the same ID");
26 params.addParam<
bool>(
27 "add_global_non_unique_id_ray",
false,
"Add a Ray on each processor with the same ID");
29 params.addParam<
bool>(
"ray_error_if_tracing",
false,
"Tests Ray::errorIfTracing()");
30 params.addParam<
bool>(
31 "ray_reset_counters",
false,
"Tests resetting a Ray's counters after it has began tracing");
33 params.addParam<
bool>(
34 "register_ray_data_late",
false,
"Tests registering data late in registerRayDataInternal()");
35 params.addParam<
bool>(
36 "register_ray_data_same_name",
38 "Tests registering ray data with the same name in registerRayDataInternal()");
39 params.addParam<
bool>(
"ray_data_index_bad_name",
41 "Tests requesting ray data index for a name that does not exist in " 42 "getRayDataIndexInternal()");
43 params.addParam<
bool>(
"ray_data_name_bad_index",
45 "Tests requesting ray data name for an index that does not exist in " 46 "getRayDataNameInternal()");
48 params.addParam<
bool>(
49 "get_ray_kernels_early",
false,
"Tests getting ray kernels early with getRayKernels()");
50 params.addParam<
bool>(
"get_ray_bcs_early",
false,
"Tests getting ray bcs early with getRayBCs()");
52 params.addParam<
bool>(
53 "get_ray_bank_generating",
false,
"Tests getting the ray bank when it is not available");
55 params.addParam<
bool>(
"register_ray_no_registration",
57 "Tests registering a Ray with Ray registration disabled");
58 params.addParam<
bool>(
"registered_ray_id_no_registration",
60 "Tests getting a registered ray id with registration disabled");
61 params.addParam<
bool>(
"registered_ray_name_no_registration",
63 "Tests getting a registered ray name with registration disabled");
65 params.addParam<
bool>(
66 "reserve_bad",
false,
"Tests reserving space in the ray buffer outside of registration");
68 params.addParam<
bool>(
"subdomain_hmax_missing",
70 "Tests requesting the subdomain hmax for an invalid subdomain");
72 params.addParam<
bool>(
73 "get_elem_normals_unimplemented",
false,
"Tests getElemNormals not being overridden");
75 params.addParam<
bool>(
"elem_extrema_build_edge",
77 "Tests building an edge from extrema when the vertices are incorrect");
79 params.addParam<
bool>(
"ray_data_index_other_exists",
81 "Tests getting a Ray data index when aux data with the same name exists");
82 params.addParam<
bool>(
"ray_data_aux_index_other_exists",
84 "Tests getting a Ray aux data index when data with the same name exists");
86 params.set<
bool>(
"_use_ray_registration") =
false;
94 if (getParam<bool>(
"register_ray_data_same_name"))
99 if (getParam<bool>(
"ray_data_index_bad_name"))
101 if (getParam<bool>(
"ray_data_name_bad_index"))
103 if (getParam<bool>(
"get_ray_kernels_early"))
105 std::vector<RayKernelBase *> rks;
108 if (getParam<bool>(
"get_ray_bcs_early"))
110 std::vector<RayBoundaryConditionBase *> rbcs;
113 if (getParam<bool>(
"registered_ray_id_no_registration"))
115 if (getParam<bool>(
"registered_ray_name_no_registration"))
117 if (getParam<bool>(
"reserve_bad"))
119 if (getParam<bool>(
"get_elem_normals_unimplemented"))
121 if (getParam<bool>(
"elem_extrema_build_edge"))
126 if (getParam<bool>(
"ray_data_index_other_exists"))
131 if (getParam<bool>(
"ray_data_aux_index_other_exists"))
147 ray->setStart(elem->vertex_average(), elem);
148 ray->setStartingEndPoint(elem->point(0));
150 if (getParam<bool>(
"add_duplicate_ray"))
152 std::shared_ptr<Ray> duplicate_ray = ray;
157 if (getParam<bool>(
"add_local_non_unique_id_ray"))
164 if (getParam<bool>(
"add_global_non_unique_id_ray"))
166 mooseAssert(
n_processors() > 1,
"Needs multiple ranks");
168 std::map<processor_id_type, std::vector<std::shared_ptr<Ray>>> send_map;
172 send_map[pid].push_back(ray);
176 auto add_ray_functor = [&](
processor_id_type,
const std::vector<std::shared_ptr<Ray>> & rays)
178 std::shared_ptr<Ray> ray = rays[0];
179 ray->clearStartingInfo();
180 ray->setStart(elem->vertex_average());
181 ray->setStartingEndPoint(elem->point(0));
185 Parallel::push_parallel_packed_range(
comm(), send_map,
parallelStudy(), add_ray_functor);
188 if (getParam<bool>(
"ray_error_if_tracing") || getParam<bool>(
"ray_reset_counters"))
192 if (getParam<bool>(
"register_ray_data_late"))
195 if (getParam<bool>(
"get_ray_bank_generating"))
198 if (getParam<bool>(
"register_ray_no_registration"))
201 if (getParam<bool>(
"subdomain_hmax_missing"))
208 if (getParam<bool>(
"ray_error_if_tracing"))
210 ray->clearStartingInfo();
212 if (getParam<bool>(
"ray_reset_counters"))
214 ray->resetCounters();
227 params.set<
bool>(
"_bank_rays_on_completion") =
false;
236 params.addParam<
bool>(
237 "registered_ray_id_missing",
false,
"Tests registeredRayID() with an invalid id");
238 params.addParam<
bool>(
239 "registered_ray_name_missing",
false,
"Tests registeredRayName() with an invalid name");
248 if (getParam<bool>(
"registered_ray_id_missing"))
250 if (getParam<bool>(
"registered_ray_name_missing"))
ParallelStudy< std::shared_ptr< Ray >, Ray > * parallelStudy()
The underlying parallel study: used for the context for calling the packed range routines.
void getRayKernels(std::vector< RayKernelBase *> &result, SubdomainID id, THREAD_ID tid)
Fills the active RayKernels associated with this study and a block into result.
RayDataIndex registerRayData(const std::string &name)
Register a value to be filled in the data on a Ray with a given name.
libMesh::ConstElemRange * getActiveLocalElementRange()
const std::vector< std::shared_ptr< Ray > > & rayBank() const
Get the Ray bank.
RayTracingStudyWithRegistrationTest(const InputParameters ¶meters)
RayDataIndex registerRayAuxData(const std::string &name)
Register a value to be filled in the aux data on a Ray with a given name.
MooseMesh & _mesh
The Mesh.
std::shared_ptr< Ray > acquireRay()
User APIs for constructing Rays within the RayTracingStudy.
void generateRays() override
Subclasses should override this to determine how to generate Rays.
Helper for defining if at an element's edge, vertex, or neither.
const Parallel::Communicator & comm() const
std::unique_ptr< const libMesh::Elem > buildEdge(const Elem *elem) const
void postExecuteStudy() override
Entry point after study execution.
std::shared_ptr< Ray > acquireRegisteredRay(const std::string &name)
Acquires a Ray with a given name within generateRays().
RayTracingStudyNoBankingTest(const InputParameters ¶meters)
RayDataIndex getRayAuxDataIndex(const std::string &name, const bool graceful=false) const
Gets the index associated with a registered value in the Ray aux data.
Real subdomainHmax(const SubdomainID subdomain_id) const
Get the cached hmax for all elements in a subdomain.
static InputParameters validParams()
uint8_t processor_id_type
processor_id_type n_processors() const
RayTracingStudyTest(const InputParameters ¶meters)
const std::string & getRayDataName(const RayDataIndex index) const
Gets the name associated with a registered value in the Ray data.
void reserveRayBuffer(const std::size_t size)
Reserve size entires in the Ray buffer.
static InputParameters validParams()
static InputParameters validParams()
static InputParameters validParams()
virtual const Point * getElemNormals(const Elem *, const THREAD_ID)
Gets the outward normals for a given element.
void getRayBCs(std::vector< RayBoundaryConditionBase *> &result, BoundaryID id, THREAD_ID tid)
Fills the active RayBCs associated with this study and a boundary into result.
const_iterator begin() const
MeshBase & meshBase() const
Access to the libMesh MeshBase.
const processor_id_type _pid
The rank of this processor (this actually takes time to lookup - so just do it once) ...
const std::string & registeredRayName(const RayID ray_id) const
Gets the name of a registered ray.
void moveRayToBuffer(std::shared_ptr< Ray > &ray)
Moves a ray to the buffer to be traced during generateRays().
RayID registeredRayID(const std::string &name, const bool graceful=false) const
Gets the ID of a registered ray.
registerMooseObject("RayTracingTestApp", RayTracingStudyTest)
RayDataIndex getRayDataIndex(const std::string &name, const bool graceful=false) const
Gets the index associated with a registered value in the Ray data.
std::shared_ptr< Ray > acquireCopiedRay(const Ray &ray)
Acquires a Ray that that is copied from another Ray within generateRays().
Base class for Ray tracing studies that will generate Rays and then propagate all of them to terminat...