|
Boost-Commit : |
From: hervebronnimann_at_[hidden]
Date: 2007-07-19 02:38:10
Author: hervebronnimann
Date: 2007-07-19 02:38:08 EDT (Thu, 19 Jul 2007)
New Revision: 7475
URL: http://svn.boost.org/trac/boost/changeset/7475
Log:
More testing, bug fixing, etc. Now all the test drivers are enabled (with some
TODO) and all compile and run properly, up to halfedge_functions.
Added:
sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_functions.cpp
sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_functions.t.cpp
Text files modified:
sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/Makefile | 3
sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/container_selectors.hpp | 24 +++
sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/container_selectors.t.cpp | 13 +
sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_functions.hpp | 68 ++++-----
sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_selectors.hpp | 3
sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_selectors.t.cpp | 276 ++++++++++++++++++---------------------
6 files changed, 196 insertions(+), 191 deletions(-)
Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/Makefile
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/Makefile (original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/Makefile 2007-07-19 02:38:08 EDT (Thu, 19 Jul 2007)
@@ -1,6 +1,5 @@
CXX=g++
-CXXFLAGS=-pedantic -W -Wall -I.
-# CXXFLAGS=-pedantic -W -Wall -I${BOOST} -I.
+CXXFLAGS=-pedantic -W -Wall -I.
LD=g++
Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/container_selectors.hpp
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/container_selectors.hpp (original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/container_selectors.hpp 2007-07-19 02:38:08 EDT (Thu, 19 Jul 2007)
@@ -197,6 +197,9 @@
// container.
// TYPES
+ typedef hashS selector;
+ // The container selector, here a 'hashS'.
+
typedef std::tr1::hash_set<ValueType> type;
// The container type, here a 'std::tr1::hash_set'.
@@ -295,6 +298,9 @@
// is instead a descriptor.
// TYPES
+ typedef listS selector;
+ // The container selector, here a 'listS'.
+
typedef std::list<ValueType> type;
// The container type, here a 'std::list'.
@@ -334,6 +340,10 @@
return &(*base_type(*this));
}
// ACCESSORS
+ bool operator==(iterator rhs)
+ {
+ return base_type(*this) == base_type(rhs);
+ }
value_type operator*() const
// Return the descriptor of the element pointed to by this
// iterator.
@@ -372,6 +382,9 @@
// container.
// TYPES
+ typedef setS selector;
+ // The container selector, here a 'setS'.
+
typedef std::set<ValueType> type;
// The container type, here a 'std::set'.
@@ -411,6 +424,10 @@
return &(*base_type(*this));
}
// ACCESSORS
+ bool operator==(iterator rhs)
+ {
+ return base_type(*this) == base_type(rhs);
+ }
value_type operator*() const
// Return the descriptor of the element pointed to by this
// iterator.
@@ -447,6 +464,9 @@
struct container_gen<vecS, ValueType> {
// TYPES
+ typedef vecS selector;
+ // The container selector, here a 'vecS'.
+
typedef std::vector<ValueType> type;
// The container type, here a 'std::vector'.
@@ -514,6 +534,10 @@
base_type(*this) - m_container->begin());
}
// ACCESSORS
+ bool operator==(iterator rhs)
+ {
+ return base_type(*this) == base_type(rhs);
+ }
reference operator*() const
// Return the descriptor of the element pointed to by this
// iterator.
Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/container_selectors.t.cpp
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/container_selectors.t.cpp (original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/container_selectors.t.cpp 2007-07-19 02:38:08 EDT (Thu, 19 Jul 2007)
@@ -12,6 +12,7 @@
// without errors, when assert is replaced by BOOST_CHECK.
#include <boost/hdstl/halfedge_ds/container_selectors.hpp>
+#include <boost/hdstl/halfedge_ds/meta_functions.hpp>
#include <boost/test/minimal.hpp>
@@ -33,19 +34,31 @@
#if 0
bool selector_requirements(boost::hdstl::hashS const&) {
+ BOOST_CHECK(( meta_is_same<container_gen<hashS>::selector,
+ listS>::value ));
+ // TODO Other checks
return true;
}
#endif
bool selector_requirements(listS const&) {
+ BOOST_CHECK(( meta_is_same<container_gen<listS, int>::selector,
+ listS>::value ));
+ // TODO Other checks
return true;
}
bool selector_requirements(setS const&) {
+ BOOST_CHECK(( meta_is_same<container_gen<setS, int>::selector,
+ setS>::value ));
+ // TODO Other checks
return true;
}
bool selector_requirements(vecS const&) {
+ BOOST_CHECK(( meta_is_same<container_gen<vecS, int>::selector,
+ vecS>::value ));
+ // TODO Other checks
return true;
}
Added: sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_functions.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_functions.cpp 2007-07-19 02:38:08 EDT (Thu, 19 Jul 2007)
@@ -0,0 +1,3 @@
+//halfedge_functions.cpp -*- C++ -*-
+
+#include <boost/hdstl/halfedge_ds/halfedge_functions.hpp>
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-19 02:38:08 EDT (Thu, 19 Jul 2007)
@@ -19,47 +19,39 @@
namespace hdstl {
// FREE FUNCTIONS
-template <typename HalfedgeS,
- typename VertexDescriptor, typename FacetDescriptor, typename Config>
-typename halfedge_gen<HalfedgeS, VertexDescriptor,
- FacetDescriptor, Config>::halfedge_iterator
-halfedges_begin(halfedge_gen<HalfedgeS, VertexDescriptor,
- FacetDescriptor, Config>& hds) {
- typedef typename halfedge_gen<HalfedgeS,
- VertexDescriptor,FacetDescriptor, Config>::ContainerGen ContainerGen;
+template <typename HalfedgeS, typename VertexDescriptor, typename FacetDescriptor, typename Config>
+typename halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>::halfedge_iterator
+halfedges_begin(halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>& hds)
+{
+ typedef typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>
+ ::ContainerGen ContainerGen;
return ContainerGen::container_begin(hds.m_container);
}
-template <typename HalfedgeS,
- typename VertexDescriptor, typename FacetDescriptor, typename Config>
-typename halfedge_gen<HalfedgeS, VertexDescriptor,
- FacetDescriptor, Config>::halfedge_iterator
-halfedges_end(halfedge_gen<HalfedgeS, VertexDescriptor,
- FacetDescriptor, Config>& hds) {
- typedef typename halfedge_gen<HalfedgeS,
- VertexDescriptor,FacetDescriptor, Config>::ContainerGen ContainerGen;
+template <typename HalfedgeS, typename VertexDescriptor, typename FacetDescriptor, typename Config>
+typename halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>::halfedge_iterator
+halfedges_end(halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>& hds)
+{
+ typedef typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>
+ ::ContainerGen ContainerGen;
return ContainerGen::container_end(hds.m_container);
}
-template <typename HalfedgeS,
- typename VertexDescriptor, typename FacetDescriptor, typename Config>
-typename halfedge_gen<HalfedgeS, VertexDescriptor,
- FacetDescriptor, Config>::size_type
-num_halfedges(halfedge_gen<HalfedgeS, VertexDescriptor,
- FacetDescriptor, Config>& hds) {
+template <typename HalfedgeS, typename VertexDescriptor, typename FacetDescriptor, typename Config>
+typename halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>::size_type
+num_halfedges(halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>& hds)
+{
return hds.m_container.size();
}
+// \cond
template<typename HalfedgeS, typename HalfedgeDescriptor>
struct opposite_function_helper {
static
HalfedgeDescriptor
opposite(HalfedgeDescriptor h)
{
- // halfedges come in pairs, point to each other as
- // opposite. If halfedges stored in a list, use the
- // opposite pointer.
- return h->m_opposite;
+ return static_cast<HalfedgeDescriptor>(h->m_opposite);
}
};
@@ -69,28 +61,28 @@
HalfedgeDescriptor
opposite(HalfedgeDescriptor h)
{
- // halfedges come in pairs, point to each other as
- // opposite. If halfedges stored in a vector:
return h^1;
}
};
+// \endcond
-template <typename HalfedgeS,
- typename VertexDescriptor, typename FacetDescriptor, typename Config>
+template <typename HalfedgeS, typename VertexDescriptor, typename FacetDescriptor,
+ typename Config>
typename Config::halfedge_descriptor
-opposite(typename Config::halfedge_descriptor h, halfedge_gen<HalfedgeS,
- VertexDescriptor, FacetDescriptor, Config>& hds)
+opposite(typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor h,
+ const halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>&)
{
-
typedef typename halfedge_gen<HalfedgeS,
- VertexDescriptor,FacetDescriptor, Config>
- ::halfedge_selector halfedge_selector;
+ VertexDescriptor,FacetDescriptor, Config
+ >::halfedge_selector halfedge_selector;
+ typedef typename halfedge_gen<HalfedgeS,
+ VertexDescriptor,FacetDescriptor, Config
+ >::halfedge_descriptor halfedge_descriptor;
return opposite_function_helper<halfedge_selector,
- typename Config::halfedge_descriptor>
- ::opposite(h);
+ halfedge_descriptor
+ >::opposite(h);
}
-
} // namespace hdstl
} // namespace boost
Added: sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_functions.t.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_functions.t.cpp 2007-07-19 02:38:08 EDT (Thu, 19 Jul 2007)
@@ -0,0 +1,329 @@
+//halfedge_functions.t.cpp -*- C++ -*-
+//
+//@OVERVIEW: The component under test is a set of function templates. We
+// must make sure that all templates are suitably defined and that the
+// template dispatch is done properly.
+//
+//@TEST_PLAN: Then instantiate the 'container_gen<HalfedgeS,ValueType>' for a
+//given value type and all selectors, and verify that all the functions act
+//correctly with it. Finally, verify that the usage example compiles and
+//executes without errors, when assert is replaced by BOOST_CHECK.
+
+#include <boost/hdstl/halfedge_ds/halfedge_functions.hpp>
+
+#include <boost/hdstl/halfedge_ds/halfedge_selectors.hpp>
+#include <boost/hdstl/halfedge_ds/facet_selectors.hpp>
+#include <boost/hdstl/halfedge_ds/vertex_selectors.hpp>
+#include <boost/hdstl/halfedge_ds/meta_functions.hpp>
+#include <boost/pending/ct_if.hpp>
+
+#include <boost/test/minimal.hpp>
+
+#include <set>
+#include <string>
+#include <vector>
+
+using namespace boost::hdstl;
+using namespace std;
+
+// ===========================================================================
+// CLASS HALFEDGE_GEN
+// ===========================================================================
+
+typedef void* halfedge_ptr;
+
+template <typename HalfedgeS, typename VertexS, typename FacetS>
+struct halfedge_config {
+ // This halfedge_config to identically replace the halfedge_ds_gen::config
+ // and reproduced here for test purposes only. Note that this tests are
+ // not for the config class, but the halfedge_selectors, so config will
+ // be tested in its own package.
+
+ enum {
+ halfedge_has_opposite_member = !meta_is_same<
+ typename HalfedgeS::container_selector, vecS>::value,
+ is_forward = HalfedgeS::is_forward,
+ is_backward = HalfedgeS::is_backward,
+ halfedge_supports_vertices = !meta_is_same<VertexS,noVertexS>::value,
+ is_source = VertexS::is_source,
+ halfedge_supports_facets = !meta_is_same<FacetS,noFacetS>::value
+ };
+ typedef typename boost::ct_if<halfedge_has_opposite_member,
+ halfedge_ptr, std::size_t>::type halfedge_descriptor;
+};
+
+template <typename HalfedgeS>
+struct halfedge_config<HalfedgeS, noVertexS, noFacetS> {
+ enum {
+ halfedge_has_opposite_member = !meta_is_same<
+ typename HalfedgeS::container_selector, vecS>::value,
+ is_forward = HalfedgeS::is_forward,
+ is_backward = HalfedgeS::is_backward,
+ halfedge_supports_vertices = false,
+ is_source = false,
+ halfedge_supports_facets = false
+ };
+ typedef typename boost::ct_if<halfedge_has_opposite_member,
+ halfedge_ptr, std::size_t>::type halfedge_descriptor;
+};
+
+template <typename HalfedgeS, typename FacetS>
+struct halfedge_config<HalfedgeS, noVertexS, FacetS> {
+ enum {
+ halfedge_has_opposite_member = !meta_is_same<
+ typename HalfedgeS::container_selector, vecS>::value,
+ is_forward = HalfedgeS::is_forward,
+ is_backward = HalfedgeS::is_backward,
+ halfedge_supports_vertices = false,
+ is_source = false,
+ halfedge_supports_facets = !meta_is_same<FacetS,noFacetS>::value
+ };
+ typedef typename boost::ct_if<halfedge_has_opposite_member,
+ halfedge_ptr, std::size_t>::type halfedge_descriptor;
+};
+
+template <typename HalfedgeS, typename VertexS>
+struct halfedge_config<HalfedgeS, VertexS, noFacetS> {
+ enum {
+ halfedge_has_opposite_member = !meta_is_same<
+ typename HalfedgeS::container_selector, vecS>::value,
+ is_forward = HalfedgeS::is_forward,
+ is_backward = HalfedgeS::is_backward,
+ halfedge_supports_vertices = !meta_is_same<VertexS,noVertexS>::value,
+ is_source = VertexS::is_source,
+ halfedge_supports_facets = false
+ };
+ typedef typename boost::ct_if<halfedge_has_opposite_member,
+ halfedge_ptr, std::size_t>::type halfedge_descriptor;
+};
+
+template <typename HalfedgeType, typename HalfedgeDescriptor, typename ContainerS>
+void set_opposite_helper(HalfedgeType& h, HalfedgeDescriptor g, ContainerS const&) {
+ h.m_opposite = g;
+}
+
+template <typename HalfedgeType, typename HalfedgeDescriptor>
+void set_opposite_helper(HalfedgeType&, HalfedgeDescriptor, vecS const&) {
+ // nothing to do
+}
+
+template <typename HalfedgeGen>
+bool halfedge_functions_requirements() {
+
+ // 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 array[] = { fa, fb, fc, fd };
+
+ // Construct a halfedge_gen object whose container contains array. Verify
+ // that halfedges_begin(), halfedges_end(), and num_halfedges() work.
+
+ container_type halfedges(array, array+4);
+ HalfedgeGen halfedgeGen;
+ halfedgeGen.m_container = halfedges;
+
+ BOOST_CHECK(( num_halfedges(halfedgeGen) == 4 ));
+
+ BOOST_CHECK(( halfedges_begin(halfedgeGen)
+ == container_gen::container_begin(halfedgeGen.m_container)
+ ));
+ BOOST_CHECK(( halfedges_end(halfedgeGen)
+ == container_gen::container_end(halfedgeGen.m_container)
+ ));
+
+ // Set up opposites correctly (nothing to do if 'vecS', let the helper
+ // decide. Then check that opposite() returns the correct value.
+ {
+ 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);
+ 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());
+ }
+
+ halfedge_iterator begin = halfedges_begin(halfedgeGen);
+ halfedge_descriptor ha = *begin;
+ halfedge_descriptor hb = *(++begin);
+ halfedge_descriptor hc = *(++begin);
+ halfedge_descriptor hd = *(++begin);
+ BOOST_CHECK(( opposite(ha, halfedgeGen) == hb ));
+ BOOST_CHECK(( opposite(hb, halfedgeGen) == ha ));
+ BOOST_CHECK(( opposite(hc, halfedgeGen) == hd ));
+ BOOST_CHECK(( opposite(hd, halfedgeGen) == hc ));
+
+ return true;
+}
+
+// ===========================================================================
+// USAGE EXAMPLE
+// ===========================================================================
+
+// The usage example is the component itself.
+
+// ===========================================================================
+// BOOST TEST APPARATUS
+// ===========================================================================
+
+template <typename ContainerS>
+bool test_container_selector()
+{
+ // Check 'forwardS'.
+ BOOST_CHECK(( halfedge_functions_requirements<
+ halfedge_gen<
+ halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
+ int, int,
+ halfedge_config<
+ halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
+ noVertexS, noFacetS> >
+ >() ));
+ BOOST_CHECK(( halfedge_functions_requirements<
+ halfedge_gen<
+ halfedgeS<ContainerS, forwardS<next_at_source_tag> >,
+ int, int,
+ halfedge_config<
+ halfedgeS<ContainerS, forwardS<next_at_source_tag> >,
+ noVertexS, noFacetS> >
+ >() ));
+ BOOST_CHECK(( halfedge_functions_requirements<
+ halfedge_gen<
+ halfedgeS<ContainerS, forwardS<next_at_target_tag> >,
+ int, int,
+ halfedge_config<
+ halfedgeS<ContainerS, forwardS<next_at_target_tag> >,
+ noVertexS, noFacetS> >
+ >() ));
+
+ // Check 'backwardS'.
+ BOOST_CHECK(( halfedge_functions_requirements<
+ 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_functions_requirements<
+ 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_functions_requirements<
+ halfedge_gen<
+ halfedgeS<ContainerS, backwardS<prev_at_target_tag> >,
+ int, int,
+ halfedge_config<
+ halfedgeS<ContainerS, backwardS<prev_at_target_tag> >,
+ noVertexS, noFacetS> >
+ >() ));
+
+ // Check 'bidirS'.
+ BOOST_CHECK(( halfedge_functions_requirements<
+ halfedge_gen<
+ halfedgeS<ContainerS, bidirS<next_in_facet_tag,
+ prev_in_facet_tag> >,
+ int, int,
+ halfedge_config<
+ halfedgeS<ContainerS, bidirS<next_in_facet_tag,
+ prev_in_facet_tag> >,
+ noVertexS, noFacetS> >
+ >() ));
+ BOOST_CHECK(( halfedge_functions_requirements<
+ halfedge_gen<
+ halfedgeS<ContainerS, bidirS<next_at_source_tag,
+ prev_at_source_tag> >,
+ int, int,
+ halfedge_config<
+ halfedgeS<ContainerS, bidirS<next_at_source_tag,
+ prev_at_source_tag> >,
+ noVertexS, noFacetS> >
+ >() ));
+ BOOST_CHECK(( halfedge_functions_requirements<
+ halfedge_gen<
+ halfedgeS<ContainerS, bidirS<next_at_target_tag,
+ prev_at_target_tag> >,
+ int, int,
+ halfedge_config<
+ halfedgeS<ContainerS, bidirS<next_at_target_tag,
+ prev_at_target_tag> >,
+ noVertexS, noFacetS> >
+ >() ));
+
+ // Check 'vertexS'.
+ BOOST_CHECK(( halfedge_functions_requirements<
+ halfedge_gen<
+ halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
+ int, int,
+ halfedge_config<
+ halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
+ vertexS<ContainerS,false,sourceS>, noFacetS> >
+ >() ));
+ BOOST_CHECK(( halfedge_functions_requirements<
+ halfedge_gen<
+ halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
+ int, int,
+ halfedge_config<
+ halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
+ vertexS<ContainerS,false,targetS>, noFacetS> >
+ >() ));
+ BOOST_CHECK(( halfedge_functions_requirements<
+ halfedge_gen<
+ halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
+ int, int,
+ halfedge_config<
+ halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
+ vertexS<ContainerS,true,sourceS>, noFacetS> >
+ >() ));
+ BOOST_CHECK(( halfedge_functions_requirements<
+ halfedge_gen<
+ halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
+ int, int,
+ halfedge_config<
+ halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
+ vertexS<ContainerS,true,targetS>, noFacetS> >
+ >() ));
+
+ // Check 'facetS'.
+ BOOST_CHECK(( halfedge_functions_requirements<
+ halfedge_gen<
+ halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
+ int, int,
+ halfedge_config<
+ halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
+ noVertexS, facetS<ContainerS,true> > >
+ >() ));
+ BOOST_CHECK(( halfedge_functions_requirements<
+ halfedge_gen<
+ halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
+ int, int,
+ halfedge_config<
+ halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
+ noVertexS, facetS<ContainerS,false> > >
+ >() ));
+
+ return true;
+}
+
+int test_main(int, char**)
+{
+ BOOST_CHECK(( test_container_selector<listS>() ));
+ BOOST_CHECK(( test_container_selector<vecS>() ));
+ // BOOST_CHECK(( test_container_selector() ));
+ return 0;
+}
Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_selectors.hpp
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_selectors.hpp (original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_selectors.hpp 2007-07-19 02:38:08 EDT (Thu, 19 Jul 2007)
@@ -214,6 +214,9 @@
typedef typename ContainerGen::iterator halfedge_iterator;
// The halfedge iterator type for this halfedge generator.
+ typedef typename ContainerGen::descriptor halfedge_descriptor;
+ // The halfedge descriptor type for this halfedge generator.
+
typedef Config config;
// DATA
Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_selectors.t.cpp
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_selectors.t.cpp (original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_selectors.t.cpp 2007-07-19 02:38:08 EDT (Thu, 19 Jul 2007)
@@ -129,62 +129,36 @@
template <typename HalfedgeGen>
-bool halfedge_gen_requirements_void() {
+bool halfedge_gen_requirements() {
// Types must exist.
typedef typename HalfedgeGen::halfedge_selector halfedge_selector;
typedef typename HalfedgeGen::halfedge_iterator halfedge_iterator;
+ typedef typename HalfedgeGen::halfedge_descriptor halfedge_descriptor;
typedef typename HalfedgeGen::halfedge_type halfedge_type;
typedef typename HalfedgeGen::container_type container_type;
+ typedef typename HalfedgeGen::ContainerGen container_gen;
typedef typename HalfedgeGen::config config;
halfedge_type fa;
halfedge_type fb;
halfedge_type fc;
halfedge_type fd;
- fa.m_opposite = &fb;
- fb.m_opposite = &fa;
- fc.m_opposite = &fd;
- fd.m_opposite = &fc;
halfedge_type array[] = { fa, fb, fc, fd };
- // Construct a halfedge_gen object whose container contains array. Verify
- // that halfedges_begin(), halfedges_end(), and num_halfedges() work.
+ // Construct a halfedge_gen object whose container contains array.
container_type halfedges(array, array+4);
HalfedgeGen halfedgeGen;
halfedgeGen.m_container = halfedges;
- BOOST_CHECK(( opposite(*halfedges_begin(halfedgeGen), halfedgeGen) == 1 ));
- return true;
-}
-
-template <typename HalfedgeGen, typename Base>
-bool halfedge_gen_requirements() {
-
- typedef typename HalfedgeGen::halfedge_selector halfedge_selector;
- typedef typename HalfedgeGen::halfedge_iterator halfedge_iterator;
- typedef typename HalfedgeGen::halfedge_type halfedge_type;
- typedef typename HalfedgeGen::container_type container_type;
-
- halfedge_type fa(1, Base(1));
- halfedge_type fb(2, Base(2));
- halfedge_type fc(3, Base(3));
- halfedge_type fd(4, Base(4));
- halfedge_type array[] = { fa, fb, fc, fd }; (void) array;
-
- // Same checks as before:
- // BOOST_CHECK(( halfedge_gen_requirements_void<HalfedgeGen>() ));
- container_type temp_con(array,array+4);
- HalfedgeGen halfedgeGen;
- halfedgeGen.m_container = temp_con;
BOOST_CHECK(( halfedgeGen.m_container.size() == 4 ));
- BOOST_CHECK(( HalfedgeGen::value(*halfedgeGen.m_container.begin(),
- halfedgeGen)->m_halfedgeLink == 1 ));
- BOOST_CHECK(( HalfedgeGen::value(*(--(halfedgeGen.m_container.begin())),
- halfedgeGen)->m_halfedgeLink == 4 ));
-
+ halfedge_iterator halfedges_begin = container_gen::container_begin(halfedgeGen.m_container);
+ halfedge_descriptor first_halfedge = *halfedges_begin;
+ halfedge_type& first_halfedge_ref = container_gen::value(first_halfedge, halfedgeGen.m_container);
+
+ BOOST_CHECK(( &first_halfedge_ref == &(*halfedgeGen.m_container.begin())));
return true;
}
@@ -224,148 +198,148 @@
bidirS<next_at_target_tag, prev_at_target_tag> >()) ));
// Check 'forwardS'.
- BOOST_CHECK(( halfedge_gen_requirements_void<
+ BOOST_CHECK(( halfedge_gen_requirements<
halfedge_gen<
halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
- /*int,*/ int, int,
- halfedge_config<
- halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
- noVertexS, noFacetS> >
- >() ));
-/* BOOST_CHECK(( halfedge_gen_requirements_void<
- halfedge_gen<
- halfedgeS<ContainerS, forwardS<next_at_source_tag> >,
- int, int, int,
- halfedge_config<
- halfedgeS<ContainerS, forwardS<next_at_source_tag> >,
- noVertexS, noFacetS> >
- >() ));
- BOOST_CHECK(( halfedge_gen_requirements_void<
- halfedge_gen<
- halfedgeS<ContainerS, forwardS<next_at_target_tag> >,
- int, int, int,
- halfedge_config<
- halfedgeS<ContainerS, forwardS<next_at_target_tag> >,
- noVertexS, noFacetS> >
+ int, int,
+ halfedge_config<
+ halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
+ noVertexS, noFacetS> >
+ >() ));
+ BOOST_CHECK(( halfedge_gen_requirements<
+ halfedge_gen<
+ halfedgeS<ContainerS, forwardS<next_at_source_tag> >,
+ int, int,
+ halfedge_config<
+ halfedgeS<ContainerS, forwardS<next_at_source_tag> >,
+ noVertexS, noFacetS> >
+ >() ));
+ BOOST_CHECK(( halfedge_gen_requirements<
+ halfedge_gen<
+ halfedgeS<ContainerS, forwardS<next_at_target_tag> >,
+ int, int,
+ halfedge_config<
+ halfedgeS<ContainerS, forwardS<next_at_target_tag> >,
+ noVertexS, noFacetS> >
>() ));
// Check 'backwardS'.
- BOOST_CHECK(( halfedge_gen_requirements_void<
- halfedge_gen<
- halfedgeS<ContainerS, backwardS<prev_in_facet_tag> >,
- int, int, int,
- halfedge_config<
- halfedgeS<ContainerS, backwardS<prev_in_facet_tag> >,
- noVertexS, noFacetS> >
- >() ));
- BOOST_CHECK(( halfedge_gen_requirements_void<
- halfedge_gen<
- halfedgeS<ContainerS, backwardS<prev_at_source_tag> >,
- int, int, int,
- halfedge_config<
- halfedgeS<ContainerS, backwardS<prev_at_source_tag> >,
- noVertexS, noFacetS> >
- >() ));
- BOOST_CHECK(( halfedge_gen_requirements_void<
- halfedge_gen<
- halfedgeS<ContainerS, backwardS<prev_at_target_tag> >,
- int, int, int,
- halfedge_config<
- halfedgeS<ContainerS, backwardS<prev_at_target_tag> >,
- noVertexS, noFacetS> >
+ BOOST_CHECK(( halfedge_gen_requirements<
+ 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_gen_requirements<
+ 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_gen_requirements<
+ halfedge_gen<
+ halfedgeS<ContainerS, backwardS<prev_at_target_tag> >,
+ int, int,
+ halfedge_config<
+ halfedgeS<ContainerS, backwardS<prev_at_target_tag> >,
+ noVertexS, noFacetS> >
>() ));
// Check 'bidirS'.
- BOOST_CHECK(( halfedge_gen_requirements_void<
+ BOOST_CHECK(( halfedge_gen_requirements<
halfedge_gen<
halfedgeS<ContainerS, bidirS<next_in_facet_tag,
- prev_in_facet_tag> >,
- int, int, int,
+ prev_in_facet_tag> >,
+ int, int,
halfedge_config<
halfedgeS<ContainerS, bidirS<next_in_facet_tag,
- prev_in_facet_tag> >,
- noVertexS, noFacetS> >
+ prev_in_facet_tag> >,
+ noVertexS, noFacetS> >
+ >() ));
+ BOOST_CHECK(( halfedge_gen_requirements<
+ halfedge_gen<
+ halfedgeS<ContainerS, bidirS<next_at_source_tag,
+ prev_at_source_tag> >,
+ int, int,
+ halfedge_config<
+ halfedgeS<ContainerS, bidirS<next_at_source_tag,
+ prev_at_source_tag> >,
+ noVertexS, noFacetS> >
>() ));
- BOOST_CHECK(( halfedge_gen_requirements_void<
- halfedge_gen<
- halfedgeS<ContainerS, bidirS<next_at_source_tag,
- prev_at_source_tag> >,
- int, int, int,
- halfedge_config<
- halfedgeS<ContainerS, bidirS<next_at_source_tag,
- prev_at_source_tag> >,
- noVertexS, noFacetS> >
- >() ));
- BOOST_CHECK(( halfedge_gen_requirements_void<
- halfedge_gen<
- halfedgeS<ContainerS, bidirS<next_at_target_tag,
- prev_at_target_tag> >,
- int, int, int,
- halfedge_config<
- halfedgeS<ContainerS, bidirS<next_at_target_tag,
- prev_at_target_tag> >,
- noVertexS, noFacetS> >
+ BOOST_CHECK(( halfedge_gen_requirements<
+ halfedge_gen<
+ halfedgeS<ContainerS, bidirS<next_at_target_tag,
+ prev_at_target_tag> >,
+ int, int,
+ halfedge_config<
+ halfedgeS<ContainerS, bidirS<next_at_target_tag,
+ prev_at_target_tag> >,
+ noVertexS, noFacetS> >
>() ));
// Check 'vertexS'.
- BOOST_CHECK(( halfedge_gen_requirements_void<
- halfedge_gen<
- halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
- int, int, int,
- halfedge_config<
- halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
- vertexS<ContainerS,false,sourceS>, noFacetS> >
- >() ));
- BOOST_CHECK(( halfedge_gen_requirements_void<
- halfedge_gen<
- halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
- int, int, int,
- halfedge_config<
- halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
- vertexS<ContainerS,false,targetS>, noFacetS> >
- >() ));
- BOOST_CHECK(( halfedge_gen_requirements_void<
- halfedge_gen<
- halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
- int, int, int,
- halfedge_config<
- halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
- vertexS<ContainerS,true,sourceS>, noFacetS> >
- >() ));
- BOOST_CHECK(( halfedge_gen_requirements_void<
- halfedge_gen<
- halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
- int, int, int,
- halfedge_config<
- halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
- vertexS<ContainerS,true,targetS>, noFacetS> >
+ BOOST_CHECK(( halfedge_gen_requirements<
+ halfedge_gen<
+ halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
+ int, int,
+ halfedge_config<
+ halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
+ vertexS<ContainerS,false,sourceS>, noFacetS> >
+ >() ));
+ BOOST_CHECK(( halfedge_gen_requirements<
+ halfedge_gen<
+ halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
+ int, int,
+ halfedge_config<
+ halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
+ vertexS<ContainerS,false,targetS>, noFacetS> >
+ >() ));
+ BOOST_CHECK(( halfedge_gen_requirements<
+ halfedge_gen<
+ halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
+ int, int,
+ halfedge_config<
+ halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
+ vertexS<ContainerS,true,sourceS>, noFacetS> >
+ >() ));
+ BOOST_CHECK(( halfedge_gen_requirements<
+ halfedge_gen<
+ halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
+ int, int,
+ halfedge_config<
+ halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
+ vertexS<ContainerS,true,targetS>, noFacetS> >
>() ));
// Check 'facetS'.
- BOOST_CHECK(( halfedge_gen_requirements_void<
- halfedge_gen<
- halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
- int, int, int,
- halfedge_config<
- halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
- noVertexS, facetS<ContainerS,true> > >
- >() ));
- BOOST_CHECK(( halfedge_gen_requirements_void<
- halfedge_gen<
- halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
- int, int, int,
- halfedge_config<
- halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
- noVertexS, facetS<ContainerS,false> > >
+ BOOST_CHECK(( halfedge_gen_requirements<
+ halfedge_gen<
+ halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
+ int, int,
+ halfedge_config<
+ halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
+ noVertexS, facetS<ContainerS,true> > >
+ >() ));
+ BOOST_CHECK(( halfedge_gen_requirements<
+ halfedge_gen<
+ halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
+ int, int,
+ halfedge_config<
+ halfedgeS<ContainerS, forwardS<next_in_facet_tag> >,
+ noVertexS, facetS<ContainerS,false> > >
>() ));
-*/
+
return true;
}
int test_main(int, char**)
{
BOOST_CHECK(( test_container_selector<listS>() ));
- //BOOST_CHECK(( test_container_selector<vecS>() ));
+ BOOST_CHECK(( test_container_selector<vecS>() ));
// BOOST_CHECK(( test_container_selector() ));
return 0;
}
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