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  ChangePointElemSideKey
 Class that is used as a parameter to changePointElem() that allows only PeriodicRayBC methods to call changeStartDirection() 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...
 
void changePointElemSide (const Point &point, const Elem &elem, const unsigned int side, const ChangePointElemSideKey)
 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 _trajectory_changed
 Whether or not this Ray had its trajectory changed (not sent in parallel) More...
 
bool _end_set
 Whether or not the user has set an end point for this Ray (via limiting its distance with setStartingEndPoint()) More...
 
bool _should_continue
 Wether or not the Ray should continue to be traced (not sent in parallel) 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...
 
Real _distance
 Total distance this Ray has traveled. More...
 
Real _max_distance
 Maximum distance the Ray is allowed to travel. 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...
 

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 57 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:686
const RayTracingStudy & study() const
Get the RayTracingStudy associated with this Ray.
Definition: Ray.h:564
Point _current_point
Current point of the Ray.
Definition: Ray.h:683
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:741
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition: Ray.h:744
Real _max_distance
Maximum distance the Ray is allowed to travel.
Definition: Ray.h:733
void resetCountersInternal()
Reset all of the internal counters.
Definition: Ray.C:406
const Elem * _current_elem
Current element that the Ray is in.
Definition: Ray.h:701
RayID _id
A unique ID for this Ray.
Definition: Ray.h:673
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:737
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:717
unsigned short _current_incoming_side
The side of _current_elem that the Ray is incoming on (if any).
Definition: Ray.h:711

◆ 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:686
bool invalidCurrentPoint() const
Whether or not the point that the Ray is currently at is valid.
Definition: Ray.h:237
Point _current_point
Current point of the Ray.
Definition: Ray.h:683
bool maxDistanceSet() const
Whether or not the distance has been set via setStartingMaxDistance()
Definition: Ray.h:523
void setStartingEndPoint(const Point &starting_end_point)
Sets the starting end point to starting_point for a Ray.
Definition: Ray.C:299
void setStartingDirection(const Point &starting_direction)
Sets the starting direction to starting_direction for a Ray.
Definition: Ray.C:282
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:741
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition: Ray.h:744
Ray()=delete
Deleted default constructor.
bool invalidDirection() const
Whether or not the Ray&#39;s direction is set to invalid.
Definition: Ray.h:283
Real _max_distance
Maximum distance the Ray is allowed to travel.
Definition: Ray.h:733
const Elem * _current_elem
Current element that the Ray is in.
Definition: Ray.h:701
RayID _id
A unique ID for this Ray.
Definition: Ray.h:673
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:737
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:233
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:717
unsigned short _current_incoming_side
The side of _current_elem that the Ray is incoming on (if any).
Definition: Ray.h:711
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:385

◆ 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 638 of file Ray.h.

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

◆ addIntersection()

void Ray::addIntersection ( )
inlineprivate

Increment the Ray's intersection counter.

Definition at line 628 of file Ray.h.

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

◆ addProcessorCrossing()

void Ray::addProcessorCrossing ( )
inlineprivate

Increment the Ray's processor crossing counter.

Definition at line 623 of file Ray.h.

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

◆ addTrajectoryChange()

void Ray::addTrajectoryChange ( )
inlineprivate

Increment the Ray's trajectory change counter.

Definition at line 633 of file Ray.h.

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

◆ 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 
182  return MooseUtils::absoluteFuzzyEqual(_distance, _max_distance);
183 }
void mooseError(Args &&... args)
std::string getInfo() const
Helper function for getting information about the Ray.
Definition: Ray.C:483
Real _max_distance
Maximum distance the Ray is allowed to travel.
Definition: Ray.h:733
Real _distance
Total distance this Ray has traveled.
Definition: Ray.h:731
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:717

◆ 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 451 of file Ray.C.

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

452 {
453  mooseAssert(_aux_data.size() == 0 || _aux_data.size() == _study.rayAuxDataSize(),
454  "Ray data size is not zero or the size required by study");
455  _aux_data.resize(_study.rayAuxDataSize());
456  return _aux_data;
457 }
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:741
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition: Ray.h:744

◆ 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 460 of file Ray.C.

461 {
462  mooseAssert(_aux_data.size() == 0 || _aux_data.size() == _study.rayAuxDataSize(),
463  "Ray data size is not zero or the size required by study");
464  _aux_data.resize(_study.rayAuxDataSize());
465  return _aux_data;
466 }
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:741
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition: Ray.h:744

◆ 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 469 of file Ray.C.

470 {
471  mooseAssert(_study.rayAuxDataSize() > i, "Accessing Ray data out of range");
472  return auxData()[i];
473 }
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:451
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition: Ray.h:744

◆ 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 476 of file Ray.C.

