Boost logo

Boost-Commit :

From: huseyinakcan_at_[hidden]
Date: 2007-07-22 19:26:11


Author: huseyinakcan
Date: 2007-07-22 19:26:10 EDT (Sun, 22 Jul 2007)
New Revision: 7506
URL: http://svn.boost.org/trac/boost/changeset/7506

Log:
prev_ functions and tests

Text files modified:
   sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_functions.hpp | 117 +++++++++-----
   sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_functions.t.cpp | 296 ++++++++++++++++++++++++++++++++++++++-
   2 files changed, 356 insertions(+), 57 deletions(-)

Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_functions.hpp
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_functions.hpp (original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_functions.hpp 2007-07-22 19:26:10 EDT (Sun, 22 Jul 2007)
@@ -266,133 +266,162 @@
     return next_at_target_helper<halfedgeGen, halfedge_descriptor, typename HalfedgeS::next_tag>::next_at_target(h,hds);
 }
 
-template<typename HalfedgeDescriptor, typename Tag = prev_in_facet_tag>
+template<typename HalfedgeGen, typename HalfedgeDescriptor, typename Tag = prev_in_facet_tag>
 struct prev_in_facet_helper{
     static
     HalfedgeDescriptor
- prev_in_facet(HalfedgeDescriptor h)
+ prev_in_facet(HalfedgeDescriptor h, HalfedgeGen& hds)
     {
- return static_cast<HalfedgeDescriptor>(h->m_prev);
+ typedef typename HalfedgeGen::ContainerGen containerGen;
+ return static_cast<HalfedgeDescriptor>(containerGen::value(h,hds.m_container).m_prev);
     }
 };
 
-template<typename HalfedgeDescriptor>
-struct prev_in_facet_helper<HalfedgeDescriptor, prev_at_source_tag>{
+template<typename HalfedgeGen, typename HalfedgeDescriptor>
+struct prev_in_facet_helper<HalfedgeGen, HalfedgeDescriptor, prev_at_source_tag>{
     static
     HalfedgeDescriptor
- prev_in_facet(HalfedgeDescriptor h)
+ prev_in_facet(HalfedgeDescriptor h, HalfedgeGen& hds)
     {
- return static_cast<HalfedgeDescriptor>(static_cast<HalfedgeDescriptor>(h->m_prev)->m_opposite);
+ typedef typename HalfedgeGen::ContainerGen containerGen;
+ return static_cast<HalfedgeDescriptor>(opposite(
+ static_cast<HalfedgeDescriptor>(containerGen::value(h,hds.m_container).m_prev)
+ , hds));
     }
 };
 
-template<typename HalfedgeDescriptor>
-struct prev_in_facet_helper<HalfedgeDescriptor, prev_at_target_tag>{
+template<typename HalfedgeGen, typename HalfedgeDescriptor>
+struct prev_in_facet_helper<HalfedgeGen, HalfedgeDescriptor, prev_at_target_tag>{
     static
     HalfedgeDescriptor
- prev_in_facet(HalfedgeDescriptor h)
+ prev_in_facet(HalfedgeDescriptor h, HalfedgeGen& hds)
     {
- return static_cast<HalfedgeDescriptor>(static_cast<HalfedgeDescriptor>(h->m_opposite)->m_prev);
+ typedef typename HalfedgeGen::ContainerGen containerGen;
+ return static_cast<HalfedgeDescriptor>(containerGen::value(
+ static_cast<HalfedgeDescriptor>(opposite(h, hds))
+ ,hds.m_container).m_prev);
     }
 };
 
-template<typename HalfedgeDescriptor, typename Tag = prev_at_source_tag>
+template<typename HalfedgeGen, typename HalfedgeDescriptor, typename Tag = prev_at_source_tag>
 struct prev_at_source_helper{
     static
     HalfedgeDescriptor
- prev_at_source(HalfedgeDescriptor h)
+ prev_at_source(HalfedgeDescriptor h, HalfedgeGen& hds)
     {
- return static_cast<HalfedgeDescriptor>(h->m_prev);
+ typedef typename HalfedgeGen::ContainerGen containerGen;
+ return static_cast<HalfedgeDescriptor>(containerGen::value(h,hds.m_container).m_prev);
     }
 };
 
-template<typename HalfedgeDescriptor>
-struct prev_at_source_helper<HalfedgeDescriptor, prev_in_facet_tag>{
+template<typename HalfedgeGen, typename HalfedgeDescriptor>
+struct prev_at_source_helper<HalfedgeGen, HalfedgeDescriptor, prev_in_facet_tag>{
     static
     HalfedgeDescriptor
- prev_at_source(HalfedgeDescriptor h)
+ prev_at_source(HalfedgeDescriptor h, HalfedgeGen& hds)
     {
- return static_cast<HalfedgeDescriptor>(static_cast<HalfedgeDescriptor>(h->m_prev)->m_opposite);
+ typedef typename HalfedgeGen::ContainerGen containerGen;
+ return static_cast<HalfedgeDescriptor>(opposite(
+ static_cast<HalfedgeDescriptor>(containerGen::value(h,hds.m_container).m_prev)
+ , hds));
     }
 };
 
-template<typename HalfedgeDescriptor>
-struct prev_at_source_helper<HalfedgeDescriptor, prev_at_target_tag>{
+template<typename HalfedgeGen, typename HalfedgeDescriptor>
+struct prev_at_source_helper<HalfedgeGen, HalfedgeDescriptor, prev_at_target_tag>{
     static
     HalfedgeDescriptor
- prev_at_source(HalfedgeDescriptor h)
+ prev_at_source(HalfedgeDescriptor h, HalfedgeGen& hds)
     {
- return static_cast<HalfedgeDescriptor>(
- static_cast<HalfedgeDescriptor>(
- static_cast<HalfedgeDescriptor>(h->m_opposite)->m_prev)->m_opposite);
+ typedef typename HalfedgeGen::ContainerGen containerGen;
+ return static_cast<HalfedgeDescriptor>(opposite(
+ static_cast<HalfedgeDescriptor>(containerGen::value(
+ static_cast<HalfedgeDescriptor>(opposite(h, hds))
+ ,hds.m_container).m_prev)
+ , hds));
     }
 };
 
-template<typename HalfedgeDescriptor, typename Tag = prev_at_target_tag>
+template<typename HalfedgeGen, typename HalfedgeDescriptor, typename Tag = prev_at_target_tag>
 struct prev_at_target_helper{
     static
     HalfedgeDescriptor
- prev_at_target(HalfedgeDescriptor h)
+ prev_at_target(HalfedgeDescriptor h, HalfedgeGen& hds)
     {
- return static_cast<HalfedgeDescriptor>(h->m_prev);
+ typedef typename HalfedgeGen::ContainerGen containerGen;
+ return static_cast<HalfedgeDescriptor>(containerGen::value(h,hds.m_container).m_prev);
     }
 };
 
-template<typename HalfedgeDescriptor>
-struct prev_at_target_helper<HalfedgeDescriptor, prev_in_facet_tag>{
+template<typename HalfedgeGen, typename HalfedgeDescriptor>
+struct prev_at_target_helper<HalfedgeGen, HalfedgeDescriptor, prev_in_facet_tag>{
     static
     HalfedgeDescriptor
- prev_at_target(HalfedgeDescriptor h)
+ prev_at_target(HalfedgeDescriptor h, HalfedgeGen& hds)
     {
- return static_cast<HalfedgeDescriptor>(static_cast<HalfedgeDescriptor>(h->m_opposite)->m_prev);
+ typedef typename HalfedgeGen::ContainerGen containerGen;
+ return static_cast<HalfedgeDescriptor>(containerGen::value(
+ static_cast<HalfedgeDescriptor>(opposite(h, hds))
+ ,hds.m_container).m_prev);
     }
 };
 
-template<typename HalfedgeDescriptor>
-struct prev_at_target_helper<HalfedgeDescriptor, prev_at_source_tag>{
+template<typename HalfedgeGen, typename HalfedgeDescriptor>
+struct prev_at_target_helper<HalfedgeGen, HalfedgeDescriptor, prev_at_source_tag>{
     static
     HalfedgeDescriptor
- prev_at_target(HalfedgeDescriptor h)
+ prev_at_target(HalfedgeDescriptor h, HalfedgeGen& hds)
     {
- return static_cast<HalfedgeDescriptor>(
- static_cast<HalfedgeDescriptor>(
- static_cast<HalfedgeDescriptor>(h->m_opposite)->m_prev)->m_opposite);
+ typedef typename HalfedgeGen::ContainerGen containerGen;
+ return static_cast<HalfedgeDescriptor>(opposite(
+ static_cast<HalfedgeDescriptor>(containerGen::value(
+ static_cast<HalfedgeDescriptor>(opposite(h, hds))
+ ,hds.m_container).m_prev)
+ , hds));
     }
 };
 
 template <typename HalfedgeS, typename VertexDescriptor, typename FacetDescriptor, typename Config>
 typename Config::halfedge_descriptor
 prev_in_facet(typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor h,
- halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>&)
+ halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>& hds)
 {
     typedef typename halfedge_gen<HalfedgeS,
                                   VertexDescriptor,FacetDescriptor, Config
>::halfedge_descriptor halfedge_descriptor;
- return prev_in_facet_helper<halfedge_descriptor, typename HalfedgeS::prev_tag>::prev_in_facet(h);
+ typedef halfedge_gen<HalfedgeS,
+ VertexDescriptor,FacetDescriptor, Config> halfedgeGen;
+
+ return prev_in_facet_helper<halfedgeGen, halfedge_descriptor, typename HalfedgeS::prev_tag>::prev_in_facet(h, hds);
 }
 
 template <typename HalfedgeS, typename VertexDescriptor, typename FacetDescriptor, typename Config>
 typename Config::halfedge_descriptor
 prev_at_source(typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor h,
- halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>&)
+ halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>& hds)
 {
     typedef typename halfedge_gen<HalfedgeS,
                                   VertexDescriptor,FacetDescriptor, Config
>::halfedge_descriptor halfedge_descriptor;
- return prev_at_source_helper<halfedge_descriptor, typename HalfedgeS::prev_tag>::prev_at_source(h);
+ typedef halfedge_gen<HalfedgeS,
+ VertexDescriptor,FacetDescriptor, Config> halfedgeGen;
+
+ return prev_at_source_helper<halfedgeGen, halfedge_descriptor, typename HalfedgeS::prev_tag>::prev_at_source(h,hds);
 }
 
 template <typename HalfedgeS, typename VertexDescriptor, typename FacetDescriptor, typename Config>
 typename Config::halfedge_descriptor
 prev_at_target(typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor h,
- halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>&)
+ halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>& hds)
 {
     typedef typename halfedge_gen<HalfedgeS,
                                   VertexDescriptor,FacetDescriptor, Config
>::halfedge_descriptor halfedge_descriptor;
- return prev_at_target_helper<halfedge_descriptor, typename HalfedgeS::prev_tag>::prev_at_target(h);
-}
+ typedef halfedge_gen<HalfedgeS,
+ VertexDescriptor,FacetDescriptor, Config> halfedgeGen;
 
+ return prev_at_target_helper<halfedgeGen, halfedge_descriptor, typename HalfedgeS::prev_tag>::prev_at_target(h,hds);
+}
 
 } // namespace hdstl
 } // namespace boost

Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_functions.t.cpp
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_functions.t.cpp (original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_functions.t.cpp 2007-07-22 19:26:10 EDT (Sun, 22 Jul 2007)
@@ -118,6 +118,17 @@
     H.m_container[h].m_next = g;
 }
 
+template <typename HalfedgeGen, typename HalfedgeDescriptor, typename ContainerS>
+void set_prev_helper(HalfedgeGen& H, HalfedgeDescriptor h, HalfedgeDescriptor g, ContainerS const&) {
+ (void) H;
+ h->m_prev = g;
+}
+
+template <typename HalfedgeGen,typename HalfedgeDescriptor>
+void set_prev_helper(HalfedgeGen& H, HalfedgeDescriptor h, HalfedgeDescriptor g, vecS const&) {
+ H.m_container[h].m_prev = g;
+}
+
 template <typename HalfedgeGen>
 bool halfedge_next_in_facet_test() {
     
@@ -193,9 +204,6 @@
     BOOST_CHECK(( next_in_facet(hc, halfedgeGen) == he));
     BOOST_CHECK(( next_at_source(hc, halfedgeGen) == hg));
     BOOST_CHECK(( next_at_target(hc, halfedgeGen) == hf));
- //BOOST_CHECK(( prev_in_facet(hc, halfedgeGen) == ha));
- //BOOST_CHECK(( prev_at_source<next_in_facet_tag>(hc, halfedgeGen) == hg));
- //BOOST_CHECK(( prev_at_target<next_in_facet_tag>(hc, halfedgeGen) == hf));
     
     return true;
 }
@@ -256,16 +264,16 @@
     }
 
     halfedge_iterator begin = halfedges_begin(halfedgeGen);
- //halfedge_descriptor ha = *begin;
+ halfedge_descriptor ha = *begin;
     halfedge_descriptor hb = *(++begin);
     halfedge_descriptor hc = *(++begin);
     halfedge_descriptor hd = *(++begin);
     halfedge_descriptor he = *(++begin);
     halfedge_descriptor hf = *(++begin);
     halfedge_descriptor hg = *(++begin);
- //halfedge_descriptor hh = *(++begin);
+ halfedge_descriptor hh = *(++begin);
     halfedge_descriptor hi = *(++begin);
- //halfedge_descriptor hj = *(++begin);
+ halfedge_descriptor hj = *(++begin);
     set_next_helper(halfedgeGen, hc, hg, container_selector());
     set_next_helper(halfedgeGen, hg, hb, container_selector());
     set_next_helper(halfedgeGen, hd, he, container_selector());
@@ -275,10 +283,10 @@
     BOOST_CHECK(( next_in_facet(hc, halfedgeGen) == he));
     BOOST_CHECK(( next_at_source(hc, halfedgeGen) == hg));
     BOOST_CHECK(( next_at_target(hc, halfedgeGen) == hf));
- //BOOST_CHECK(( prev_in_facet(hc, halfedgeGen) == ha));
- //BOOST_CHECK(( prev_at_source<next_in_facet_tag>(hc, halfedgeGen) == hg));
- //BOOST_CHECK(( prev_at_target<next_in_facet_tag>(hc, halfedgeGen) == hf));
-
+ (void) ha;
+ (void) hh;
+ (void) hj;
+
     return true;
 }
 
@@ -359,13 +367,250 @@
     BOOST_CHECK(( next_at_target(hc, halfedgeGen) == hf));
     (void) hb;
     (void) hi;
- //BOOST_CHECK(( prev_in_facet(hc, halfedgeGen) == ha));
- //BOOST_CHECK(( prev_at_source<next_in_facet_tag>(hc, halfedgeGen) == hg));
- //BOOST_CHECK(( prev_at_target<next_in_facet_tag>(hc, halfedgeGen) == hf));
     
     return true;
 }
 
