https://mooseframework.inl.gov
Loading...
Searching...
No Matches
CreateRayRayBCTest.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
10#include "CreateRayRayBCTest.h"
11
12// Local includes
13#include "RayTracingStudy.h"
14
16
22
24 : GeneralRayBC(params),
25 _secondary_ray_data_index(_study.registerRayAuxData(name() + "_secondary"))
26{
27}
28
29void
30CreateRayRayBCTest::onBoundary(const unsigned int /* num_applying */)
31{
32 // Don't generate another if this Ray is already a secondary Ray (was generated mid-trace)
33 const bool is_secondary = currentRay()->auxData(_secondary_ray_data_index) > 0;
34 if (is_secondary)
35 return;
36
37 // Reverse direction of the Ray - where the new Ray will go
38 const Point reverse_direction = -1.0 * currentRay()->direction();
39
40 // Get a new Ray that starts in this elem, at the current intersection point in the
41 // reverse direction, from the current interescted side, with a unique ID
42 std::shared_ptr<Ray> new_ray = acquireRay(reverse_direction);
43 // Set that this Ray is a secondary Ray so that it doesn't generate even more Rays
44 new_ray->auxData(_secondary_ray_data_index) = 1;
45 // Add it to the buffer to be traced and we're done!
46 moveRayToBuffer(new_ray);
47}
registerMooseObject("RayTracingTestApp", CreateRayRayBCTest)
const std::string name
Definition Setup.h:21
A RayBC that generates an additional Ray at the intersection point on the boundary in the opposite di...
virtual void onBoundary(const unsigned int num_applying) override
Called on a Ray on the boundary to apply the Ray boundary condition.
static InputParameters validParams()
CreateRayRayBCTest(const InputParameters &params)
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)
static InputParameters validParams()
std::shared_ptr< Ray > acquireRay(const Point &direction)
Acquires a Ray to be used for generating a new Ray while tracing on the boundary.
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...
const std::shared_ptr< Ray > & currentRay() const
Gets the current Ray that this is working on.