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

Static Public Attributes

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

Private Member Functions

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

Private Attributes

RayID _id
 A unique ID for this Ray.
 
Point _current_point
 Current point of the Ray.
 
Point _direction
 Direction of the Ray.
 
const Elem * _current_elem
 Current element that the Ray is in.
 
unsigned short _current_incoming_side
 The side of _current_elem that the Ray is incoming on (if any).
 
bool _trajectory_changed
 Whether or not this Ray had its trajectory changed (not sent in parallel)
 
bool _end_set
 Whether or not the user has set an end point for this Ray (via limiting its distance with setStartingEndPoint())
 
bool _should_continue
 Wether or not the Ray should continue to be traced (not sent in parallel)
 
unsigned int _processor_crossings
 Number of times this Ray has been communicated.
 
unsigned int _intersections
 Number of intersections done for this Ray.
 
unsigned int _trajectory_changes
 Number of times this Ray has had its trajectory changed.
 
Real _distance
 Total distance this Ray has traveled.
 
Real _max_distance
 Maximum distance the Ray is allowed to travel.
 
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.
 
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.
 
RayTracingStudy_study
 The RayTracingStudy that owns this Ray (not sent in parallel)
 

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

26 : _id(id),
29 _current_elem(nullptr),
31 _end_set(false),
32 _max_distance(std::numeric_limits<Real>::max()),
33 _data(data_size, 0),
34 _aux_data(aux_data_size, 0),
36{
38}
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
Real _max_distance
Maximum distance the Ray is allowed to travel.
Definition Ray.h:733
Point _direction
Direction of the Ray.
Definition Ray.h:686
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 resetCountersInternal()
Reset all of the internal counters.
Definition Ray.C:404
const Elem * _current_elem
Current element that the Ray is in.
Definition Ray.h:701
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
const RayTracingStudy & study() const
Get the RayTracingStudy associated with this Ray.
Definition Ray.h:564
RayID _id
A unique ID for this Ray.
Definition Ray.h:673
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Definition Ray.h:744
Point _current_point
Current point of the Ray.
Definition Ray.h:683
unsigned short _current_incoming_side
The side of _current_elem that the Ray is incoming on (if any).
Definition Ray.h:711
static const unsigned short invalid_side
Identifier for an invalid side index.
static const libMesh::Point invalid_point(invalid_distance, invalid_distance, invalid_distance)
Identifier for an invalid point.

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

69 : Ray(&other->_study,
70 other->_id,
71 other->_data.size(),
72 other->_aux_data.size(),
73 /* reset = */ true,
74 key)
75{
76 other->errorIfTracing("Cannot copy Ray");
77
78 if (!other->invalidCurrentPoint())
80
81 if (other->_end_set)
83 else
84 {
85 if (!other->invalidDirection())
87 if (other->maxDistanceSet())
89 }
90
91 std::copy(other->_data.begin(), other->_data.end(), _data.begin());
92 std::copy(other->_aux_data.begin(), other->_aux_data.end(), _aux_data.begin());
93}
void setStartingEndPoint(const Point &starting_end_point)
Sets the starting end point to starting_point for a Ray.
Definition Ray.C:297
void setStartingDirection(const Point &starting_direction)
Sets the starting direction to starting_direction for a Ray.
Definition Ray.C:280
bool maxDistanceSet() const
Whether or not the distance has been set via setStartingMaxDistance()
Definition Ray.h:523
Ray()=delete
Deleted default constructor.
void errorIfTracing(const std::string &reason) const
Produces a useful error if a Ray has started tracing.
Definition Ray.C:383
bool invalidDirection() const
Whether or not the Ray's direction is set to invalid.
Definition Ray.h:283
Point endPoint() const
Gets the user-set end point for the Ray, if set.
Definition Ray.C:184
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:231
bool invalidCurrentPoint() const
Whether or not the point that the Ray is currently at is valid.
Definition Ray.h:237

◆ 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.

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

175{
176 if (!_end_set)
177 mooseError("Cannot use Ray::atEnd() for a Ray that does not have an end set\n\n", getInfo());
178 mooseAssert(_distance <= _max_distance + TOLERANCE * TOLERANCE, "Distance past max distance");
179
180 return MooseUtils::absoluteFuzzyEqual(_distance, _max_distance);
181}
void mooseError(Args &&... args)
std::string getInfo() const
Helper function for getting information about the Ray.
Definition Ray.C:481

Referenced by getInfo().

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

450{
451 mooseAssert(_aux_data.size() == 0 || _aux_data.size() == _study.rayAuxDataSize(),
452 "Ray data size is not zero or the size required by study");
454 return _aux_data;
455}
std::size_t rayAuxDataSize() const
The registered size of values in the Ray aux data.

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

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

459{
460 mooseAssert(_aux_data.size() == 0 || _aux_data.size() == _study.rayAuxDataSize(),
461 "Ray data size is not zero or the size required by study");
463 return _aux_data;
464}

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

468{
469 mooseAssert(_study.rayAuxDataSize() > i, "Accessing Ray data out of range");
470 return auxData()[i];
471}
std::vector< RayData > & auxData()
Gets a writeable reference to the Ray's auxilary data.
Definition Ray.C:449

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

475{
476 mooseAssert(_study.rayAuxDataSize() > i, "Accessing Ray data out of range");
477 return auxData()[i];
478}

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

195{
196 if (direction.absolute_fuzzy_equals(Point(0, 0, 0)))
197 mooseError("Cannot set zero vector direction for a Ray\n\n", getInfo());
198
199 _direction = direction.unit();
200 _trajectory_changed = true;
201}
bool _trajectory_changed
Whether or not this Ray had its trajectory changed (not sent in parallel)
Definition Ray.h:714
const Point & direction() const
Gets the Ray's direction.
Definition Ray.h:279

◆ 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's ID.
Definition Ray.h:219

◆ 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; }

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

221{
222 mooseAssert(!_trajectory_changed, "Should not have already changed");
223
224 _current_point = point;
225 _current_elem = &elem;
227 _trajectory_changed = true;
228}

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

207{
208 if (direction.absolute_fuzzy_equals(Point(0, 0, 0)))
209 mooseError("Cannot set zero vector direction for a Ray\n\n", getInfo());
210
211 _current_point = start;
212 _direction = direction.unit();
213 _trajectory_changed = true;
214}

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

366{
367 errorIfTracing("Cannot use Ray::clearStartingInfo()");
369}
void clearStartingInfoInternal()
Clears the starting information.
Definition Ray.C:372

◆ clearStartingInfoInternal()

void Ray::clearStartingInfoInternal ( )
private

Clears the starting information.

Definition at line 372 of file Ray.C.

373{
379 _end_set = false;
380}
void invalidateMaxDistance()
Invalidates the Ray's max distance.
Definition Ray.h:646
void invalidateCurrentIncomingSide()
Invalidates the Ray's current incoming side.
Definition Ray.h:610
void invalidateDirection()
Invalidates the Ray's current direction.
Definition Ray.h:593
void invalidateCurrentElem()
Invalidates the Ray's current element.
Definition Ray.h:575
void invalidateCurrentPoint()
Invalidates the Ray's current point.
Definition Ray.h:584

Referenced by clearStartingInfo(), and reset().

◆ 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.

449{ return _current_elem; }

Referenced by getInfo().

◆ 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.

459{ return _current_incoming_side; }

Referenced by getInfo().

◆ 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.

233{ return _current_point; }

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

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

416{
417 mooseAssert(_data.size() == 0 || _data.size() == _study.rayDataSize(),
418 "Ray data size of " + std::to_string(_data.size()) +
419 " is not zero or the size required by the study of " +
420 std::to_string(_study.rayDataSize()));
421 _data.resize(_study.rayDataSize());
422 return _data;
423}
std::size_t rayDataSize() const
The registered size of values in the Ray data.

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

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

427{
428 mooseAssert(_data.size() == 0 || _data.size() == _study.rayDataSize(),
429 "Ray data size is not zero or the size required by study");
430 _data.resize(_study.rayDataSize());
431 return _data;
432}

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

436{
437 mooseAssert(_study.rayDataSize() > i, "Accessing Ray data out of range");
438 return data()[i];
439}
std::vector< RayData > & data()
Gets a writeable reference to the Ray's data.
Definition Ray.C:415

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

443{
444 mooseAssert(_study.rayDataSize() > i, "Accessing Ray data out of range");
445 return data()[i];
446}

◆ direction()

const Point & Ray::direction ( ) const
inline

Gets the Ray's direction.

Definition at line 279 of file Ray.h.

279{ return _direction; }

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

◆ distance()

Real Ray::distance ( ) const
inline

Gets the distance this Ray has traveled.

Definition at line 512 of file Ray.h.

512{ return _distance; }

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

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

185{
186 if (!_end_set)
187 mooseError("Cannot use Ray::endPoint() for a Ray that does not have an end set\n\n", getInfo());
188 mooseAssert(_distance <= _max_distance + TOLERANCE * TOLERANCE, "Distance past max distance");
189
191}

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

◆ 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.

478{ return _end_set; }

Referenced by getInfo().

◆ equalityHelper()

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

Helper for the equality operators.

Definition at line 124 of file Ray.C.

125{
126 if (this == &other)
127 return equal;
128
129 if (_id != other._id)
130 return !equal;
131 if (invalidCurrentPoint() != other.invalidCurrentPoint() ||
132 !_current_point.absolute_fuzzy_equals(other._current_point))
133 return !equal;
134 if (invalidDirection() != other.invalidDirection() ||
135 !_direction.absolute_fuzzy_equals(other._direction))
136 return !equal;
137 if (_current_elem != other._current_elem)
138 return !equal;
140 return !equal;
142 return !equal;
143 if (_end_set != other._end_set)
144 return !equal;
146 return !equal;
148 return !equal;
149 if (_intersections != other._intersections)
150 return !equal;
152 return !equal;
153 if (!MooseUtils::absoluteFuzzyEqual(_distance, other._distance))
154 return !equal;
155 if (!MooseUtils::absoluteFuzzyEqual(_max_distance, other._max_distance))
156 return !equal;
157 if (_data.size() != other._data.size())
158 return !equal;
159 for (std::size_t i = 0; i < _data.size(); ++i)
160 if (!MooseUtils::absoluteFuzzyEqual(_data[i], other._data[i]))
161 return !equal;
162 if (_aux_data.size() != other._aux_data.size())
163 return !equal;
164 for (std::size_t i = 0; i < _aux_data.size(); ++i)
165 if (!MooseUtils::absoluteFuzzyEqual(_aux_data[i], other._aux_data[i]))
166 return !equal;
167 if (&_study != &other._study)
168 return !equal;
169
170 return equal;
171}
bool _should_continue
Wether or not the Ray should continue to be traced (not sent in parallel)
Definition Ray.h:719

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

◆ errorIfTracing()

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

Produces a useful error if a Ray has started tracing.

Definition at line 383 of file Ray.C.

384{
385 if (hasTraced())
386 mooseError(reason, " after it has started tracing\n\n", getInfo());
387}
bool hasTraced() const
Whether or not a Ray has begun tracing.
Definition Ray.h:556

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

◆ errorWhenInitializing()

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

Produces a useful error for use when initializing a Ray.

Definition at line 390 of file Ray.C.

391{
392 mooseError("While initializing starting information for a Ray:\n\n", reason, "\n\n", getInfo());
393}

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

◆ getInfo()

std::string Ray::getInfo ( ) const

Helper function for getting information about the Ray.

Definition at line 481 of file Ray.C.

