https://mooseframework.inl.gov
Classes | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Friends | List of all members
Ray Class Reference

Basic datastructure for a ray that will traverse the mesh. More...

#include <Ray.h>

Classes

class  ChangeDirectionKey
 Class that is used as a parameter to changeDirection() that allows only RayBC methods to call changeDirection() More...
 
class  ChangeStartDirectionKey
 Class that is used as a parameter to changeStartDirection() that allows only RayKernelBase methods to call changeStartDirection() More...
 
class  ConstructRayKey
 Class that is used as a parameter to the public constructors/reset methods. More...
 

Public Member Functions

 Ray (RayTracingStudy *study, const RayID id, const std::size_t data_size, const std::size_t aux_data_size, const bool reset, const ConstructRayKey &)
 Ray constructor for internal use only. More...
 
void reset (RayTracingStudy *study, const RayID id, const std::size_t data_size, const std::size_t aux_data_size, const bool reset, const ConstructRayKey &)
 Resets a Ray for internal use only. More...
 
 Ray (const Ray *const other, const ConstructRayKey &)
 Copy constructor for internal use only. More...
 
void reset (const Ray *const other, const ConstructRayKey &)
 Resets a Ray from another Ray for internal use only. More...
 
Rayoperator= (const Ray &)=delete
 Deleted copy operator. More...
 
 Ray ()=delete
 Deleted default constructor. More...
 
 Ray (const Ray &other)=delete
 Deleted copy constructor. More...
 
bool operator== (const Ray &other) const
 Equality operator. More...
 
bool operator!= (const Ray &other) const
 Non-equal operator. More...
 
RayID id () const
 Gets the Ray's ID. More...
 
bool invalidID () const
 Whether or not the Ray's ID is invalid. More...
 
const Point & currentPoint () const
 Gets the point that the Ray is currently at. More...
 
bool invalidCurrentPoint () const
 Whether or not the point that the Ray is currently at is valid. More...
 
void changeDirection (const Point &direction, const ChangeDirectionKey)
 This method is for internal use only. More...
 
void changeStartDirection (const Point &start, const Point &direction, const ChangeStartDirectionKey)
 This method is for internal use only. More...
 
const Point & direction () const
 Gets the Ray's direction. More...
 
bool invalidDirection () const
 Whether or not the Ray's direction is set to invalid. More...
 
std::vector< RayData > & data ()
 Gets a writeable reference to the Ray's data. More...
 
const std::vector< RayData > & data () const
 Gets a read only reference to the Ray's data. More...
 
RayDatadata (const std::size_t i)
 Gets a writeable reference to the Ray's data at an index. More...
 
const RayDatadata (const std::size_t i) const
 Gets a read only reference to the Ray's data at an index. More...
 
std::vector< RayData > & auxData ()
 Gets a writeable reference to the Ray's auxilary data. More...
 
const std::vector< RayData > & auxData () const
 Gets a read only reference to the Ray's auxilary data. More...
 
RayDataauxData (const std::size_t i)
 Gets a writeable reference to a component of the Ray's auxilary data. More...
 
const RayDataauxData (const std::size_t i) const
 Gets a read only reference to a component of the Ray's auxilary data. More...
 
void setStart (const Point &starting_point, const Elem *starting_elem=nullptr, const unsigned short starting_incoming_side=RayTracingCommon::invalid_side)
 Sets the information pretaining to the start point for the Ray. More...
 
void setStartingDirection (const Point &starting_direction)
 Sets the starting direction to starting_direction for a Ray. More...
 
void setStartingEndPoint (const Point &starting_end_point)
 Sets the starting end point to starting_point for a Ray. More...
 
void setStartingMaxDistance (const Real starting_max_distance)
 Sets the maximum distance this Ray should travel to starting_max_distance. More...
 
void setStationary ()
 Sets the Ray to be stationary (max distance = 0). More...
 
void invalidateStartingElem ()
 Invalidates a Ray's starting element. More...
 
void invalidateStartingIncomingSide ()
 Invalidates a Ray's starting incoming side. More...
 
void clearStartingInfo ()
 Clears the starting information set on the Ray: More...
 
void resetCounters ()
 Clears the internal counters on the Ray so that the Ray can be traced again. More...
 
const Elem * currentElem () const
 Gets the current element that the Ray is in. More...
 
unsigned short currentIncomingSide () const
 Get a Ray's current incoming side. More...
 
bool invalidCurrentIncomingSide () const
 Whether or not the Ray's current incoming side is invalid. More...
 
bool endSet () const
 Whether or not the user has set an end point for this Ray. More...
 
bool atEnd () const
 Whether or not the Ray is at the user-defined end point. More...
 
Point endPoint () const
 Gets the user-set end point for the Ray, if set. More...
 
unsigned int processorCrossings () const
 Gets the number of times this Ray has crossed a processor. More...
 
unsigned int intersections () const
 Gets the number of intersections this Ray has done. More...
 
Real distance () const
 Gets the distance this Ray has traveled. More...
 
Real maxDistance () const
 Gets the max distance this Ray is allowed to travel. More...
 
bool maxDistanceSet () const
 Whether or not the distance has been set via setStartingMaxDistance() More...
 
bool stationary () const
 
bool shouldContinue () const
 Whether or not this Ray should continue. More...
 
void setShouldContinue (const bool should_continue)
 Sets whether or not this Ray should continue. More...
 
bool trajectoryChanged () const
 Whether or not this Ray has had its trajectory changed. More...
 
unsigned int trajectoryChanges () const
 Gets the number of trajectory changes this Ray has had. More...
 
std::string getInfo () const
 Helper function for getting information about the Ray. More...
 
bool hasTraced () const
 Whether or not a Ray has begun tracing. More...
 
const RayTracingStudystudy () const
 Get the RayTracingStudy associated with this Ray. More...
 

Static Public Attributes

static const RayDataIndex INVALID_RAY_DATA_INDEX = static_cast<RayDataIndex>(-1)
 Invalid index into a Ray's data. More...
 
static const RayID INVALID_RAY_ID = static_cast<RayID>(-1)
 Invalid Ray ID. More...
 

Private Member Functions

void changeID (const RayID id)
 Changes the Ray's ID. More...
 
void invalidateCurrentElem ()
 Invalidates the Ray's current element. More...
 
void setCurrentPoint (const Point &current_point)
 Sets the Ray's current point. More...
 
void invalidateCurrentPoint ()
 Invalidates the Ray's current point. More...
 
void setDirection (const Point &direction)
 Sets the Ray's direction. More...
 
void invalidateDirection ()
 Invalidates the Ray's current direction. More...
 
void setCurrentElem (const Elem *current_elem)
 Change a Ray's current elem. More...
 
void setCurrentIncomingSide (const unsigned short current_incoming_side)
 Change a Ray's incoming side. More...
 
void invalidateCurrentIncomingSide ()
 Invalidates the Ray's current incoming side. More...
 
void setTrajectoryChanged (const bool trajectory_changed)
 Set whether or not this Ray has had its trajectory changed. More...
 
void addProcessorCrossing ()
 Increment the Ray's processor crossing counter. More...
 
void addIntersection ()
 Increment the Ray's intersection counter. More...
 
void addTrajectoryChange ()
 Increment the Ray's trajectory change counter. More...
 
void addDistance (const Real add_distance)
 Adds to the distance this Ray has traveled. More...
 
void changeMaxDistance (const Real max_distance)
 Changes the Ray's max distance to be traveled. More...
 
void invalidateMaxDistance ()
 Invalidates the Ray's max distance. More...
 
void errorIfTracing (const std::string &reason) const
 Produces a useful error if a Ray has started tracing. More...
 
void errorWhenInitializing (const std::string &reason) const
 Produces a useful error for use when initializing a Ray. More...
 
void resetCountersInternal ()
 Reset all of the internal counters. More...
 
bool equalityHelper (const Ray &other, const bool equal) const
 Helper for the equality operators. More...
 
void clearStartingInfoInternal ()
 Clears the starting information. More...
 

Private Attributes

RayID _id
 A unique ID for this Ray. More...
 
Point _current_point
 Current point of the Ray. More...
 
Point _direction
 Direction of the Ray. More...
 
const Elem * _current_elem
 Current element that the Ray is in. More...
 
unsigned short _current_incoming_side
 The side of _current_elem that the Ray is incoming on (if any). More...
 
bool _end_set
 Whether or not the user has set an end point for this Ray (via limiting its distance with setStartingEndPoint()) More...
 
unsigned int _processor_crossings
 Number of times this Ray has been communicated. More...
 
unsigned int _intersections
 Number of intersections done for this Ray. More...
 
unsigned int _trajectory_changes
 Number of times this Ray has had its trajectory changed. More...
 
bool _trajectory_changed
 Whether or not this Ray had its trajectory changed (not sent in parallel) More...
 
Real _distance
 Total distance this Ray has traveled. More...
 
Real _max_distance
 Maximum distance the Ray is allowed to travel. More...
 
bool _should_continue
 Wether or not the Ray should continue to be traced (not sent in parallel) More...
 
std::vector< RayData_data
 The data that is carried with the Ray This is mutable so that we can resize it if needed within const accessors. More...
 
std::vector< RayData_aux_data
 Auxiliary data that is carried with the ray This is mutable so that we can resize it if needed within const accessors. More...
 
RayTracingStudy_study
 The RayTracingStudy that owns this Ray (not sent in parallel) More...
 
long padding [8]
 Extra padding to avoid false sharing. More...
 

Friends

class TraceRay
 
class Parallel::Packing< std::shared_ptr< Ray > >
 
class TestRayLots
 
void dataStore (std::ostream &stream, std::shared_ptr< Ray > &ray, void *context)
 
void dataLoad (std::istream &stream, std::shared_ptr< Ray > &ray, void *context)
 

Detailed Description

Basic datastructure for a ray that will traverse the mesh.

Definition at line 56 of file Ray.h.

Constructor & Destructor Documentation

◆ Ray() [1/4]

Ray::Ray ( RayTracingStudy study,
const RayID  id,
const std::size_t  data_size,
const std::size_t  aux_data_size,
const bool  reset,
const ConstructRayKey  
)

Ray constructor for internal use only.

Even though this method is public, it in general CANNOT be used publicly. This is ONLY used internally and is protected by the ConstructRayKey. In order to construct a Ray as a user, use the RayTracingStudy::acquire{}() methods, such as RayTracingStudy::acquireRay().

