20#include "libmesh/parallel.h"
46#ifdef SINGLE_PRECISION_RAY
124 const std::size_t data_size,
125 const std::size_t aux_data_size,
127 const ConstructRayKey &);
146 const std::size_t data_size,
147 const std::size_t aux_data_size,
273 const unsigned int side,
274 const ChangePointElemSideKey);
291 std::vector<RayData> &
data();
298 const std::vector<RayData> &
data()
const;
320 std::vector<RayData> &
auxData();
327 const std::vector<RayData> &
auxData()
const;
355 void setStart(
const Point & starting_point,
356 const Elem * starting_elem =
nullptr,
749 friend class Parallel::Packing<
std::shared_ptr<Ray>>;
753 friend void
dataStore(std::ostream & stream, std::shared_ptr<Ray> & ray, void * context);
754 friend void
dataLoad(std::istream & stream, std::shared_ptr<Ray> & ray, void * context);
760 const bool stationary = _max_distance == 0;
762 mooseAssert(_intersections == 0,
"Should be zero");
780 static unsigned int packed_size(
typename std::vector<Real>::const_iterator in);
781 static unsigned int packable_size(
const std::shared_ptr<Ray> & ray,
const void *);
782 static unsigned int size(
const std::size_t data_size,
const std::size_t aux_data_size);
784 template <
typename Iter,
typename Context>
785 static void pack(
const std::shared_ptr<Ray> &
object, Iter data_out,
const Context * context);
787 template <
typename BufferIter,
typename Context>
788 static std::shared_ptr<Ray>
unpack(BufferIter in, Context * context);
795void dataStore(std::ostream & stream, std::shared_ptr<Ray> & ray,
void * context);
796void dataLoad(std::istream & stream, std::shared_ptr<Ray> & ray,
void * context);
unsigned int RayDataIndex
Type for the index into the data and aux data on a Ray.
unsigned long int RayID
Type for a Ray's ID.
float RayData
Type for a Ray's data.
RayBC that enforces periodic boundaries.
Base class for the RayBC syntax.
Base object for the RayKernel syntax.
Base class for Ray tracing studies that will generate Rays and then propagate all of them to terminat...
Class that is used as a parameter to changeDirection() that allows only RayBC methods to call changeD...
ChangeDirectionKey(const ChangeDirectionKey &)
Class that is used as a parameter to changePointElem() that allows only PeriodicRayBC methods to call...
ChangePointElemSideKey(const ChangePointElemSideKey &)
Class that is used as a parameter to changeStartDirection() that allows only RayKernelBase methods to...
ChangeStartDirectionKey()
ChangeStartDirectionKey(const ChangeStartDirectionKey &)
Class that is used as a parameter to the public constructors/reset methods.
ConstructRayKey(const ConstructRayKey &)
Basic datastructure for a ray that will traverse the mesh.
void addDistance(const Real add_distance)
Adds to the distance this Ray has traveled.
unsigned short currentIncomingSide() const
Get a Ray's current incoming side.
static const RayDataIndex INVALID_RAY_DATA_INDEX
Invalid index into a Ray's data.
void invalidateMaxDistance()
Invalidates the Ray's max distance.
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...
void changeID(const RayID id)
Changes the Ray's ID.
Real _max_distance
Maximum distance the Ray is allowed to travel.
bool endSet() const
Whether or not the user has set an end point for this Ray.
unsigned int trajectoryChanges() const
Gets the number of trajectory changes this Ray has had.
void invalidateCurrentIncomingSide()
Invalidates the Ray's current incoming side.
std::vector< RayData > & auxData()
Gets a writeable reference to the Ray's auxilary data.
void setStartingEndPoint(const Point &starting_end_point)
Sets the starting end point to starting_point for a Ray.
void clearStartingInfo()
Clears the starting information set on the Ray:
void changeDirection(const Point &direction, const ChangeDirectionKey)
This method is for internal use only.
Point _direction
Direction of the Ray.
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...
bool invalidCurrentIncomingSide() const
Whether or not the Ray's current incoming side is invalid.
void addIntersection()
Increment the Ray's intersection counter.
void setStartingDirection(const Point &starting_direction)
Sets the starting direction to starting_direction for a Ray.
void resetCountersInternal()
Reset all of the internal counters.
Real distance() const
Gets the distance this Ray has traveled.
void errorWhenInitializing(const std::string &reason) const
Produces a useful error for use when initializing a Ray.
bool hasTraced() const
Whether or not a Ray has begun tracing.
bool _should_continue
Wether or not the Ray should continue to be traced (not sent in parallel)
void clearStartingInfoInternal()
Clears the starting information.
bool maxDistanceSet() const
Whether or not the distance has been set via setStartingMaxDistance()
friend void dataStore(std::ostream &stream, std::shared_ptr< Ray > &ray, void *context)
Real maxDistance() const
Gets the max distance this Ray is allowed to travel.
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.
bool operator!=(const Ray &other) const
Non-equal operator.
Ray()=delete
Deleted default constructor.
unsigned int processorCrossings() const
Gets the number of times this Ray has crossed a processor.
void resetCounters()
Clears the internal counters on the Ray so that the Ray can be traced again.
void errorIfTracing(const std::string &reason) const
Produces a useful error if a Ray has started tracing.
void setCurrentElem(const Elem *current_elem)
Change a Ray's current elem.
Ray & operator=(const Ray &)=delete
Deleted copy operator.
std::vector< RayData > & data()
Gets a writeable reference to the Ray's data.
bool trajectoryChanged() const
Whether or not this Ray has had its trajectory changed.
void setStationary()
Sets the Ray to be stationary (max distance = 0).
void setCurrentIncomingSide(const unsigned short current_incoming_side)
Change a Ray's incoming side.
const Elem * _current_elem
Current element that the Ray is in.
void setShouldContinue(const bool should_continue)
Sets whether or not this Ray should continue.
bool _end_set
Whether or not the user has set an end point for this Ray (via limiting its distance with setStarting...
Real _distance
Total distance this Ray has traveled.
void invalidateStartingIncomingSide()
Invalidates a Ray's starting incoming side.
void setCurrentPoint(const Point ¤t_point)
Sets the Ray's current point.
unsigned int intersections() const
Gets the number of intersections this Ray has done.
friend void dataLoad(std::istream &stream, std::shared_ptr< Ray > &ray, void *context)
Ray(const Ray &other)=delete
Deleted copy constructor.
const Elem * currentElem() const
Gets the current element that the Ray is in.
const Point & currentPoint() const
Gets the point that the Ray is currently at.
bool operator==(const Ray &other) const
Equality operator.
unsigned int _intersections
Number of intersections done for this Ray.
const RayTracingStudy & study() const
Get the RayTracingStudy associated with this Ray.
void setTrajectoryChanged(const bool trajectory_changed)
Set whether or not this Ray has had its trajectory changed.
bool invalidDirection() const
Whether or not the Ray's direction is set to invalid.
Point endPoint() const
Gets the user-set end point for the Ray, if set.
bool _trajectory_changed
Whether or not this Ray had its trajectory changed (not sent in parallel)
void invalidateDirection()
Invalidates the Ray's current direction.
static const RayID INVALID_RAY_ID
Invalid Ray ID.
RayID _id
A unique ID for this Ray.
bool invalidID() const
Whether or not the Ray's ID is invalid.
bool equalityHelper(const Ray &other, const bool equal) const
Helper for the equality operators.
void invalidateStartingElem()
Invalidates a Ray's starting element.
void setDirection(const Point &direction)
Sets the Ray's direction.
bool atEnd() const
Whether or not the Ray is at the user-defined end point.
void addTrajectoryChange()
Increment the Ray's trajectory change counter.
RayID id() const
Gets the Ray's ID.
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 addProcessorCrossing()
Increment the Ray's processor crossing counter.
unsigned int _trajectory_changes
Number of times this Ray has had its trajectory changed.
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
Point _current_point
Current point of the Ray.
void changeStartDirection(const Point &start, const Point &direction, const ChangeStartDirectionKey)
This method is for internal use only.
unsigned short _current_incoming_side
The side of _current_elem that the Ray is incoming on (if any).
void setStartingMaxDistance(const Real starting_max_distance)
Sets the maximum distance this Ray should travel to starting_max_distance.
std::string getInfo() const
Helper function for getting information about the Ray.
bool shouldContinue() const
Whether or not this Ray should continue.
bool invalidCurrentPoint() const
Whether or not the point that the Ray is currently at is valid.
const Point & direction() const
Gets the Ray's direction.
void invalidateCurrentElem()
Invalidates the Ray's current element.
void changePointElemSide(const Point &point, const Elem &elem, const unsigned int side, const ChangePointElemSideKey)
This method is for internal use only.
void invalidateCurrentPoint()
Invalidates the Ray's current point.
unsigned int _processor_crossings
Number of times this Ray has been communicated.
void changeMaxDistance(const Real max_distance)
Changes the Ray's max distance to be traveled.
Traces Rays through the mesh on a single processor.
static void pack(const std::shared_ptr< Ray > &object, Iter data_out, const Context *context)
static std::shared_ptr< Ray > unpack(BufferIter in, Context *context)
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.
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real