482{
483 std::ostringstream oss;
484
485 oss << "Ray information with " << _study.type() << " '" << _study.name() << "' on pid "
486 << _study.comm().rank() << "\n";
487 oss << " this = " << this << "\n";
488 oss << " id() = " << id() << "\n";
490 oss << " _study.registeredRayName(id()) = " << _study.registeredRayName(id()) << "\n";
491 oss << " currentPoint() = ";
493 oss << "invalid point\n";
494 else
495 oss << currentPoint() << "\n";
496 oss << " direction() = ";
497 if (invalidDirection())
498 oss << "invalid point\n";
499 else
500 oss << direction() << "\n";
501 oss << " currentIncomingSide() = ";
503 oss << "invalid side\n";
504 else
505 oss << currentIncomingSide() << "\n";
506 oss << " endSet() = " << (endSet() ? "true" : "false") << "\n";
507 if (endSet())
508 {
509 oss << " endPoint() = " << endPoint() << "\n";
510 oss << " atEnd() = " << (atEnd() ? "true" : "false") << "\n";
511 }
512 oss << " distance() = " << distance() << "\n";
513 oss << " maxDistance() = " << maxDistance() << "\n";
514 if (currentElem())
515 {
516 oss << " currentElem()->id() = " << currentElem()->id() << "\n";
517 oss << " currentElem()->processor_id() = " << currentElem()->processor_id() << "\n";
518 }
519 else
520 oss << " currentElem()->id() = invalid\n";
521 oss << " processorCrossings() = " << processorCrossings() << "\n";
522 oss << " intersections() = " << intersections() << "\n";
523 oss << " trajectoryChanges() = " << trajectoryChanges() << "\n";
524 oss << " shouldContinue() = " << (shouldContinue() ? "true" : "false") << "\n";
525 oss << " trajectoryChanged() = " << (trajectoryChanged() ? "true" : "false") << "\n";
526 oss << " data() = ";
527 for (std::size_t i = 0; i < data().size(); ++i)
528 oss << "\n '" << _study.getRayDataName(i) << "' = " << data(i);
529 oss << "\n";
530 oss << " auxData() = ";
531 for (std::size_t i = 0; i < auxData().size(); ++i)
532 oss << "\n '" << _study.getRayAuxDataName(i) << "' = " << auxData(i);
533 oss << "\n";
534
535 return oss.str();
536}
const std::string & type() const
const std::string & name() const
const std::string & getRayAuxDataName(const RayDataIndex index) const
Gets the name associated with a registered value in the Ray aux data.
bool useRayRegistration() const
Whether or not ray registration is being used.
const std::string & registeredRayName(const RayID ray_id) const
Gets the name of a registered ray.
const std::string & getRayDataName(const RayDataIndex index) const
Gets the name associated with a registered value in the Ray data.
unsigned short currentIncomingSide() const
Get a Ray's current incoming side.
Definition Ray.h:459
bool endSet() const
Whether or not the user has set an end point for this Ray.
Definition Ray.h:478
unsigned int trajectoryChanges() const
Gets the number of trajectory changes this Ray has had.
Definition Ray.h:546
bool invalidCurrentIncomingSide() const
Whether or not the Ray's current incoming side is invalid.
Definition Ray.h:468
Real distance() const
Gets the distance this Ray has traveled.
Definition Ray.h:512
Real maxDistance() const
Gets the max distance this Ray is allowed to travel.
Definition Ray.h:519
unsigned int processorCrossings() const
Gets the number of times this Ray has crossed a processor.
Definition Ray.h:502
bool trajectoryChanged() const
Whether or not this Ray has had its trajectory changed.
Definition Ray.h:542
unsigned int intersections() const
Gets the number of intersections this Ray has done.
Definition Ray.h:507
const Elem * currentElem() const
Gets the current element that the Ray is in.
Definition Ray.h:449
const Point & currentPoint() const
Gets the point that the Ray is currently at.
Definition Ray.h:233
bool invalidID() const
Whether or not the Ray's ID is invalid.
Definition Ray.h:223
bool atEnd() const
Whether or not the Ray is at the user-defined end point.
Definition Ray.C:174
bool shouldContinue() const
Whether or not this Ray should continue.
Definition Ray.h:533
processor_id_type rank() const
const Parallel::Communicator & comm() const

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

◆ hasTraced()

bool Ray::hasTraced ( ) const
inline

Whether or not a Ray has begun tracing.

Definition at line 556 of file Ray.h.

557 {
558 return (bool)_distance || (bool)_processor_crossings || (bool)_intersections;
559 }

Referenced by errorIfTracing().

◆ id()

RayID Ray::id ( ) const
inline

Gets the Ray's ID.

Definition at line 219 of file Ray.h.

219{ return _id; }

Referenced by changeID(), and getInfo().

◆ intersections()

unsigned int Ray::intersections ( ) const
inline

Gets the number of intersections this Ray has done.

Definition at line 507 of file Ray.h.

507{ return _intersections; }

Referenced by getInfo().

◆ invalidateCurrentElem()

void Ray::invalidateCurrentElem ( )
inlineprivate

Invalidates the Ray's current element.

Definition at line 575 of file Ray.h.

575{ _current_elem = nullptr; }

Referenced by clearStartingInfoInternal(), and invalidateStartingElem().

◆ 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().

◆ invalidateCurrentPoint()

void Ray::invalidateCurrentPoint ( )
inlineprivate

Invalidates the Ray's current point.

Definition at line 584 of file Ray.h.

Referenced by clearStartingInfoInternal().

◆ invalidateDirection()

void Ray::invalidateDirection ( )
inlineprivate