+template <typename HalfedgeGen>
+bool halfedge_prev_in_facet_test() {
+
+ // Types must exist.
+ typedef typename HalfedgeGen::halfedge_selector halfedge_selector;
+ typedef typename HalfedgeGen::halfedge_descriptor halfedge_descriptor;
+ typedef typename HalfedgeGen::halfedge_iterator halfedge_iterator;
+ typedef typename HalfedgeGen::halfedge_type halfedge_type;
+ typedef typename HalfedgeGen::ContainerGen container_gen;
+ typedef typename HalfedgeGen::ContainerGen::selector container_selector;
+ typedef typename HalfedgeGen::container_type container_type;
+
+ halfedge_type fa;
+ halfedge_type fb;
+ halfedge_type fc;
+ halfedge_type fd;
+ halfedge_type fe;
+ halfedge_type ff;
+ halfedge_type fg;
+ halfedge_type fh;
+ halfedge_type fi;
+ halfedge_type fj;
+ halfedge_type array[] = { fa, fb, fc, fd, fe, ff, fg, fh, fi, fj};
+
+ // Construct a halfedge_gen object whose container contains array. Verify
+ // that halfedges_begin(), halfedges_end(), and num_halfedges() work.
+
+ container_type halfedges(array, array+10);
+ HalfedgeGen halfedgeGen;
+ halfedgeGen.m_container = halfedges;
+
+ {
+ typename container_type::iterator begin = halfedgeGen.m_container.begin();
+ halfedge_type& ha = *begin;
+ halfedge_type& hb = *(++begin);
+ halfedge_type& hc = *(++begin);
+ halfedge_type& hd = *(++begin);
+ halfedge_type& he = *(++begin);
+ halfedge_type& hf = *(++begin);
+ halfedge_type& hg = *(++begin);
+ halfedge_type& hh = *(++begin);
+ halfedge_type& hi = *(++begin);
+ halfedge_type& hj = *(++begin);
+ set_opposite_helper(ha, &hb, container_selector());
+ set_opposite_helper(hb, &ha, container_selector());
+ set_opposite_helper(hc, &hd, container_selector());
+ set_opposite_helper(hd, &hc, container_selector());
+ set_opposite_helper(he, &hf, container_selector());
+ set_opposite_helper(hf, &he, container_selector());
+ set_opposite_helper(hg, &hh, container_selector());
+ set_opposite_helper(hh, &hg, container_selector());
+ set_opposite_helper(hi, &hj, container_selector());
+ set_opposite_helper(hj, &hi, container_selector());
+ }
+
+ halfedge_iterator begin = halfedges_begin(halfedgeGen);
+ halfedge_descriptor ha = *begin;
+ halfedge_descriptor hb = *(++begin);
+ halfedge_descriptor hc = *(++begin);
+ halfedge_descriptor hd = *(++begin);
+ halfedge_descriptor he = *(++begin);
+ halfedge_descriptor hf = *(++begin);
+ halfedge_descriptor hg = *(++begin);
+ halfedge_descriptor hh = *(++begin);
+ halfedge_descriptor hi = *(++begin);
+ halfedge_descriptor hj = *(++begin);
+ set_prev_helper(halfedgeGen, hc, ha, container_selector());
+ set_prev_helper(halfedgeGen, he, hc, container_selector());
+ set_prev_helper(halfedgeGen, hb, hh, container_selector());
+ set_prev_helper(halfedgeGen, hi, hf, container_selector());
+ set_prev_helper(halfedgeGen, hg, hd, container_selector());
+ set_prev_helper(halfedgeGen, hd, hj, container_selector());
+ BOOST_CHECK(( prev_in_facet(hc, halfedgeGen) == ha));
+ BOOST_CHECK(( prev_at_source(hc, halfedgeGen) == hb));
+ BOOST_CHECK(( prev_at_target(hc, halfedgeGen) == hj));
+
+ return true;
+}
+
+template <typename HalfedgeGen>
+bool halfedge_prev_at_source_test() {
+
+ // Types must exist.
+ typedef typename HalfedgeGen::halfedge_selector halfedge_selector;
+ typedef typename HalfedgeGen::halfedge_descriptor halfedge_descriptor;
+ typedef typename HalfedgeGen::halfedge_iterator halfedge_iterator;
+ typedef typename HalfedgeGen::halfedge_type halfedge_type;
+ typedef typename HalfedgeGen::ContainerGen container_gen;
+ typedef typename HalfedgeGen::ContainerGen::selector container_selector;
+ typedef typename HalfedgeGen::container_type container_type;
+
+ halfedge_type fa;
+ halfedge_type fb;
+ halfedge_type fc;
+ halfedge_type fd;
+ halfedge_type fe;
+ halfedge_type ff;
+ halfedge_type fg;
+ halfedge_type fh;
+ halfedge_type fi;
+ halfedge_type fj;
+ halfedge_type array[] = { fa, fb, fc, fd, fe, ff, fg, fh, fi, fj};
+
+ // Construct a halfedge_gen object whose container contains array. Verify
+ // that halfedges_begin(), halfedges_end(), and num_halfedges() work.
+
+ container_type halfedges(array, array+10);
+ HalfedgeGen halfedgeGen;
+ halfedgeGen.m_container = halfedges;
+
+ {
+ typename container_type::iterator begin = halfedgeGen.m_container.begin();
+ halfedge_type& ha = *begin;
+ halfedge_type& hb = *(++begin);
+ halfedge_type& hc = *(++begin);
+ halfedge_type& hd = *(++begin);
+ halfedge_type& he = *(++begin);
+ halfedge_type& hf = *(++begin);
+ halfedge_type& hg = *(++begin);
+ halfedge_type& hh = *(++begin);
+ halfedge_type& hi = *(++begin);
+ halfedge_type& hj = *(++begin);
+ set_opposite_helper(ha, &hb, container_selector());
+ set_opposite_helper(hb, &ha, container_selector());
+ set_opposite_helper(hc, &hd, container_selector());
+ set_opposite_helper(hd, &hc, container_selector());
+ set_opposite_helper(he, &hf, container_selector());
+ set_opposite_helper(hf, &he, container_selector());
+ set_opposite_helper(hg, &hh, container_selector());
+ set_opposite_helper(hh, &hg, container_selector());
+ set_opposite_helper(hi, &hj, container_selector());
+ set_opposite_helper(hj, &hi, container_selector());
+ }
+
+ halfedge_iterator begin = halfedges_begin(halfedgeGen);
+ halfedge_descriptor ha = *begin;
+ halfedge_descriptor hb = *(++begin);
+ halfedge_descriptor hc = *(++begin);
+ halfedge_descriptor hd = *(++begin);
+ halfedge_descriptor he = *(++begin);
+ halfedge_descriptor hf = *(++begin);
+ halfedge_descriptor hg = *(++begin);
+ halfedge_descriptor hh = *(++begin);
+ halfedge_descriptor hi = *(++begin);
+ halfedge_descriptor hj = *(++begin);
+ set_prev_helper(halfedgeGen, hc, hb, container_selector());
+ set_prev_helper(halfedgeGen, hg, hc, container_selector());
+ set_prev_helper(halfedgeGen, hb, hg, container_selector());
+ set_prev_helper(halfedgeGen, he, hd, container_selector());
+ set_prev_helper(halfedgeGen, hi, he, container_selector());
+ set_prev_helper(halfedgeGen, hd, hi, container_selector());
+ BOOST_CHECK(( prev_in_facet(hc, halfedgeGen) == ha));
+ BOOST_CHECK(( prev_at_source(hc, halfedgeGen) == hb));
+ BOOST_CHECK(( prev_at_target(hc, halfedgeGen) == hj));
+ (void) hf;
+ (void) hh;
+ return true;
+}
+
+template <typename HalfedgeGen>
+bool halfedge_prev_at_target_test() {
+
+ // Types must exist.
+ typedef typename HalfedgeGen::halfedge_selector halfedge_selector;
+ typedef typename HalfedgeGen::halfedge_descriptor halfedge_descriptor;
+ typedef typename HalfedgeGen::halfedge_iterator halfedge_iterator;
+ typedef typename HalfedgeGen::halfedge_type halfedge_type;
+ typedef typename HalfedgeGen::ContainerGen container_gen;
+ typedef typename HalfedgeGen::ContainerGen::selector container_selector;
+ typedef typename HalfedgeGen::container_type container_type;
+
+ halfedge_type fa;
+ halfedge_type fb;
+ halfedge_type fc;
+ halfedge_type fd;
+ halfedge_type fe;
+ halfedge_type ff;
+ halfedge_type fg;
+ halfedge_type fh;
+ halfedge_type fi;
+ halfedge_type fj;
+ halfedge_type array[] = { fa, fb, fc, fd, fe, ff, fg, fh, fi, fj};
+
+ // Construct a halfedge_gen object whose container contains array. Verify
+ // that halfedges_begin(), halfedges_end(), and num_halfedges() work.
+
+ container_type halfedges(array, array+10);
+ HalfedgeGen halfedgeGen;
+ halfedgeGen.m_container = halfedges;
+
+ {
+ typename container_type::iterator begin = halfedgeGen.m_container.begin();
+ halfedge_type& ha = *begin;
+ halfedge_type& hb = *(++begin);
+ halfedge_type& hc = *(++begin);
+ halfedge_type& hd = *(++begin);
+ halfedge_type& he = *(++begin);
+ halfedge_type& hf = *(++begin);
+ halfedge_type& hg = *(++begin);
+ halfedge_type& hh = *(++begin);
+ halfedge_type& hi = *(++begin);
+ halfedge_type& hj = *(++begin);
+ set_opposite_helper(ha, &hb, container_selector());
+ set_opposite_helper(hb, &ha, container_selector());
+ set_opposite_helper(hc, &hd, container_selector());
+ set_opposite_helper(hd, &hc, container_selector());
+ set_opposite_helper(he, &hf, container_selector());
+ set_opposite_helper(hf, &he, container_selector());
+ set_opposite_helper(hg, &hh, container_selector());
+ set_opposite_helper(hh, &hg, container_selector());
+ set_opposite_helper(hi, &hj, container_selector());
+ set_opposite_helper(hj, &hi, container_selector());
+ }
+
+ halfedge_iterator begin = halfedges_begin(halfedgeGen);
+ halfedge_descriptor ha = *begin;
+ halfedge_descriptor hb = *(++begin);
+ halfedge_descriptor hc = *(++begin);
+ halfedge_descriptor hd = *(++begin);
+ halfedge_descriptor he = *(++begin);
+ halfedge_descriptor hf = *(++begin);
+ halfedge_descriptor hg = *(++begin);
+ halfedge_descriptor hh = *(++begin);
+ halfedge_descriptor hi = *(++begin);
+ halfedge_descriptor hj = *(++begin);
+ set_prev_helper(halfedgeGen, hc, hj, container_selector());
+ set_prev_helper(halfedgeGen, hd, ha, container_selector());
+ set_prev_helper(halfedgeGen, ha, hh, container_selector());
+ set_prev_helper(halfedgeGen, hh, hd, container_selector());
+ set_prev_helper(halfedgeGen, hf, hc, container_selector());
+ set_prev_helper(halfedgeGen, hj, hf, container_selector());
+ BOOST_CHECK(( prev_in_facet(hc, halfedgeGen) == ha));
+ BOOST_CHECK(( prev_at_source(hc, halfedgeGen) == hb));
+ BOOST_CHECK(( prev_at_target(hc, halfedgeGen) == hj));
+ (void) he;
+ (void) hg;
+ (void) hi;
+
+ return true;
+}
 
 template <typename HalfedgeGen>
 bool halfedge_functions_requirements() {
@@ -620,6 +865,31 @@
                         halfedgeS<ContainerS, forwardS<next_at_target_tag> >,
                         noVertexS, noFacetS> >
>() ));
+ // Check prev_... functions
+ BOOST_CHECK(( halfedge_prev_in_facet_test<
+ halfedge_gen<
+ halfedgeS<ContainerS, backwardS<prev_in_facet_tag> >,
+ int, int,
+ halfedge_config<
+ halfedgeS<ContainerS, backwardS<prev_in_facet_tag> >,
+ noVertexS, noFacetS> >
+ >() ));
+ BOOST_CHECK(( halfedge_prev_at_source_test<
+ halfedge_gen<
+ halfedgeS<ContainerS, backwardS<prev_at_source_tag> >,
+ int, int,
+ halfedge_config<
+ halfedgeS<ContainerS, backwardS<prev_at_source_tag> >,
+ noVertexS, noFacetS> >
+ >() ));
+ BOOST_CHECK(( halfedge_prev_at_target_test<
+ halfedge_gen<
+ halfedgeS<ContainerS, backwardS<prev_at_target_tag> >,
+ int, int,
+ halfedge_config<
+ halfedgeS<ContainerS, backwardS<prev_at_target_tag> >,
+ noVertexS, noFacetS> >
+ >() ));
     return true;
 }
 


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