https://mooseframework.inl.gov
Loading...
Searching...
No Matches
RayTracingObject.h
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#pragma once
11
12#include "RayTracingStudy.h"
13
14// MOOSE includes
15#include "MooseObject.h"
16#include "SetupInterface.h"
17#include "FunctionInterface.h"
21#include "TransientInterface.h"
22#include "UserObjectInterface.h"
24
25// Local includes
26#include "ElemExtrema.h"
27
28// Forward declarations
29class AuxiliarySystem;
31class TraceRay;
32
37 public SetupInterface,
38 public FunctionInterface,
42 public TransientInterface,
45{
46public:
47 RayTracingObject(const InputParameters & params);
48
50
51 const std::set<std::string> & getRequestedItems() override { return _depend_names; }
52 const std::set<std::string> & getSuppliedItems() override { return _supplied_names; }
53
61 const RayTracingStudy & study() const { return _study; }
62
67 template <typename T>
68 T & getStudy();
69
73 virtual void preExecuteStudy() {}
77 virtual void postExecuteStudy() {}
78
79protected:
83 const std::shared_ptr<Ray> & currentRay() const { return *_current_ray; }
84
88 void dependsOn(const std::string name) { _depend_names.insert(name); }
89
96
99
102
107
112
115
117 const Elem * const & _current_elem;
121 const unsigned short & _current_intersected_side;
124
125private:
127 std::set<std::string> _depend_names;
129 std::set<std::string> _supplied_names;
130
132 const std::shared_ptr<Ray> * const & _current_ray;
133};
134
135template <typename T>
136T &
138{
139 static_assert(std::is_base_of<RayTracingStudy, T>::value, "Not derived from a RayTracingStudy");
140
141 if (T * cast_study = dynamic_cast<T *>(&_study))
142 return *cast_study;
143
144 std::stringstream err;
145 err << "Supplied study of type " << _study.type() << " is not the required study type "
146 << MooseUtils::prettyCppType<T>();
147 if (isParamValid("study"))
148 paramError("study", err.str());
149 else
150 mooseError(err.str());
151}
152
153#define usingRayTracingObjectMembers \
154 usingMooseObjectMembers; \
155 usingFunctionInterfaceMembers; \
156 usingPostprocessorInterfaceMembers; \
157 usingTransientInterfaceMembers; \
158 using RayTracingObject::currentRay
const double T
unsigned int THREAD_ID
const std::string & type() const
const std::string & name() const
void paramError(const std::string &param, Args... args) const
void mooseError(Args &&... args) const
bool isParamValid(const std::string &name) const
Base class for a MooseObject used in ray tracing.
const THREAD_ID _tid
The thread id.
const std::set< std::string > & getRequestedItems() override
static InputParameters validParams()
const RayTracingStudy & study() const
The RayTracingStudy associated with this object.
void dependsOn(const std::string name)
Add an object of this classes base type that this class depends on.
RayTracingStudy & study()
The RayTracingStudy associated with this object.
const std::shared_ptr< Ray > *const & _current_ray
The current Ray that the action is being applied to.
NonlinearSystemBase * _nl
The nonlinear system, we might not have one.
virtual void postExecuteStudy()
Insertion point called immediately after executing the RayTracingStudy.
FEProblemBase & _fe_problem
The FEProblemBase.
RayTracingStudy & _study
The RayTracingStudy associated with this object.
NonlinearSystemBase * getNonlinearSystem()
Get the right nonlinear system.
MooseMesh & _mesh
The MooseMesh.
std::set< std::string > _supplied_names
The names of the supplied objects: just this one.
const unsigned short & _current_intersected_side
The side that _current_ray intersects (if any)
const ElemExtrema & _current_intersected_extrema
The elem extrema (vertex/edge) that _current_ray intersects (if any)
const SubdomainID & _current_subdomain_id
The subdomain ID of the _current_elem that the ray is tracing through.
T & getStudy()
Casts the RayTracingStudy associated with this object to a study of type T with a meaningful error me...
const std::set< std::string > & getSuppliedItems() override
AuxiliarySystem & _aux
The aux system.
const std::shared_ptr< Ray > & currentRay() const
Gets the current Ray that this is working on.
std::set< std::string > _depend_names
The names of the objects this depends on.
const TraceRay & _trace_ray
The TraceRay object associated with this thread.
virtual void preExecuteStudy()
Insertion point called immediately before executing the RayTracingStudy.
const Elem *const & _current_elem
The current Elem that _current_ray is tracing through.
Base class for Ray tracing studies that will generate Rays and then propagate all of them to terminat...
Traces Rays through the mesh on a single processor.
Definition TraceRay.h:47
Helper for defining if at an element's edge, vertex, or neither.
Definition ElemExtrema.h:26