Mantid
|
This class is responsible for tracking rays and accumulating a list of objects that are intersected along the way. More...
#include <InstrumentRayTracer.h>
Public Member Functions | |
IDetector_const_sptr | getDetectorResult () const |
Gets the results of the trace, then returns the first detector (that is NOT a monitor) found in the results. More... | |
Links | getResults () const |
Get the results of the intersection tests that have been updated since the previous call to trace. More... | |
InstrumentRayTracer (Instrument_const_sptr instrument) | |
Constructor taking an instrument. More... | |
void | trace (const Kernel::V3D &dir) const |
Trace a given track from the instrument source in the given direction and compile a list of results that this track intersects. More... | |
void | traceFromSample (const Kernel::V3D &dir) const |
Trace a given track from the sample position in the given direction. More... | |
Private Member Functions | |
void | fireRay (Track &testRay) const |
Fire the given track at the instrument. More... | |
InstrumentRayTracer () | |
Default constructor. More... | |
Private Attributes | |
boost::unordered_map< IComponent *, BoundingBox > | m_boxCache |
Map of component id -> bounding box. More... | |
Instrument_const_sptr | m_instrument |
Pointer to the instrument. More... | |
std::mutex | m_mutex |
Mutex to lock box cache. More... | |
Track | m_resultsTrack |
Accumulate results in this Track object, aids performance. More... | |
This class is responsible for tracking rays and accumulating a list of objects that are intersected along the way.
Definition at line 37 of file InstrumentRayTracer.h.
Mantid::Geometry::InstrumentRayTracer::InstrumentRayTracer | ( | Instrument_const_sptr | instrument | ) |
Constructor taking an instrument.
Constructor specifying the instrument involved in the tracing.
The instrument must have defined a source component.
instrument | :: The instrument to perform the ray tracings on. It must have a defined source. |
Definition at line 35 of file InstrumentRayTracer.cpp.
References m_instrument.
|
private |
Default constructor.
|
private |
Fire the given track at the instrument.
Fire the test ray at the instrument and perform a bread-first search of the object tree to find the objects that were intersected.
testRay | :: An input/output parameter that defines the track and accumulates the intersection results |
Definition at line 124 of file InstrumentRayTracer.cpp.
References Mantid::Geometry::BoundingBox::doesLineIntersect(), m_boxCache, m_instrument, and m_mutex.
Referenced by trace(), and traceFromSample().
IDetector_const_sptr Mantid::Geometry::InstrumentRayTracer::getDetectorResult | ( | ) | const |
Gets the results of the trace, then returns the first detector (that is NOT a monitor) found in the results.
Definition at line 97 of file InstrumentRayTracer.cpp.
References getResults(), and m_instrument.
Referenced by Mantid::Algorithms::RayTracerTester::exec(), and Mantid::DataObjects::Peak::findDetector().
Links Mantid::Geometry::InstrumentRayTracer::getResults | ( | ) | const |
Get the results of the intersection tests that have been updated since the previous call to trace.
Return the results of any trace() calls since the last call the getResults.
Definition at line 86 of file InstrumentRayTracer.cpp.
References Mantid::Geometry::Track::cbegin(), Mantid::Geometry::Track::cend(), Mantid::Geometry::Track::clearIntersectionResults(), and m_resultsTrack.
Referenced by getDetectorResult().
void Mantid::Geometry::InstrumentRayTracer::trace | ( | const Kernel::V3D & | dir | ) | const |
Trace a given track from the instrument source in the given direction and compile a list of results that this track intersects.
Trace a given track from the instrument source in the given direction.
For performance reasons the results are accumulated within the object and can be returned using getResults.
dir | :: A directional vector. The starting point is defined by the instrument source. |
Definition at line 58 of file InstrumentRayTracer.cpp.
References fireRay(), m_instrument, m_resultsTrack, and Mantid::Geometry::Track::reset().
void Mantid::Geometry::InstrumentRayTracer::traceFromSample | ( | const Kernel::V3D & | dir | ) | const |
Trace a given track from the sample position in the given direction.
For performance reasons the results are accumulated within the object and can be returned using getResults.
dir | :: A directional vector. The starting point is defined by the instrument source. |
Definition at line 75 of file InstrumentRayTracer.cpp.
References fireRay(), m_instrument, m_resultsTrack, and Mantid::Geometry::Track::reset().
Referenced by Mantid::Algorithms::RayTracerTester::exec(), and Mantid::DataObjects::Peak::findDetector().
|
mutableprivate |
Map of component id -> bounding box.
Definition at line 63 of file InstrumentRayTracer.h.
Referenced by fireRay().
|
private |
Pointer to the instrument.
Definition at line 58 of file InstrumentRayTracer.h.
Referenced by fireRay(), getDetectorResult(), InstrumentRayTracer(), trace(), and traceFromSample().
|
mutableprivate |
Mutex to lock box cache.
Definition at line 65 of file InstrumentRayTracer.h.
Referenced by fireRay().
|
mutableprivate |
Accumulate results in this Track object, aids performance.
This is cleared when getResults is called.
Definition at line 61 of file InstrumentRayTracer.h.
Referenced by getResults(), trace(), and traceFromSample().