Line data Source code
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 "RayTracingObject.h" 11 : 12 : #include "TraceRay.h" 13 : 14 : InputParameters 15 15687 : RayTracingObject::validParams() 16 : { 17 15687 : auto params = MooseObject::validParams(); 18 15687 : params += SetupInterface::validParams(); 19 15687 : params += TransientInterface::validParams(); 20 15687 : params += MeshChangedInterface::validParams(); 21 : 22 31374 : params.addParam<UserObjectName>("study", 23 : "The RayTracingStudy associated with this object. If none " 24 : "provided, this will default to the one study that exists."); 25 31374 : params.addParam<std::vector<std::string>>( 26 : "rays", 27 : "The name of the Rays associated with this object; only used if Ray registration is enabled " 28 : "within the study. If no Rays are supplied, this object will be applied to all Rays."); 29 : 30 15687 : params.addPrivateParam<RayTracingStudy *>("_ray_tracing_study"); 31 : 32 : // Execute flags don't make sense here because the RayTracingStudy calls this object 33 15687 : params.suppressParameter<ExecFlagEnum>("execute_on"); 34 : 35 15687 : return params; 36 0 : } 37 : 38 8443 : RayTracingObject::RayTracingObject(const InputParameters & params) 39 : : MooseObject(params), 40 : SetupInterface(this), 41 : FunctionInterface(this), 42 : PostprocessorInterface(this), 43 : VectorPostprocessorInterface(this), 44 : MeshChangedInterface(params), 45 : TransientInterface(this), 46 : UserObjectInterface(this), 47 : DependencyResolverInterface(), 48 8443 : _tid(params.get<THREAD_ID>("_tid")), 49 8443 : _fe_problem(*params.getCheckedPointerParam<FEProblemBase *>("_fe_problem_base")), 50 8443 : _study(*params.getCheckedPointerParam<RayTracingStudy *>("_ray_tracing_study")), 51 8443 : _trace_ray(const_cast<const RayTracingStudy &>(_study).traceRay(_tid)), 52 8443 : _nl(getNonlinearSystem()), 53 8443 : _aux(_fe_problem.getAuxiliarySystem()), 54 8443 : _mesh(_fe_problem.mesh()), 55 8443 : _current_elem(_trace_ray.currentElem()), 56 8443 : _current_subdomain_id(_trace_ray.currentSubdomainID()), 57 8443 : _current_intersected_side(_trace_ray.currentIntersectedSide()), 58 8443 : _current_intersected_extrema(_trace_ray.currentIntersectedExtrema()), 59 8443 : _current_ray(_trace_ray.currentRay()) 60 : { 61 : // Supplies only itself 62 8443 : _supplied_names.insert(name()); 63 8443 : } 64 : 65 : NonlinearSystemBase * 66 8443 : RayTracingObject::getNonlinearSystem() 67 : { 68 : // If this object actually operates with a nonlinear variable that belongs to a system 69 : // we use the variable's system 70 8443 : if (_study.systemNumber() < _fe_problem.numNonlinearSystems()) 71 8443 : return &_fe_problem.getNonlinearSystemBase(_study.systemNumber()); 72 : 73 : // If the user operates on auxiliary variables we just use the first nonlinear 74 : // system if there is any 75 0 : if (_fe_problem.numNonlinearSystems()) 76 0 : return &_fe_problem.getNonlinearSystemBase(0); 77 : 78 : return nullptr; 79 : }