/usr/include/boost/geometry/index/parameters.hpp is in libboost1.54-dev 1.54.0-4ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | // Boost.Geometry Index
//
// R-tree algorithms parameters
//
// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
//
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_GEOMETRY_INDEX_PARAMETERS_HPP
#define BOOST_GEOMETRY_INDEX_PARAMETERS_HPP
#include <limits>
namespace boost { namespace geometry { namespace index {
namespace detail {
template <size_t MaxElements>
struct default_min_elements_s
{
// TODO - assert MaxElements <= (std::numeric_limits<size_t>::max)()/3
static const size_t raw_value = (MaxElements * 3) / 10;
static const size_t value = 1 <= raw_value ? raw_value : 1;
};
inline size_t default_min_elements_d()
{
return (std::numeric_limits<size_t>::max)();
}
inline size_t default_min_elements_d_calc(size_t max_elements, size_t min_elements)
{
if ( default_min_elements_d() == min_elements )
{
// TODO - assert MaxElements <= (std::numeric_limits<size_t>::max)()/3
size_t raw_value = (max_elements * 3) / 10;
return 1 <= raw_value ? raw_value : 1;
}
return min_elements;
}
template <size_t MaxElements>
struct default_rstar_reinserted_elements_s
{
// TODO - assert MaxElements <= (std::numeric_limits<size_t>::max)()/3
static const size_t value = (MaxElements * 3) / 10;
};
inline size_t default_rstar_reinserted_elements_d()
{
return (std::numeric_limits<size_t>::max)();
}
inline size_t default_rstar_reinserted_elements_d_calc(size_t max_elements, size_t reinserted_elements)
{
if ( default_rstar_reinserted_elements_d() == reinserted_elements )
{
// TODO - assert MaxElements <= (std::numeric_limits<size_t>::max)()/3
return (max_elements * 3) / 10;
}
return reinserted_elements;
}
} // namespace detail
/*!
\brief Linear r-tree creation algorithm parameters.
\tparam MaxElements Maximum number of elements in nodes.
\tparam MinElements Minimum number of elements in nodes. Default: 0.3*Max.
*/
template <size_t MaxElements,
size_t MinElements = detail::default_min_elements_s<MaxElements>::value
>
struct linear
{
BOOST_MPL_ASSERT_MSG((0 < MinElements && 2*MinElements <= MaxElements+1),
INVALID_STATIC_MIN_MAX_PARAMETERS, (linear));
static const size_t max_elements = MaxElements;
static const size_t min_elements = MinElements;
static size_t get_max_elements() { return MaxElements; }
static size_t get_min_elements() { return MinElements; }
};
/*!
\brief Quadratic r-tree creation algorithm parameters.
\tparam MaxElements Maximum number of elements in nodes.
\tparam MinElements Minimum number of elements in nodes. Default: 0.3*Max.
*/
template <size_t MaxElements,
size_t MinElements = detail::default_min_elements_s<MaxElements>::value>
struct quadratic
{
BOOST_MPL_ASSERT_MSG((0 < MinElements && 2*MinElements <= MaxElements+1),
INVALID_STATIC_MIN_MAX_PARAMETERS, (quadratic));
static const size_t max_elements = MaxElements;
static const size_t min_elements = MinElements;
static size_t get_max_elements() { return MaxElements; }
static size_t get_min_elements() { return MinElements; }
};
/*!
\brief R*-tree creation algorithm parameters.
\tparam MaxElements Maximum number of elements in nodes.
\tparam MinElements Minimum number of elements in nodes. Default: 0.3*Max.
\tparam ReinsertedElements The number of elements reinserted by forced reinsertions algorithm.
If 0 forced reinsertions are disabled. Maximum value is Max+1-Min.
Greater values are truncated. Default: 0.3*Max.
\tparam OverlapCostThreshold The number of most suitable leafs taken into account while choosing
the leaf node to which currently inserted value will be added. If
value is in range (0, MaxElements) - the algorithm calculates
nearly minimum overlap cost, otherwise all leafs are analyzed
and true minimum overlap cost is calculated. Default: 32.
*/
template <size_t MaxElements,
size_t MinElements = detail::default_min_elements_s<MaxElements>::value,
size_t ReinsertedElements = detail::default_rstar_reinserted_elements_s<MaxElements>::value,
size_t OverlapCostThreshold = 32>
struct rstar
{
BOOST_MPL_ASSERT_MSG((0 < MinElements && 2*MinElements <= MaxElements+1),
INVALID_STATIC_MIN_MAX_PARAMETERS, (rstar));
static const size_t max_elements = MaxElements;
static const size_t min_elements = MinElements;
static const size_t reinserted_elements = ReinsertedElements;
static const size_t overlap_cost_threshold = OverlapCostThreshold;
static size_t get_max_elements() { return MaxElements; }
static size_t get_min_elements() { return MinElements; }
static size_t get_reinserted_elements() { return ReinsertedElements; }
static size_t get_overlap_cost_threshold() { return OverlapCostThreshold; }
};
//template <size_t MaxElements, size_t MinElements>
//struct kmeans
//{
// static const size_t max_elements = MaxElements;
// static const size_t min_elements = MinElements;
//};
/*!
\brief Linear r-tree creation algorithm parameters - run-time version.
*/
class dynamic_linear
{
public:
/*!
\brief The constructor.
\param max_elements Maximum number of elements in nodes.
\param min_elements Minimum number of elements in nodes. Default: 0.3*Max.
*/
dynamic_linear(size_t max_elements,
size_t min_elements = detail::default_min_elements_d())
: m_max_elements(max_elements)
, m_min_elements(detail::default_min_elements_d_calc(max_elements, min_elements))
{
if (!(0 < m_min_elements && 2*m_min_elements <= m_max_elements+1))
detail::throw_invalid_argument("invalid min or/and max parameters of dynamic_linear");
}
size_t get_max_elements() const { return m_max_elements; }
size_t get_min_elements() const { return m_min_elements; }
private:
size_t m_max_elements;
size_t m_min_elements;
};
/*!
\brief Quadratic r-tree creation algorithm parameters - run-time version.
*/
class dynamic_quadratic
{
public:
/*!
\brief The constructor.
\param max_elements Maximum number of elements in nodes.
\param min_elements Minimum number of elements in nodes. Default: 0.3*Max.
*/
dynamic_quadratic(size_t max_elements,
size_t min_elements = detail::default_min_elements_d())
: m_max_elements(max_elements)
, m_min_elements(detail::default_min_elements_d_calc(max_elements, min_elements))
{
if (!(0 < m_min_elements && 2*m_min_elements <= m_max_elements+1))
detail::throw_invalid_argument("invalid min or/and max parameters of dynamic_quadratic");
}
size_t get_max_elements() const { return m_max_elements; }
size_t get_min_elements() const { return m_min_elements; }
private:
size_t m_max_elements;
size_t m_min_elements;
};
/*!
\brief R*-tree creation algorithm parameters - run-time version.
*/
class dynamic_rstar
{
public:
/*!
\brief The constructor.
\param max_elements Maximum number of elements in nodes.
\param min_elements Minimum number of elements in nodes. Default: 0.3*Max.
\param reinserted_elements The number of elements reinserted by forced reinsertions algorithm.
If 0 forced reinsertions are disabled. Maximum value is Max-Min+1.
Greater values are truncated. Default: 0.3*Max.
\param overlap_cost_threshold The number of most suitable leafs taken into account while choosing
the leaf node to which currently inserted value will be added. If
value is in range (0, MaxElements) - the algorithm calculates
nearly minimum overlap cost, otherwise all leafs are analyzed
and true minimum overlap cost is calculated. Default: 32.
*/
dynamic_rstar(size_t max_elements,
size_t min_elements = detail::default_min_elements_d(),
size_t reinserted_elements = detail::default_rstar_reinserted_elements_d(),
size_t overlap_cost_threshold = 32)
: m_max_elements(max_elements)
, m_min_elements(detail::default_min_elements_d_calc(max_elements, min_elements))
, m_reinserted_elements(detail::default_rstar_reinserted_elements_d_calc(max_elements, reinserted_elements))
, m_overlap_cost_threshold(overlap_cost_threshold)
{
if (!(0 < m_min_elements && 2*m_min_elements <= m_max_elements+1))
detail::throw_invalid_argument("invalid min or/and max parameters of dynamic_rstar");
}
size_t get_max_elements() const { return m_max_elements; }
size_t get_min_elements() const { return m_min_elements; }
size_t get_reinserted_elements() const { return m_reinserted_elements; }
size_t get_overlap_cost_threshold() const { return m_overlap_cost_threshold; }
private:
size_t m_max_elements;
size_t m_min_elements;
size_t m_reinserted_elements;
size_t m_overlap_cost_threshold;
};
}}} // namespace boost::geometry::index
#endif // BOOST_GEOMETRY_INDEX_PARAMETERS_HPP
|