https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ChangeRayRayBCTest.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 "ChangeRayRayBCTest.h"
11
13
16{
17 auto params = GeneralRayBC::validParams();
18
19 params.addParam<std::string>("data_name", "Name of the data to change");
20 params.addParam<Real>("add_value", 0, "Value to add to the data");
21 params.addParam<Real>("scale_value", 1, "Value to scale the data with");
22
23 params.addParam<bool>("change_direction", false, "Whether or not to change the Ray's direction");
24 params.addParam<bool>("change_direction_zero",
25 false,
26 "Whether or not to change the Ray's direction to the zero vector");
27
28 return params;
29}
30
32 : GeneralRayBC(params),
33 _ray_data_index(isParamValid("data_name")
34 ? _study.getRayDataIndex(getParam<std::string>("data_name"))
35 : Ray::INVALID_RAY_DATA_INDEX),
36 _add_value(getParam<Real>("add_value")),
37 _scale_value(getParam<Real>("scale_value"))
38{
39 if (params.isParamSetByUser("add_value") && params.isParamSetByUser("scale_value"))
40 mooseError("Cannot add and scale value");
41}
42
43void
44ChangeRayRayBCTest::onBoundary(const unsigned int /* num_applying */)
45{
47 {
50 }
51
52 if (getParam<bool>("change_direction"))
53 changeRayDirection(-currentRay()->direction());
54 if (getParam<bool>("change_direction_zero"))
55 changeRayDirection(Point(0, 0, 0));
56}
registerMooseObject("RayTracingTestApp", ChangeRayRayBCTest)
static InputParameters validParams()
const RayDataIndex _ray_data_index
ChangeRayRayBCTest(const InputParameters &params)
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()
bool isParamSetByUser(const std::string &name) const
void mooseError(Args &&... args) const
void changeRayDirection(const Point &direction, const bool skip_changed_check=false)
Changes the current Ray's direction.
const std::shared_ptr< Ray > & currentRay() const
Gets the current Ray that this is working on.
Basic datastructure for a ray that will traverse the mesh.
Definition Ray.h:58
static const RayDataIndex INVALID_RAY_DATA_INDEX
Invalid index into a Ray's data.
Definition Ray.h:212