Invalidates the Ray's current direction.

Definition at line 593 of file Ray.h.

Referenced by clearStartingInfoInternal().

◆ invalidateMaxDistance()

void Ray::invalidateMaxDistance ( )
inlineprivate

Invalidates the Ray's max distance.

Definition at line 646 of file Ray.h.

646{ _max_distance = std::numeric_limits<Real>::max(); }

Referenced by clearStartingInfoInternal().

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

352{
353 errorIfTracing("Cannot use Ray::invalidateStartingElem()");
355}

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

359{
360 errorIfTracing("Cannot use Ray::invalidateStartingIncomingSide()");
362}

◆ 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().

◆ 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().

◆ 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().

◆ invalidID()

bool Ray::invalidID ( ) const
inline

Whether or not the Ray's ID is invalid.

Definition at line 223 of file Ray.h.

223{ return _id == INVALID_RAY_ID; }
static const RayID INVALID_RAY_ID
Invalid Ray ID.
Definition Ray.h:214

Referenced by getInfo().

◆ 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.

519{ return _max_distance; }

Referenced by getInfo().

◆ maxDistanceSet()

bool Ray::maxDistanceSet ( ) const
inline

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

Definition at line 523 of file Ray.h.

523{ return _max_distance != std::numeric_limits<Real>::max(); }

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

◆ 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:124

◆ 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); }

◆ 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.

502{ return _processor_crossings; }

Referenced by getInfo().

◆ reset() [1/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 96 of file Ray.C.

97{
98 other->errorIfTracing("Cannot copy Ray");
99 mooseAssert(&other->_study == &_study, "Cannot copy Ray from different study");
100
103
104 _id = other->_id;
105
106 if (!other->invalidCurrentPoint())
108
109 if (other->_end_set)
111 else
112 {
113 if (!other->invalidDirection())
115 if (other->maxDistanceSet())
117 }
118
119 _data = other->_data;
120 _aux_data = other->_aux_data;
121}

◆ reset() [2/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

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

397{
399 mooseError("Ray::resetCounters() can only be used during generateRays()\n\n", getInfo());
401}
bool currentlyGenerating() const
Whether or not the study is generating.

◆ resetCountersInternal()

void Ray::resetCountersInternal ( )
private

Reset all of the internal counters.

Definition at line 404 of file Ray.C.

405{
407 _intersections = 0;
409 _distance = 0;
410 _trajectory_changed = false;
411 _should_continue = true;
412}

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

◆ 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; }

◆ 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 }

◆ 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; }

◆ setDirection()

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

Sets the Ray's direction.

Definition at line 589 of file Ray.h.

◆ 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; }

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

234{
235 mooseAssert(starting_point != RayTracingCommon::invalid_point, "Invalid point");
236 errorIfTracing("Cannot use Ray::setStart()");
237 if (!invalidCurrentPoint() && !_current_point.absolute_fuzzy_equals(starting_point))
238 errorWhenInitializing("Starting point was already set via Ray::setStart() and is being changed."
239 "\n\nYou may only call Ray::setStart() after it has been called once to"
240 "\nchange the starting element and starting incoming side."
241 "\n\nYou may also clear the starting info via Ray::clearStartingInfo().");
242
243 _current_point = starting_point;
244 _current_elem = starting_elem;
245 _current_incoming_side = starting_incoming_side;
246
247 if (_study.verifyRays())
248 {
249 if (!_study.looseBoundingBox().contains_point(starting_point))
250 errorWhenInitializing("Mesh does not contain starting point.");
251 if (starting_elem)
252 {
253 mooseAssert(_study.meshBase().query_elem_ptr(starting_elem->id()) == starting_elem,
254 "Element is not owned by the mesh");
255 if (!starting_elem->active())
256 errorWhenInitializing("Starting element is not active.");
257 }
258
259 bool non_planar_start = false;
260
262 {
263 if (!starting_elem)
264 errorWhenInitializing("Starting incoming side is set but starting element is not set.");
265 if (starting_elem->n_sides() < starting_incoming_side)
266 errorWhenInitializing("Starting incoming side is not valid for its starting element.");
267
268 non_planar_start = _study.sideIsNonPlanar(starting_elem, starting_incoming_side);
269 if (!non_planar_start &&
270 !starting_elem->build_side_ptr(starting_incoming_side)->contains_point(starting_point))
271 errorWhenInitializing("Starting incoming side does not contain the starting point.");
272 }
273
274 if (starting_elem && !non_planar_start && !starting_elem->contains_point(starting_point))
275 errorWhenInitializing("Starting element does not contain the starting point.");
276 }
277}
MeshBase & meshBase() const
Access to the libMesh MeshBase.
bool sideIsNonPlanar(const Elem *elem, const unsigned short s) const
Whether or not the side \s on elem elem is non-planar.
const BoundingBox & looseBoundingBox() const
Get the loose nodal bounding box for the domain.
bool verifyRays() const
Whether or not to verify if Rays have valid information before being traced.
void errorWhenInitializing(const std::string &reason) const
Produces a useful error for use when initializing a Ray.
Definition Ray.C:390

