Loading [MathJax]/extensions/tex2jax.js
https://mooseframework.inl.gov
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
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 
12 registerMooseObject("RayTracingTestApp", ChangeRayRayBCTest);
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 
43 void
44 ChangeRayRayBCTest::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 }
static const RayDataIndex INVALID_RAY_DATA_INDEX
Invalid index into a Ray&#39;s data.
Definition: Ray.h:200
registerMooseObject("RayTracingTestApp", ChangeRayRayBCTest)
virtual void onBoundary(const unsigned int num_applying) override
Called on a Ray on the boundary to apply the Ray boundary condition.
const std::shared_ptr< Ray > & currentRay() const
Gets the current Ray that this is working on.
const RayDataIndex _ray_data_index
Basic datastructure for a ray that will traverse the mesh.
Definition: Ray.h:56
static InputParameters validParams()
ChangeRayRayBCTest(const InputParameters &params)
bool isParamSetByUser(const std::string &name) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void changeRayDirection(const Point &direction, const bool skip_changed_check=false)
Changes the current Ray&#39;s direction.
void mooseError(Args &&... args) const
static InputParameters validParams()
Definition: GeneralRayBC.C:13