477 {
478  mooseAssert(_study.rayAuxDataSize() > i, "Accessing Ray data out of range");
479  return auxData()[i];
480 }
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:451
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition: Ray.h:744

◆ 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:686
std::string getInfo() const
Helper function for getting information about the Ray.
Definition: Ray.C:483
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:279
bool _trajectory_changed
Whether or not this Ray had its trajectory changed (not sent in parallel)
Definition: Ray.h:714

◆ changeID()

void Ray::changeID ( const RayID  id)
inlineprivate

Changes the Ray's ID.

Definition at line 570 of file Ray.h.

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

◆ changeMaxDistance()

void Ray::changeMaxDistance ( const Real  max_distance)
inlineprivate

Changes the Ray's max distance to be traveled.

Definition at line 642 of file Ray.h.

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

◆ changePointElemSide()

void Ray::changePointElemSide ( const Point point,
const Elem elem,
const unsigned int  side,
const ChangePointElemSideKey   
)

This method is for internal use only.

It is intended to be called only by PeriodicRayBC::onBoundary().

ChangePointElemSideKey is constructable only by PeriodicRayBC objects on purpose to limit usage of this method.

Definition at line 219 of file Ray.C.

223 {
224  mooseAssert(!_trajectory_changed, "Should not have already changed");
225 
226  _current_point = point;
227  _current_elem = &elem;
228  _current_incoming_side = side;
229  _trajectory_changed = true;
230 }
Point _current_point
Current point of the Ray.
Definition: Ray.h:683
const Elem * _current_elem
Current element that the Ray is in.
Definition: Ray.h:701
bool _trajectory_changed
Whether or not this Ray had its trajectory changed (not sent in parallel)
Definition: Ray.h:714
unsigned short _current_incoming_side
The side of _current_elem that the Ray is incoming on (if any).
Definition: Ray.h:711

◆ 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:686
std::string getInfo() const
Helper function for getting information about the Ray.
Definition: Ray.C:483
Point _current_point
Current point of the Ray.
Definition: Ray.h:683
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:279
bool _trajectory_changed
Whether or not this Ray had its trajectory changed (not sent in parallel)
Definition: Ray.h:714

◆ 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 367 of file Ray.C.

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

◆ clearStartingInfoInternal()

void Ray::clearStartingInfoInternal ( )
private

Clears the starting information.

Definition at line 374 of file Ray.C.

Referenced by clearStartingInfo(), and reset().

375 {
381  _end_set = false;
382 }
void invalidateMaxDistance()
Invalidates the Ray&#39;s max distance.
Definition: Ray.h:646
void invalidateCurrentIncomingSide()
Invalidates the Ray&#39;s current incoming side.
Definition: Ray.h:610
void invalidateDirection()
Invalidates the Ray&#39;s current direction.
Definition: Ray.h:593
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:717
void invalidateCurrentElem()
Invalidates the Ray&#39;s current element.
Definition: Ray.h:575
void invalidateCurrentPoint()
Invalidates the Ray&#39;s current point.
Definition: Ray.h:584

◆ 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 449 of file Ray.h.

Referenced by getInfo().

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

◆ 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 459 of file Ray.h.

Referenced by getInfo().

459 { 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:711

◆ 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 233 of file Ray.h.

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

233 { return _current_point; }
Point _current_point
Current point of the Ray.
Definition: Ray.h:683

◆ 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 417 of file Ray.C.

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

418 {
419  mooseAssert(_data.size() == 0 || _data.size() == _study.rayDataSize(),
420  "Ray data size of " + std::to_string(_data.size()) +
421  " is not zero or the size required by the study of " +
422  std::to_string(_study.rayDataSize()));
423  _data.resize(_study.rayDataSize());
424  return _data;
425 }
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition: Ray.h:744
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:737
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 428 of file Ray.C.

429 {
430  mooseAssert(_data.size() == 0 || _data.size() == _study.rayDataSize(),
431  "Ray data size is not zero or the size required by study");
432  _data.resize(_study.rayDataSize());
433  return _data;
434 }
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition: Ray.h:744
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:737
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 437 of file Ray.C.

438 {
439  mooseAssert(_study.rayDataSize() > i, "Accessing Ray data out of range");
440  return data()[i];
441 }
std::vector< RayData > & data()
Gets a writeable reference to the Ray&#39;s data.
Definition: Ray.C:417
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition: Ray.h:744
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 444 of file Ray.C.

445 {
446  mooseAssert(_study.rayDataSize() > i, "Accessing Ray data out of range");
447  return data()[i];
448 }
std::vector< RayData > & data()
Gets a writeable reference to the Ray&#39;s data.
Definition: Ray.C:417
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition: Ray.h:744
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 279 of file Ray.h.

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

279 { return _direction; }
Point _direction
Direction of the Ray.
Definition: Ray.h:686

◆ distance()

Real Ray::distance ( ) const
inline

Gets the distance this Ray has traveled.

Definition at line 512 of file Ray.h.

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

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

◆ 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:686
std::string getInfo() const
Helper function for getting information about the Ray.
Definition: Ray.C:483
Point _current_point
Current point of the Ray.
Definition: Ray.h:683
Real _max_distance
Maximum distance the Ray is allowed to travel.
Definition: Ray.h:733
Real _distance
Total distance this Ray has traveled.
Definition: Ray.h:731
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:717

◆ 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 478 of file Ray.h.

Referenced by getInfo().

478 { 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:717

◆ 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;
144  return !equal;
145  if (_end_set != other._end_set)
146  return !equal;
147  if (_should_continue != other._should_continue)
148  return !equal;
150  return !equal;
151  if (_intersections != other._intersections)
152  return !equal;
154  return !equal;
155  if (!MooseUtils::absoluteFuzzyEqual(_distance, other._distance))
156  return !equal;
157  if (!MooseUtils::absoluteFuzzyEqual(_max_distance, other._max_distance))
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)
167  if (!MooseUtils::absoluteFuzzyEqual(_aux_data[i], other._aux_data[i]))
168  return !equal;
169  if (&_study != &other._study)
170  return !equal;
171 
172  return equal;
173 }
Point _direction
Direction of the Ray.
Definition: Ray.h:686
unsigned int _processor_crossings
Number of times this Ray has been communicated.
Definition: Ray.h:722
bool invalidCurrentPoint() const
Whether or not the point that the Ray is currently at is valid.
Definition: Ray.h:237
Point _current_point
Current point of the Ray.
Definition: Ray.h:683
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:741
bool _should_continue
Wether or not the Ray should continue to be traced (not sent in parallel)
Definition: Ray.h:719
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition: Ray.h:744
bool invalidDirection() const
Whether or not the Ray&#39;s direction is set to invalid.
Definition: Ray.h:283
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:733
const Elem * _current_elem
Current element that the Ray is in.
Definition: Ray.h:701
RayID _id
A unique ID for this Ray.
Definition: Ray.h:673
Real _distance
Total distance this Ray has traveled.
Definition: Ray.h:731
unsigned int _intersections
Number of intersections done for this Ray.
Definition: Ray.h:725
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:737
bool _trajectory_changed
Whether or not this Ray had its trajectory changed (not sent in parallel)
Definition: Ray.h:714
unsigned int _trajectory_changes
Number of times this Ray has had its trajectory changed.
Definition: Ray.h:728
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:717
unsigned short _current_incoming_side
The side of _current_elem that the Ray is incoming on (if any).
Definition: Ray.h:711

◆ errorIfTracing()

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

Produces a useful error if a Ray has started tracing.

Definition at line 385 of file Ray.C.

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

386 {
387  if (hasTraced())
388  mooseError(reason, " after it has started tracing\n\n", getInfo());
389 }
void mooseError(Args &&... args)
bool hasTraced() const
Whether or not a Ray has begun tracing.
Definition: Ray.h:556
std::string getInfo() const
Helper function for getting information about the Ray.
Definition: Ray.C:483

◆ errorWhenInitializing()

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

Produces a useful error for use when initializing a Ray.

Definition at line 392 of file Ray.C.

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

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

◆ getInfo()

std::string Ray::getInfo ( ) const

Helper function for getting information about the Ray.

Definition at line 483 of file Ray.C.

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

484 {
485  std::ostringstream oss;
486 
487  oss << "Ray information with " << _study.type() << " '" << _study.name() << "' on pid "
488  << _study.comm().rank() << "\n";
489  oss << " this = " << this << "\n";
490  oss << " id() = " << id() << "\n";
491  if (_study.useRayRegistration() && !invalidID())
492  oss << " _study.registeredRayName(id()) = " << _study.registeredRayName(id()) << "\n";
493  oss << " currentPoint() = ";
494  if (invalidCurrentPoint())
495  oss << "invalid point\n";
496  else
497  oss << currentPoint() << "\n";
498  oss << " direction() = ";
499  if (invalidDirection())
500  oss << "invalid point\n";
501  else
502  oss << direction() << "\n";
503  oss << " currentIncomingSide() = ";
505  oss << "invalid side\n";
506  else
507  oss << currentIncomingSide() << "\n";
508  oss << " endSet() = " << (endSet() ? "true" : "false") << "\n";
509  if (endSet())
510  {
511  oss << " endPoint() = " << endPoint() << "\n";
512  oss << " atEnd() = " << (atEnd() ? "true" : "false") << "\n";
513  }
514  oss << " distance() = " << distance() << "\n";
515  oss << " maxDistance() = " << maxDistance() << "\n";
516  if (currentElem())
517  {
518  oss << " currentElem()->id() = " << currentElem()->id() << "\n";
519  oss << " currentElem()->processor_id() = " << currentElem()->processor_id() << "\n";
520  }
521  else
522  oss << " currentElem()->id() = invalid\n";
523  oss << " processorCrossings() = " << processorCrossings() << "\n";
524  oss << " intersections() = " << intersections() << "\n";
525  oss << " trajectoryChanges() = " << trajectoryChanges() << "\n";
526  oss << " shouldContinue() = " << (shouldContinue() ? "true" : "false") << "\n";
527  oss << " trajectoryChanged() = " << (trajectoryChanged() ? "true" : "false") << "\n";
528  oss << " data() = ";
529  for (std::size_t i = 0; i < data().size(); ++i)
530  oss << "\n '" << _study.getRayDataName(i) << "' = " << data(i);
531  oss << "\n";
532  oss << " auxData() = ";
533  for (std::size_t i = 0; i < auxData().size(); ++i)
534  oss << "\n '" << _study.getRayAuxDataName(i) << "' = " << auxData(i);
535  oss << "\n";
536 
537  return oss.str();
538 }
RayID id() const
Gets the Ray&#39;s ID.
Definition: Ray.h:219
std::vector< RayData > & data()
Gets a writeable reference to the Ray&#39;s data.
Definition: Ray.C:417
unsigned int processorCrossings() const
Gets the number of times this Ray has crossed a processor.
Definition: Ray.h:502
bool invalidID() const
Whether or not the Ray&#39;s ID is invalid.
Definition: Ray.h:223
bool trajectoryChanged() const
Whether or not this Ray has had its trajectory changed.
Definition: Ray.h:542
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:451
unsigned int trajectoryChanges() const
Gets the number of trajectory changes this Ray has had.
Definition: Ray.h:546
const Point & currentPoint() const
Gets the point that the Ray is currently at.
Definition: Ray.h:233
const Elem * currentElem() const
Gets the current element that the Ray is in.
Definition: Ray.h:449
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:237
bool invalidCurrentIncomingSide() const
Whether or not the Ray&#39;s current incoming side is invalid.
Definition: Ray.h:468
const std::string & name() const
dof_id_type id() const
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition: Ray.h:744
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:283
bool shouldContinue() const
Whether or not this Ray should continue.
Definition: Ray.h:533
bool endSet() const
Whether or not the user has set an end point for this Ray.
Definition: Ray.h:478
unsigned short currentIncomingSide() const
Get a Ray&#39;s current incoming side.
Definition: Ray.h:459
Real distance() const
Gets the distance this Ray has traveled.
Definition: Ray.h:512
const Point & direction() const
Gets the Ray&#39;s direction.
Definition: Ray.h:279
Real maxDistance() const
Gets the max distance this Ray is allowed to travel.
Definition: Ray.h:519
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:507
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 556 of file Ray.h.

Referenced by errorIfTracing().

557  {
558  return (bool)_distance || (bool)_processor_crossings || (bool)_intersections;
559  }
unsigned int _processor_crossings
Number of times this Ray has been communicated.
Definition: Ray.h:722
Real _distance
Total distance this Ray has traveled.
Definition: Ray.h:731
unsigned int _intersections
Number of intersections done for this Ray.
Definition: Ray.h:725

◆ id()

RayID Ray::id ( ) const
inline

Gets the Ray's ID.

Definition at line 219 of file Ray.h.

Referenced by changeID(), and getInfo().

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

◆ intersections()

unsigned int Ray::intersections ( ) const
inline

Gets the number of intersections this Ray has done.

Definition at line 507 of file Ray.h.

Referenced by getInfo().

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

◆ invalidateCurrentElem()

void Ray::invalidateCurrentElem ( )
inlineprivate

Invalidates the Ray's current element.

Definition at line 575 of file Ray.h.

Referenced by clearStartingInfoInternal(), and invalidateStartingElem().

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

◆ invalidateCurrentIncomingSide()

void Ray::invalidateCurrentIncomingSide ( )
inlineprivate

Invalidates the Ray's current incoming side.

Definition at line 610 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:711

◆ invalidateCurrentPoint()

void Ray::invalidateCurrentPoint ( )
inlineprivate

Invalidates the Ray's current point.

Definition at line 584 of file Ray.h.

Referenced by clearStartingInfoInternal().

Point _current_point
Current point of the Ray.
Definition: Ray.h:683
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 593 of file Ray.h.

Referenced by clearStartingInfoInternal().

Point _direction
Direction of the Ray.
Definition: Ray.h:686
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 646 of file Ray.h.

Referenced by clearStartingInfoInternal().

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

◆ 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 353 of file Ray.C.

354 {
355  errorIfTracing("Cannot use Ray::invalidateStartingElem()");
357 }
void invalidateCurrentElem()
Invalidates the Ray&#39;s current element.
Definition: Ray.h:575
void errorIfTracing(const std::string &reason) const
Produces a useful error if a Ray has started tracing.
Definition: Ray.C:385

◆ 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 360 of file Ray.C.

361 {
362  errorIfTracing("Cannot use Ray::invalidateStartingIncomingSide()");
364 }
void invalidateCurrentIncomingSide()
Invalidates the Ray&#39;s current incoming side.
Definition: Ray.h:610
void errorIfTracing(const std::string &reason) const
Produces a useful error if a Ray has started tracing.
Definition: Ray.C:385

◆ 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 468 of file Ray.h.

Referenced by getInfo(), and setStart().

469  {
471  }
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:711

◆ invalidCurrentPoint()

bool Ray::invalidCurrentPoint ( ) const
inline

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

Definition at line 237 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:683
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 283 of file Ray.h.

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

Point _direction
Direction of the Ray.
Definition: Ray.h:686
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 223 of file Ray.h.

Referenced by getInfo().

223 { return _id == INVALID_RAY_ID; }
RayID _id
A unique ID for this Ray.
Definition: Ray.h:673
static const RayID INVALID_RAY_ID
Invalid Ray ID.
Definition: Ray.h:214

◆ 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 519 of file Ray.h.

Referenced by getInfo().

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

◆ maxDistanceSet()

bool Ray::maxDistanceSet ( ) const
inline

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

Definition at line 523 of file Ray.h.

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

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

◆ 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 209 of file Ray.h.