Referenced by Ray(), and reset().

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

281{
282 errorIfTracing("Cannot use Ray::setStartingDirection()");
284 errorWhenInitializing("Cannot use Ray::setStartingDirection() before Ray::setStart().");
285 if (!invalidDirection())
287 "Cannot change a Ray's starting direction using Ray::setStartingDirection()"
288 "\nafter it has already been set."
289 "\n\nYou must first clear the starting info using Ray::clearStartingInfo().");
290 if (starting_direction.absolute_fuzzy_equals(Point(0, 0, 0)))
291 errorWhenInitializing("Starting direction in Ray::setStartingDirection() is the zero vector.");
292
293 _direction = starting_direction.unit();
294}

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

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

298{
299 errorIfTracing("Cannot use Ray::setStartingEndPoint()");
301 errorWhenInitializing("Cannot use Ray::setStartingEndPoint() before Ray::setStart().");
302 if (_current_point.absolute_fuzzy_equals(starting_end_point))
303 errorWhenInitializing("End point is equal to the start point in Ray::setStartingEndPoint().");
304 if (!invalidDirection())
305 errorWhenInitializing("Cannot use Ray::setStartingEndPoint() after Ray::setStartingDirection()."
306 "\n\nClear the starting information with Ray::clearStartingInfo().");
307 if (maxDistanceSet())
309 "Cannot use Ray::setStartingEndPoint() after Ray::setStartingMaxDistance().");
310
311 if (_study.verifyRays() && !_study.looseBoundingBox().contains_point(starting_end_point))
312 errorWhenInitializing("End point is not within the mesh for Ray::setStartingEndPoint().");
313
314 Point difference = starting_end_point;
315 difference -= _current_point;
316 setStartingMaxDistance(difference.norm());
317 setStartingDirection(difference);
318 _end_set = true;
319}
void setStartingMaxDistance(const Real starting_max_distance)
Sets the maximum distance this Ray should travel to starting_max_distance.
Definition Ray.C:322

Referenced by Ray(), and reset().

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

323{
324 errorIfTracing("Cannot use Ray::setStartingMaxDistance()");
326 errorWhenInitializing("Cannot use Ray::setStartingMaxDistance() before Ray::setStart().");
327 if (starting_max_distance <= 0)
328 errorWhenInitializing("Starting max distance is <= 0 in Ray::setStartingMaxDistance().");
329 if (_end_set)
331 "Cannot use Ray::setStartingMaxDistance() after Ray::setStartingEndPoint().");
332
333 _max_distance = starting_max_distance;
334}

Referenced by setStartingEndPoint().

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

338{
339 errorIfTracing("Cannot use Ray::setStationary()");
341 errorWhenInitializing("Cannot use Ray::setStationary() before Ray::setStart()");
342 if (_end_set)
343 errorWhenInitializing("Cannot use Ray::setStationary() after Ray::setStartingEndPoint()");
344 if (!invalidDirection())
345 errorWhenInitializing("Cannot use Ray::setStationary() with Ray::setStartingDirection()");
346 _max_distance = 0;
347 mooseAssert(stationary(), "Stationary not set");
348}
bool stationary() const
Definition Ray.h:758

◆ 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 }

◆ shouldContinue()

bool Ray::shouldContinue ( ) const
inline

Whether or not this Ray should continue.

Definition at line 533 of file Ray.h.

533{ return _should_continue; }

Referenced by getInfo().

◆ 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.

759{
760 const bool stationary = _max_distance == 0;
761 if (stationary)
762 mooseAssert(_intersections == 0, "Should be zero");
763 return stationary;
764}

