https://mooseframework.inl.gov
Loading...
Searching...
No Matches
CreateRayRayKernelTest.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
11
12// Local includes
13#include "RayTracingStudy.h"
14
16
19{
20 auto params = GeneralRayKernel::validParams();
21 return params;
22}
23
25 : GeneralRayKernel(params),
26 _secondary_ray_data_index(_study.registerRayAuxData(name() + "_secondary"))
27{
28}
29
30void
32{
33 // Don't generate another if this Ray is already a secondary Ray (was generated mid-trace)
34 const bool is_secondary = currentRay()->auxData(_secondary_ray_data_index) > 0;
35 if (is_secondary)
36 return;
37
38 // Midpoint of the Ray segment - where the new Ray will start
39 const Point midpoint = 0.5 * (_current_segment_start + _current_segment_end);
40 // Reverse direction of the Ray - where the new Ray will go
41 const Point reverse_direction = -1.0 * currentRay()->direction();
42
43 // Get a new Ray that starts in this elem, at the midpoint in the
44 // reverse direction, with a unique ID
45 std::shared_ptr<Ray> new_ray = acquireRay(midpoint, reverse_direction);
46 // Set that this Ray is a secondary Ray so that it doesn't generate even more Rays
47 new_ray->auxData(_secondary_ray_data_index) = 1;
48 // Add it to the buffer to be traced and we're done!
49 moveRayToBuffer(new_ray);
50}
registerMooseObject("RayTracingTestApp", CreateRayRayKernelTest)
const std::string name
Definition Setup.h:21
A RayKernel that generates an additional Ray at the midpoint of each segment in the opposite directio...
CreateRayRayKernelTest(const InputParameters &params)
static InputParameters validParams()
const RayDataIndex _secondary_ray_data_index
Ray's aux data index for a value that states if a Ray is a secondary ray (generated-mid trace)
virtual void onSegment() override
Called on each segment of a Ray.
static InputParameters validParams()
const Point & _current_segment_start
The start point of the current Ray's segment.
void moveRayToBuffer(std::shared_ptr< Ray > &ray)
Moves a Ray into the working buffer to be traced during tracing with a meaningful error on verificati...
std::shared_ptr< Ray > acquireRay(const Point &start, const Point &direction)
Acquires a Ray to be used for generating a new Ray while tracing on the boundary.
const Point & _current_segment_end
The end point of the current Ray's segment.
const std::shared_ptr< Ray > & currentRay() const
Gets the current Ray that this is working on.