209 { 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 203 of file Ray.h.

203 { 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 502 of file Ray.h.

Referenced by getInfo().

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

◆ 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:686
bool invalidCurrentPoint() const
Whether or not the point that the Ray is currently at is valid.
Definition: Ray.h:237
Point _current_point
Current point of the Ray.
Definition: Ray.h:683
bool maxDistanceSet() const
Whether or not the distance has been set via setStartingMaxDistance()
Definition: Ray.h:523
void setStartingEndPoint(const Point &starting_end_point)
Sets the starting end point to starting_point for a Ray.
Definition: Ray.C:299
void setStartingDirection(const Point &starting_direction)
Sets the starting direction to starting_direction for a Ray.
Definition: Ray.C:282
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:741
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition: Ray.h:744
bool invalidDirection() const
Whether or not the Ray&#39;s direction is set to invalid.
Definition: Ray.h:283
Real _max_distance
Maximum distance the Ray is allowed to travel.
Definition: Ray.h:733
void resetCountersInternal()
Reset all of the internal counters.
Definition: Ray.C:406
void clearStartingInfoInternal()
Clears the starting information.
Definition: Ray.C:374
const Elem * _current_elem
Current element that the Ray is in.
Definition: Ray.h:701
RayID _id
A unique ID for this Ray.
Definition: Ray.h:673
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:737
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:233
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:717
unsigned short _current_incoming_side
The side of _current_elem that the Ray is incoming on (if any).
Definition: Ray.h:711
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:385

◆ 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 398 of file Ray.C.

399 {
401  mooseError("Ray::resetCounters() can only be used during generateRays()\n\n", getInfo());
403 }
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:483
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition: Ray.h:744
void resetCountersInternal()
Reset all of the internal counters.
Definition: Ray.C:406

◆ resetCountersInternal()

void Ray::resetCountersInternal ( )
private

Reset all of the internal counters.

Definition at line 406 of file Ray.C.

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

407 {
409  _intersections = 0;
411  _distance = 0;
412  _trajectory_changed = false;
413  _should_continue = true;
414 }
unsigned int _processor_crossings
Number of times this Ray has been communicated.
Definition: Ray.h:722
bool _should_continue
Wether or not the Ray should continue to be traced (not sent in parallel)
Definition: Ray.h:719
Real _distance
Total distance this Ray has traveled.
Definition: Ray.h:731
unsigned int _intersections
Number of intersections done for this Ray.
Definition: Ray.h:725
bool _trajectory_changed
Whether or not this Ray had its trajectory changed (not sent in parallel)
Definition: Ray.h:714
unsigned int _trajectory_changes
Number of times this Ray has had its trajectory changed.
Definition: Ray.h:728

◆ setCurrentElem()

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

Change a Ray's current elem.

Definition at line 598 of file Ray.h.

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

◆ setCurrentIncomingSide()

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

Change a Ray's incoming side.

Definition at line 603 of file Ray.h.

604  {
605  _current_incoming_side = current_incoming_side;
606  }
unsigned short _current_incoming_side
The side of _current_elem that the Ray is incoming on (if any).
Definition: Ray.h:711

◆ setCurrentPoint()

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

Sets the Ray's current point.

Definition at line 580 of file Ray.h.

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

◆ setDirection()

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

Sets the Ray's direction.

Definition at line 589 of file Ray.h.

589 { _direction = direction; }
Point _direction
Direction of the Ray.
Definition: Ray.h:686
const Point & direction() const
Gets the Ray&#39;s direction.
Definition: Ray.h:279

◆ setShouldContinue()

void Ray::setShouldContinue ( const bool  should_continue)
inline

Sets whether or not this Ray should continue.

Definition at line 537 of file Ray.h.

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

◆ 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 233 of file Ray.C.

Referenced by Ray(), and reset().

236 {
237  mooseAssert(starting_point != RayTracingCommon::invalid_point, "Invalid point");
238  errorIfTracing("Cannot use Ray::setStart()");
239  if (!invalidCurrentPoint() && !_current_point.absolute_fuzzy_equals(starting_point))
240  errorWhenInitializing("Starting point was already set via Ray::setStart() and is being changed."
241  "\n\nYou may only call Ray::setStart() after it has been called once to"
242  "\nchange the starting element and starting incoming side."
243  "\n\nYou may also clear the starting info via Ray::clearStartingInfo().");
244 
245  _current_point = starting_point;
246  _current_elem = starting_elem;
247  _current_incoming_side = starting_incoming_side;
248 
249  if (_study.verifyRays())
250  {
251  if (!_study.looseBoundingBox().contains_point(starting_point))
252  errorWhenInitializing("Mesh does not contain starting point.");
253  if (starting_elem)
254  {
255  mooseAssert(_study.meshBase().query_elem_ptr(starting_elem->id()) == starting_elem,
256  "Element is not owned by the mesh");
257  if (!starting_elem->active())
258  errorWhenInitializing("Starting element is not active.");
259  }
260 
261  bool non_planar_start = false;
262 
264  {
265  if (!starting_elem)
266  errorWhenInitializing("Starting incoming side is set but starting element is not set.");
267  if (starting_elem->n_sides() < starting_incoming_side)
268  errorWhenInitializing("Starting incoming side is not valid for its starting element.");
269 
270  non_planar_start = _study.sideIsNonPlanar(starting_elem, starting_incoming_side);
271  if (!non_planar_start &&
272  !starting_elem->build_side_ptr(starting_incoming_side)->contains_point(starting_point))
273  errorWhenInitializing("Starting incoming side does not contain the starting point.");
274  }
275 
276  if (starting_elem && !non_planar_start && !starting_elem->contains_point(starting_point))
277  errorWhenInitializing("Starting element does not contain the starting point.");
278  }
279 }
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:237
Point _current_point
Current point of the Ray.
Definition: Ray.h:683
bool invalidCurrentIncomingSide() const
Whether or not the Ray&#39;s current incoming side is invalid.
Definition: Ray.h:468
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:744
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:701
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:711
bool active() const
void errorWhenInitializing(const std::string &reason) const
Produces a useful error for use when initializing a Ray.
Definition: Ray.C:392
void errorIfTracing(const std::string &reason) const
Produces a useful error if a Ray has started tracing.
Definition: Ray.C:385

◆ 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 282 of file Ray.C.

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

283 {
284  errorIfTracing("Cannot use Ray::setStartingDirection()");
285  if (invalidCurrentPoint())
286  errorWhenInitializing("Cannot use Ray::setStartingDirection() before Ray::setStart().");
287  if (!invalidDirection())
289  "Cannot change a Ray's starting direction using Ray::setStartingDirection()"
290  "\nafter it has already been set."
291  "\n\nYou must first clear the starting info using Ray::clearStartingInfo().");
292  if (starting_direction.absolute_fuzzy_equals(Point(0, 0, 0)))
293  errorWhenInitializing("Starting direction in Ray::setStartingDirection() is the zero vector.");
294 
295  _direction = starting_direction.unit();
296 }
Point _direction
Direction of the Ray.
Definition: Ray.h:686
bool invalidCurrentPoint() const
Whether or not the point that the Ray is currently at is valid.
Definition: Ray.h:237
TypeVector< Real > unit() const
bool invalidDirection() const
Whether or not the Ray&#39;s direction is set to invalid.
Definition: Ray.h:283
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:392
void errorIfTracing(const std::string &reason) const
Produces a useful error if a Ray has started tracing.
Definition: Ray.C:385

◆ 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 299 of file Ray.C.

Referenced by Ray(), and reset().

300 {
301  errorIfTracing("Cannot use Ray::setStartingEndPoint()");
302  if (invalidCurrentPoint())
303  errorWhenInitializing("Cannot use Ray::setStartingEndPoint() before Ray::setStart().");
304  if (_current_point.absolute_fuzzy_equals(starting_end_point))
305  errorWhenInitializing("End point is equal to the start point in Ray::setStartingEndPoint().");
306  if (!invalidDirection())
307  errorWhenInitializing("Cannot use Ray::setStartingEndPoint() after Ray::setStartingDirection()."
308  "\n\nClear the starting information with Ray::clearStartingInfo().");
309  if (maxDistanceSet())
311  "Cannot use Ray::setStartingEndPoint() after Ray::setStartingMaxDistance().");
312 
313  if (_study.verifyRays() && !_study.looseBoundingBox().contains_point(starting_end_point))
314  errorWhenInitializing("End point is not within the mesh for Ray::setStartingEndPoint().");
315 
316  Point difference = starting_end_point;
317  difference -= _current_point;
318  setStartingMaxDistance(difference.norm());
319  setStartingDirection(difference);
320  _end_set = true;
321 }
auto norm() const
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:237
Point _current_point
Current point of the Ray.
Definition: Ray.h:683
bool maxDistanceSet() const
Whether or not the distance has been set via setStartingMaxDistance()
Definition: Ray.h:523
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:282
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition: Ray.h:744
bool invalidDirection() const
Whether or not the Ray&#39;s direction is set to invalid.
Definition: Ray.h:283
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:324
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:717
void errorWhenInitializing(const std::string &reason) const
Produces a useful error for use when initializing a Ray.
Definition: Ray.C:392
void errorIfTracing(const std::string &reason) const
Produces a useful error if a Ray has started tracing.
Definition: Ray.C:385

◆ 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 324 of file Ray.C.

Referenced by setStartingEndPoint().

325 {
326  errorIfTracing("Cannot use Ray::setStartingMaxDistance()");
327  if (invalidCurrentPoint())
328  errorWhenInitializing("Cannot use Ray::setStartingMaxDistance() before Ray::setStart().");
329  if (starting_max_distance <= 0)
330  errorWhenInitializing("Starting max distance is <= 0 in Ray::setStartingMaxDistance().");
331  if (_end_set)
333  "Cannot use Ray::setStartingMaxDistance() after Ray::setStartingEndPoint().");
334 
335  _max_distance = starting_max_distance;
336 }
bool invalidCurrentPoint() const
Whether or not the point that the Ray is currently at is valid.
Definition: Ray.h:237
Real _max_distance
Maximum distance the Ray is allowed to travel.
Definition: Ray.h:733
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:717
void errorWhenInitializing(const std::string &reason) const
Produces a useful error for use when initializing a Ray.
Definition: Ray.C:392
void errorIfTracing(const std::string &reason) const
Produces a useful error if a Ray has started tracing.
Definition: Ray.C:385

◆ 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 339 of file Ray.C.

340 {
341  errorIfTracing("Cannot use Ray::setStationary()");
342  if (invalidCurrentPoint())
343  errorWhenInitializing("Cannot use Ray::setStationary() before Ray::setStart()");
344  if (_end_set)
345  errorWhenInitializing("Cannot use Ray::setStationary() after Ray::setStartingEndPoint()");
346  if (!invalidDirection())
347  errorWhenInitializing("Cannot use Ray::setStationary() with Ray::setStartingDirection()");
348  _max_distance = 0;
349  mooseAssert(stationary(), "Stationary not set");
350 }
bool stationary() const
Definition: Ray.h:758
bool invalidCurrentPoint() const
Whether or not the point that the Ray is currently at is valid.
Definition: Ray.h:237
bool invalidDirection() const
Whether or not the Ray&#39;s direction is set to invalid.
Definition: Ray.h:283
Real _max_distance
Maximum distance the Ray is allowed to travel.
Definition: Ray.h:733
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:717
void errorWhenInitializing(const std::string &reason) const
Produces a useful error for use when initializing a Ray.
Definition: Ray.C:392
void errorIfTracing(const std::string &reason) const
Produces a useful error if a Ray has started tracing.
Definition: Ray.C:385

◆ setTrajectoryChanged()

void Ray::setTrajectoryChanged ( const bool  trajectory_changed)
inlineprivate

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

Definition at line 615 of file Ray.h.

616  {
617  _trajectory_changed = trajectory_changed;
618  }
bool _trajectory_changed
Whether or not this Ray had its trajectory changed (not sent in parallel)
Definition: Ray.h:714

◆ shouldContinue()

bool Ray::shouldContinue ( ) const
inline

Whether or not this Ray should continue.

Definition at line 533 of file Ray.h.

Referenced by getInfo().

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

◆ stationary()

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

Definition at line 758 of file Ray.h.

Referenced by setStationary().

759 {
760  const bool stationary = _max_distance == 0;
761  if (stationary)
762  mooseAssert(_intersections == 0, "Should be zero");
763  return stationary;
764 }
bool stationary() const
Definition: Ray.h:758
Real _max_distance
Maximum distance the Ray is allowed to travel.
Definition: Ray.h:733
unsigned int _intersections
Number of intersections done for this Ray.
Definition: Ray.h:725

◆ study()

const RayTracingStudy& Ray::study ( ) const
inline

Get the RayTracingStudy associated with this Ray.

Definition at line 564 of file Ray.h.

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

◆ trajectoryChanged()

bool Ray::trajectoryChanged ( ) const
inline

Whether or not this Ray has had its trajectory changed.

Definition at line 542 of file Ray.h.

Referenced by getInfo().

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

◆ trajectoryChanges()

unsigned int Ray::trajectoryChanges ( ) const
inline

Gets the number of trajectory changes this Ray has had.

Definition at line 546 of file Ray.h.

Referenced by getInfo().

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

Friends And Related Function Documentation

◆ dataLoad

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

Definition at line 738 of file Ray.C.

739 {
740  mooseAssert(context, "Missing RayTracingStudy context");
741  RayTracingStudy * study = static_cast<RayTracingStudy *>(context);
742 
743  RayID id;
744  loadHelper(stream, id, context);
745  ray = study->acquireRayInternal(id,
746  /* data_size = */ 0,
747  /* aux_data_size = */ 0,
748  /* reset = */ true,
750 
751  loadHelper(stream, ray->_current_point, context);
752  loadHelper(stream, ray->_direction, context);
753  dof_id_type current_elem_id;
754  loadHelper(stream, current_elem_id, context);
755  ray->_current_elem = study->meshBase().query_elem_ptr(current_elem_id);
756  loadHelper(stream, ray->_current_incoming_side, context);
757  loadHelper(stream, ray->_trajectory_changed, context);
758  loadHelper(stream, ray->_end_set, context);
759  loadHelper(stream, ray->_should_continue, context);
760  loadHelper(stream, ray->_processor_crossings, context);
761  loadHelper(stream, ray->_intersections, context);
762  loadHelper(stream, ray->_trajectory_changes, context);
763  loadHelper(stream, ray->_distance, context);
764  loadHelper(stream, ray->_max_distance, context);
765  loadHelper(stream, ray->_data, context);
766  loadHelper(stream, ray->_aux_data, context);
767 
768  if (ray->hasTraced())
769  mooseAssert(!study->currentlyGenerating() && !study->currentlyPropagating(),
770  "Cannot not load a Ray that has already traced during generation or propagation; "
771  "reset the Ray first");
772 }
bool currentlyGenerating() const
Whether or not the study is generating.
RayID id() const
Gets the Ray&#39;s ID.
Definition: Ray.h:219
unsigned long int RayID
Type for a Ray&#39;s ID.
Definition: Ray.h:44
const RayTracingStudy & study() const
Get the RayTracingStudy associated with this Ray.
Definition: Ray.h:564
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 713 of file Ray.C.

714 {
715  mooseAssert(ray, "Null ray");
716  mooseAssert(context, "Missing RayTracingStudy context");
717  mooseAssert(static_cast<RayTracingStudy *>(context) == &ray->study(), "Different study");
718 
719  storeHelper(stream, ray->_id, context);
720  storeHelper(stream, ray->_current_point, context);
721  storeHelper(stream, ray->_direction, context);
722  auto current_elem_id = ray->currentElem() ? ray->currentElem()->id() : DofObject::invalid_id;
723  storeHelper(stream, current_elem_id, context);
724  storeHelper(stream, ray->_current_incoming_side, context);
725  storeHelper(stream, ray->_trajectory_changed, context);
726  storeHelper(stream, ray->_end_set, context);
727  storeHelper(stream, ray->_should_continue, context);
728  storeHelper(stream, ray->_processor_crossings, context);
729  storeHelper(stream, ray->_intersections, context);
730  storeHelper(stream, ray->_trajectory_changes, context);
731  storeHelper(stream, ray->_distance, context);
732  storeHelper(stream, ray->_max_distance, context);
733  storeHelper(stream, ray->_data, context);
734  storeHelper(stream, ray->_aux_data, context);
735 }
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 749 of file Ray.h.

◆ TestRayLots

friend class TestRayLots
friend

Definition at line 751 of file Ray.h.

◆ TraceRay

friend class TraceRay
friend

Definition at line 747 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 741 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 701 of file Ray.h.

Referenced by changePointElemSide(), 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 711 of file Ray.h.

Referenced by changePointElemSide(), 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 683 of file Ray.h.

Referenced by changePointElemSide(), 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 737 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 731 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 717 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 673 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 725 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 722 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 719 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 744 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 714 of file Ray.h.

Referenced by changeDirection(), changePointElemSide(), 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 728 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

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