Commit 8e0dcd69 authored by Ayomide Bamidele's avatar Ayomide Bamidele Committed by Martyn Gigg
Browse files

Refactor list to boost::small_vector with optimised size. Refs: #25642

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