https://mooseframework.inl.gov
RayBoundaryConditionBase.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 #include "TraceRay.h"
15 
16 // MOOSE includes
17 #include "Assembly.h"
18 
21 {
22  auto params = RayTracingObject::validParams();
24 
25  params.addParam<std::vector<std::string>>("depends_on",
26  "Other RayBCs that this RayBC depends on");
27 
28  params.registerBase("RayBoundaryCondition");
29  params.registerSystemAttributeName("RayBoundaryCondition");
30 
31  // We don't currently allow reinits on RayBCs just yet
32  params.suppressParameter<bool>("implicit");
33 
34  return params;
35 }
36 
38  : RayTracingObject(params),
39  Restartable(this, "RayBoundaryConditions"),
40  BoundaryRestrictableRequired(this, false), // false for sidesets
41  _current_intersection_point(_trace_ray.currentIntersectionPoint()),
42  _current_bnd_id(_trace_ray.currentBoundaryID())
43 {
44  // Add dependencies
45  if (params.isParamSetByUser("depends_on"))
46  for (const auto & name : getParam<std::vector<std::string>>("depends_on"))
47  dependsOn(name);
48 }
49 
51 
52 void
53 RayBoundaryConditionBase::changeRayDirection(const Point & direction, const bool skip_changed_check)
54 {
55  auto & ray = currentRay();
56 
57  if (!ray->shouldContinue())
58  mooseError("Cannot changeRayDirection() for a Ray that should not continue\n\n",
59  ray->getInfo());
60 
61  if (!skip_changed_check && ray->trajectoryChanged())
62  mooseError("Cannot change direction for a ray whose direction has already been changed\n\n",
63  ray->getInfo());
64 
65  if (ray->endSet())
66  mooseError("Cannot change the direction of a Ray whose end point is set upon generation "
67  "(via setStartingEndPoint()).\n\n",
68  ray->getInfo());
69 
70  ray->changeDirection(direction, Ray::ChangeDirectionKey());
71 }
72 
73 std::shared_ptr<Ray>
74 RayBoundaryConditionBase::acquireRay(const Point & direction)
75 {
76  mooseAssert(_study.currentlyPropagating(), "Should not be getting a Ray while not propagating");
77 
78  // Acquire a Ray with the proper sizes and a unique ID, and set the start info
79  std::shared_ptr<Ray> ray =
82  ray->setStartingDirection(direction);
83 
84  return ray;
85 }
86 
87 void
88 RayBoundaryConditionBase::moveRayToBuffer(std::shared_ptr<Ray> & ray)
89 {
90  mooseAssert(_study.currentlyPropagating(),
91  "Should not move Rays into buffer while not propagating");
92 
94 }
const unsigned short & _current_intersected_side
The side that _current_ray intersects (if any)
static InputParameters validParams()
void moveRayToBufferDuringTrace(std::shared_ptr< Ray > &ray, const THREAD_ID tid, const AcquireMoveDuringTraceKey &)
INTERNAL method for moving a Ray into the buffer during tracing.
std::shared_ptr< Ray > acquireRay(const Point &direction)
Acquires a Ray to be used for generating a new Ray while tracing on the boundary. ...
const Point & _current_intersection_point
The current intersection point on the boundary.
Base class for a MooseObject used in ray tracing.
const std::shared_ptr< Ray > & currentRay() const
Gets the current Ray that this is working on.
RayBoundaryConditionBase(const InputParameters &params)
Key that is used for restricting access to moveRayToBufferDuringTrace() and acquireRayDuringTrace().
std::shared_ptr< Ray > acquireRayDuringTrace(const THREAD_ID tid, const AcquireMoveDuringTraceKey &)
INTERNAL methods for acquiring a Ray during a trace in RayKernels and RayBCs.
virtual const std::string & name() const
const Elem *const & _current_elem
The current Elem that _current_ray is tracing through.
static InputParameters validParams()
const T & getParam(const std::string &name) const
const THREAD_ID _tid
The thread id.
bool isParamSetByUser(const std::string &name) const
void dependsOn(const std::string name)
Add an object of this classes base type that this class depends on.
bool currentlyPropagating() const
Whether or not the study is propagating (tracing Rays)
Class that is used as a parameter to changeDirection() that allows only RayBC methods to call changeD...
Definition: Ray.h:63
void changeRayDirection(const Point &direction, const bool skip_changed_check=false)
Changes the current Ray&#39;s direction.
void mooseError(Args &&... args) const
RayTracingStudy & _study
The RayTracingStudy associated with this object.
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...
static InputParameters validParams()