20 #include "libmesh/parallel.h" 43 typedef unsigned long int RayID;
45 #ifdef SINGLE_PRECISION_RAY 112 const std::size_t data_size,
113 const std::size_t aux_data_size,
115 const ConstructRayKey &);
134 const std::size_t data_size,
135 const std::size_t aux_data_size,
137 const ConstructRayKey &);
149 Ray(
const Ray *
const other,
const ConstructRayKey &);
162 void reset(
const Ray *
const other,
const ConstructRayKey &);
184 Ray(
const Ray & other) =
delete;
267 std::vector<RayData> &
data();
274 const std::vector<RayData> &
data()
const;
296 std::vector<RayData> &
auxData();
303 const std::vector<RayData> &
auxData()
const;
331 void setStart(
const Point & starting_point,
332 const Elem * starting_elem =
nullptr,
729 friend class Parallel::Packing<
std::shared_ptr<Ray>>;
733 friend
void dataStore(std::ostream & stream, std::shared_ptr<Ray> & ray, void * context);
734 friend
void dataLoad(std::istream & stream, std::shared_ptr<Ray> & ray, void * context);
760 static unsigned int packed_size(
typename std::vector<Real>::const_iterator in);
761 static unsigned int packable_size(
const std::shared_ptr<Ray> & ray,
const void *);
762 static unsigned int size(
const std::size_t data_size,
const std::size_t aux_data_size);
764 template <
typename Iter,
typename Context>
765 static void pack(
const std::shared_ptr<Ray> &
object, Iter data_out,
const Context * context);
767 template <
typename BufferIter,
typename Context>
768 static std::shared_ptr<Ray>
unpack(BufferIter in,
Context * context);
775 void dataStore(std::ostream & stream, std::shared_ptr<Ray> & ray,
void * context);
776 void dataLoad(std::istream & stream, std::shared_ptr<Ray> & ray,
void * context);
static const unsigned short invalid_side
Identifier for an invalid side index.
void setCurrentPoint(const Point ¤t_point)
Sets the Ray's current point.
RayID id() const
Gets the Ray's ID.
std::vector< RayData > & data()
Gets a writeable reference to the Ray's data.
static const RayDataIndex INVALID_RAY_DATA_INDEX
Invalid index into a Ray's data.
unsigned int processorCrossings() const
Gets the number of times this Ray has crossed a processor.
bool invalidID() const
Whether or not the Ray's ID is invalid.
void invalidateMaxDistance()
Invalidates the Ray's max distance.
long padding[8]
Extra padding to avoid false sharing.
unsigned long int RayID
Type for a Ray's ID.
Class that is used as a parameter to the public constructors/reset methods.
bool operator==(const Ray &other) const
Equality operator.
bool trajectoryChanged() const
Whether or not this Ray has had its trajectory changed.
ChangeStartDirectionKey(const ChangeStartDirectionKey &)
BufferType pack(const ValueType value)
Packs value into a value of type BufferType at a byte level, to be unpacked with the unpack() routine...
bool hasTraced() const
Whether or not a Ray has begun tracing.
Point _direction
Direction of the Ray.
Base object for the RayKernel syntax.
std::string getInfo() const
Helper function for getting information about the Ray.
std::vector< RayData > & auxData()
Gets a writeable reference to the Ray's auxilary data.
void setDirection(const Point &direction)
Sets the Ray's direction.
void invalidateStartingElem()
Invalidates a Ray's starting element.
void setTrajectoryChanged(const bool trajectory_changed)
Set whether or not this Ray has had its trajectory changed.
unsigned int trajectoryChanges() const
Gets the number of trajectory changes this Ray has had.
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
const RayTracingStudy & study() const
Get the RayTracingStudy associated with this Ray.
unsigned int _processor_crossings
Number of times this Ray has been communicated.
void changeDirection(const Point &direction, const ChangeDirectionKey)
This method is for internal use only.
const Point & currentPoint() const
Gets the point that the Ray is currently at.
const Elem * currentElem() const
Gets the current element that the Ray is in.
void unpack(const BufferType value_as_buffer_type, ValueType &value)
Unpacks value_as_buffer_type (which is packed with pack()) into value at a byte level.
void changeMaxDistance(const Real max_distance)
Changes the Ray's max distance to be traveled.
bool atEnd() const
Whether or not the Ray is at the user-defined end point.
bool operator!=(const Ray &other) const
Non-equal operator.
bool invalidCurrentPoint() const
Whether or not the point that the Ray is currently at is valid.
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.
void addTrajectoryChange()
Increment the Ray's trajectory change counter.
bool maxDistanceSet() const
Whether or not the distance has been set via setStartingMaxDistance()
bool invalidCurrentIncomingSide() const
Whether or not the Ray's current incoming side is invalid.
unsigned int RayDataIndex
Type for the index into the data and aux data on a Ray.
friend void dataStore(std::ostream &stream, std::shared_ptr< Ray > &ray, void *context)
void setStartingEndPoint(const Point &starting_end_point)
Sets the starting end point to starting_point for a Ray.
void addIntersection()
Increment the Ray's intersection counter.
void setCurrentIncomingSide(const unsigned short current_incoming_side)
Change a Ray's incoming side.
void setStartingDirection(const Point &starting_direction)
Sets the starting direction to starting_direction for a Ray.
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...
ChangeDirectionKey(const ChangeDirectionKey &)
void clearStartingInfo()
Clears the starting information set on the Ray:
bool _should_continue
Wether or not the Ray should continue to be traced (not sent in parallel)
RayTracingStudy & _study
The RayTracingStudy that owns this Ray (not sent in parallel)
void invalidateCurrentIncomingSide()
Invalidates the Ray's current incoming side.
Basic datastructure for a ray that will traverse the mesh.
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()=delete
Deleted default constructor.
bool invalidDirection() const
Whether or not the Ray's direction is set to invalid.
void setStartingMaxDistance(const Real starting_max_distance)
Sets the maximum distance this Ray should travel to starting_max_distance.
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 endSet() const
Whether or not the user has set an end point for this Ray.
Real _max_distance
Maximum distance the Ray is allowed to travel.
void invalidateDirection()
Invalidates the Ray's current direction.
Ray & operator=(const Ray &)=delete
Deleted copy operator.
void resetCountersInternal()
Reset all of the internal counters.
unsigned short currentIncomingSide() const
Get a Ray's current incoming side.
ChangeStartDirectionKey()
void setStationary()
Sets the Ray to be stationary (max distance = 0).
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void resetCounters()
Clears the internal counters on the Ray so that the Ray can be traced again.
void clearStartingInfoInternal()
Clears the starting information.
Class that is used as a parameter to changeStartDirection() that allows only RayKernelBase methods to...
Real distance() const
Gets the distance this Ray has traveled.
Class that is used as a parameter to changeDirection() that allows only RayBC methods to call changeD...
void addProcessorCrossing()
Increment the Ray's processor crossing counter.
void invalidateStartingIncomingSide()
Invalidates a Ray's starting incoming side.
const Elem * _current_elem
Current element that the Ray is in.
const Point & direction() const
Gets the Ray's direction.
class infix_ostream_iterator if void
ConstructRayKey(const ConstructRayKey &)
bool equalityHelper(const Ray &other, const bool equal) const
Helper for the equality operators.
Real maxDistance() const
Gets the max distance this Ray is allowed to travel.
RayID _id
A unique ID for this Ray.
void addDistance(const Real add_distance)
Adds to the distance this Ray has traveled.
Real _distance
Total distance this Ray has traveled.
friend void dataLoad(std::istream &stream, std::shared_ptr< Ray > &ray, void *context)
unsigned int _intersections
Number of intersections done for this Ray.
float RayData
Type for a Ray's data.
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 _trajectory_changed
Whether or not this Ray had its trajectory changed (not sent in parallel)
static const libMesh::Point invalid_point(invalid_distance, invalid_distance, invalid_distance)
Identifier for an invalid point.
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.
unsigned int _trajectory_changes
Number of times this Ray has had its trajectory changed.
bool _end_set
Whether or not the user has set an end point for this Ray (via limiting its distance with setStarting...
Base class for the RayBC syntax.
void changeID(const RayID id)
Changes the Ray's ID.
void setCurrentElem(const Elem *current_elem)
Change a Ray's current elem.
unsigned short _current_incoming_side
The side of _current_elem that the Ray is incoming on (if any).
unsigned int intersections() const
Gets the number of intersections this Ray has done.
void errorWhenInitializing(const std::string &reason) const
Produces a useful error for use when initializing a Ray.
Point endPoint() const
Gets the user-set end point for the Ray, if set.
Traces Rays through the mesh on a single processor.
static const RayID INVALID_RAY_ID
Invalid Ray ID.
void invalidateCurrentElem()
Invalidates the Ray's current element.
void invalidateCurrentPoint()
Invalidates the Ray's current point.
void errorIfTracing(const std::string &reason) const
Produces a useful error if a Ray has started tracing.
Base class for Ray tracing studies that will generate Rays and then propagate all of them to terminat...