Referenced by setStationary().

◆ 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; }

◆ trajectoryChanged()

bool Ray::trajectoryChanged ( ) const
inline

Whether or not this Ray has had its trajectory changed.

Definition at line 542 of file Ray.h.

542{ return _trajectory_changed; }

Referenced by getInfo().

◆ 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.

546{ return _trajectory_changes; }

Referenced by getInfo().

Friends And Related Symbol Documentation

◆ dataLoad

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

Definition at line 736 of file Ray.C.

737{
738 mooseAssert(context, "Missing RayTracingStudy context");
739 RayTracingStudy * study = static_cast<RayTracingStudy *>(context);
740
741 RayID id;
742 dataLoad(stream, id, context);
743 ray = study->acquireRayInternal(id,
744 /* data_size = */ 0,
745 /* aux_data_size = */ 0,
746 /* reset = */ true,
748
749 dataLoad(stream, ray->_current_point, context);
750 dataLoad(stream, ray->_direction, context);
751 dof_id_type current_elem_id;
752 dataLoad(stream, current_elem_id, context);
753 ray->_current_elem = study->meshBase().query_elem_ptr(current_elem_id);
754 dataLoad(stream, ray->_current_incoming_side, context);
755 dataLoad(stream, ray->_trajectory_changed, context);
756 dataLoad(stream, ray->_end_set, context);
757 dataLoad(stream, ray->_should_continue, context);
758 dataLoad(stream, ray->_processor_crossings, context);
759 dataLoad(stream, ray->_intersections, context);
760 dataLoad(stream, ray->_trajectory_changes, context);
761 dataLoad(stream, ray->_distance, context);
762 dataLoad(stream, ray->_max_distance, context);
763 dataLoad(stream, ray->_data, context);
764 dataLoad(stream, ray->_aux_data, context);
765
766 if (ray->hasTraced())
768 "Cannot not load a Ray that has already traced during generation or propagation; "
769 "reset the Ray first");
770}
unsigned long int RayID
Type for a Ray's ID.
Definition Ray.h:44
Key that is used for restricting access to acquireRayInternal().
Base class for Ray tracing studies that will generate Rays and then propagate all of them to terminat...
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 &)
bool currentlyPropagating() const
Whether or not the study is propagating (tracing Rays)
friend void dataLoad(std::istream &stream, std::shared_ptr< Ray > &ray, void *context)
Definition Ray.C:736
uint8_t dof_id_type

◆ dataStore

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

Definition at line 711 of file Ray.C.

712{
713 mooseAssert(ray, "Null ray");
714 mooseAssert(context, "Missing RayTracingStudy context");
715 mooseAssert(static_cast<RayTracingStudy *>(context) == &ray->study(), "Different study");
716
717 dataStore(stream, ray->_id, context);
718 dataStore(stream, ray->_current_point, context);
719 dataStore(stream, ray->_direction, context);
720 auto current_elem_id = ray->currentElem() ? ray->currentElem()->id() : DofObject::invalid_id;
721 dataStore(stream, current_elem_id, context);
722 dataStore(stream, ray->_current_incoming_side, context);
723 dataStore(stream, ray->_trajectory_changed, context);
724 dataStore(stream, ray->_end_set, context);
725 dataStore(stream, ray->_should_continue, context);
726 dataStore(stream, ray->_processor_crossings, context);
727 dataStore(stream, ray->_intersections, context);
728 dataStore(stream, ray->_trajectory_changes, context);
729 dataStore(stream, ray->_distance, context);
730 dataStore(stream, ray->_max_distance, context);
731 dataStore(stream, ray->_data, context);
732 dataStore(stream, ray->_aux_data, context);
733}
friend void dataStore(std::ostream &stream, std::shared_ptr< Ray > &ray, void *context)
Definition Ray.C:711

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

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

Definition at line 747 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(), 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(), 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(), and resetCountersInternal().

◆ _max_distance

Real Ray::_max_distance
private

Maximum distance the Ray is allowed to travel.

Definition at line 733 of file Ray.h.

Referenced by atEnd(), changeMaxDistance(), endPoint(), equalityHelper(), invalidateMaxDistance(), maxDistance(), maxDistanceSet(), Ray(), reset(), setStartingMaxDistance(), and setStationary().

◆ _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(), auxData(), auxData(), auxData(), data(), data(), data(), 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: