https://mooseframework.inl.gov
Loading...
Searching...
No Matches
RayIntegralValue.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// MOOSE includes
11#include "RayIntegralValue.h"
12
13// Local includes
14#include "IntegralRayKernel.h"
15#include "RayTracingStudy.h"
16
18
21{
23
24 params.addClassDescription("Obtains the integrated value accumulated into a Ray from an "
25 "IntegralRayKernel-derived class.");
26
27 params.addRequiredParam<std::string>("ray",
28 "Name of the Ray to get the final integral value from");
29 params.addRequiredParam<std::string>(
30 "ray_kernel",
31 "The name of the IntegralRayKernel-derived RayKernel to obtain the integral value of");
32
33 return params;
34}
35
37 : GeneralPostprocessor(parameters), _study(nullptr)
38{
39}
40
41void
43{
44 // Look for the IntegralRayKernel by the name provided by the user
45 const IntegralRayKernel * integral_ray_kernel = nullptr;
46 std::vector<RayKernelBase *> rks;
47 _fe_problem.theWarehouse().query().condition<AttribSystem>("RayKernel").queryInto(rks);
48 for (const RayKernelBase * rk : rks)
49 if (rk->name() == getParam<std::string>("ray_kernel"))
50 {
51 integral_ray_kernel = dynamic_cast<const IntegralRayKernel *>(rk);
52 if (!integral_ray_kernel)
53 mooseError(rk->type(), " is not derived from an IntegralRayKernel.");
54 _study = &rk->study();
55 break;
56 }
57
58 // Didn't find one
59 if (!integral_ray_kernel)
60 paramError("ray_kernel",
61 "The RayKernel by the name '",
62 getParam<std::string>("ray_kernel"),
63 "' was not found.");
64
65 // This requires that our studies use Ray name registration
67 mooseError("Cannot be used because the supplied ",
68 _study->type(),
69 " does not have Ray registration enabled.\n\nThis is controlled by the "
70 "RayTracingStudy private param '_use_ray_registration'.");
71 // And also that the Rays are banked, otherwise we can't grab the values
73 mooseError("Cannot be used because the supplied ",
74 _study->type(),
75 " does not bank Rays on completion.\n\nThis is controlled by the RayTracingStudy "
76 "private param '_bank_rays_on_completion'.");
77
78 // Get the Ray ID
79 const auto & ray_name = getParam<std::string>("ray");
80 _ray_id = _study->registeredRayID(ray_name, /* graceful = */ true);
82 paramError("ray", "Could not find a Ray named '", ray_name, "'");
83
84 // Get the index for the data on the ray requested
86}
87
88Real
90{
91 // This gathers the value from the proc that killed the Ray we're looking for
93}
registerMooseObject("RayTracingApp", RayIntegralValue)
TheWarehouse & theWarehouse() const
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
Base class for a RayKernel that integrates along a Ray segment and stores the result in a scalar valu...
std::string integralRayDataName() const
Gets the name of the Ray data associated with the integral accumulated by this RayKernel.
const std::string & type() const
void paramError(const std::string &param, Args... args) const
void mooseError(Args &&... args) const
Obtains the integrated value accumulated into a Ray from an IntegralRayKernel-derived class.
unsigned int _ray_data_index
The Ray data index where the integral value resides.
RayID _ray_id
The ID of the Ray that we seek the value from.
virtual Real getValue() const override
const RayTracingStudy * _study
The RayTracingStudy to get the value from.
static InputParameters validParams()
virtual void initialize() override
RayIntegralValue(const InputParameters &parameters)
Base object for the RayKernel syntax.
RayData getBankedRayData(const RayID ray_id, const RayDataIndex index) const
Gets the data value for a banked ray with a given ID.
bool useRayRegistration() const
Whether or not ray registration is being used.
RayDataIndex getRayDataIndex(const std::string &name, const bool graceful=false) const
Gets the index associated with a registered value in the Ray data.
bool bankRaysOnCompletion() const
Whether or not to bank Rays on completion.
RayID registeredRayID(const std::string &name, const bool graceful=false) const
Gets the ID of a registered ray.
static const RayID INVALID_RAY_ID
Invalid Ray ID.
Definition Ray.h:214
Query query()
FEProblemBase & _fe_problem