Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76467 - trunk/boost/geometry/algorithms/detail
From: barend.gehrels_at_[hidden]
Date: 2012-01-13 15:46:37


Author: barendgehrels
Date: 2012-01-13 15:46:37 EST (Fri, 13 Jan 2012)
New Revision: 76467
URL: http://svn.boost.org/trac/boost/changeset/76467

Log:
Cosmetic changes (<= 80 char's / line) only
Text files modified:
   trunk/boost/geometry/algorithms/detail/partition.hpp | 120 ++++++++++++++++++++++++++--------------
   1 files changed, 78 insertions(+), 42 deletions(-)

Modified: trunk/boost/geometry/algorithms/detail/partition.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/detail/partition.hpp (original)
+++ trunk/boost/geometry/algorithms/detail/partition.hpp 2012-01-13 15:46:37 EST (Fri, 13 Jan 2012)
@@ -10,14 +10,13 @@
 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_PARTITION_HPP
 
 #include <vector>
-#include <boost/geometry/algorithms/assign.hpp>
 #include <boost/range/algorithm/copy.hpp>
+#include <boost/geometry/algorithms/assign.hpp>
 #include <boost/geometry/core/coordinate_type.hpp>
 
 namespace boost { namespace geometry
 {
 
-
 namespace detail { namespace partition
 {
 
@@ -39,24 +38,31 @@
     geometry::set<min_corner, Dimension>(upper_box, mid);
 }
 
-// Divide collection into three subsets: lower, upper and oversized (not-fitting)
+// Divide collection into three subsets: lower, upper and oversized
+// (not-fitting)
 // (lower == left or bottom, upper == right or top)
 template <typename OverlapsPolicy, typename InputCollection, typename Box>
-static inline void divide_into_subsets(Box const& lower_box, Box const& upper_box,
+static inline void divide_into_subsets(Box const& lower_box,
+ Box const& upper_box,
         InputCollection const& collection,
         index_vector_type const& input,
         index_vector_type& lower,
         index_vector_type& upper,
         index_vector_type& exceeding)
 {
- typedef boost::range_iterator<index_vector_type const>::type index_iterator_type;
+ typedef boost::range_iterator
+ <
+ index_vector_type const
+ >::type index_iterator_type;
 
     for(index_iterator_type it = boost::begin(input);
         it != boost::end(input);
         ++it)
     {
- bool const lower_overlapping = OverlapsPolicy::apply(lower_box, collection[*it]);
- bool const upper_overlapping = OverlapsPolicy::apply(upper_box, collection[*it]);
+ bool const lower_overlapping = OverlapsPolicy::apply(lower_box,
+ collection[*it]);
+ bool const upper_overlapping = OverlapsPolicy::apply(upper_box,
+ collection[*it]);
 
         if (lower_overlapping && upper_overlapping)
         {
@@ -78,16 +84,18 @@
     }
 }
 
-
 // Match collection with itself
 template <typename InputCollection, typename Policy>
 static inline void handle_one(InputCollection const& collection,
         index_vector_type const& input,
         Policy& policy)
 {
- typedef boost::range_iterator<index_vector_type const>::type index_iterator_type;
+ typedef boost::range_iterator<index_vector_type const>::type
+ index_iterator_type;
     // Quadratic behaviour at lowest level (lowest quad, or all exceeding)
- for(index_iterator_type it1 = boost::begin(input); it1 != boost::end(input); ++it1)
+ for(index_iterator_type it1 = boost::begin(input);
+ it1 != boost::end(input);
+ ++it1)
     {
         index_iterator_type it2 = it1;
         for(++it2; it2 != boost::end(input); ++it2)
@@ -104,17 +112,24 @@
         InputCollection const& collection2, index_vector_type const& input2,
         Policy& policy)
 {
- typedef boost::range_iterator<index_vector_type const>::type index_iterator_type;
- for(index_iterator_type it1 = boost::begin(input1); it1 != boost::end(input1); ++it1)
+ typedef boost::range_iterator
+ <
+ index_vector_type const
+ >::type index_iterator_type;
+
+ for(index_iterator_type it1 = boost::begin(input1);
+ it1 != boost::end(input1);
+ ++it1)
     {
- for(index_iterator_type it2 = boost::begin(input2); it2 != boost::end(input2); ++it2)
+ for(index_iterator_type it2 = boost::begin(input2);
+ it2 != boost::end(input2);
+ ++it2)
         {
             policy.apply(collection1[*it1], collection2[*it2]);
         }
     }
 }
 
-
 template
 <
     int Dimension,
@@ -145,7 +160,8 @@
         {
             if (boost::size(input) > min_elements && level < 100)
             {
- sub_divide::apply(box, collection, input, level + 1, min_elements, policy, box_policy);
+ sub_divide::apply(box, collection, input, level + 1,
+ min_elements, policy, box_policy);
             }
             else
             {
@@ -169,7 +185,8 @@
         divide_box<Dimension>(box, lower_box, upper_box);
 
         index_vector_type lower, upper, exceeding;
- divide_into_subsets<OverlapsPolicy>(lower_box, upper_box, collection, input, lower, upper, exceeding);
+ divide_into_subsets<OverlapsPolicy>(lower_box, upper_box, collection,
+ input, lower, upper, exceeding);
 
         if (boost::size(exceeding) > 0)
         {
@@ -181,12 +198,13 @@
         }
 
         // Recursively call operation both parts
- next_level(lower_box, collection, lower, level, min_elements, policy, box_policy);
- next_level(upper_box, collection, upper, level, min_elements, policy, box_policy);
+ next_level(lower_box, collection, lower, level, min_elements,
+ policy, box_policy);
+ next_level(upper_box, collection, upper, level, min_elements,
+ policy, box_policy);
     }
 };
 
-
 template
 <
     int Dimension,
@@ -208,8 +226,10 @@
 
     template <typename InputCollection, typename Policy>
     static inline void next_level(Box const& box,
- InputCollection const& collection1, index_vector_type const& input1,
- InputCollection const& collection2, index_vector_type const& input2,
+ InputCollection const& collection1,
+ index_vector_type const& input1,
+ InputCollection const& collection2,
+ index_vector_type const& input2,
             int level, int min_elements,
             Policy& policy, VisitBoxPolicy& box_policy)
     {
@@ -219,7 +239,9 @@
                 && boost::size(input2) > min_elements
                 && level < 100)
             {
- sub_divide::apply(box, collection1, input1, collection2, input2, level + 1, min_elements, policy, box_policy);
+ sub_divide::apply(box, collection1, input1, collection2,
+ input2, level + 1, min_elements,
+ policy, box_policy);
             }
             else
             {
@@ -245,13 +267,16 @@
 
         index_vector_type lower1, upper1, exceeding1;
         index_vector_type lower2, upper2, exceeding2;
- divide_into_subsets<OverlapsPolicy>(lower_box, upper_box, collection1, input1, lower1, upper1, exceeding1);
- divide_into_subsets<OverlapsPolicy>(lower_box, upper_box, collection2, input2, lower2, upper2, exceeding2);
+ divide_into_subsets<OverlapsPolicy>(lower_box, upper_box, collection1,
+ input1, lower1, upper1, exceeding1);
+ divide_into_subsets<OverlapsPolicy>(lower_box, upper_box, collection2,
+ input2, lower2, upper2, exceeding2);
 
         if (boost::size(exceeding1) > 0)
         {
             // All exceeding from 1 with 2:
- handle_two(collection1, exceeding1, collection2, exceeding2, policy);
+ handle_two(collection1, exceeding1, collection2, exceeding2,
+ policy);
 
             // All exceeding from 1 with lower and upper of 2:
             handle_two(collection1, exceeding1, collection2, lower2, policy);
@@ -264,13 +289,13 @@
             handle_two(collection1, upper1, collection2, exceeding2, policy);
         }
 
- next_level(lower_box, collection1, lower1, collection2, lower2, level, min_elements, policy, box_policy);
- next_level(upper_box, collection1, upper1, collection2, upper2, level, min_elements, policy, box_policy);
+ next_level(lower_box, collection1, lower1, collection2, lower2, level,
+ min_elements, policy, box_policy);
+ next_level(upper_box, collection1, upper1, collection2, upper2, level,
+ min_elements, policy, box_policy);
     }
 };
 
-
-
 }} // namespace detail::partition
 
 struct visit_no_policy
@@ -280,7 +305,6 @@
     {}
 };
 
-
 template
 <
     typename Box,
@@ -293,7 +317,8 @@
     typedef std::vector<std::size_t> index_vector_type;
 
     template <typename InputCollection>
- static inline void expand_to_collection(InputCollection const& collection, Box& total, index_vector_type& index_vector)
+ static inline void expand_to_collection(InputCollection const& collection,
+ Box& total, index_vector_type& index_vector)
     {
         std::size_t index = 0;
         for(typename boost::range_iterator<InputCollection const>::type it
@@ -306,7 +331,6 @@
         }
     }
 
-
 public :
     template <typename InputCollection, typename VisitPolicy>
     static inline void apply(InputCollection const& collection,
@@ -327,12 +351,18 @@
                     0, Box,
                     OverlapsPolicy,
                     VisitBoxPolicy
- >::apply(total, collection, index_vector, 0, min_elements, visitor, box_visitor);
+ >::apply(total, collection, index_vector, 0, min_elements,
+ visitor, box_visitor);
         }
         else
         {
- typedef typename boost::range_iterator<InputCollection const>::type iterator_type;
- for(iterator_type it1 = boost::begin(collection); it1 != boost::end(collection); ++it1)
+ typedef typename boost::range_iterator
+ <
+ InputCollection const
+ >::type iterator_type;
+ for(iterator_type it1 = boost::begin(collection);
+ it1 != boost::end(collection);
+ ++it1)
             {
                 iterator_type it2 = it1;
                 for(++it2; it2 != boost::end(collection); ++it2)
@@ -351,7 +381,8 @@
                 VisitBoxPolicy box_visitor = visit_no_policy()
                 )
     {
- if (boost::size(collection1) > min_elements && boost::size(collection2) > min_elements)
+ if (boost::size(collection1) > min_elements
+ && boost::size(collection2) > min_elements)
         {
             index_vector_type index_vector1, index_vector2;
             Box total;
@@ -369,10 +400,17 @@
         }
         else
         {
- typedef typename boost::range_iterator<InputCollection const>::type iterator_type;
- for(iterator_type it1 = boost::begin(collection1); it1 != boost::end(collection1); ++it1)
+ typedef typename boost::range_iterator
+ <
+ InputCollection const
+ >::type iterator_type;
+ for(iterator_type it1 = boost::begin(collection1);
+ it1 != boost::end(collection1);
+ ++it1)
             {
- for(iterator_type it2 = boost::begin(collection2); it2 != boost::end(collection2); ++it2)
+ for(iterator_type it2 = boost::begin(collection2);
+ it2 != boost::end(collection2);
+ ++it2)
                 {
                     visitor.apply(*it1, *it2);
                 }
@@ -382,8 +420,6 @@
 
 };
 
-
 }} // namespace boost::geometry
 
-
-#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_RING_IDENTIFIER_HPP
+#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_PARTITION_HPP


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk