Skip to content
Snippets Groups Projects
Unverified Commit 8d41a1db authored by Dan Nixon's avatar Dan Nixon Committed by GitHub
Browse files

Merge pull request #25646 from mantidproject/25642_use_boost_small_vector_to_optimise_track

Refactored Track to use boost::container::small_vector with optimised vector size
parents e590dbd3 8e0dcd69
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,9 @@
#include "MantidGeometry/Objects/IObject.h"
#include "MantidGeometry/Surfaces/Line.h"
#include "MantidKernel/Tolerance.h"
#include <boost/container/small_vector.hpp>
#include <iosfwd>
#include <list>
......@@ -141,8 +144,8 @@ struct IntersectionPoint {
*/
class MANTID_GEOMETRY_DLL Track {
public:
using LType = std::vector<Link>;
using PType = std::vector<IntersectionPoint>;
using LType = boost::container::small_vector<Link, 5>;
using PType = boost::container::small_vector<IntersectionPoint, 5>;
public:
/// Default constructor
......@@ -160,7 +163,6 @@ public:
void removeCojoins();
/// Construct links between added points
void buildLink();
/// Set a starting point and direction
void reset(const Kernel::V3D &startPoint, const Kernel::V3D &direction);
/// Clear the current set of intersection results
......
......@@ -9,6 +9,7 @@
#include "MantidKernel/Matrix.h"
#include "MantidKernel/Tolerance.h"
#include "MantidKernel/V3D.h"
#include <boost/iterator/distance.hpp>
#include <algorithm>
#include <cmath>
......@@ -77,7 +78,7 @@ int Track::nonComplete() const {
while (bc != m_links.end()) {
if ((ac->exitPoint).distance(bc->entryPoint) > Tolerance) {
return (static_cast<int>(distance(m_links.begin(), bc)) + 1);
return (static_cast<int>(boost::distance(m_links.begin(), bc)) + 1);
}
++ac;
++bc;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment