19 params.addParam<
bool>(
"get_info",
false,
"Tests Ray::getInfo()");
20 params.addParam<
bool>(
"equality",
false,
"Tests the equality and inequality operators for Ray");
34 if (getParam<bool>(
"get_info"))
35 for (
const auto & ray :
rayBank())
38 if (getParam<bool>(
"equality"))
40 std::size_t same_passes = 0, duplicate_passes = 0;
42 std::vector<UserObject *> uos;
46 if (
auto study = dynamic_cast<RayTracingStudy *>(uo))
52 mooseAssert(other_study,
"Failed to find other study");
54 for (
const auto & ray :
rayBank())
56 std::vector<std::shared_ptr<Ray>> duplicate_rays;
58 auto duplicate_ray = [&ray, &duplicate_rays](
RayTracingStudy * study =
nullptr)
60 auto duplicate = std::make_shared<Ray>(study !=
nullptr ? study : &ray->_study,
63 ray->auxData().size(),
66 duplicate->_current_point = ray->_current_point;
67 duplicate->_direction = ray->_direction;
68 duplicate->_current_elem = ray->_current_elem;
69 duplicate->_current_incoming_side = ray->_current_incoming_side;
70 duplicate->_end_set = ray->_end_set;
71 duplicate->_processor_crossings = ray->_processor_crossings;
72 duplicate->_intersections = ray->_intersections;
73 duplicate->_trajectory_changes = ray->_trajectory_changes;
74 duplicate->_trajectory_changed = ray->_trajectory_changed;
75 duplicate->_distance = ray->_distance;
76 duplicate->_max_distance = ray->_max_distance;
77 duplicate->_should_continue = ray->_should_continue;
78 duplicate->_data = ray->_data;
79 duplicate->_aux_data = ray->_aux_data;
81 duplicate_rays.push_back(duplicate);
86 if (*ray != *ray || !(*ray == *ray))
91 ++duplicate_ray()->_id;
94 bool found_other_elem =
false;
95 for (
const auto & elem :
meshBase().active_local_element_ptr_range())
96 if (elem != ray->currentElem())
98 found_other_elem =
true;
99 duplicate_ray()->_current_elem = elem;
102 if (!found_other_elem)
104 if (ray->invalidCurrentIncomingSide())
105 duplicate_ray()->_current_incoming_side = 0;
107 ++duplicate_ray()->_current_incoming_side;
108 duplicate_ray()->_end_set = !ray->_end_set;
109 ++duplicate_ray()->_processor_crossings;
110 ++duplicate_ray()->_intersections;
111 ++duplicate_ray()->_trajectory_changes;
112 duplicate_ray()->_trajectory_changed = !ray->_trajectory_changed;
113 duplicate_ray()->_distance += 1;
114 duplicate_ray()->_max_distance = 0;
115 duplicate_ray()->_should_continue = !ray->_should_continue;
116 duplicate_ray()->_data.resize(ray->_data.size() + 1);
117 duplicate_ray()->_data[0] += 1;
118 duplicate_ray()->_aux_data.resize(ray->_aux_data.size() + 1);
119 duplicate_ray()->_aux_data[0] += 1;
120 duplicate_ray(other_study);
122 for (
const auto & duplicate : duplicate_rays)
124 const auto equal = *duplicate == *ray;
128 const auto inequal = *duplicate != *ray;
132 if (equal != !inequal)
142 _console <<
"Ray equality test: same_passes = " << same_passes
143 <<
", duplicate_passes = " << duplicate_passes << std::endl;
RayDataIndex registerRayData(const std::string &name)
Register a value to be filled in the data on a Ray with a given name.
const std::vector< std::shared_ptr< Ray > > & rayBank() const
Get the Ray bank.
RayDataIndex registerRayAuxData(const std::string &name)
Register a value to be filled in the aux data on a Ray with a given name.
Class that is used as a parameter to the public constructors/reset methods.
TestRayLots(const InputParameters ¶meters)
const Parallel::Communicator & comm() const
static InputParameters validParams()
TheWarehouse & theWarehouse() const
void postExecuteStudy() override final
Entry point after study execution.
OStreamProxy err(std::cerr)
static InputParameters validParams()
registerMooseObject("RayTracingTestApp", TestRayLots)
FEProblemBase & _fe_problem
void mooseError(Args &&... args) const
MeshBase & meshBase() const
Access to the libMesh MeshBase.
static const libMesh::Point invalid_point(invalid_distance, invalid_distance, invalid_distance)
Identifier for an invalid point.
const ConsoleStream _console
A RayTracingStudy used for generating a lot of rays for testing purposes.
processor_id_type processor_id() const
Base class for Ray tracing studies that will generate Rays and then propagate all of them to terminat...