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 @@
#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;
......
Markdown is supported
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