Parameters
studyThe study that owns the Ray
idID for the Ray
data_sizeSize of data to initialize with zeros
aux_data_sizeSize of aux data to initialize with zeros
resetWhether or not to reset the Ray information

Definition at line 22 of file Ray.C.

28  : _id(id),
31  _current_elem(nullptr),
33  _end_set(false),
34  _max_distance(std::numeric_limits<Real>::max()),
35  _data(data_size, 0),
36  _aux_data(aux_data_size, 0),
37  _study(*study)
38 {
40 }
static const unsigned short invalid_side
Identifier for an invalid side index.
Point _direction
Direction of the Ray.
Definition: Ray.h:662
const RayTracingStudy & study() const
Get the RayTracingStudy associated with this Ray.
Definition: Ray.h:540
Point _current_point
Current point of the Ray.
Definition: Ray.h:659
std::vector< RayData > _aux_data
Auxiliary data that is carried with the ray This is mutable so that we can resize it if needed within...
Definition: Ray.h:718
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition: Ray.h:721
Real _max_distance
Maximum distance the Ray is allowed to travel.
Definition: Ray.h:707
void resetCountersInternal()
Reset all of the internal counters.
Definition: Ray.C:392
const Elem * _current_elem
Current element that the Ray is in.
Definition: Ray.h:677
RayID _id
A unique ID for this Ray.
Definition: Ray.h:649
std::vector< RayData > _data
The data that is carried with the Ray This is mutable so that we can resize it if needed within const...
Definition: Ray.h:714
static const libMesh::Point invalid_point(invalid_distance, invalid_distance, invalid_distance)
Identifier for an invalid point.
bool _end_set
Whether or not the user has set an end point for this Ray (via limiting its distance with setStarting...
Definition: Ray.h:691
unsigned short _current_incoming_side
The side of _current_elem that the Ray is incoming on (if any).
Definition: Ray.h:687

◆ Ray() [2/4]

Ray::Ray ( const Ray *const  other,
const ConstructRayKey key 
)

Copy constructor for internal use only.

Even though this method is public, it in general CANNOT be used publicly. This is ONLY used internally and is protected by the ConstructRayKey. In order to construct a Ray as a user, use the RayTracingStudy::acquire{}() methods, such as RayTracingStudy::acquireRay().

Resets the counters.

Definition at line 70 of file Ray.C.

71  : Ray(&other->_study,
72  other->_id,
73  other->_data.size(),
74  other->_aux_data.size(),
75  /* reset = */ true,
76  key)
77 {
78  other->errorIfTracing("Cannot copy Ray");
79 
80  if (!other->invalidCurrentPoint())
82 
83  if (other->_end_set)
84  setStartingEndPoint(other->endPoint());
85  else
86  {
87  if (!other->invalidDirection())
89  if (other->maxDistanceSet())
91  }
92 
93  std::copy(other->_data.begin(), other->_data.end(), _data.begin());
94  std::copy(other->_aux_data.begin(), other->_aux_data.end(), _aux_data.begin());
95 }
Point _direction
Direction of the Ray.
Definition: Ray.h:662
bool invalidCurrentPoint() const
Whether or not the point that the Ray is currently at is valid.
Definition: Ray.h:225
Point _current_point
Current point of the Ray.
Definition: Ray.h:659
bool maxDistanceSet() const
Whether or not the distance has been set via setStartingMaxDistance()
Definition: Ray.h:499
void setStartingEndPoint(const Point &starting_end_point)
Sets the starting end point to starting_point for a Ray.
Definition: Ray.C:285
void setStartingDirection(const Point &starting_direction)
Sets the starting direction to starting_direction for a Ray.
Definition: Ray.C:268
std::vector< RayData > _aux_data
Auxiliary data that is carried with the ray This is mutable so that we can resize it if needed within...
Definition: Ray.h:718
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition: Ray.h:721
Ray()=delete
Deleted default constructor.
bool invalidDirection() const
Whether or not the Ray&#39;s direction is set to invalid.
Definition: Ray.h:259
Real _max_distance
Maximum distance the Ray is allowed to travel.
Definition: Ray.h:707
const Elem * _current_elem
Current element that the Ray is in.
Definition: Ray.h:677
RayID _id
A unique ID for this Ray.
Definition: Ray.h:649
std::vector< RayData > _data
The data that is carried with the Ray This is mutable so that we can resize it if needed within const...
Definition: Ray.h:714
void setStart(const Point &starting_point, const Elem *starting_elem=nullptr, const unsigned short starting_incoming_side=RayTracingCommon::invalid_side)
Sets the information pretaining to the start point for the Ray.
Definition: Ray.C:219
bool _end_set
Whether or not the user has set an end point for this Ray (via limiting its distance with setStarting...
Definition: Ray.h:691
unsigned short _current_incoming_side
The side of _current_elem that the Ray is incoming on (if any).
Definition: Ray.h:687
Point endPoint() const
Gets the user-set end point for the Ray, if set.
Definition: Ray.C:186
void errorIfTracing(const std::string &reason) const
Produces a useful error if a Ray has started tracing.
Definition: Ray.C:371

◆ Ray() [3/4]

Ray::Ray ( )
delete

Deleted default constructor.

All Ray construction is handled internally within the RayTracingStudy via the RayTracingStudy::acquire{}() methods.

◆ Ray() [4/4]

Ray::Ray ( const Ray other)
delete

Deleted copy constructor.

All Ray construction is handled internally within the RayTracingStudy via the RayTracingStudy::acquire{}() methods.

Member Function Documentation

◆ addDistance()

void Ray::addDistance ( const Real  add_distance)
inlineprivate

Adds to the distance this Ray has traveled.

Definition at line 614 of file Ray.h.

614 { _distance += add_distance; }
Real _distance
Total distance this Ray has traveled.
Definition: Ray.h:705

◆ addIntersection()

void Ray::addIntersection ( )
inlineprivate

Increment the Ray's intersection counter.

Definition at line 604 of file Ray.h.

604 { ++_intersections; }
unsigned int _intersections
Number of intersections done for this Ray.
Definition: Ray.h:697

◆ addProcessorCrossing()

void Ray::addProcessorCrossing ( )
inlineprivate

Increment the Ray's processor crossing counter.

Definition at line 599 of file Ray.h.

unsigned int _processor_crossings
Number of times this Ray has been communicated.
Definition: Ray.h:694

◆ addTrajectoryChange()

void Ray::addTrajectoryChange ( )
inlineprivate

Increment the Ray's trajectory change counter.

Definition at line 609 of file Ray.h.

609 { ++_trajectory_changes; }
unsigned int _trajectory_changes
Number of times this Ray has had its trajectory changed.
Definition: Ray.h:700

◆ atEnd()

bool Ray::atEnd ( ) const

Whether or not the Ray is at the user-defined end point.

This is only valid when the user set the trajectory of the Ray with setStartingEndPoint(), which internally set its maximum distance to the straight-line distance between start and end and set endSet() == true.

Definition at line 176 of file Ray.C.

Referenced by getInfo().

177 {
178  if (!_end_set)
179  mooseError("Cannot use Ray::atEnd() for a Ray that does not have an end set\n\n", getInfo());
180  mooseAssert(_distance <= _max_distance + TOLERANCE * TOLERANCE, "Distance past max distance");
181 
183 }
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
void mooseError(Args &&... args)
std::string getInfo() const
Helper function for getting information about the Ray.
Definition: Ray.C:469
Real _max_distance
Maximum distance the Ray is allowed to travel.
Definition: Ray.h:707
Real _distance
Total distance this Ray has traveled.
Definition: Ray.h:705
bool _end_set
Whether or not the user has set an end point for this Ray (via limiting its distance with setStarting...
Definition: Ray.h:691

◆ auxData() [1/4]

std::vector< RayData > & Ray::auxData ( )

Gets a writeable reference to the Ray's auxilary data.

If the aux data is not sized to the size as required by the study, this will resize the aux data.

Definition at line 437 of file Ray.C.

Referenced by auxData(), TestRayDataStudy::auxDataValue(), TestRayDataStudy::dataValue(), getInfo(), and TestRayDataStudy::onCompleteRay().

438 {
439  mooseAssert(_aux_data.size() == 0 || _aux_data.size() == _study.rayAuxDataSize(),
440  "Ray data size is not zero or the size required by study");
441  _aux_data.resize(_study.rayAuxDataSize());
442  return _aux_data;
443 }
std::size_t rayAuxDataSize() const
The registered size of values in the Ray aux data.
std::vector< RayData > _aux_data
Auxiliary data that is carried with the ray This is mutable so that we can resize it if needed within...
Definition: Ray.h:718
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition: Ray.h:721

◆ auxData() [2/4]

const std::vector< RayData > & Ray::auxData ( ) const

Gets a read only reference to the Ray's auxilary data.

If the aux data is not sized to the size as required by the study, this will resize the aux data.

Definition at line 446 of file Ray.C.

447 {
448  mooseAssert(_aux_data.size() == 0 || _aux_data.size() == _study.rayAuxDataSize(),
449  "Ray data size is not zero or the size required by study");
450  _aux_data.resize(_study.rayAuxDataSize());
451  return _aux_data;
452 }
std::size_t rayAuxDataSize() const
The registered size of values in the Ray aux data.
std::vector< RayData > _aux_data
Auxiliary data that is carried with the ray This is mutable so that we can resize it if needed within...
Definition: Ray.h:718
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition: Ray.h:721

◆ auxData() [3/4]

RayData & Ray::auxData ( const std::size_t  i)

Gets a writeable reference to a component of the Ray's auxilary data.

If the aux data is not sized to the size as required by the study, this will resize the aux data.

Definition at line 455 of file Ray.C.

456 {
457  mooseAssert(_study.rayAuxDataSize() > i, "Accessing Ray data out of range");
458  return auxData()[i];
459 }
std::size_t rayAuxDataSize() const
The registered size of values in the Ray aux data.
std::vector< RayData > & auxData()
Gets a writeable reference to the Ray&#39;s auxilary data.
Definition: Ray.C:437
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition: Ray.h:721

◆ auxData() [4/4]

const RayData & Ray::auxData ( const std::size_t  i) const

Gets a read only reference to a component of the Ray's auxilary data.

If the aux data is not sized to the size as required by the study, this will resize the aux data.

Definition at line 462 of file Ray.C.

463 {
464  mooseAssert(_study.rayAuxDataSize() > i, "Accessing Ray data out of range");
465  return auxData()[i];
466 }
std::size_t rayAuxDataSize() const
The registered size of values in the Ray aux data.
std::vector< RayData > & auxData()
Gets a writeable reference to the Ray&#39;s auxilary data.
Definition: Ray.C:437
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition: Ray.h:721

◆ changeDirection()

void Ray::changeDirection ( const Point direction,
const ChangeDirectionKey   
)

This method is for internal use only.

It is intended to be called only by RayBoundaryConditionBase::changeRayDirection().

If you wish to change a Ray's direction mid-trace in a RayBC, see RayBoundaryConditionBase::changeRayDirection() instead.

ChangeDirectionKey is constructable only by RayBC objects on purpose to limit usage of this method.

Definition at line 196 of file Ray.C.

197 {
198  if (direction.absolute_fuzzy_equals(Point(0, 0, 0)))
199  mooseError("Cannot set zero vector direction for a Ray\n\n", getInfo());
200 
202  _trajectory_changed = true;
203 }
void mooseError(Args &&... args)
Point _direction
Direction of the Ray.
Definition: Ray.h:662
std::string getInfo() const
Helper function for getting information about the Ray.
Definition: Ray.C:469
TypeVector< Real > unit() const
bool absolute_fuzzy_equals(const TypeVector< Real > &rhs, Real tol=TOLERANCE) const
const Point & direction() const
Gets the Ray&#39;s direction.
Definition: Ray.h:255
bool _trajectory_changed
Whether or not this Ray had its trajectory changed (not sent in parallel)
Definition: Ray.h:702

◆ changeID()

void Ray::changeID ( const RayID  id)
inlineprivate

Changes the Ray's ID.

Definition at line 546 of file Ray.h.

546 { _id = id; }
RayID id() const
Gets the Ray&#39;s ID.
Definition: Ray.h:207
RayID _id
A unique ID for this Ray.
Definition: Ray.h:649

◆ changeMaxDistance()

void Ray::changeMaxDistance ( const Real  max_distance)
inlineprivate

Changes the Ray's max distance to be traveled.

Definition at line 618 of file Ray.h.

618 { _max_distance = max_distance; }
Real _max_distance
Maximum distance the Ray is allowed to travel.
Definition: Ray.h:707

◆ changeStartDirection()

void Ray::changeStartDirection ( const Point start,
const Point direction,
const ChangeStartDirectionKey   
)

This method is for internal use only.

It is intended to be called only by RayKernelBase::changeRay().

If you wish to change a Ray's direction mid-trace in a RayKernel, see RayKernelBase::changeRay() instead.

ChangeStartDirectionKey is constructable only by RayKernelBase objects on purpose to limit usage of this method.

Definition at line 206 of file Ray.C.

209 {
210  if (direction.absolute_fuzzy_equals(Point(0, 0, 0)))
211  mooseError("Cannot set zero vector direction for a Ray\n\n", getInfo());
212 
213  _current_point = start;
215  _trajectory_changed = true;
216 }
void mooseError(Args &&... args)
Point _direction
Direction of the Ray.
Definition: Ray.h:662
std::string getInfo() const
Helper function for getting information about the Ray.
Definition: Ray.C:469
Point _current_point
Current point of the Ray.
Definition: Ray.h:659
TypeVector< Real > unit() const
bool absolute_fuzzy_equals(const TypeVector< Real > &rhs, Real tol=TOLERANCE) const
const Point & direction() const
Gets the Ray&#39;s direction.
Definition: Ray.h:255
bool _trajectory_changed
Whether or not this Ray had its trajectory changed (not sent in parallel)
Definition: Ray.h:702

◆ clearStartingInfo()

void Ray::clearStartingInfo ( )

Clears the starting information set on the Ray:

  • Starting point
  • Starting element
  • Starting incoming side
  • Starting direction
  • Starting maximum distance

This can only be called before a Ray has begun tracing.

Definition at line 353 of file Ray.C.

354 {
355  errorIfTracing("Cannot use Ray::clearStartingInfo()");
357 }
void clearStartingInfoInternal()
Clears the starting information.
Definition: Ray.C:360
void errorIfTracing(const std::string &reason) const
Produces a useful error if a Ray has started tracing.
Definition: Ray.C:371

◆ clearStartingInfoInternal()

void Ray::clearStartingInfoInternal ( )
private

Clears the starting information.

Definition at line 360 of file Ray.C.

Referenced by clearStartingInfo(), and reset().

361 {
367  _end_set = false;
368 }
void invalidateMaxDistance()
Invalidates the Ray&#39;s max distance.
Definition: Ray.h:622
void invalidateCurrentIncomingSide()
Invalidates the Ray&#39;s current incoming side.
Definition: Ray.h:586
void invalidateDirection()
Invalidates the Ray&#39;s current direction.
Definition: Ray.h:569
bool _end_set
Whether or not the user has set an end point for this Ray (via limiting its distance with setStarting...
Definition: Ray.h:691
void invalidateCurrentElem()
Invalidates the Ray&#39;s current element.
Definition: Ray.h:551
void invalidateCurrentPoint()
Invalidates the Ray&#39;s current point.
Definition: Ray.h:560

◆ currentElem()

const Elem* Ray::currentElem ( ) const
inline

Gets the current element that the Ray is in.

Before tracing, this is the starting element for the Ray.

During tracing:

  • It is valid within RayKernels, because a Ray can only operate on a single element per segment.
  • When used on boundaries (RayBCs), it is the element that the Ray actually traced through. When on a boundary, a RayBC may be applied to multiple elements when hitting a vertex or edge. Therefore, this will be only one of said elements.

Definition at line 425 of file Ray.h.

Referenced by getInfo().

425 { return _current_elem; }
const Elem * _current_elem
Current element that the Ray is in.
Definition: Ray.h:677

◆ currentIncomingSide()

unsigned short Ray::currentIncomingSide ( ) const
inline

Get a Ray's current incoming side.

Before tracing, this is the starting incoming side (if any).

During and after tracing, this is ONLY guaranteed to be valid while executing RayKernels!

Definition at line 435 of file Ray.h.

Referenced by getInfo().

435 { return _current_incoming_side; }
unsigned short _current_incoming_side
The side of _current_elem that the Ray is incoming on (if any).
Definition: Ray.h:687

◆ currentPoint()

const Point& Ray::currentPoint ( ) const
inline

Gets the point that the Ray is currently at.

Before a Ray is traced, this is the starting point of the Ray. While a Ray is being traced, this is the furthest point that the Ray has travelled. During RayKernel execution, this is the end of the segment. After a Ray has been traced, this is the point where the Ray was killed.

Definition at line 221 of file Ray.h.

Referenced by getInfo(), and TestPICRayStudy::maxDistance().

221 { return _current_point; }
Point _current_point
Current point of the Ray.
Definition: Ray.h:659

◆ data() [1/4]

std::vector< RayData > & Ray::data ( )

Gets a writeable reference to the Ray's data.

If the data is not sized to the size as required by the study, this will resize the data.

Definition at line 403 of file Ray.C.

Referenced by data(), getInfo(), and TestRayDataStudy::onCompleteRay().

404 {
405  mooseAssert(_data.size() == 0 || _data.size() == _study.rayDataSize(),
406  "Ray data size of " + std::to_string(_data.size()) +
407  " is not zero or the size required by the study of " +
408  std::to_string(_study.rayDataSize()));
409  _data.resize(_study.rayDataSize());
410  return _data;
411 }
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition: Ray.h:721
std::vector< RayData > _data
The data that is carried with the Ray This is mutable so that we can resize it if needed within const...
Definition: Ray.h:714
std::size_t rayDataSize() const
The registered size of values in the Ray data.

◆ data() [2/4]

const std::vector< RayData > & Ray::data ( ) const

Gets a read only reference to the Ray's data.

If the data is not sized to the size as required by the study, this will resize the data.

Definition at line 414 of file Ray.C.

415 {
416  mooseAssert(_data.size() == 0 || _data.size() == _study.rayDataSize(),
417  "Ray data size is not zero or the size required by study");
418  _data.resize(_study.rayDataSize());
419  return _data;
420 }
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition: Ray.h:721
std::vector< RayData > _data
The data that is carried with the Ray This is mutable so that we can resize it if needed within const...
Definition: Ray.h:714
std::size_t rayDataSize() const
The registered size of values in the Ray data.

◆ data() [3/4]

RayData & Ray::data ( const std::size_t  i)

Gets a writeable reference to the Ray's data at an index.

If the data is not sized to the size as required by the study, this will resize the data.

Definition at line 423 of file Ray.C.

424 {
425  mooseAssert(_study.rayDataSize() > i, "Accessing Ray data out of range");
426  return data()[i];
427 }
std::vector< RayData > & data()
Gets a writeable reference to the Ray&#39;s data.
Definition: Ray.C:403
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition: Ray.h:721
std::size_t rayDataSize() const
The registered size of values in the Ray data.

◆ data() [4/4]

const RayData & Ray::data ( const std::size_t  i) const

Gets a read only reference to the Ray's data at an index.

If the data is not sized to the size as required by the study, this will resize the data.

Definition at line 430 of file Ray.C.

431 {
432  mooseAssert(_study.rayDataSize() > i, "Accessing Ray data out of range");
433  return data()[i];
434 }
std::vector< RayData > & data()
Gets a writeable reference to the Ray&#39;s data.
Definition: Ray.C:403
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition: Ray.h:721
std::size_t rayDataSize() const
The registered size of values in the Ray data.

◆ direction()

const Point& Ray::direction ( ) const
inline

Gets the Ray's direction.

Definition at line 255 of file Ray.h.

Referenced by changeDirection(), changeStartDirection(), getInfo(), and setDirection().

255 { return _direction; }
Point _direction
Direction of the Ray.
Definition: Ray.h:662

◆ distance()

Real Ray::distance ( ) const
inline

Gets the distance this Ray has traveled.

Definition at line 488 of file Ray.h.

Referenced by TestRayDataStudy::dataValue(), and getInfo().

488 { return _distance; }
Real _distance
Total distance this Ray has traveled.
Definition: Ray.h:705

◆ endPoint()

Point Ray::endPoint ( ) const

Gets the user-set end point for the Ray, if set.

Internally, we do not keep track of the end point. Instead, we set a maximum straight-line distance the Ray can travel until it hits its endpoint. With the current point, the distance, the maximum distance, and the direction, we can infer the user-set end point.

Definition at line 186 of file Ray.C.

Referenced by getInfo(), Ray(), and reset().

187 {
188  if (!_end_set)
189  mooseError("Cannot use Ray::endPoint() for a Ray that does not have an end set\n\n", getInfo());
190  mooseAssert(_distance <= _max_distance + TOLERANCE * TOLERANCE, "Distance past max distance");
191 
193 }
void mooseError(Args &&... args)
Point _direction
Direction of the Ray.
Definition: Ray.h:662
std::string getInfo() const
Helper function for getting information about the Ray.
Definition: Ray.C:469
Point _current_point
Current point of the Ray.
Definition: Ray.h:659
Real _max_distance
Maximum distance the Ray is allowed to travel.
Definition: Ray.h:707
Real _distance
Total distance this Ray has traveled.
Definition: Ray.h:705
bool _end_set
Whether or not the user has set an end point for this Ray (via limiting its distance with setStarting...
Definition: Ray.h:691

◆ endSet()

bool Ray::endSet ( ) const
inline

Whether or not the user has set an end point for this Ray.

This is done by limiting the distance of the Ray in its set direction.

Definition at line 454 of file Ray.h.

Referenced by getInfo().

454 { return _end_set; }
bool _end_set
Whether or not the user has set an end point for this Ray (via limiting its distance with setStarting...
Definition: Ray.h:691

◆ equalityHelper()

bool Ray::equalityHelper ( const Ray other,
const bool  equal 
) const
private

Helper for the equality operators.

Definition at line 126 of file Ray.C.

Referenced by operator!=(), and operator==().

127 {
128  if (this == &other)
129  return equal;
130 
131  if (_id != other._id)
132  return !equal;
133  if (invalidCurrentPoint() != other.invalidCurrentPoint() ||
135  return !equal;
136  if (invalidDirection() != other.invalidDirection() ||
138  return !equal;
139  if (_current_elem != other._current_elem)
140  return !equal;
142  return !equal;
143  if (_end_set != other._end_set)
144  return !equal;
146  return !equal;
147  if (_intersections != other._intersections)
148  return !equal;
150  return !equal;
152  return !equal;
154  return !equal;
156  return !equal;
157  if (_should_continue != other._should_continue)
158  return !equal;
159  if (_data.size() != other._data.size())
160  return !equal;
161  for (std::size_t i = 0; i < _data.size(); ++i)
162  if (!MooseUtils::absoluteFuzzyEqual(_data[i], other._data[i]))
163  return !equal;
164  if (_aux_data.size() != other._aux_data.size())
165  return !equal;
166  for (std::size_t i = 0; i < _aux_data.size(); ++i)
168  return !equal;
169  if (&_study != &other._study)
170  return !equal;
171 
172  return equal;
173 }
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
Point _direction
Direction of the Ray.
Definition: Ray.h:662
unsigned int _processor_crossings
Number of times this Ray has been communicated.
Definition: Ray.h:694
bool invalidCurrentPoint() const
Whether or not the point that the Ray is currently at is valid.
Definition: Ray.h:225
Point _current_point
Current point of the Ray.
Definition: Ray.h:659
std::vector< RayData > _aux_data
Auxiliary data that is carried with the ray This is mutable so that we can resize it if needed within...
Definition: Ray.h:718
bool _should_continue
Wether or not the Ray should continue to be traced (not sent in parallel)
Definition: Ray.h:710
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition: Ray.h:721
bool invalidDirection() const
Whether or not the Ray&#39;s direction is set to invalid.
Definition: Ray.h:259
bool absolute_fuzzy_equals(const TypeVector< Real > &rhs, Real tol=TOLERANCE) const
Real _max_distance
Maximum distance the Ray is allowed to travel.
Definition: Ray.h:707
const Elem * _current_elem
Current element that the Ray is in.
Definition: Ray.h:677
RayID _id
A unique ID for this Ray.
Definition: Ray.h:649
Real _distance
Total distance this Ray has traveled.
Definition: Ray.h:705
unsigned int _intersections
Number of intersections done for this Ray.
Definition: Ray.h:697
std::vector< RayData > _data
The data that is carried with the Ray This is mutable so that we can resize it if needed within const...
Definition: Ray.h:714
bool _trajectory_changed
Whether or not this Ray had its trajectory changed (not sent in parallel)
Definition: Ray.h:702
unsigned int _trajectory_changes
Number of times this Ray has had its trajectory changed.
Definition: Ray.h:700
bool _end_set
Whether or not the user has set an end point for this Ray (via limiting its distance with setStarting...
Definition: Ray.h:691
unsigned short _current_incoming_side
The side of _current_elem that the Ray is incoming on (if any).
Definition: Ray.h:687

◆ errorIfTracing()

void Ray::errorIfTracing ( const std::string &  reason) const
private

Produces a useful error if a Ray has started tracing.

Definition at line 371 of file Ray.C.

Referenced by clearStartingInfo(), invalidateStartingElem(), invalidateStartingIncomingSide(), Ray(), reset(), setStart(), setStartingDirection(), setStartingEndPoint(), setStartingMaxDistance(), and setStationary().

372 {
373  if (hasTraced())
374  mooseError(reason, " after it has started tracing\n\n", getInfo());
375 }
void mooseError(Args &&... args)
bool hasTraced() const
Whether or not a Ray has begun tracing.
Definition: Ray.h:532
std::string getInfo() const
Helper function for getting information about the Ray.
Definition: Ray.C:469

◆ errorWhenInitializing()

void Ray::errorWhenInitializing ( const std::string &  reason) const
private

Produces a useful error for use when initializing a Ray.

Definition at line 378 of file Ray.C.

Referenced by setStart(), setStartingDirection(), setStartingEndPoint(), setStartingMaxDistance(), and setStationary().

379 {
380  mooseError("While initializing starting information for a Ray:\n\n", reason, "\n\n", getInfo());
381 }
void mooseError(Args &&... args)
std::string getInfo() const
Helper function for getting information about the Ray.
Definition: Ray.C:469

◆ getInfo()

std::string Ray::getInfo ( ) const

Helper function for getting information about the Ray.

Definition at line 469 of file Ray.C.

Referenced by atEnd(), changeDirection(), changeStartDirection(), endPoint(), errorIfTracing(), errorWhenInitializing(), resetCounters(), and RepeatableRayStudyBase::verifyReplicatedRays().

470 {
471  std::ostringstream oss;
472 
473  oss << "Ray information with " << _study.type() << " '" << _study.name() << "' on pid "
474  << _study.comm().rank() << "\n";
475  oss << " this = " << this << "\n";
476  oss << " id() = " << id() << "\n";
477  if (_study.useRayRegistration() && !invalidID())
478  oss << " _study.registeredRayName(id()) = " << _study.registeredRayName(id()) << "\n";
479  oss << " currentPoint() = ";
480  if (invalidCurrentPoint())
481  oss << "invalid point\n";
482  else
483  oss << currentPoint() << "\n";
484  oss << " direction() = ";
485  if (invalidDirection())
486  oss << "invalid point\n";
487  else
488  oss << direction() << "\n";
489  oss << " currentIncomingSide() = ";
491  oss << "invalid side\n";
492  else
493  oss << currentIncomingSide() << "\n";
494  oss << " endSet() = " << (endSet() ? "true" : "false") << "\n";
495  if (endSet())
496  {
497  oss << " endPoint() = " << endPoint() << "\n";
498  oss << " atEnd() = " << (atEnd() ? "true" : "false") << "\n";
499  }
500  oss << " distance() = " << distance() << "\n";
501  oss << " maxDistance() = " << maxDistance() << "\n";
502  if (currentElem())
503  {
504  oss << " currentElem()->id() = " << currentElem()->id() << "\n";
505  oss << " currentElem()->processor_id() = " << currentElem()->processor_id() << "\n";
506  }
507  else
508  oss << " currentElem()->id() = invalid\n";
509  oss << " processorCrossings() = " << processorCrossings() << "\n";
510  oss << " intersections() = " << intersections() << "\n";
511  oss << " trajectoryChanges() = " << trajectoryChanges() << "\n";
512  oss << " shouldContinue() = " << (shouldContinue() ? "true" : "false") << "\n";
513  oss << " trajectoryChanged() = " << (trajectoryChanged() ? "true" : "false") << "\n";
514  oss << " data() = ";
515  for (std::size_t i = 0; i < data().size(); ++i)
516  oss << "\n '" << _study.getRayDataName(i) << "' = " << data(i);
517  oss << "\n";
518  oss << " auxData() = ";
519  for (std::size_t i = 0; i < auxData().size(); ++i)
520  oss << "\n '" << _study.getRayAuxDataName(i) << "' = " << auxData(i);
521  oss << "\n";
522 
523  return oss.str();
524 }
RayID id() const
Gets the Ray&#39;s ID.
Definition: Ray.h:207
std::vector< RayData > & data()
Gets a writeable reference to the Ray&#39;s data.
Definition: Ray.C:403
unsigned int processorCrossings() const
Gets the number of times this Ray has crossed a processor.
Definition: Ray.h:478
bool invalidID() const
Whether or not the Ray&#39;s ID is invalid.
Definition: Ray.h:211
bool trajectoryChanged() const
Whether or not this Ray has had its trajectory changed.
Definition: Ray.h:518
bool useRayRegistration() const
Whether or not ray registration is being used.
processor_id_type rank() const
const Parallel::Communicator & comm() const
std::vector< RayData > & auxData()
Gets a writeable reference to the Ray&#39;s auxilary data.
Definition: Ray.C:437
unsigned int trajectoryChanges() const
Gets the number of trajectory changes this Ray has had.
Definition: Ray.h:522
const Point & currentPoint() const
Gets the point that the Ray is currently at.
Definition: Ray.h:221
const Elem * currentElem() const
Gets the current element that the Ray is in.
Definition: Ray.h:425
virtual const std::string & name() const
bool atEnd() const
Whether or not the Ray is at the user-defined end point.
Definition: Ray.C:176
bool invalidCurrentPoint() const
Whether or not the point that the Ray is currently at is valid.
Definition: Ray.h:225
bool invalidCurrentIncomingSide() const
Whether or not the Ray&#39;s current incoming side is invalid.
Definition: Ray.h:444
dof_id_type id() const
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition: Ray.h:721
const std::string & getRayDataName(const RayDataIndex index) const
Gets the name associated with a registered value in the Ray data.
const std::string & type() const
const std::string & getRayAuxDataName(const RayDataIndex index) const
Gets the name associated with a registered value in the Ray aux data.
bool invalidDirection() const
Whether or not the Ray&#39;s direction is set to invalid.
Definition: Ray.h:259
bool shouldContinue() const
Whether or not this Ray should continue.
Definition: Ray.h:509
bool endSet() const
Whether or not the user has set an end point for this Ray.
Definition: Ray.h:454
unsigned short currentIncomingSide() const
Get a Ray&#39;s current incoming side.
Definition: Ray.h:435
Real distance() const
Gets the distance this Ray has traveled.
Definition: Ray.h:488
const Point & direction() const
Gets the Ray&#39;s direction.
Definition: Ray.h:255
Real maxDistance() const
Gets the max distance this Ray is allowed to travel.
Definition: Ray.h:495
const std::string & registeredRayName(const RayID ray_id) const
Gets the name of a registered ray.
processor_id_type processor_id() const
unsigned int intersections() const
Gets the number of intersections this Ray has done.
Definition: Ray.h:483
Point endPoint() const
Gets the user-set end point for the Ray, if set.
Definition: Ray.C:186

◆ hasTraced()

bool Ray::hasTraced ( ) const
inline

Whether or not a Ray has begun tracing.

Definition at line 532 of file Ray.h.

Referenced by errorIfTracing().

533  {
534  return (bool)_distance || (bool)_processor_crossings || (bool)_intersections;
535  }
unsigned int _processor_crossings
Number of times this Ray has been communicated.
Definition: Ray.h:694
Real _distance
Total distance this Ray has traveled.
Definition: Ray.h:705
unsigned int _intersections
Number of intersections done for this Ray.
Definition: Ray.h:697

◆ id()

RayID Ray::id ( ) const
inline

Gets the Ray's ID.

Definition at line 207 of file Ray.h.

Referenced by changeID(), and getInfo().

207 { return _id; }
RayID _id
A unique ID for this Ray.
Definition: Ray.h:649

◆ intersections()

unsigned int Ray::intersections ( ) const
inline

Gets the number of intersections this Ray has done.

Definition at line 483 of file Ray.h.

Referenced by getInfo().

483 { return _intersections; }
unsigned int _intersections
Number of intersections done for this Ray.
Definition: Ray.h:697

◆ invalidateCurrentElem()

void Ray::invalidateCurrentElem ( )
inlineprivate

Invalidates the Ray's current element.

Definition at line 551 of file Ray.h.

Referenced by clearStartingInfoInternal(), and invalidateStartingElem().

551 { _current_elem = nullptr; }
const Elem * _current_elem
Current element that the Ray is in.
Definition: Ray.h:677

◆ invalidateCurrentIncomingSide()

void Ray::invalidateCurrentIncomingSide ( )
inlineprivate

Invalidates the Ray's current incoming side.

Definition at line 586 of file Ray.h.

Referenced by clearStartingInfoInternal(), and invalidateStartingIncomingSide().

static const unsigned short invalid_side
Identifier for an invalid side index.
unsigned short _current_incoming_side
The side of _current_elem that the Ray is incoming on (if any).
Definition: Ray.h:687

◆ invalidateCurrentPoint()

void Ray::invalidateCurrentPoint ( )
inlineprivate

Invalidates the Ray's current point.

Definition at line 560 of file Ray.h.

Referenced by clearStartingInfoInternal().

Point _current_point
Current point of the Ray.
Definition: Ray.h:659
static const libMesh::Point invalid_point(invalid_distance, invalid_distance, invalid_distance)
Identifier for an invalid point.

◆ invalidateDirection()

void Ray::invalidateDirection ( )
inlineprivate

Invalidates the Ray's current direction.

Definition at line 569 of file Ray.h.

Referenced by clearStartingInfoInternal().

Point _direction
Direction of the Ray.
Definition: Ray.h:662
static const libMesh::Point invalid_point(invalid_distance, invalid_distance, invalid_distance)
Identifier for an invalid point.

◆ invalidateMaxDistance()

void Ray::invalidateMaxDistance ( )
inlineprivate

Invalidates the Ray's max distance.

Definition at line 622 of file Ray.h.

Referenced by clearStartingInfoInternal().

622 { _max_distance = std::numeric_limits<Real>::max(); }
Real _max_distance
Maximum distance the Ray is allowed to travel.
Definition: Ray.h:707

◆ invalidateStartingElem()

void Ray::invalidateStartingElem ( )

Invalidates a Ray's starting element.

This is useful after the mesh has changed due to adaptivity, in which the starting element may no longer be valid.

This can only be called before a Ray has begun tracing.

Definition at line 339 of file Ray.C.

340 {
341  errorIfTracing("Cannot use Ray::invalidateStartingElem()");
343 }
void invalidateCurrentElem()
Invalidates the Ray&#39;s current element.
Definition: Ray.h:551
void errorIfTracing(const std::string &reason) const
Produces a useful error if a Ray has started tracing.
Definition: Ray.C:371

◆ invalidateStartingIncomingSide()

void Ray::invalidateStartingIncomingSide ( )

Invalidates a Ray's starting incoming side.

This is useful after the mesh has changed due to adaptivity, in which the incoming side may no longer be valid.

This can only be called before a Ray has begun tracing.

Definition at line 346 of file Ray.C.

347 {
348  errorIfTracing("Cannot use Ray::invalidateStartingIncomingSide()");
350 }
void invalidateCurrentIncomingSide()
Invalidates the Ray&#39;s current incoming side.
Definition: Ray.h:586
void errorIfTracing(const std::string &reason) const
Produces a useful error if a Ray has started tracing.
Definition: Ray.C:371

◆ invalidCurrentIncomingSide()

bool Ray::invalidCurrentIncomingSide ( ) const
inline

Whether or not the Ray's current incoming side is invalid.

Before tracing, this is the starting incoming side (if any).

During and after tracing, this is ONLY guaranteed to be valid while executing RayKernels!

Definition at line 444 of file Ray.h.

Referenced by getInfo(), and setStart().

445  {
447  }
static const unsigned short invalid_side
Identifier for an invalid side index.
unsigned short _current_incoming_side
The side of _current_elem that the Ray is incoming on (if any).
Definition: Ray.h:687

◆ invalidCurrentPoint()

bool Ray::invalidCurrentPoint ( ) const
inline

Whether or not the point that the Ray is currently at is valid.

Definition at line 225 of file Ray.h.

Referenced by equalityHelper(), getInfo(), Ray(), reset(), setStart(), setStartingDirection(), setStartingEndPoint(), setStartingMaxDistance(), and setStationary().

Point _current_point
Current point of the Ray.
Definition: Ray.h:659
static const libMesh::Point invalid_point(invalid_distance, invalid_distance, invalid_distance)
Identifier for an invalid point.

◆ invalidDirection()

bool Ray::invalidDirection ( ) const
inline

Whether or not the Ray's direction is set to invalid.

Definition at line 259 of file Ray.h.

Referenced by equalityHelper(), getInfo(), Ray(), reset(), setStartingDirection(), setStartingEndPoint(), and setStationary().

Point _direction
Direction of the Ray.
Definition: Ray.h:662
static const libMesh::Point invalid_point(invalid_distance, invalid_distance, invalid_distance)
Identifier for an invalid point.

◆ invalidID()

bool Ray::invalidID ( ) const
inline

Whether or not the Ray's ID is invalid.

Definition at line 211 of file Ray.h.

Referenced by getInfo().

211 { return _id == INVALID_RAY_ID; }
RayID _id
A unique ID for this Ray.
Definition: Ray.h:649
static const RayID INVALID_RAY_ID
Invalid Ray ID.
Definition: Ray.h:202

◆ maxDistance()

Real Ray::maxDistance ( ) const
inline

Gets the max distance this Ray is allowed to travel.

This may be set internally to || end - start || in the case that the user initialized the Ray with setStartingEndPoint().

Definition at line 495 of file Ray.h.

Referenced by getInfo().

495 { return _max_distance; }
Real _max_distance
Maximum distance the Ray is allowed to travel.
Definition: Ray.h:707

◆ maxDistanceSet()

bool Ray::maxDistanceSet ( ) const
inline

Whether or not the distance has been set via setStartingMaxDistance()

Definition at line 499 of file Ray.h.

Referenced by Ray(), reset(), and setStartingEndPoint().

499 { return _max_distance != std::numeric_limits<Real>::max(); }
Real _max_distance
Maximum distance the Ray is allowed to travel.
Definition: Ray.h:707

◆ operator!=()

bool Ray::operator!= ( const Ray other) const
inline

Non-equal operator.

This will perform "fuzzy" equals checks on the points and data.

Definition at line 197 of file Ray.h.

197 { return equalityHelper(other, false); }
bool equalityHelper(const Ray &other, const bool equal) const
Helper for the equality operators.
Definition: Ray.C:126

◆ operator=()

Ray& Ray::operator= ( const Ray )
delete

Deleted copy operator.

General Ray modification is handled internally within the RayTracingStudy via the RayTracingStudy::acquire{}() methods.

◆ operator==()

bool Ray::operator== ( const Ray other) const
inline

Equality operator.

This will perform "fuzzy" equals checks on the points and data.

Definition at line 191 of file Ray.h.

191 { return equalityHelper(other, true); }
bool equalityHelper(const Ray &other, const bool equal) const
Helper for the equality operators.
Definition: Ray.C:126

◆ processorCrossings()

unsigned int Ray::processorCrossings ( ) const
inline

Gets the number of times this Ray has crossed a processor.

Definition at line 478 of file Ray.h.

Referenced by getInfo().

478 { return _processor_crossings; }
unsigned int _processor_crossings
Number of times this Ray has been communicated.
Definition: Ray.h:694

◆ reset() [1/2]

void Ray::reset ( RayTracingStudy study,
const RayID  id,
const std::size_t  data_size,
const std::size_t  aux_data_size,
const bool  reset,
const ConstructRayKey  
)

Resets a Ray for internal use only.

Used by the SharedPool to reset a Ray with these forwarded arguments.

Even though this method is public, it in general CANNOT be used publicly. This is ONLY used internally and is protected by the ConstructRayKey. In order to construct a Ray as a user, use the RayTracingStudy::acquire{}() methods, such as RayTracingStudy::acquireRay().

Parameters
studyThe study that owns the Ray
idID for the Ray
data_sizeSize of data to initialize with zeros
aux_data_sizeSize of aux data to initialize with zeros
resetWhether or not to reset the Ray information

◆ reset() [2/2]

void Ray::reset ( const Ray *const  other,
const ConstructRayKey  
)

Resets a Ray from another Ray for internal use only.

Used by the SharedPool to reset a Ray from another.

Even though this method is public, it in general CANNOT be used publicly. This is ONLY used internally and is protected by the ConstructRayKey. In order to construct a Ray as a user, use the RayTracingStudy::acquire{}() methods, such as RayTracingStudy::acquireRay().

Resets the counters.

Definition at line 98 of file Ray.C.

99 {
100  other->errorIfTracing("Cannot copy Ray");
101  mooseAssert(&other->_study == &_study, "Cannot copy Ray from different study");
102 
105 
106  _id = other->_id;
107 
108  if (!other->invalidCurrentPoint())
110 
111  if (other->_end_set)
112  setStartingEndPoint(other->endPoint());
113  else
114  {
115  if (!other->invalidDirection())
117  if (other->maxDistanceSet())
118  _max_distance = other->_max_distance;
119  }
120 
121  _data = other->_data;
122  _aux_data = other->_aux_data;
123 }
Point _direction
Direction of the Ray.
Definition: Ray.h:662
bool invalidCurrentPoint() const
Whether or not the point that the Ray is currently at is valid.
Definition: Ray.h:225
Point _current_point
Current point of the Ray.
Definition: Ray.h:659
bool maxDistanceSet() const
Whether or not the distance has been set via setStartingMaxDistance()
Definition: Ray.h:499
void setStartingEndPoint(const Point &starting_end_point)
Sets the starting end point to starting_point for a Ray.
Definition: Ray.C:285
void setStartingDirection(const Point &starting_direction)
Sets the starting direction to starting_direction for a Ray.
Definition: Ray.C:268
std::vector< RayData > _aux_data
Auxiliary data that is carried with the ray This is mutable so that we can resize it if needed within...
Definition: Ray.h:718
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition: Ray.h:721
bool invalidDirection() const
Whether or not the Ray&#39;s direction is set to invalid.
Definition: Ray.h:259
Real _max_distance
Maximum distance the Ray is allowed to travel.
Definition: Ray.h:707
void resetCountersInternal()
Reset all of the internal counters.
Definition: Ray.C:392
void clearStartingInfoInternal()
Clears the starting information.
Definition: Ray.C:360
const Elem * _current_elem
Current element that the Ray is in.
Definition: Ray.h:677
RayID _id
A unique ID for this Ray.
Definition: Ray.h:649
std::vector< RayData > _data
The data that is carried with the Ray This is mutable so that we can resize it if needed within const...
Definition: Ray.h:714
void setStart(const Point &starting_point, const Elem *starting_elem=nullptr, const unsigned short starting_incoming_side=RayTracingCommon::invalid_side)
Sets the information pretaining to the start point for the Ray.
Definition: Ray.C:219
bool _end_set
Whether or not the user has set an end point for this Ray (via limiting its distance with setStarting...
Definition: Ray.h:691
unsigned short _current_incoming_side
The side of _current_elem that the Ray is incoming on (if any).
Definition: Ray.h:687
Point endPoint() const
Gets the user-set end point for the Ray, if set.
Definition: Ray.C:186
void errorIfTracing(const std::string &reason) const
Produces a useful error if a Ray has started tracing.
Definition: Ray.C:371

◆ resetCounters()

void Ray::resetCounters ( )

Clears the internal counters on the Ray so that the Ray can be traced again.

Can only be used within generateRays().

Definition at line 384 of file Ray.C.

385 {
387  mooseError("Ray::resetCounters() can only be used during generateRays()\n\n", getInfo());
389 }
bool currentlyGenerating() const
Whether or not the study is generating.
void mooseError(Args &&... args)
std::string getInfo() const
Helper function for getting information about the Ray.
Definition: Ray.C:469
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition: Ray.h:721
void resetCountersInternal()
Reset all of the internal counters.
Definition: Ray.C:392

◆ resetCountersInternal()

void Ray::resetCountersInternal ( )
private

Reset all of the internal counters.

Definition at line 392 of file Ray.C.

Referenced by Ray(), reset(), and resetCounters().

393 {
395  _intersections = 0;
397  _distance = 0;
398  _trajectory_changed = false;
399  _should_continue = true;
400 }
unsigned int _processor_crossings
Number of times this Ray has been communicated.
Definition: Ray.h:694
bool _should_continue
Wether or not the Ray should continue to be traced (not sent in parallel)
Definition: Ray.h:710
Real _distance
Total distance this Ray has traveled.
Definition: Ray.h:705
unsigned int _intersections
Number of intersections done for this Ray.
Definition: Ray.h:697
bool _trajectory_changed
Whether or not this Ray had its trajectory changed (not sent in parallel)
Definition: Ray.h:702
unsigned int _trajectory_changes
Number of times this Ray has had its trajectory changed.
Definition: Ray.h:700

◆ setCurrentElem()

void Ray::setCurrentElem ( const Elem *  current_elem)
inlineprivate

Change a Ray's current elem.

Definition at line 574 of file Ray.h.

574 { _current_elem = current_elem; }
const Elem * _current_elem
Current element that the Ray is in.
Definition: Ray.h:677

◆ setCurrentIncomingSide()

void Ray::setCurrentIncomingSide ( const unsigned short  current_incoming_side)
inlineprivate

Change a Ray's incoming side.

Definition at line 579 of file Ray.h.

580  {
581  _current_incoming_side = current_incoming_side;
582  }
unsigned short _current_incoming_side
The side of _current_elem that the Ray is incoming on (if any).
Definition: Ray.h:687

◆ setCurrentPoint()

void Ray::setCurrentPoint ( const Point &  current_point)
inlineprivate

Sets the Ray's current point.

Definition at line 556 of file Ray.h.

556 { _current_point = current_point; }
Point _current_point
Current point of the Ray.
Definition: Ray.h:659

◆ setDirection()

void Ray::setDirection ( const Point &  direction)
inlineprivate

Sets the Ray's direction.

Definition at line 565 of file Ray.h.

565 { _direction = direction; }
Point _direction
Direction of the Ray.
Definition: Ray.h:662
const Point & direction() const
Gets the Ray&#39;s direction.
Definition: Ray.h:255

◆ setShouldContinue()

void Ray::setShouldContinue ( const bool  should_continue)
inline

Sets whether or not this Ray should continue.

Definition at line 513 of file Ray.h.

513 { _should_continue = should_continue; }
bool _should_continue
Wether or not the Ray should continue to be traced (not sent in parallel)
Definition: Ray.h:710

◆ setStart()

void Ray::setStart ( const Point starting_point,
const Elem starting_elem = nullptr,
const unsigned short  starting_incoming_side = RayTracingCommon::invalid_side 
)

Sets the information pretaining to the start point for the Ray.

This MUST be called before setStartingDirection(), setStartingEndPoint(), or setStartingMaxDistance(). It cannot be called after a Ray has begun tracing.

Parameters
starting_pointThe starting point
starting_elemThe starting element (if known)
starting_incoming_sideThe starting incoming side (if known and if the Ray starts on a side of starting_elem

Definition at line 219 of file Ray.C.

Referenced by Ray(), and reset().

222 {
223  mooseAssert(starting_point != RayTracingCommon::invalid_point, "Invalid point");
224  errorIfTracing("Cannot use Ray::setStart()");
225  if (!invalidCurrentPoint() && !_current_point.absolute_fuzzy_equals(starting_point))
226  errorWhenInitializing("Starting point was already set via Ray::setStart() and is being changed."
227  "\n\nYou may only call Ray::setStart() after it has been called once to"
228  "\nchange the starting element and starting incoming side."
229  "\n\nYou may also clear the starting info via Ray::clearStartingInfo().");
230 
231  _current_point = starting_point;
232  _current_elem = starting_elem;
233  _current_incoming_side = starting_incoming_side;
234 
235  if (_study.verifyRays())
236  {
237  if (!_study.looseBoundingBox().contains_point(starting_point))
238  errorWhenInitializing("Mesh does not contain starting point.");
239  if (starting_elem)
240  {
241  mooseAssert(_study.meshBase().query_elem_ptr(starting_elem->id()) == starting_elem,
242  "Element is not owned by the mesh");
243  if (!starting_elem->active())
244  errorWhenInitializing("Starting element is not active.");
245  }
246 
247  bool non_planar_start = false;
248 
250  {
251  if (!starting_elem)
252  errorWhenInitializing("Starting incoming side is set but starting element is not set.");
253  if (starting_elem->n_sides() < starting_incoming_side)
254  errorWhenInitializing("Starting incoming side is not valid for its starting element.");
255 
256  non_planar_start = _study.sideIsNonPlanar(starting_elem, starting_incoming_side);
257  if (!non_planar_start &&
258  !starting_elem->build_side_ptr(starting_incoming_side)->contains_point(starting_point))
259  errorWhenInitializing("Starting incoming side does not contain the starting point.");
260  }
261 
262  if (starting_elem && !non_planar_start && !starting_elem->contains_point(starting_point))
263  errorWhenInitializing("Starting element does not contain the starting point.");
264  }
265 }
bool contains_point(const Point &) const
virtual std::unique_ptr< Elem > build_side_ptr(const unsigned int i)=0
const BoundingBox & looseBoundingBox() const
Get the loose nodal bounding box for the domain.
bool invalidCurrentPoint() const
Whether or not the point that the Ray is currently at is valid.
Definition: Ray.h:225
Point _current_point
Current point of the Ray.
Definition: Ray.h:659
bool invalidCurrentIncomingSide() const
Whether or not the Ray&#39;s current incoming side is invalid.
Definition: Ray.h:444
bool verifyRays() const
Whether or not to verify if Rays have valid information before being traced.
virtual bool contains_point(const Point &p, Real tol=TOLERANCE) const
dof_id_type id() const
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition: Ray.h:721
bool absolute_fuzzy_equals(const TypeVector< Real > &rhs, Real tol=TOLERANCE) const
bool sideIsNonPlanar(const Elem *elem, const unsigned short s) const
Whether or not the side on elem elem is non-planar.
virtual unsigned int n_sides() const=0
virtual const Elem * query_elem_ptr(const dof_id_type i) const=0
const Elem * _current_elem
Current element that the Ray is in.
Definition: Ray.h:677
MeshBase & meshBase() const
Access to the libMesh MeshBase.
static const libMesh::Point invalid_point(invalid_distance, invalid_distance, invalid_distance)
Identifier for an invalid point.
unsigned short _current_incoming_side
The side of _current_elem that the Ray is incoming on (if any).
Definition: Ray.h:687
bool active() const
void errorWhenInitializing(const std::string &reason) const
Produces a useful error for use when initializing a Ray.
Definition: Ray.C:378
void errorIfTracing(const std::string &reason) const
Produces a useful error if a Ray has started tracing.
Definition: Ray.C:371

◆ setStartingDirection()

void Ray::setStartingDirection ( const Point starting_direction)

Sets the starting direction to starting_direction for a Ray.

This MUST be called after setStart(). It cannot be used with setStartingEndPoint(), which sets the direction internally. It cannot be called after a Ray has begun tracing.

Definition at line 268 of file Ray.C.

Referenced by Ray(), reset(), and setStartingEndPoint().

269 {
270  errorIfTracing("Cannot use Ray::setStartingDirection()");
271  if (invalidCurrentPoint())
272  errorWhenInitializing("Cannot use Ray::setStartingDirection() before Ray::setStart().");
273  if (!invalidDirection())
275  "Cannot change a Ray's starting direction using Ray::setStartingDirection()"
276  "\nafter it has already been set."
277  "\n\nYou must first clear the starting info using Ray::clearStartingInfo().");
278  if (starting_direction.absolute_fuzzy_equals(Point(0, 0, 0)))
279  errorWhenInitializing("Starting direction in Ray::setStartingDirection() is the zero vector.");
280 
281  _direction = starting_direction.unit();
282 }
Point _direction
Direction of the Ray.
Definition: Ray.h:662
bool invalidCurrentPoint() const
Whether or not the point that the Ray is currently at is valid.
Definition: Ray.h:225
TypeVector< Real > unit() const
bool invalidDirection() const
Whether or not the Ray&#39;s direction is set to invalid.
Definition: Ray.h:259
bool absolute_fuzzy_equals(const TypeVector< Real > &rhs, Real tol=TOLERANCE) const
void errorWhenInitializing(const std::string &reason) const
Produces a useful error for use when initializing a Ray.
Definition: Ray.C:378
void errorIfTracing(const std::string &reason) const
Produces a useful error if a Ray has started tracing.
Definition: Ray.C:371

◆ setStartingEndPoint()

void Ray::setStartingEndPoint ( const Point starting_end_point)

Sets the starting end point to starting_point for a Ray.

This MUST be called after setStart(). It cannot be used with setStartingDirection(). It cannot be called after a Ray has begun tracing.

Internally, this sets the direction to be currentPoint() -> starting_direction, and sets the maximum distance to || starting_direction - currentPoint() ||.

Definition at line 285 of file Ray.C.

Referenced by Ray(), and reset().

286 {
287  errorIfTracing("Cannot use Ray::setStartingEndPoint()");
288  if (invalidCurrentPoint())
289  errorWhenInitializing("Cannot use Ray::setStartingEndPoint() before Ray::setStart().");
290  if (_current_point.absolute_fuzzy_equals(starting_end_point))
291  errorWhenInitializing("End point is equal to the start point in Ray::setStartingEndPoint().");
292  if (!invalidDirection())
293  errorWhenInitializing("Cannot use Ray::setStartingEndPoint() after Ray::setStartingDirection()."
294  "\n\nClear the starting information with Ray::clearStartingInfo().");
295  if (maxDistanceSet())
297  "Cannot use Ray::setStartingEndPoint() after Ray::setStartingMaxDistance().");
298 
299  if (_study.verifyRays() && !_study.looseBoundingBox().contains_point(starting_end_point))
300  errorWhenInitializing("End point is not within the mesh for Ray::setStartingEndPoint().");
301 
302  Point difference = starting_end_point;
303  difference -= _current_point;
304  setStartingMaxDistance(difference.norm());
305  setStartingDirection(difference);
306  _end_set = true;
307 }
auto norm() const -> decltype(std::norm(Real()))
bool contains_point(const Point &) const
const BoundingBox & looseBoundingBox() const
Get the loose nodal bounding box for the domain.
bool invalidCurrentPoint() const
Whether or not the point that the Ray is currently at is valid.
Definition: Ray.h:225
Point _current_point
Current point of the Ray.
Definition: Ray.h:659
bool maxDistanceSet() const
Whether or not the distance has been set via setStartingMaxDistance()
Definition: Ray.h:499
bool verifyRays() const
Whether or not to verify if Rays have valid information before being traced.
void setStartingDirection(const Point &starting_direction)
Sets the starting direction to starting_direction for a Ray.
Definition: Ray.C:268
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition: Ray.h:721
bool invalidDirection() const
Whether or not the Ray&#39;s direction is set to invalid.
Definition: Ray.h:259
bool absolute_fuzzy_equals(const TypeVector< Real > &rhs, Real tol=TOLERANCE) const
void setStartingMaxDistance(const Real starting_max_distance)
Sets the maximum distance this Ray should travel to starting_max_distance.
Definition: Ray.C:310
bool _end_set
Whether or not the user has set an end point for this Ray (via limiting its distance with setStarting...
Definition: Ray.h:691
void errorWhenInitializing(const std::string &reason) const
Produces a useful error for use when initializing a Ray.
Definition: Ray.C:378
void errorIfTracing(const std::string &reason) const
Produces a useful error if a Ray has started tracing.
Definition: Ray.C:371

◆ setStartingMaxDistance()

void Ray::setStartingMaxDistance ( const Real  starting_max_distance)

Sets the maximum distance this Ray should travel to starting_max_distance.

This MUST be called after setStart(). It cannot be used with setStartingEndPoint(). It cannot be called after a Ray has begun tracing.

If setting a Ray's trajectory with setStartingEndPoint(), the max distance is set internally to be || end - start ||.

Can only be called before a Ray has started to be traced!

Definition at line 310 of file Ray.C.

Referenced by setStartingEndPoint().

311 {
312  errorIfTracing("Cannot use Ray::setStartingMaxDistance()");
313  if (invalidCurrentPoint())
314  errorWhenInitializing("Cannot use Ray::setStartingMaxDistance() before Ray::setStart().");
315  if (starting_max_distance <= 0)
316  errorWhenInitializing("Starting max distance is <= 0 in Ray::setStartingMaxDistance().");
317  if (_end_set)
319  "Cannot use Ray::setStartingMaxDistance() after Ray::setStartingEndPoint().");
320 
321  _max_distance = starting_max_distance;
322 }
bool invalidCurrentPoint() const
Whether or not the point that the Ray is currently at is valid.
Definition: Ray.h:225
Real _max_distance
Maximum distance the Ray is allowed to travel.
Definition: Ray.h:707
bool _end_set
Whether or not the user has set an end point for this Ray (via limiting its distance with setStarting...
Definition: Ray.h:691
void errorWhenInitializing(const std::string &reason) const
Produces a useful error for use when initializing a Ray.
Definition: Ray.C:378
void errorIfTracing(const std::string &reason) const
Produces a useful error if a Ray has started tracing.
Definition: Ray.C:371

◆ setStationary()

void Ray::setStationary ( )

Sets the Ray to be stationary (max distance = 0).

This MUST be called after setStart(). It cannot be used with setStartingEndPoint(). It cannot be called after a Ray has begun tracing.

Can only be called before a Ray has started to be traced!

Definition at line 325 of file Ray.C.

326 {
327  errorIfTracing("Cannot use Ray::setStationary()");
328  if (invalidCurrentPoint())
329  errorWhenInitializing("Cannot use Ray::setStationary() before Ray::setStart()");
330  if (_end_set)
331  errorWhenInitializing("Cannot use Ray::setStationary() after Ray::setStartingEndPoint()");
332  if (!invalidDirection())
333  errorWhenInitializing("Cannot use Ray::setStationary() with Ray::setStartingDirection()");
334  _max_distance = 0;
335  mooseAssert(stationary(), "Stationary not set");
336 }
bool stationary() const
Definition: Ray.h:738
bool invalidCurrentPoint() const
Whether or not the point that the Ray is currently at is valid.
Definition: Ray.h:225
bool invalidDirection() const
Whether or not the Ray&#39;s direction is set to invalid.
Definition: Ray.h:259
Real _max_distance
Maximum distance the Ray is allowed to travel.
Definition: Ray.h:707
bool _end_set
Whether or not the user has set an end point for this Ray (via limiting its distance with setStarting...
Definition: Ray.h:691
void errorWhenInitializing(const std::string &reason) const
Produces a useful error for use when initializing a Ray.
Definition: Ray.C:378
void errorIfTracing(const std::string &reason) const
Produces a useful error if a Ray has started tracing.
Definition: Ray.C:371

◆ setTrajectoryChanged()

void Ray::setTrajectoryChanged ( const bool  trajectory_changed)
inlineprivate

Set whether or not this Ray has had its trajectory changed.

Definition at line 591 of file Ray.h.

592  {
593  _trajectory_changed = trajectory_changed;
594  }
bool _trajectory_changed
Whether or not this Ray had its trajectory changed (not sent in parallel)
Definition: Ray.h:702

◆ shouldContinue()

bool Ray::shouldContinue ( ) const
inline

Whether or not this Ray should continue.

Definition at line 509 of file Ray.h.

Referenced by getInfo().

509 { return _should_continue; }
bool _should_continue
Wether or not the Ray should continue to be traced (not sent in parallel)
Definition: Ray.h:710

◆ stationary()

bool Ray::stationary ( ) const
inline
Returns
Whether or not the Ray is set to be stationary

Definition at line 738 of file Ray.h.

Referenced by setStationary().

739 {
740  const bool stationary = _max_distance == 0;
741  if (stationary)
742  mooseAssert(_intersections == 0, "Should be zero");
743  return stationary;
744 }
bool stationary() const
Definition: Ray.h:738
Real _max_distance
Maximum distance the Ray is allowed to travel.
Definition: Ray.h:707
unsigned int _intersections
Number of intersections done for this Ray.
Definition: Ray.h:697

◆ study()

const RayTracingStudy& Ray::study ( ) const
inline

Get the RayTracingStudy associated with this Ray.

Definition at line 540 of file Ray.h.

540 { return _study; }
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition: Ray.h:721

◆ trajectoryChanged()

bool Ray::trajectoryChanged ( ) const
inline

Whether or not this Ray has had its trajectory changed.

Definition at line 518 of file Ray.h.

Referenced by getInfo().

518 { return _trajectory_changed; }
bool _trajectory_changed
Whether or not this Ray had its trajectory changed (not sent in parallel)
Definition: Ray.h:702

◆ trajectoryChanges()

unsigned int Ray::trajectoryChanges ( ) const
inline

Gets the number of trajectory changes this Ray has had.

Definition at line 522 of file Ray.h.

Referenced by getInfo().

522 { return _trajectory_changes; }
unsigned int _trajectory_changes
Number of times this Ray has had its trajectory changed.
Definition: Ray.h:700

Friends And Related Function Documentation

◆ dataLoad

void dataLoad ( std::istream &  stream,
std::shared_ptr< Ray > &  ray,
void context 
)
friend

Definition at line 724 of file Ray.C.

725 {
726  mooseAssert(context, "Missing RayTracingStudy context");
727  RayTracingStudy * study = static_cast<RayTracingStudy *>(context);
728 
729  RayID id;
730  loadHelper(stream, id, context);
731  ray = study->acquireRayInternal(id,
732  /* data_size = */ 0,
733  /* aux_data_size = */ 0,
734  /* reset = */ true,
736 
737  loadHelper(stream, ray->_current_point, context);
738  loadHelper(stream, ray->_direction, context);
739  dof_id_type current_elem_id;
740  loadHelper(stream, current_elem_id, context);
741  ray->_current_elem = study->meshBase().query_elem_ptr(current_elem_id);
742  loadHelper(stream, ray->_current_incoming_side, context);
743  loadHelper(stream, ray->_end_set, context);
744  loadHelper(stream, ray->_processor_crossings, context);
745  loadHelper(stream, ray->_intersections, context);
746  loadHelper(stream, ray->_trajectory_changes, context);
747  loadHelper(stream, ray->_trajectory_changed, context);
748  loadHelper(stream, ray->_distance, context);
749  loadHelper(stream, ray->_max_distance, context);
750  loadHelper(stream, ray->_should_continue, context);
751  loadHelper(stream, ray->_data, context);
752  loadHelper(stream, ray->_aux_data, context);
753 
754  if (ray->hasTraced())
755  mooseAssert(!study->currentlyGenerating() && !study->currentlyPropagating(),
756  "Cannot not load a Ray that has already traced during generation or propagation; "
757  "reset the Ray first");
758 }
bool currentlyGenerating() const
Whether or not the study is generating.
RayID id() const
Gets the Ray&#39;s ID.
Definition: Ray.h:207
unsigned long int RayID
Type for a Ray&#39;s ID.
Definition: Ray.h:43
const RayTracingStudy & study() const
Get the RayTracingStudy associated with this Ray.
Definition: Ray.h:540
std::shared_ptr< Ray > acquireRayInternal(const RayID id, const std::size_t data_size, const std::size_t aux_data_size, const bool reset, const AcquireRayInternalKey &)
Key that is used for restricting access to acquireRayInternal().
virtual const Elem * query_elem_ptr(const dof_id_type i) const=0
bool currentlyPropagating() const
Whether or not the study is propagating (tracing Rays)
MeshBase & meshBase() const
Access to the libMesh MeshBase.
void loadHelper(std::istream &stream, P &data, void *context)
uint8_t dof_id_type
Base class for Ray tracing studies that will generate Rays and then propagate all of them to terminat...

◆ dataStore

void dataStore ( std::ostream &  stream,
std::shared_ptr< Ray > &  ray,
void context 
)
friend

Definition at line 699 of file Ray.C.

700 {
701  mooseAssert(ray, "Null ray");
702  mooseAssert(context, "Missing RayTracingStudy context");
703  mooseAssert(static_cast<RayTracingStudy *>(context) == &ray->study(), "Different study");
704 
705  storeHelper(stream, ray->_id, context);
706  storeHelper(stream, ray->_current_point, context);
707  storeHelper(stream, ray->_direction, context);
708  auto current_elem_id = ray->currentElem() ? ray->currentElem()->id() : DofObject::invalid_id;
709  storeHelper(stream, current_elem_id, context);
710  storeHelper(stream, ray->_current_incoming_side, context);
711  storeHelper(stream, ray->_end_set, context);
712  storeHelper(stream, ray->_processor_crossings, context);
713  storeHelper(stream, ray->_intersections, context);
714  storeHelper(stream, ray->_trajectory_changes, context);
715  storeHelper(stream, ray->_trajectory_changed, context);
716  storeHelper(stream, ray->_distance, context);
717  storeHelper(stream, ray->_max_distance, context);
718  storeHelper(stream, ray->_should_continue, context);
719  storeHelper(stream, ray->_data, context);
720  storeHelper(stream, ray->_aux_data, context);
721 }
void storeHelper(std::ostream &stream, P &data, void *context)

◆ Parallel::Packing< std::shared_ptr< Ray > >

friend class Parallel::Packing< std::shared_ptr< Ray > >
friend

Definition at line 729 of file Ray.h.

◆ TestRayLots

friend class TestRayLots
friend

Definition at line 731 of file Ray.h.

◆ TraceRay

friend class TraceRay
friend

Definition at line 727 of file Ray.h.

Member Data Documentation

◆ _aux_data

std::vector<RayData> Ray::_aux_data
mutableprivate

Auxiliary data that is carried with the ray This is mutable so that we can resize it if needed within const accessors.

Definition at line 718 of file Ray.h.

Referenced by auxData(), equalityHelper(), Ray(), and reset().

◆ _current_elem

const Elem* Ray::_current_elem
private

Current element that the Ray is in.

Before tracing, this is the starting element for the Ray.

During tracing:

  • It is valid within RayKernels, because a Ray can only operate on a single element per segment.
  • When used on boundaries (RayBCs), it is the element that the Ray actually traced through. When on a boundary, a RayBC may be applied to multiple elements when hitting a vertex or edge. Therefore, this will be only one of said elements.

Definition at line 677 of file Ray.h.

Referenced by currentElem(), equalityHelper(), invalidateCurrentElem(), Ray(), reset(), setCurrentElem(), and setStart().

◆ _current_incoming_side

unsigned short Ray::_current_incoming_side
private

The side of _current_elem that the Ray is incoming on (if any).

Before tracing, this is the starting incoming side (if any).

During tracing, this is ONLY guaranteed to be valid during the execution of RayKernels!

Definition at line 687 of file Ray.h.

Referenced by currentIncomingSide(), equalityHelper(), invalidateCurrentIncomingSide(), invalidCurrentIncomingSide(), Ray(), reset(), setCurrentIncomingSide(), and setStart().

◆ _current_point

Point Ray::_current_point
private

Current point of the Ray.

Before tracing, this is the starting point for the Ray. During tracing, this is the furthest ahead that a Ray has traced. For example, when on a segment in a RayKernel, this will be end of said segment. After tracing, this is where the Ray ended.

Definition at line 659 of file Ray.h.

Referenced by changeStartDirection(), currentPoint(), endPoint(), equalityHelper(), invalidateCurrentPoint(), invalidCurrentPoint(), Ray(), reset(), setCurrentPoint(), setStart(), and setStartingEndPoint().

◆ _data

std::vector<RayData> Ray::_data
mutableprivate

The data that is carried with the Ray This is mutable so that we can resize it if needed within const accessors.

Definition at line 714 of file Ray.h.

Referenced by data(), equalityHelper(), Ray(), and reset().

◆ _direction

Point Ray::_direction
private

◆ _distance

Real Ray::_distance
private

Total distance this Ray has traveled.

Definition at line 705 of file Ray.h.

Referenced by addDistance(), atEnd(), distance(), endPoint(), equalityHelper(), hasTraced(), and resetCountersInternal().

◆ _end_set

bool Ray::_end_set
private

Whether or not the user has set an end point for this Ray (via limiting its distance with setStartingEndPoint())

Definition at line 691 of file Ray.h.

Referenced by atEnd(), clearStartingInfoInternal(), endPoint(), endSet(), equalityHelper(), Ray(), reset(), setStartingEndPoint(), setStartingMaxDistance(), and setStationary().

◆ _id

RayID Ray::_id
private

A unique ID for this Ray.

Definition at line 649 of file Ray.h.

Referenced by changeID(), equalityHelper(), id(), invalidID(), and reset().

◆ _intersections

unsigned int Ray::_intersections
private

Number of intersections done for this Ray.

Definition at line 697 of file Ray.h.

Referenced by addIntersection(), equalityHelper(), hasTraced(), intersections(), resetCountersInternal(), and stationary().

◆ _max_distance

Real Ray::_max_distance
private

◆ _processor_crossings

unsigned int Ray::_processor_crossings
private

Number of times this Ray has been communicated.

Definition at line 694 of file Ray.h.

Referenced by addProcessorCrossing(), equalityHelper(), hasTraced(), processorCrossings(), and resetCountersInternal().

◆ _should_continue

bool Ray::_should_continue
private

Wether or not the Ray should continue to be traced (not sent in parallel)

Definition at line 710 of file Ray.h.

Referenced by equalityHelper(), resetCountersInternal(), setShouldContinue(), and shouldContinue().

◆ _study

RayTracingStudy& Ray::_study
private

The RayTracingStudy that owns this Ray (not sent in parallel)

Definition at line 721 of file Ray.h.

Referenced by auxData(), data(), equalityHelper(), getInfo(), reset(), resetCounters(), setStart(), setStartingEndPoint(), and study().

◆ _trajectory_changed

bool Ray::_trajectory_changed
private

Whether or not this Ray had its trajectory changed (not sent in parallel)

Definition at line 702 of file Ray.h.

Referenced by changeDirection(), changeStartDirection(), equalityHelper(), resetCountersInternal(), setTrajectoryChanged(), and trajectoryChanged().

◆ _trajectory_changes

unsigned int Ray::_trajectory_changes
private

Number of times this Ray has had its trajectory changed.

Definition at line 700 of file Ray.h.

Referenced by addTrajectoryChange(), equalityHelper(), resetCountersInternal(), and trajectoryChanges().

◆ INVALID_RAY_DATA_INDEX

const RayDataIndex Ray::INVALID_RAY_DATA_INDEX = static_cast<RayDataIndex>(-1)
static

◆ INVALID_RAY_ID

const RayID Ray::INVALID_RAY_ID = static_cast<RayID>(-1)
static

◆ padding

long Ray::padding[8]
private

Extra padding to avoid false sharing.

Definition at line 724 of file Ray.h.


The documentation for this class was generated from the following files: