Boost logo

Boost-Commit :

From: huseyinakcan_at_[hidden]
Date: 2007-08-01 23:26:05


Author: huseyinakcan
Date: 2007-08-01 23:26:04 EDT (Wed, 01 Aug 2007)
New Revision: 38391
URL: http://svn.boost.org/trac/boost/changeset/38391

Log:
facet and vertex function components and their tests
also doc updates

Added:
   sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/facet_functions.cpp (contents, props changed)
   sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/facet_functions.hpp (contents, props changed)
   sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/facet_functions.t.cpp (contents, props changed)
   sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/vertex_functions.cpp (contents, props changed)
   sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/vertex_functions.hpp (contents, props changed)
   sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/vertex_functions.t.cpp (contents, props changed)
Text files modified:
   sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/Makefile | 22 ++++-
   sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/facet_selectors.hpp | 112 ------------------------------
   sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/facet_selectors.t.cpp | 90 +++++++++++++-----------
   sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_functions.hpp | 136 +++++++++++++++++++++++++-----------
   sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/vertex_selectors.hpp | 146 ----------------------------------------
   sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/vertex_selectors.t.cpp | 79 ++++++++++++---------
   6 files changed, 206 insertions(+), 379 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-08-01 23:26:04 EDT (Wed, 01 Aug 2007)
@@ -6,12 +6,14 @@
 TARGET=dbg_exc_mt
 
 PACKAGE_OBJECTS=container_selectors.o facet_selectors.o \
- vertex_selectors.o halfedge_selectors.o halfedge_functions.o
+ facet_functions.o vertex_selectors.o vertex_functions.o \
+ halfedge_selectors.o halfedge_functions.o
 
 PACKAGE_LIBRARY=libhalfedge_ds.a
 
 TEST_DRIVERS=container_selectors.t facet_selectors.t \
- vertex_selectors.t halfedge_selectors.t halfedge_functions.t
+ facet_functions.t vertex_selectors.t vertex_functions.t \
+ halfedge_selectors.t halfedge_functions.t
 
 .SUFFIXES:
 .SUFFIXES: ${TARGET}.o .o .cpp .hpp
@@ -31,8 +33,12 @@
 
 facet_selectors.o: container_selectors.hpp
 
+facet_functions.o: facet_selectors.hpp
+
 vertex_selectors.o: container_selectors.hpp
 
+vertex_functions.o: vertex_selectors.hpp
+
 halfedge_selectors.o: container_selectors.hpp
 
 halfedge_functions.o: halfedge_functions.hpp \
@@ -50,8 +56,12 @@
 
 facet_selectors.t.o: container_selectors.hpp
 
+facet_functions.t.o: facet_selectors.hpp
+
 vertex_selectors.t.o: container_selectors.hpp
 
+vertex_functions.t.o: vertex_selectors.hpp
+
 halfedge_selectors.t.o: container_selectors.hpp
 
 halfedge_functions.t.o: halfedge_functions.hpp \
@@ -64,21 +74,25 @@
 
 facet_selectors.t: container_selectors.o
 
+facet_functions.t: facet_selectors.o
+
 vertex_selectors.t: container_selectors.o
 
+vertex_functions.t: vertex_selectors.o
+
 halfedge_selectors.t: container_selectors.o
 
 halfedge_functions.t.o: halfedge_selectors.o container_selectors.o
 
 ## UTILITIES
 
-clean: testclean
+clean: realclean testclean
 
 testclean:
         - rm *.t.o
         - rm *.t
 
-realclean: clean
+realclean:
         - rm *.o
         - rm ${PACKAGE_LIBRARY}
 

Added: sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/facet_functions.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/facet_functions.cpp 2007-08-01 23:26:04 EDT (Wed, 01 Aug 2007)
@@ -0,0 +1,3 @@
+//facet_functions.cpp -*- C++ -*-
+
+#include <boost/hdstl/halfedge_ds/facet_functions.hpp>

Added: sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/facet_functions.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/facet_functions.hpp 2007-08-01 23:26:04 EDT (Wed, 01 Aug 2007)
@@ -0,0 +1,119 @@
+//facet_functions.hpp -*- C++ -*-
+//
+//@PURPOSE: Provide free functions for accessing and manipulating facets.
+//
+//@DESCRIPTION: This file provides free functions for accessing and
+// manipulating facets. The list of these functions are as follows:
+//
+// - facets_begin: returns an iterator to the first facet in the 'hds' as part of the 'FacetListHDS' concept.
+// - facets_end: returns an iterator after the last facet in the 'hds' as part of the 'FacetListHDS' concept.
+// - num_facets: returns the number of facets in the 'hds' as part of the 'FacetListHDS' concept.
+// - halfedge: returns a descriptor to one of the halfedges around this facets cycle as part of the 'FacetHDS'
+// concept.
+// - facet: returns the facet to the left of the given halfedge 'h' in the 'hds' as part of the 'FacetHDS'
+// concept.
+// - set_facet: sets the facet 'f' as the facet on the left for halfedge 'h' in the 'hds' as part of the
+// 'MutableFacetHDS' concept.
+// - new_facet: creates a facet and adds it into the 'hds' as part of the 'MutableFacetHDS' concept.
+// - delete_facet: removes the given facet 'f' from the 'hds' as part of the 'MutableFacetHDS' concept.
+//
+//@SEE_ALSO: {hds_concepts.hpp, container_selectors.hpp, facet_selectors.hpp}
+
+
+#ifndef BOOST_HDSTL_FACET_FUNCTIONS_HPP
+#define BOOST_HDSTL_FACET_FUNCTIONS_HPP 1
+
+#include <boost/hdstl/halfedge_ds/facet_selectors.hpp>
+
+namespace boost {
+namespace hdstl {
+ // ====================
+ // FacetListHDS Concept
+ // ====================
+
+// FREE FUNCTIONS
+template <typename FacetS, typename HalfedgeDescriptor, typename FacetBase>
+typename facet_gen<FacetS, HalfedgeDescriptor, FacetBase>::facet_iterator
+facets_begin(facet_gen<FacetS, HalfedgeDescriptor, FacetBase>& hds)
+ // Returns a facet iterator to the beginning of the container member of 'hds'. The value type
+ // of the facet iterator is a facet descriptor.
+{
+ typedef typename facet_gen<FacetS,
+ HalfedgeDescriptor,
+ FacetBase>::ContainerGen ContainerGen;
+ return ContainerGen::container_begin(hds.m_container);
+}
+
+template <typename FacetS, typename HalfedgeDescriptor, typename FacetBase>
+typename facet_gen<FacetS, HalfedgeDescriptor, FacetBase>::facet_iterator
+facets_end(facet_gen<FacetS, HalfedgeDescriptor, FacetBase>& hds)
+ // Returns a facet iterator to the end of the container member of 'hds'. The value type
+ // of the facet iterator is a facet descriptor.
+{
+ typedef typename facet_gen<FacetS,
+ HalfedgeDescriptor,
+ FacetBase>::ContainerGen ContainerGen;
+ return ContainerGen::container_end(hds.m_container);
+}
+
+template <typename FacetS, typename HalfedgeDescriptor, typename FacetBase>
+typename facet_gen<FacetS, HalfedgeDescriptor, FacetBase>::size_type
+num_facets(facet_gen<FacetS, HalfedgeDescriptor, FacetBase> const& hds)
+ // Returns the number of facets in the 'hds'. Return type is the size type specific to
+ // the container used, specified in container selectors.
+{
+ return hds.m_container.size();
+}
+
+ // =======================
+ // FacetHDS Concept
+ // =======================
+
+template <typename FacetS, typename HalfedgeDescriptor, typename FacetBase>
+HalfedgeDescriptor
+halfedge(typename facet_gen<FacetS, HalfedgeDescriptor, FacetBase>::facet_descriptor const& f,
+ facet_gen<FacetS, HalfedgeDescriptor, FacetBase>& hds)
+ // Returns a halfedge descriptor to one of the halfedges around this facet in the 'hds'.
+{
+ return facet_gen<FacetS, HalfedgeDescriptor, FacetBase>::ContainerGen
+ ::value(f, hds.m_container).m_facetLink;
+}
+
+template <typename FacetS, typename HalfedgeDescriptor, typename FacetBase>
+typename facet_gen<FacetS, HalfedgeDescriptor, FacetBase>::facet_descriptor
+facet(HalfedgeDescriptor h, facet_gen<FacetS, HalfedgeDescriptor, FacetBase>& hds)
+ // Returns a facet descriptor to the facet left of the halfedge given by the descriptor 'h' in the 'hds'.
+{
+ return facet_gen<FacetS, HalfedgeDescriptor, FacetBase>::ContainerGen
+ ::value(h, hds.m_container).m_facet;
+}
+
+ // =======================
+ // MutableFacetHDS Concept
+ // =======================
+
+template <typename FacetS, typename HalfedgeDescriptor, typename FacetBase>
+void
+set_facet(HalfedgeDescriptor h, typename facet_gen<FacetS, HalfedgeDescriptor, FacetBase>::facet_descriptor f,
+ facet_gen<FacetS, HalfedgeDescriptor, FacetBase>& hds)
+ // Sets the facet specified by 'f' as the facet on the left for halfedge specified by 'h' in the 'hds'.
+{
+ facet_gen<FacetS, HalfedgeDescriptor, FacetBase>::ContainerGen::value(h, hds.m_container).m_facet = f;
+}
+
+template <typename FacetS, typename HalfedgeDescriptor, typename FacetBase>
+typename facet_gen<FacetS, HalfedgeDescriptor, FacetBase>::facet_descriptor
+new_facet(facet_gen<FacetS, HalfedgeDescriptor, FacetBase>& hds)
+ // Create a new facet, add it to the 'hds' and return the descriptor of this new facet.
+{
+ typedef typename facet_gen<FacetS, HalfedgeDescriptor, FacetBase>::ContainerGen ContainerGen;
+ typedef typename facet_gen<FacetS, HalfedgeDescriptor, FacetBase>::facet_type facet_type;
+
+ facet_type facet_f;
+ return *ContainerGen::container_add(facet_f, hds.m_container);
+}
+
+} // namespace hdstl
+} // namespace boost
+
+#endif

Added: sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/facet_functions.t.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/facet_functions.t.cpp 2007-08-01 23:26:04 EDT (Wed, 01 Aug 2007)
@@ -0,0 +1,242 @@
+//facet_selectors.hpp -*- C++ -*-
+//
+//@OVERVIEW: The components under test are the stored_facet and facet_gen
+//classes. We must make sure that all selectors are suitably defined and
+//that the selection is done properly.
+//
+//@TEST_PLAN: First create an instance of all the selectors (to make sure they
+// exist, and verify that there are no more than tested). Then instantiate the
+// 'facet_gen' for all selector values, with base facet classes and without
+// base facet classes and verify that each combination compiles and works.
+
+#include <boost/hdstl/halfedge_ds/facet_selectors.hpp>
+#include <boost/hdstl/halfedge_ds/facet_functions.hpp>
+
+#include <boost/test/minimal.hpp>
+
+#include <set>
+#include <string>
+#include <vector>
+
+using namespace boost::hdstl;
+using namespace std;
+
+// ===========================================================================
+// SELECTION CLASSES
+// ===========================================================================
+
+template <typename FacetS>
+bool selection_requirements(FacetS const&) {
+ return false;
+}
+
+bool selection_requirements(noFacetS const&) {
+ return true;
+}
+
+template <typename Selector>
+bool selection_requirements(facetS<Selector, false> const&) {
+ return true;
+}
+
+template <typename Selector>
+bool selection_requirements(facetS<Selector, true> const&) {
+ return true;
+}
+
+// ===========================================================================
+// CLASS FACET_GEN
+// ===========================================================================
+
+template<typename FacetGen>
+bool facet_gen_requirements_void_noFacetLink() {
+
+ // Types must exist.
+ typedef typename FacetGen::facet_selector facet_selector;
+ typedef typename FacetGen::facet_descriptor facet_descriptor;
+ typedef typename FacetGen::facet_iterator facet_iterator;
+ typedef typename FacetGen::facet_type facet_type;
+ typedef typename FacetGen::container_type container_type;
+
+ facet_type fa;
+ facet_type fb;
+ facet_type fc;
+ facet_type fd;
+ facet_type array[] = { fa, fb, fc, fd };
+
+ // Construct a facet_gen object whose container contains array.
+ // Verify that facets_begin(), facets_end(), and num_facets() work.
+ // Access the facets and, if the has_facet_links is set, check that the
+ // halfedge() works.
+ container_type temp_con(array,array+4);
+ FacetGen facetGen;
+ facetGen.m_container = temp_con;
+ BOOST_CHECK(( num_facets(facetGen) == 4 ));
+
+ facet_descriptor fn = new_facet(facetGen);
+ (void) fn;
+ BOOST_CHECK(( num_facets(facetGen) == 5 ));
+ return true;
+}
+
+template <typename FacetGen>
+bool facet_gen_requirements_void() {
+
+ // Types must exist.
+ typedef typename FacetGen::facet_selector facet_selector;
+ typedef typename FacetGen::facet_descriptor facet_descriptor;
+ typedef typename FacetGen::facet_iterator facet_iterator;
+ typedef typename FacetGen::facet_type facet_type;
+ typedef typename FacetGen::container_type container_type;
+
+ facet_type fa(1);
+ facet_type fb(2);
+ facet_type fc(3);
+ facet_type fd(4);
+ facet_type array[] = { fa, fb, fc, fd };
+
+ // Construct a facet_gen object whose container contains array.
+ // Verify that facets_begin(), facets_end(), and num_facets() work.
+ // Access the facets and, if the has_facet_links is set, check that the
+ // halfedge() works.
+ container_type temp_con(array,array+4);
+ FacetGen facetGen;
+ facetGen.m_container = temp_con;
+ BOOST_CHECK(( num_facets(facetGen) == 4 ));
+ BOOST_CHECK(( facets_begin(facetGen)->m_facetLink == 1 ));
+ BOOST_CHECK(( (--facets_end(facetGen))->m_facetLink == 4 ));
+
+ BOOST_CHECK(( halfedge(*facets_begin(facetGen), facetGen) == 1 ));
+ BOOST_CHECK(( halfedge(*--facets_end(facetGen), facetGen) == 4 ));
+
+ facet_descriptor fn = new_facet(facetGen);
+ (void) fn;
+ BOOST_CHECK(( num_facets(facetGen) == 5 ));
+
+
+ return true;
+}
+
+template <typename FacetGen, typename Base>
+bool facet_gen_requirements_noFacetLink() {
+
+ typedef typename FacetGen::facet_selector facet_selector;
+ typedef typename FacetGen::facet_descriptor facet_descriptor;
+ typedef typename FacetGen::facet_iterator facet_iterator;
+ typedef typename FacetGen::facet_type facet_type;
+ typedef typename FacetGen::container_type container_type;
+
+ facet_type fa(Base(1));
+ facet_type fb(Base(2));
+ facet_type fc(Base(3));
+ facet_type fd(Base(4));
+ facet_type array[] = { fa, fb, fc, fd }; (void) array;
+
+ // Same checks as before:
+ container_type temp_con(array,array+4);
+ FacetGen facetGen;
+ facetGen.m_container = temp_con;
+ BOOST_CHECK(( num_facets(facetGen) == 4 ));
+
+ // Plus: get the base back from the facets and making sure it matches.
+ BOOST_CHECK(( facets_begin(facetGen)->base() == 1 ));
+ BOOST_CHECK(( (--facets_end(facetGen))->base() == 4 ));
+
+ facet_descriptor fn = new_facet(facetGen);
+ (void) fn;
+ BOOST_CHECK(( num_facets(facetGen) == 5 ));
+
+ return true;
+}
+
+template <typename FacetGen, typename Base>
+bool facet_gen_requirements() {
+
+ typedef typename FacetGen::facet_selector facet_selector;
+ typedef typename FacetGen::facet_descriptor facet_descriptor;
+ typedef typename FacetGen::facet_iterator facet_iterator;
+ typedef typename FacetGen::facet_type facet_type;
+ typedef typename FacetGen::container_type container_type;
+
+ facet_type fa(1, Base(1));
+ facet_type fb(2, Base(2));
+ facet_type fc(3, Base(3));
+ facet_type fd(4, Base(4));
+ facet_type array[] = { fa, fb, fc, fd }; (void) array;
+
+ // Same checks as before:
+ container_type temp_con(array,array+4);
+ FacetGen facetGen;
+ facetGen.m_container = temp_con;
+ BOOST_CHECK(( num_facets(facetGen) == 4 ));
+
+ BOOST_CHECK(( facets_begin(facetGen)->m_facetLink == 1 ));
+ BOOST_CHECK(( (--facets_end(facetGen))->m_facetLink == 4 ));
+
+ BOOST_CHECK(( halfedge(*facets_begin(facetGen), facetGen) == 1 ));
+ BOOST_CHECK(( halfedge(*--facets_end(facetGen), facetGen) == 4 ));
+
+ // Plus: get the base back from the facets and making sure it matches.
+ BOOST_CHECK(( facets_begin(facetGen)->base() == 1 ));
+ BOOST_CHECK(( (--facets_end(facetGen))->base() == 4 ));
+
+ facet_descriptor fn = new_facet(facetGen);
+ (void) fn;
+ BOOST_CHECK(( num_facets(facetGen) == 5 ));
+ return true;
+}
+
+// ===========================================================================
+// USAGE EXAMPLE
+// ===========================================================================
+
+// The usage example is the component itself.
+
+// ===========================================================================
+// BOOST TEST APPARATUS
+// ===========================================================================
+
+int test_main(int, char **)
+{
+ BOOST_CHECK(( selection_requirements(noFacetS()) ));
+ BOOST_CHECK(( selection_requirements(facetS<listS,true>()) ));
+ BOOST_CHECK(( selection_requirements(facetS<listS,false>()) ));
+
+ BOOST_CHECK(( facet_gen_requirements_void_noFacetLink<
+ facet_gen<facetS<listS,false>, int, void> >() ));
+ BOOST_CHECK(( facet_gen_requirements_void<
+ facet_gen<facetS<listS,true>, int, void> >() ));
+
+ BOOST_CHECK(( facet_gen_requirements_noFacetLink<
+ facet_gen<facetS<listS,false>, int, int>, int >() ));
+ BOOST_CHECK(( facet_gen_requirements<
+ facet_gen<facetS<listS,true>, int, int>, int >() ));
+
+ // BOOST_CHECK(( facet_gen_requirements<
+ // facet_gen<facetS<listS,false>, int, custom_facet_base> >() ));
+
+ // BOOST_CHECK(( facet_gen_requirements<
+ // facet_gen<facetS<listS,true>, int, custom_facet_base> >() ));
+
+ BOOST_CHECK(( selection_requirements(facetS<vecS,true>()) ));
+ BOOST_CHECK(( selection_requirements(facetS<vecS,false>()) ));
+
+ BOOST_CHECK(( facet_gen_requirements_void_noFacetLink<
+ facet_gen<facetS<vecS,false>, int, void> >() ));
+ BOOST_CHECK(( facet_gen_requirements_void<
+ facet_gen<facetS<vecS,true>, int, void> >() ));
+
+ BOOST_CHECK(( facet_gen_requirements_noFacetLink<
+ facet_gen<facetS<vecS,false>, int, int>, int >() ));
+ BOOST_CHECK(( facet_gen_requirements<
+ facet_gen<facetS<vecS,true>, int, int>, int >() ));
+
+ // BOOST_CHECK(( facet_gen_requirements<
+ // facet_gen<facetS<vecS,false>, int, custom_facet_base> >() ));
+ // BOOST_CHECK(( facet_gen_requirements<
+ // facet_gen<facetS<vecS,true>, int, custom_facet_base> >() ));
+ //BOOST_CHECK(( usageExample() ));
+
+ return 0;
+}
+

Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/facet_selectors.hpp
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/facet_selectors.hpp (original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/facet_selectors.hpp 2007-08-01 23:26:04 EDT (Wed, 01 Aug 2007)
@@ -117,33 +117,6 @@
 // // The actual container for the facets, from which facets can be obtained.
 // };
 //..
-// and the supporting functions, required by the 'FacetListHDS' concept, are:
-//..
-// // FREE FUNCTIONS
-// template <typename FacetS, typename HalfedgeDescriptor, typename FacetBase>
-// typename facet_gen<FacetS, HalfedgeDescriptor, FacetBase>::iterator
-// facets_begin(facet_gen<FacetS, HalfedgeDescriptor, FacetBase> const& hds) {
-// typedef typename facet_gen<FacetS,
-// HalfedgeDescriptor,
-// FacetBase>::container_gen_type ContainerGen;
-// return ContainerGen::container_begin(hds.m_container);
-// }
-//
-// template <typename FacetS, typename HalfedgeDescriptor, typename FacetBase>
-// typename facet_gen<FacetS, HalfedgeDescriptor, FacetBase>::iterator
-// facets_end(facet_gen<FacetS, HalfedgeDescriptor, FacetBase> const& hds) {
-// typedef typename facet_gen<FacetS,
-// HalfedgeDescriptor,
-// FacetBase>::container_gen_type ContainerGen;
-// return ContainerGen::container_end(hds.m_container);
-// }
-//
-// template <typename FacetS, typename HalfedgeDescriptor, typename FacetBase>
-// typename facet_gen<FacetS, HalfedgeDescriptor, FacetBase>::size_type;
-// facets_end(facet_gen<FacetS, HalfedgeDescriptor, FacetBase> const& hds) {
-// return hds.m_container.size();
-// }
-//..
 
 #ifndef BOOST_HDSTL_FACET_SELECTORS_HPP
 #define BOOST_HDSTL_FACET_SELECTORS_HPP 1
@@ -305,91 +278,6 @@
         // The actual container for the facets, from which facets can be obtained.
 };
 
- // ====================
- // FacetListHDS Concept
- // ====================
-
-// FREE FUNCTIONS
-template <typename FacetS, typename HalfedgeDescriptor, typename FacetBase>
-typename facet_gen<FacetS, HalfedgeDescriptor, FacetBase>::facet_iterator
-facets_begin(facet_gen<FacetS, HalfedgeDescriptor, FacetBase>& hds)
- // Returns a facet iterator to the beginning of the container member of 'hds'. The value type
- // of the facet iterator is a facet descriptor.
-{
- typedef typename facet_gen<FacetS,
- HalfedgeDescriptor,
- FacetBase>::ContainerGen ContainerGen;
- return ContainerGen::container_begin(hds.m_container);
-}
-
-template <typename FacetS, typename HalfedgeDescriptor, typename FacetBase>
-typename facet_gen<FacetS, HalfedgeDescriptor, FacetBase>::facet_iterator
-facets_end(facet_gen<FacetS, HalfedgeDescriptor, FacetBase>& hds)
- // Returns a facet iterator to the end of the container member of 'hds'. The value type
- // of the facet iterator is a facet descriptor.
-{
- typedef typename facet_gen<FacetS,
- HalfedgeDescriptor,
- FacetBase>::ContainerGen ContainerGen;
- return ContainerGen::container_end(hds.m_container);
-}
-
-template <typename FacetS, typename HalfedgeDescriptor, typename FacetBase>
-typename facet_gen<FacetS, HalfedgeDescriptor, FacetBase>::size_type
-num_facets(facet_gen<FacetS, HalfedgeDescriptor, FacetBase> const& hds)
- // Returns the number of facets in the 'hds'. Return type is the size type specific to
- // the container used, specified in container selectors.
-{
- return hds.m_container.size();
-}
-
- // =======================
- // FacetHDS Concept
- // =======================
-
-template <typename FacetS, typename HalfedgeDescriptor, typename FacetBase>
-HalfedgeDescriptor
-halfedge(typename facet_gen<FacetS, HalfedgeDescriptor, FacetBase>::facet_descriptor const& f,
- facet_gen<FacetS, HalfedgeDescriptor, FacetBase>& hds)
- // Returns a halfedge descriptor to one of the halfedges around this facet in the 'hds'.
-{
- return facet_gen<FacetS, HalfedgeDescriptor, FacetBase>::ContainerGen
- ::value(f, hds.m_container).m_facetLink;
-}
-
-template <typename FacetS, typename HalfedgeDescriptor, typename FacetBase>
-typename facet_gen<FacetS, HalfedgeDescriptor, FacetBase>::facet_descriptor
-facet(HalfedgeDescriptor h, facet_gen<FacetS, HalfedgeDescriptor, FacetBase>& hds)
- // Returns a facet descriptor to the facet left of the halfedge given by the descriptor 'h' in the 'hds'.
-{
- return facet_gen<FacetS, HalfedgeDescriptor, FacetBase>::ContainerGen
- ::value(h, hds.m_container).m_facet;
-}
-
- // =======================
- // MutableFacetHDS Concept
- // =======================
-
-template <typename FacetS, typename HalfedgeDescriptor, typename FacetBase>
-void
-set_facet(HalfedgeDescriptor h, typename facet_gen<FacetS, HalfedgeDescriptor, FacetBase>::facet_descriptor f,
- facet_gen<FacetS, HalfedgeDescriptor, FacetBase>& hds)
- // Sets the facet specified by 'f' as the facet on the left for halfedge specified by 'h' in the 'hds'.
-{
- facet_gen<FacetS, HalfedgeDescriptor, FacetBase>::ContainerGen::value(h, hds.m_container).m_facet = f;
-}
-
-template <typename FacetS, typename HalfedgeDescriptor, typename FacetBase>
-typename facet_gen<FacetS, HalfedgeDescriptor, FacetBase>::facet_descriptor
-new_facet(facet_gen<FacetS, HalfedgeDescriptor, FacetBase>& hds)
- // Create a new facet, add it to the 'hds' and return the descriptor of this new facet.
-{
- typedef typename facet_gen<FacetS, HalfedgeDescriptor, FacetBase>::ContainerGen ContainerGen;
- typedef typename facet_gen<FacetS, HalfedgeDescriptor, FacetBase>::facet_type facet_type;
-
- facet_type facet_f;
- return *ContainerGen::container_add(facet_f, hds.m_container);
-}
 
 } // namespace hdstl
 } // namespace boost

Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/facet_selectors.t.cpp
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/facet_selectors.t.cpp (original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/facet_selectors.t.cpp 2007-08-01 23:26:04 EDT (Wed, 01 Aug 2007)
@@ -1,4 +1,4 @@
-//facet_selectors.hpp -*- C++ -*-
+//facet_selectors.t.cpp -*- C++ -*-
 //
 //@OVERVIEW: The components under test are the stored_facet and facet_gen
 //classes. We must make sure that all selectors are suitably defined and
@@ -56,6 +56,7 @@
     typedef typename FacetGen::facet_iterator facet_iterator;
     typedef typename FacetGen::facet_type facet_type;
     typedef typename FacetGen::container_type container_type;
+ typedef typename FacetGen::ContainerGen container_gen;
 
     facet_type fa;
     facet_type fb;
@@ -64,17 +65,18 @@
     facet_type array[] = { fa, fb, fc, fd };
     
     // Construct a facet_gen object whose container contains array.
- // Verify that facets_begin(), facets_end(), and num_facets() work.
- // Access the facets and, if the has_facet_links is set, check that the
- // halfedge() works.
- container_type temp_con(array,array+4);
+ // Verify that facets_begin, facets_end work.
+ container_type facets(array,array+4);
     FacetGen facetGen;
- facetGen.m_container = temp_con;
- BOOST_CHECK(( num_facets(facetGen) == 4 ));
+ facetGen.m_container = facets;
+
+ BOOST_CHECK(( facetGen.m_container.size() == 4 ));
     
- facet_descriptor fn = new_facet(facetGen);
- (void) fn;
- BOOST_CHECK(( num_facets(facetGen) == 5 ));
+ facet_iterator facets_begin = container_gen::container_begin(facetGen.m_container);
+ facet_descriptor first_facet = *facets_begin;
+ facet_type& first_facet_ref = container_gen::value(first_facet, facetGen.m_container);
+
+ BOOST_CHECK(( &first_facet_ref == &(*facetGen.m_container.begin())));
     return true;
 }
 
@@ -87,6 +89,7 @@
     typedef typename FacetGen::facet_iterator facet_iterator;
     typedef typename FacetGen::facet_type facet_type;
     typedef typename FacetGen::container_type container_type;
+ typedef typename FacetGen::ContainerGen container_gen;
 
     facet_type fa(1);
     facet_type fb(2);
@@ -95,24 +98,22 @@
     facet_type array[] = { fa, fb, fc, fd };
     
     // Construct a facet_gen object whose container contains array.
- // Verify that facets_begin(), facets_end(), and num_facets() work.
- // Access the facets and, if the has_facet_links is set, check that the
- // halfedge() works.
+ // Verify that facets_begin, facets_end work.
     container_type temp_con(array,array+4);
     FacetGen facetGen;
     facetGen.m_container = temp_con;
- BOOST_CHECK(( num_facets(facetGen) == 4 ));
- BOOST_CHECK(( facets_begin(facetGen)->m_facetLink == 1 ));
- BOOST_CHECK(( (--facets_end(facetGen))->m_facetLink == 4 ));
-
- BOOST_CHECK(( halfedge(*facets_begin(facetGen), facetGen) == 1 ));
- BOOST_CHECK(( halfedge(*--facets_end(facetGen), facetGen) == 4 ));
-
- facet_descriptor fn = new_facet(facetGen);
- (void) fn;
- BOOST_CHECK(( num_facets(facetGen) == 5 ));
     
+ BOOST_CHECK(( facetGen.m_container.size() == 4 ));
 
+ facet_iterator facets_begin = container_gen::container_begin(facetGen.m_container);
+ facet_iterator facets_end = --container_gen::container_end(facetGen.m_container);
+ facet_descriptor first_facet = *facets_begin;
+ facet_type& first_facet_ref = container_gen::value(first_facet, facetGen.m_container);
+
+ BOOST_CHECK(( &first_facet_ref == &(*facetGen.m_container.begin())));
+ BOOST_CHECK(( facets_begin->m_facetLink == 1 ));
+ BOOST_CHECK(( facets_end->m_facetLink == 4 ));
+
     return true;
 }
 
@@ -124,6 +125,7 @@
     typedef typename FacetGen::facet_iterator facet_iterator;
     typedef typename FacetGen::facet_type facet_type;
     typedef typename FacetGen::container_type container_type;
+ typedef typename FacetGen::ContainerGen container_gen;
 
     facet_type fa(Base(1));
     facet_type fb(Base(2));
@@ -135,15 +137,19 @@
     container_type temp_con(array,array+4);
     FacetGen facetGen;
     facetGen.m_container = temp_con;
- BOOST_CHECK(( num_facets(facetGen) == 4 ));
 
- // Plus: get the base back from the facets and making sure it matches.
- BOOST_CHECK(( facets_begin(facetGen)->base() == 1 ));
- BOOST_CHECK(( (--facets_end(facetGen))->base() == 4 ));
+ BOOST_CHECK(( facetGen.m_container.size() == 4 ));
 
- facet_descriptor fn = new_facet(facetGen);
- (void) fn;
- BOOST_CHECK(( num_facets(facetGen) == 5 ));
+ facet_iterator facets_begin = container_gen::container_begin(facetGen.m_container);
+ facet_iterator facets_end = --container_gen::container_end(facetGen.m_container);
+ facet_descriptor first_facet = *facets_begin;
+ facet_type& first_facet_ref = container_gen::value(first_facet, facetGen.m_container);
+
+ BOOST_CHECK(( &first_facet_ref == &(*facetGen.m_container.begin())));
+
+ // Plus: get the base back from the facets and making sure it matches.
+ BOOST_CHECK(( facets_begin->base() == 1 ));
+ BOOST_CHECK(( facets_end->base() == 4 ));
 
     return true;
 }
@@ -156,6 +162,7 @@
     typedef typename FacetGen::facet_iterator facet_iterator;
     typedef typename FacetGen::facet_type facet_type;
     typedef typename FacetGen::container_type container_type;
+ typedef typename FacetGen::ContainerGen container_gen;
 
     facet_type fa(1, Base(1));
     facet_type fb(2, Base(2));
@@ -167,21 +174,22 @@
     container_type temp_con(array,array+4);
     FacetGen facetGen;
     facetGen.m_container = temp_con;
- BOOST_CHECK(( num_facets(facetGen) == 4 ));
-
- BOOST_CHECK(( facets_begin(facetGen)->m_facetLink == 1 ));
- BOOST_CHECK(( (--facets_end(facetGen))->m_facetLink == 4 ));
     
- BOOST_CHECK(( halfedge(*facets_begin(facetGen), facetGen) == 1 ));
- BOOST_CHECK(( halfedge(*--facets_end(facetGen), facetGen) == 4 ));
+ BOOST_CHECK(( facetGen.m_container.size() == 4 ));
+
+ facet_iterator facets_begin = container_gen::container_begin(facetGen.m_container);
+ facet_iterator facets_end = --container_gen::container_end(facetGen.m_container);
+ facet_descriptor first_facet = *facets_begin;
+ facet_type& first_facet_ref = container_gen::value(first_facet, facetGen.m_container);
+
+ BOOST_CHECK(( &first_facet_ref == &(*facetGen.m_container.begin())));
+ BOOST_CHECK(( facets_begin->m_facetLink == 1 ));
+ BOOST_CHECK(( facets_end->m_facetLink == 4 ));
     
     // Plus: get the base back from the facets and making sure it matches.
- BOOST_CHECK(( facets_begin(facetGen)->base() == 1 ));
- BOOST_CHECK(( (--facets_end(facetGen))->base() == 4 ));
+ BOOST_CHECK(( facets_begin->base() == 1 ));
+ BOOST_CHECK(( facets_end->base() == 4 ));
 
- facet_descriptor fn = new_facet(facetGen);
- (void) fn;
- BOOST_CHECK(( num_facets(facetGen) == 5 ));
     return true;
 }
 

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-08-01 23:26:04 EDT (Wed, 01 Aug 2007)
@@ -334,9 +334,16 @@
 typename Config::halfedge_descriptor
 next_in_facet(typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor h,
                halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>& hds)
- // returns a halfedge descriptor to the halfedge succeeding the given halfedge in the adjacent facet cycle, when
- // facet cycles are oriented in counter-clockwise order. Uses the 'HalfedgeS::next_tag' to determine
- // the primary way the next links are set, and does conversion using the helper classes if necessary.
+ // Return a descriptor to the halfedge succeeding the specified halfedge 'h' in the adjacent facet cycle, when facet
+ // cycles are ordered in counter-clockwise order. The nested 'next_tag' type in the template parameter 'HalfedgeS'
+ // determines the primary forward link used to deduce the 'next_at_source' link, according to the following table:
+ //..
+ // next_tag primary link return value
+ // -------- ------------ ------------
+ // next_in_facet_tag next_in_facet next_in_facet(h)
+ // next_at_source_tag next_at_source next_at_source(opposite(h))
+ // next_at_target_tag next_at_target opposite(next_at_target(h))
+ //..
 {
     typedef typename halfedge_gen<HalfedgeS,
                                   VertexDescriptor,FacetDescriptor, Config
@@ -352,9 +359,18 @@
 typename Config::halfedge_descriptor
 next_at_source(typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor h,
                halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>& hds)
- // returns a halfedge descriptor to the halfedge succeeding the given halfedge around the source vertex, when
- // halfedges are ordered around a given vertex in clockwise order. Uses the 'HalfedgeS::next_tag' to determine
- // the primary way the next links are set, and does conversion using the helper classes if necessary.
+ // Return a descriptor to the halfedge succeeding the specified halfedge 'h'
+ // around its source vertex, when halfedges are ordered around a given
+ // source vertex in clockwise order. The nested 'next_tag' type in the
+ // template parameter 'HalfedgeS' determines the primary forward link used
+ // to deduce the 'next_at_source' link, according to the following table:
+ //..
+ // next_tag primary link return value
+ // -------- ------------ ------------
+ // next_in_facet_tag next_in_facet next_in_facet(opposite(h))
+ // next_at_source_tag next_at_source next_at_source(h)
+ // next_at_target_tag next_at_target opposite(next_at_target(opposite(h)))
+ //..
 {
     typedef typename halfedge_gen<HalfedgeS,
                                   VertexDescriptor,FacetDescriptor, Config
@@ -370,9 +386,18 @@
 typename Config::halfedge_descriptor
 next_at_target(typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor h,
                halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>& hds)
- // returns a halfedge descriptor to the halfedge succeeding the given halfedge around the target vertex, when
- // halfedges are ordered around a given vertex in clockwise order. Uses the 'HalfedgeS::next_tag' to determine
- // the primary way the next links are set, and does conversion using the helper classes if necessary.
+ // Return a descriptor to the halfedge succeeding the specified halfedge 'h'
+ // around its target vertex, when halfedges are ordered around a given
+ // target vertex in clockwise order. The nested 'next_tag' type in the
+ // template parameter 'HalfedgeS' determines the primary forward link used
+ // to deduce the 'next_at_target' link, according to the following table:
+ //..
+ // next_tag primary link return value
+ // -------- ------------ ------------
+ // next_in_facet_tag next_in_facet opposite(next_in_facet(h))
+ // next_at_source_tag next_at_source opposite(next_at_source(opposite(h)))
+ // next_at_target_tag next_at_target next_at_target(h)
+ //..
 {
     typedef typename halfedge_gen<HalfedgeS,
                                   VertexDescriptor,FacetDescriptor, Config
@@ -561,9 +586,18 @@
 typename Config::halfedge_descriptor
 prev_in_facet(typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor h,
                halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>& hds)
- // returns a halfedge descriptor to the halfedge preceeding the given halfedge in the adjacent facet cycle, when
- // facet cycles are oriented in counter-clockwise order. Uses the 'HalfedgeS::prev_tag' to determine
- // the primary way the prev links are set, and does conversion using the helper classes if necessary.
+ // Return a descriptor to the halfedge preceeding the specified halfedge 'h'
+ // in the adjacent facet cycle, when facet cycles are oriented in
+ // counter-clockwise order. The nested 'prev_tag' type in the
+ // template parameter 'HalfedgeS' determines the primary backward link used
+ // to deduce the 'prev_at_source' link, according to the following table:
+ //..
+ // prev_tag primary link return value
+ // -------- ------------ ------------
+ // prev_in_facet_tag prev_in_facet prev_in_facet(h)
+ // prev_at_source_tag prev_at_source opposite(prev_at_source(h))
+ // prev_at_target_tag prev_at_target prev_at_target(opposite(h))
+ //..
 {
     typedef typename halfedge_gen<HalfedgeS,
                                   VertexDescriptor,FacetDescriptor, Config
@@ -579,9 +613,18 @@
 typename Config::halfedge_descriptor
 prev_at_source(typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor h,
                halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>& hds)
- // returns a halfedge descriptor to the halfedge preceeding the given halfedge around the source vertex, when
- // halfedges are ordered around a given vertex in clockwise order. Uses the 'HalfedgeS::prev_tag' to determine
- // the primary way the prev links are set, and does conversion using the helper classes if necessary.
+ // Return a descriptor to the halfedge preceding the specified halfedge 'h'
+ // around its source vertex, when halfedges are ordered around a given
+ // source vertex in clockwise order. The nested 'prev_tag' type in the
+ // template parameter 'HalfedgeS' determines the primary backward link used
+ // to deduce the 'prev_at_source' link, according to the following table:
+ //..
+ // prev_tag primary link return value
+ // -------- ------------ ------------
+ // prev_in_facet_tag prev_in_facet opposite(prev_in_facet(h))
+ // prev_at_source_tag prev_at_source prev_at_source(h)
+ // prev_at_target_tag prev_at_target opposite(prev_at_target(opposite(h)))
+ //..
 {
     typedef typename halfedge_gen<HalfedgeS,
                                   VertexDescriptor,FacetDescriptor, Config
@@ -597,9 +640,18 @@
 typename Config::halfedge_descriptor
 prev_at_target(typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor h,
                halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>& hds)
- // returns a halfedge descriptor to the halfedge preceeding the given halfedge around the target vertex, when
- // halfedges are ordered around a given vertex in clockwise order. Uses the 'HalfedgeS::prev_tag' to determine
- // the primary way the prev links are set, and does conversion using the helper classes if necessary.
+ // Return a descriptor to the halfedge preceding the specified halfedge 'h'
+ // around its target vertex, when halfedges are ordered around a given
+ // target vertex in clockwise order. The nested 'prev_tag' type in the
+ // template parameter 'HalfedgeS' determines the primary backward link used
+ // to deduce the 'prev_at_target' link, according to the following table:
+ //..
+ // prev_tag primary link return value
+ // -------- ------------ ------------
+ // prev_in_facet_tag prev_in_facet prev_in_facet(opposite(h))
+ // prev_at_source_tag prev_at_source prev_at_source(h)
+ // prev_at_target_tag prev_at_target opposite(prev_at_target(opposite(h)))
+ //..
 {
     typedef typename halfedge_gen<HalfedgeS,
                                   VertexDescriptor,FacetDescriptor, Config
@@ -668,10 +720,10 @@
 set_next_in_facet(typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor h,
                   typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor g,
                   halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>& hds)
- // sets 'g' as the halfedge succeeding 'h' in the adjacent facet cycle, when facet cycles are oriented in
- // counter-clockwise order. The helper functions do selections based on containerS and the 'Halfedge::next_tag'.
- // Also the 'this_tag' and the 'Halfedge::next_tag' should match for properly setting the next link. Otherwise
- // compile time error will follow.
+ // Set halfedge 'g' as the halfedge succeeding 'h' in the adjacent facet cycle, when facet cycles are oriented in
+ // counter-clockwise order. This function only works on data structure 'hds' which has set its primary forward
+ // link as 'next_in_facet' defined by the the nested 'next_tag' in template parameter 'HalfedgeS'.
+ // Otherwise compile time error will follow.
 {
     typedef typename halfedge_gen<HalfedgeS,
                                   VertexDescriptor,FacetDescriptor, Config
@@ -691,10 +743,10 @@
 set_next_at_source(typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor h,
                   typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor g,
                   halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>& hds)
- // sets 'g' as the halfedge succeeding 'h' around the source vertex of 'h', when halfedges are ordered around a
- // given vertex in clockwise order. The helper functions do selections based on containerS and the
- // 'Halfedge::next_tag'. Also the 'this_tag' and the 'Halfedge::next_tag' should match for properly setting the
- // next link. Otherwise compile time error will follow.
+ // Set halfedge 'g' as the halfedge succeeding 'h' around the source vertex of 'h', when halfedges are ordered
+ // around a given vertex in clockwise order. This function only works on data structure 'hds' which has set its
+ // primary forward link as 'next_at_source' defined by the the nested 'next_tag' in template parameter 'HalfedgeS'.
+ // Otherwise compile time error will follow.
 {
     typedef typename halfedge_gen<HalfedgeS,
                                   VertexDescriptor,FacetDescriptor, Config
@@ -714,10 +766,10 @@
 set_next_at_target(typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor h,
                   typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor g,
                   halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>& hds)
- // sets 'g' as the halfedge succeeding 'h' around the target vertex of 'h', when halfedges are ordered around a
- // given vertex in clockwise order. The helper functions do selections based on containerS and the
- // 'Halfedge::next_tag'. Also the 'this_tag' and the 'Halfedge::next_tag' should match for properly setting the
- // next link. Otherwise compile time error will follow.
+ // Set halfedge 'g' as the halfedge succeeding 'h' around the target vertex of 'h', when halfedges are ordered
+ // around a given vertex in clockwise order. This function only works on data structure 'hds' which has set its
+ // primary forward link as 'next_at_target' defined by the the nested 'next_tag' in template parameter 'HalfedgeS'.
+ // Otherwise compile time error will follow.
 {
     typedef typename halfedge_gen<HalfedgeS,
                                   VertexDescriptor,FacetDescriptor, Config
@@ -789,10 +841,10 @@
 set_prev_in_facet(typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor h,
                   typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor g,
                   halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>& hds)
- // sets 'g' as the halfedge preceeding 'h' in the adjacent facet cycle, when facet cycles are oriented in
- // counter-clockwise order. The helper functions do selections based on containerS and the 'Halfedge::prev_tag'.
- // Also the 'this_tag' and the 'Halfedge::prev_tag' should match for properly setting the prev link. Otherwise
- // compile time error will follow.
+ // Set halfedge 'g' as the halfedge preceeding 'h' in the adjacent facet cycle, when facet cycles are oriented in
+ // counter-clockwise order. This function only works on data structure 'hds' which has set its primary backward
+ // link as 'prev_in_facet' defined by the the nested 'prev_tag' in template parameter 'HalfedgeS'.
+ // Otherwise compile time error will follow.
 {
     typedef typename halfedge_gen<HalfedgeS,
                                   VertexDescriptor,FacetDescriptor, Config
@@ -812,10 +864,10 @@
 set_prev_at_source(typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor h,
                   typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor g,
                   halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>& hds)
- // sets 'g' as the halfedge preceeding 'h' around the source vertex of 'h', when halfedges are ordered around a
- // given vertex in clockwise order. The helper functions do selections based on containerS and the
- // 'Halfedge::prev_tag'. Also the 'this_tag' and the 'Halfedge::prev_tag' should match for properly setting the
- // prev link. Otherwise compile time error will follow.
+ // Set halfedge 'g' as the halfedge preceeding 'h' around the source vertex of 'h', when halfedges are ordered
+ // around a given vertex in clockwise order. This function only works on data structure 'hds' which has set its
+ // primary backward link as 'prev_at_source' defined by the the nested 'prev_tag' in template parameter 'HalfedgeS'.
+ // Otherwise compile time error will follow.
 {
     typedef typename halfedge_gen<HalfedgeS,
                                   VertexDescriptor,FacetDescriptor, Config
@@ -835,10 +887,10 @@
 set_prev_at_target(typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor h,
                   typename halfedge_gen<HalfedgeS, VertexDescriptor,FacetDescriptor, Config>::halfedge_descriptor g,
                   halfedge_gen<HalfedgeS, VertexDescriptor, FacetDescriptor, Config>& hds)
- // sets 'g' as the halfedge preceeding 'h' around the target vertex of 'h', when halfedges are ordered around a
- // given vertex in clockwise order. The helper functions do selections based on containerS and the
- // 'Halfedge::prev_tag'. Also the 'this_tag' and the 'Halfedge::prev_tag' should match for properly setting the
- // prev link. Otherwise compile time error will follow.
+ // Set halfedge 'g' as the halfedge preceeding 'h' around the target vertex of 'h', when halfedges are ordered
+ // around a given vertex in clockwise order. This function only works on data structure 'hds' which has set its
+ // primary backward link as 'prev_at_target' defined by the the nested 'prev_tag' in template parameter 'HalfedgeS'.
+ // Otherwise compile time error will follow.
 {
     typedef typename halfedge_gen<HalfedgeS,
                                   VertexDescriptor,FacetDescriptor, Config

Added: sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/vertex_functions.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/vertex_functions.cpp 2007-08-01 23:26:04 EDT (Wed, 01 Aug 2007)
@@ -0,0 +1,3 @@
+//vertex_functions.cpp -*- C++ -*-
+
+#include <boost/hdstl/halfedge_ds/vertex_functions.hpp>

Added: sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/vertex_functions.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/vertex_functions.hpp 2007-08-01 23:26:04 EDT (Wed, 01 Aug 2007)
@@ -0,0 +1,156 @@
+//vertex_functions.hpp -*- C++ -*-
+//
+//@PURPOSE: Provide free functions for accessing and manipulating vertices.
+//
+//@DESCRIPTION: This file provides free functions for accessing and
+// manipulating vertices. The list of these functions are as follows:
+//
+// - vertices_begin: returns an iterator to the first vertex in the 'hds' as part of the 'VertexListHDS' concept.
+// - vertices_end: returns an iterator after the last vertex in the 'hds' as part of the 'VertexListHDS' concept.
+// - num_vertices: returns the number of vertices in the 'hds' as part of the 'VertexListHDS' concept.
+// - halfedge: returns a descriptor to one of the halfedges around this vertex cycle as part of the 'VertexHDS'
+// concept.
+// - source: returns the descriptor of the source vertex of the given halfedge 'h' in the 'hds' as part of
+// the 'VertexHDS' concept.
+// - target: returns the descriptor of the target vertex of the given halfedge 'h' in the 'hds' as part of
+// the 'VertexHDS' concept.
+// - set_vertex: sets the vertex 'v' as the vertex on the left for halfedge 'h' in the 'hds' as part of the
+// 'MutableVertexHDS' concept.
+// - new_vertex: creates a vertex and adds it into the 'hds' as part of the 'MutableVertexHDS' concept.
+// - delete_vertex: removes the given vertex 'v' from the 'hds' as part of the 'MutableVertexHDS' concept.
+//
+//@SEE_ALSO: {hds_concepts.hpp, container_selectors.hpp, vertex_selectors.hpp}
+
+#ifndef BOOST_HDSTL_VERTEX_FUNCTIONS_HPP
+#define BOOST_HDSTL_VERTEX_FUNCTIONS_HPP 1
+
+#include <boost/hdstl/halfedge_ds/vertex_selectors.hpp>
+
+namespace boost {
+namespace hdstl {
+ // =====================
+ // VertexListHDS Concept
+ // =====================
+
+// FREE FUNCTIONS
+template <typename VertexS, typename HalfedgeDescriptor, typename VertexBase>
+typename vertex_gen<VertexS, HalfedgeDescriptor,VertexBase>::vertex_iterator
+vertices_begin(vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>& hds)
+ // Returns a vertex iterator to the beginning of the container member of 'hds'. The value type
+ // of the vertex iterator is a vertex descriptor.
+{
+ typedef typename vertex_gen<VertexS, HalfedgeDescriptor,
+ VertexBase>::ContainerGen ContainerGen;
+ return ContainerGen::container_begin(hds.m_container);
+}
+
+template <typename VertexS, typename HalfedgeDescriptor, typename VertexBase>
+typename vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>::vertex_iterator
+vertices_end(vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>& hds)
+ // Returns a vertex iterator to the end of the container member of 'hds'. The value type
+ // of the vertex iterator is a vertex descriptor.
+{
+ typedef typename vertex_gen<VertexS, HalfedgeDescriptor,
+ VertexBase>::ContainerGen ContainerGen;
+ return ContainerGen::container_end(hds.m_container);
+}
+
+template <typename VertexS, typename HalfedgeDescriptor, typename VertexBase>
+typename vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>::size_type
+num_vertices(vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>& hds)
+ // Returns the number of vertexs in the 'hds'. Return type is the size type specific to
+ // the container used, specified in container selectors.
+{
+ return hds.m_container.size();
+}
+
+template <typename VertexS, typename HalfedgeDescriptor, typename VertexBase>
+HalfedgeDescriptor
+halfedge(typename vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>::vertex_descriptor const& v,
+ vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>& hds)
+ // Returns a halfedge descriptor to one of the halfedges around this vertex in the 'hds'.
+{
+ return vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>::ContainerGen
+ ::value(v, hds.m_container).m_vertexLink;
+}
+
+ // =======================
+ // VertexHDS Concept
+ // =======================
+
+template <typename VertexS, typename HalfedgeDescriptor, typename VertexBase>
+typename vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>::vertex_descriptor
+source(HalfedgeDescriptor h, vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>& hds)
+ // Returns a vertex descriptor to the source vertex of the halfedge given by the descriptor 'h' in the 'hds'.
+{
+ return vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>::ContainerGen
+ ::value(h, hds.m_container).m_source;
+}
+
+template <typename VertexS, typename HalfedgeDescriptor, typename VertexBase>
+typename vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>::vertex_descriptor
+target(HalfedgeDescriptor h, vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>& hds)
+ // Returns a vertex descriptor to the target vertex of the halfedge given by the descriptor 'h' in the 'hds'.
+{
+ return vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>::ContainerGen
+ ::value(h, hds.m_container).m_target;
+}
+
+ // ========================
+ // MutableVertexHDS Concept
+ // ========================
+
+namespace detail {
+
+template <typename HalfedgeDescriptor, typename VertexDescriptor, typename VertexGen, bool IsSource>
+struct set_vertex_helper
+ // Helper function for setting the vertex 'v' as the source vertex for halfedge 'h' in 'hds'.
+{
+ static void
+ set_vertex(HalfedgeDescriptor h, VertexDescriptor v, VertexGen& hds)
+ {
+ VertexGen::ContainerGen::value(h, hds.m_container).m_source = v;
+ }
+};
+
+template <typename HalfedgeDescriptor, typename VertexDescriptor, typename VertexGen>
+struct set_vertex_helper<HalfedgeDescriptor, VertexDescriptor, VertexGen, false>
+ // Helper function for setting the vertex 'v' as the target vertex for halfedge 'h' in 'hds'.
+{
+ static void
+ set_vertex(HalfedgeDescriptor h, VertexDescriptor v, VertexGen& hds)
+ {
+ VertexGen::ContainerGen::value(h, hds.m_container).m_target = v;
+ }
+};
+
+} // end namespace detail
+
+template <typename VertexS, typename HalfedgeDescriptor, typename VertexBase>
+void
+set_vertex(HalfedgeDescriptor h, typename vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>::vertex_descriptor v,
+ vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>& hds)
+ // Sets the vertex specified by 'v' as the source or target vertex of the halfedge specified by 'h' in the 'hds'.
+ // The selection is based on the VertexS::is_source selector.
+{
+ typedef vertex_gen<VertexS, HalfedgeDescriptor, VertexBase> VertexGen;
+ typedef typename VertexGen::vertex_descriptor vertex_descriptor;
+ detail::set_vertex_helper<HalfedgeDescriptor, vertex_descriptor, VertexGen, VertexS::is_source>::set_vertex(h,v,hds);
+}
+
+template <typename VertexS, typename HalfedgeDescriptor, typename VertexBase>
+typename vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>::vertex_descriptor
+new_vertex(vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>& hds)
+ // Create a new vertex, add it to the 'hds' and return the descriptor of this new vertex.
+{
+ typedef typename vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>::ContainerGen ContainerGen;
+ typedef typename vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>::vertex_type vertex_type;
+
+ vertex_type vertex_f;
+ return *ContainerGen::container_add(vertex_f, hds.m_container);
+}
+
+} // namespace hdstl
+} // namespace boost
+
+#endif

Added: sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/vertex_functions.t.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/vertex_functions.t.cpp 2007-08-01 23:26:04 EDT (Wed, 01 Aug 2007)
@@ -0,0 +1,275 @@
+//vertex_selectors.hpp -*- C++ -*-
+//
+//@OVERVIEW: The components under test are the stored_vertex and vertex_gen
+//classes. We must make sure that all selectors are suitably defined and
+//that the selection is done properly.
+//
+//@TEST_PLAN: First create an instance of all the selectors (to make sure they
+// exist, and verify that there are no more than tested). Then instantiate the
+// 'vertex_gen' for all selector values, with base vertex classes and without
+// base vertex classes and verify that each combination compiles and works.
+
+#include <boost/hdstl/halfedge_ds/vertex_functions.hpp>
+
+#include <boost/test/minimal.hpp>
+
+#include <set>
+#include <string>
+#include <vector>
+
+using namespace boost::hdstl;
+using namespace std;
+
+// ===========================================================================
+// SELECTION CLASSES
+// ===========================================================================
+
+template <typename VertexS>
+bool selection_requirements(VertexS const&) {
+ return false;
+}
+
+bool selection_requirements(noVertexS const&) {
+ return true;
+}
+
+template <typename Selector>
+bool selection_requirements(vertexS<Selector, false, sourceS> const&) {
+ return true;
+}
+
+template <typename Selector>
+bool selection_requirements(vertexS<Selector, false, targetS> const&) {
+ return true;
+}
+
+template <typename Selector>
+bool selection_requirements(vertexS<Selector, true, sourceS> const&) {
+ return true;
+}
+
+template <typename Selector>
+bool selection_requirements(vertexS<Selector, true, targetS> const&) {
+ return true;
+}
+
+// ===========================================================================
+// CLASS VERTEX_GEN
+// ===========================================================================
+
+template<typename VertexGen>
+bool vertex_gen_requirements_void_noVertexLink() {
+
+ // Types must exist.
+ typedef typename VertexGen::vertex_selector vertex_selector;
+ typedef typename VertexGen::vertex_descriptor vertex_descriptor;
+ typedef typename VertexGen::vertex_iterator vertex_iterator;
+ typedef typename VertexGen::vertex_type vertex_type;
+ typedef typename VertexGen::container_type container_type;
+
+ vertex_type fa;
+ vertex_type fb;
+ vertex_type fc;
+ vertex_type fd;
+ vertex_type array[] = { fa, fb, fc, fd };
+
+ // Construct a vertex_gen object whose container contains array.
+ // Verify that vertices_begin(), vertices_end(), and num_vertices() work.
+ // Access the vertices and, if the has_vertex_links is set, check that the
+ // halfedge() works.
+ container_type temp_con(array,array+4);
+ VertexGen vertexGen;
+ vertexGen.m_container = temp_con;
+ BOOST_CHECK(( num_vertices(vertexGen) == 4 ));
+
+ vertex_descriptor vn = new_vertex(vertexGen);
+ (void) vn;
+ BOOST_CHECK(( num_vertices(vertexGen) == 5 ));
+ return true;
+}
+
+template <typename VertexGen>
+bool vertex_gen_requirements_void() {
+
+ // Types must exist.
+ typedef typename VertexGen::vertex_selector vertex_selector;
+ typedef typename VertexGen::vertex_descriptor vertex_descriptor;
+ typedef typename VertexGen::vertex_iterator vertex_iterator;
+ typedef typename VertexGen::vertex_type vertex_type;
+ typedef typename VertexGen::container_type container_type;
+
+ vertex_type fa(1);
+ vertex_type fb(2);
+ vertex_type fc(3);
+ vertex_type fd(4);
+ vertex_type array[] = { fa, fb, fc, fd };
+
+ // Construct a vertex_gen object whose container contains array.
+ // Verify that vertices_begin(), vertices_end(), and num_vertices() work.
+ // Access the vertices and, if the has_vertex_links is set, check that the
+ // halfedge() works.
+ container_type temp_con(array,array+4);
+ VertexGen vertexGen;
+ vertexGen.m_container = temp_con;
+ BOOST_CHECK(( num_vertices(vertexGen) == 4 ));
+ BOOST_CHECK(( vertices_begin(vertexGen)->m_vertexLink == 1 ));
+ BOOST_CHECK(( (--vertices_end(vertexGen))->m_vertexLink == 4 ));
+
+ BOOST_CHECK(( halfedge(*vertices_begin(vertexGen), vertexGen) == 1 ));
+ BOOST_CHECK(( halfedge(*(--vertices_end(vertexGen)), vertexGen) == 4 ));
+
+ vertex_descriptor vn = new_vertex(vertexGen);
+ (void) vn;
+ BOOST_CHECK(( num_vertices(vertexGen) == 5 ));
+
+ return true;
+}
+
+template <typename VertexGen, typename Base>
+bool vertex_gen_requirements_noVertexLink() {
+
+ typedef typename VertexGen::vertex_selector vertex_selector;
+ typedef typename VertexGen::vertex_descriptor vertex_descriptor;
+ typedef typename VertexGen::vertex_iterator vertex_iterator;
+ typedef typename VertexGen::vertex_type vertex_type;
+ typedef typename VertexGen::container_type container_type;
+
+ vertex_type fa(Base(1));
+ vertex_type fb(Base(2));
+ vertex_type fc(Base(3));
+ vertex_type fd(Base(4));
+ vertex_type array[] = { fa, fb, fc, fd }; (void) array;
+
+ // Same checks as before:
+ //BOOST_CHECK(( vertex_gen_requirements_void_noVertexLink<VertexGen>() ));
+ container_type temp_con(array,array+4);
+ VertexGen vertexGen;
+ vertexGen.m_container = temp_con;
+ BOOST_CHECK(( num_vertices(vertexGen) == 4 ));
+
+ // Plus: get the base back from the vertices and making sure it matches.
+ BOOST_CHECK(( vertices_begin(vertexGen)->base() == 1 ));
+ BOOST_CHECK(( (--vertices_end(vertexGen))->base() == 4 ));
+
+
+ vertex_descriptor vn = new_vertex(vertexGen);
+ (void) vn;
+ BOOST_CHECK(( num_vertices(vertexGen) == 5 ));
+
+ return true;
+}
+
+template <typename VertexGen, typename Base>
+bool vertex_gen_requirements() {
+
+ typedef typename VertexGen::vertex_selector vertex_selector;
+ typedef typename VertexGen::vertex_descriptor vertex_descriptor;
+ typedef typename VertexGen::vertex_iterator vertex_iterator;
+ typedef typename VertexGen::vertex_type vertex_type;
+ typedef typename VertexGen::container_type container_type;
+
+ vertex_type fa(1, Base(1));
+ vertex_type fb(2, Base(2));
+ vertex_type fc(3, Base(3));
+ vertex_type fd(4, Base(4));
+ vertex_type array[] = { fa, fb, fc, fd }; (void) array;
+
+ // Same checks as before:
+ container_type temp_con(array,array+4);
+ VertexGen vertexGen;
+ vertexGen.m_container = temp_con;
+ BOOST_CHECK(( num_vertices(vertexGen) == 4 ));
+
+ BOOST_CHECK(( vertices_begin(vertexGen)->m_vertexLink == 1 ));
+ BOOST_CHECK(( (--vertices_end(vertexGen))->m_vertexLink == 4 ));
+
+ BOOST_CHECK(( halfedge(*vertices_begin(vertexGen), vertexGen) == 1 ));
+ BOOST_CHECK(( halfedge(*(--vertices_end(vertexGen)), vertexGen) == 4 ));
+
+ // Plus: get the base back from the vertices and making sure it matches.
+ BOOST_CHECK(( vertices_begin(vertexGen)->base() == 1 ));
+ BOOST_CHECK(( (--vertices_end(vertexGen))->base() == 4 ));
+
+
+ vertex_descriptor vn = new_vertex(vertexGen);
+ (void) vn;
+ BOOST_CHECK(( num_vertices(vertexGen) == 5 ));
+ return true;
+}
+
+// ===========================================================================
+// USAGE EXAMPLE
+// ===========================================================================
+
+// The usage example is the component itself.
+
+// ===========================================================================
+// BOOST TEST APPARATUS
+// ===========================================================================
+
+int test_main(int, char **)
+{
+ BOOST_CHECK(( selection_requirements(noVertexS()) ));
+
+ BOOST_CHECK(( selection_requirements(vertexS<listS,true, sourceS>()) ));
+ BOOST_CHECK(( selection_requirements(vertexS<listS,false, sourceS>()) ));
+ BOOST_CHECK(( selection_requirements(vertexS<listS,true, targetS>()) ));
+ BOOST_CHECK(( selection_requirements(vertexS<listS,false, targetS>()) ));
+
+ BOOST_CHECK(( vertex_gen_requirements_void_noVertexLink<
+ vertex_gen<vertexS<listS,false, sourceS>, int, void> >() ));
+ BOOST_CHECK(( vertex_gen_requirements_void_noVertexLink<
+ vertex_gen<vertexS<listS,false, targetS>, int, void> >() ));
+ BOOST_CHECK(( vertex_gen_requirements_void<
+ vertex_gen<vertexS<listS,true, sourceS>, int, void> >() ));
+ BOOST_CHECK(( vertex_gen_requirements_void<
+ vertex_gen<vertexS<listS,true, targetS>, int, void> >() ));
+
+ BOOST_CHECK(( vertex_gen_requirements_noVertexLink<
+ vertex_gen<vertexS<listS,false, sourceS>, int, int>, int >() ));
+ BOOST_CHECK(( vertex_gen_requirements_noVertexLink<
+ vertex_gen<vertexS<listS,false, targetS>, int, int>, int >() ));
+ BOOST_CHECK(( vertex_gen_requirements<
+ vertex_gen<vertexS<listS,true, sourceS>, int, int>, int >() ));
+ BOOST_CHECK(( vertex_gen_requirements<
+ vertex_gen<vertexS<listS,true, targetS>, int, int>, int >() ));
+
+ // BOOST_CHECK(( vertex_gen_requirements<
+ // vertex_gen<vertexS<listS,false>, int, custom_vertex_base> >() ));
+
+ // BOOST_CHECK(( vertex_gen_requirements<
+ // vertex_gen<vertexS<listS,true>, int, custom_vertex_base> >() ));
+
+ BOOST_CHECK(( selection_requirements(vertexS<vecS,true, sourceS>()) ));
+ BOOST_CHECK(( selection_requirements(vertexS<vecS,false, sourceS>()) ));
+ BOOST_CHECK(( selection_requirements(vertexS<vecS,true, targetS>()) ));
+ BOOST_CHECK(( selection_requirements(vertexS<vecS,false, targetS>()) ));
+
+ BOOST_CHECK(( vertex_gen_requirements_void_noVertexLink<
+ vertex_gen<vertexS<vecS,false, sourceS>, int, void> >() ));
+ BOOST_CHECK(( vertex_gen_requirements_void_noVertexLink<
+ vertex_gen<vertexS<vecS,false, targetS>, int, void> >() ));
+ BOOST_CHECK(( vertex_gen_requirements_void<
+ vertex_gen<vertexS<vecS,true, sourceS>, int, void> >() ));
+ BOOST_CHECK(( vertex_gen_requirements_void<
+ vertex_gen<vertexS<vecS,true, targetS>, int, void> >() ));
+
+ BOOST_CHECK(( vertex_gen_requirements_noVertexLink<
+ vertex_gen<vertexS<vecS,false, sourceS>, int, int>, int >() ));
+ BOOST_CHECK(( vertex_gen_requirements_noVertexLink<
+ vertex_gen<vertexS<vecS,false, targetS>, int, int>, int >() ));
+ BOOST_CHECK(( vertex_gen_requirements<
+ vertex_gen<vertexS<vecS,true, sourceS>, int, int>, int >() ));
+ BOOST_CHECK(( vertex_gen_requirements<
+ vertex_gen<vertexS<vecS,true, targetS>, int, int>, int >() ));
+
+ // BOOST_CHECK(( vertex_gen_requirements<
+ // vertex_gen<vertexS<vecS,false>, int, custom_vertex_base> >() ));
+
+ // BOOST_CHECK(( vertex_gen_requirements<
+ // vertex_gen<vertexS<vecS,true>, int, custom_vertex_base> >() ));
+ //BOOST_CHECK(( usageExample() ));
+
+ return 0;
+}
+

Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/vertex_selectors.hpp
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/vertex_selectors.hpp (original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/vertex_selectors.hpp 2007-08-01 23:26:04 EDT (Wed, 01 Aug 2007)
@@ -161,31 +161,6 @@
 // // obtained.
 // };
 //..
-// and the supporting functions, required by the 'VertexListHDS' concept, are:
-//..
-// // FREE FUNCTIONS
-// template <typename VertexS, typename HalfedgeDescriptor>
-// typename vertex_gen<VertexS, HalfedgeDescriptor>::iterator
-// vertices_begin(vertex_gen<VertexS, HalfedgeDescriptor> const& hds) {
-// typedef typename vertex_gen<VertexS,
-// HalfedgeDescriptor>::ContainerGen ContainerGen;
-// return ContainerGen::container_begin(hds.m_container);
-// }
-//
-// template <typename VertexS, typename HalfedgeDescriptor>
-// typename vertex_gen<VertexS, HalfedgeDescriptor>::iterator
-// vertices_end(vertex_gen<VertexS, HalfedgeDescriptor> const& hds) {
-// typedef typename vertex_gen<VertexS,
-// HalfedgeDescriptor>::ContainerGen ContainerGen;
-// return ContainerGen::container_end(hds.m_container);
-// }
-//
-// template <typename VertexS, typename HalfedgeDescriptor>
-// typename vertex_gen<VertexS, HalfedgeDescriptor>::size_type
-// num_vertices(vertex_gen<VertexS, HalfedgeDescriptor> const& hds) {
-// return hds.m_container.size();
-// }
-//..
 
 #ifndef BOOST_HDSTL_VERTEX_SELECTORS_HPP
 #define BOOST_HDSTL_VERTEX_SELECTORS_HPP 1
@@ -387,127 +362,6 @@
         // obtained.
 };
                    
- // =====================
- // VertexListHDS Concept
- // =====================
-
-// FREE FUNCTIONS
-template <typename VertexS, typename HalfedgeDescriptor, typename VertexBase>
-typename vertex_gen<VertexS, HalfedgeDescriptor,VertexBase>::vertex_iterator
-vertices_begin(vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>& hds)
- // Returns a vertex iterator to the beginning of the container member of 'hds'. The value type
- // of the vertex iterator is a vertex descriptor.
-{
- typedef typename vertex_gen<VertexS, HalfedgeDescriptor,
- VertexBase>::ContainerGen ContainerGen;
- return ContainerGen::container_begin(hds.m_container);
-}
-
-template <typename VertexS, typename HalfedgeDescriptor, typename VertexBase>
-typename vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>::vertex_iterator
-vertices_end(vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>& hds)
- // Returns a vertex iterator to the end of the container member of 'hds'. The value type
- // of the vertex iterator is a vertex descriptor.
-{
- typedef typename vertex_gen<VertexS, HalfedgeDescriptor,
- VertexBase>::ContainerGen ContainerGen;
- return ContainerGen::container_end(hds.m_container);
-}
-
-template <typename VertexS, typename HalfedgeDescriptor, typename VertexBase>
-typename vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>::size_type
-num_vertices(vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>& hds)
- // Returns the number of vertexs in the 'hds'. Return type is the size type specific to
- // the container used, specified in container selectors.
-{
- return hds.m_container.size();
-}
-
-template <typename VertexS, typename HalfedgeDescriptor, typename VertexBase>
-HalfedgeDescriptor
-halfedge(typename vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>::vertex_descriptor const& v,
- vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>& hds)
- // Returns a halfedge descriptor to one of the halfedges around this vertex in the 'hds'.
-{
- return vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>::ContainerGen
- ::value(v, hds.m_container).m_vertexLink;
-}
-
- // =======================
- // VertexHDS Concept
- // =======================
-
-template <typename VertexS, typename HalfedgeDescriptor, typename VertexBase>
-typename vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>::vertex_descriptor
-source(HalfedgeDescriptor h, vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>& hds)
- // Returns a vertex descriptor to the source vertex of the halfedge given by the descriptor 'h' in the 'hds'.
-{
- return vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>::ContainerGen
- ::value(h, hds.m_container).m_source;
-}
-
-template <typename VertexS, typename HalfedgeDescriptor, typename VertexBase>
-typename vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>::vertex_descriptor
-target(HalfedgeDescriptor h, vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>& hds)
- // Returns a vertex descriptor to the target vertex of the halfedge given by the descriptor 'h' in the 'hds'.
-{
- return vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>::ContainerGen
- ::value(h, hds.m_container).m_target;
-}
-
- // ========================
- // MutableVertexHDS Concept
- // ========================
-
-namespace detail {
-
-template <typename HalfedgeDescriptor, typename VertexDescriptor, typename VertexGen, bool IsSource>
-struct set_vertex_helper
- // Helper function for setting the vertex 'v' as the source vertex for halfedge 'h' in 'hds'.
-{
- static void
- set_vertex(HalfedgeDescriptor h, VertexDescriptor v, VertexGen& hds)
- {
- VertexGen::ContainerGen::value(h, hds.m_container).m_source = v;
- }
-};
-
-template <typename HalfedgeDescriptor, typename VertexDescriptor, typename VertexGen>
-struct set_vertex_helper<HalfedgeDescriptor, VertexDescriptor, VertexGen, false>
- // Helper function for setting the vertex 'v' as the target vertex for halfedge 'h' in 'hds'.
-{
- static void
- set_vertex(HalfedgeDescriptor h, VertexDescriptor v, VertexGen& hds)
- {
- VertexGen::ContainerGen::value(h, hds.m_container).m_target = v;
- }
-};
-
-} // end namespace detail
-
-template <typename VertexS, typename HalfedgeDescriptor, typename VertexBase>
-void
-set_vertex(HalfedgeDescriptor h, typename vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>::vertex_descriptor v,
- vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>& hds)
- // Sets the vertex specified by 'v' as the source or target vertex of the halfedge specified by 'h' in the 'hds'.
- // The selection is based on the VertexS::is_source selector.
-{
- typedef vertex_gen<VertexS, HalfedgeDescriptor, VertexBase> VertexGen;
- typedef typename VertexGen::vertex_descriptor vertex_descriptor;
- detail::set_vertex_helper<HalfedgeDescriptor, vertex_descriptor, VertexGen, VertexS::is_source>::set_vertex(h,v,hds);
-}
-
-template <typename VertexS, typename HalfedgeDescriptor, typename VertexBase>
-typename vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>::vertex_descriptor
-new_vertex(vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>& hds)
- // Create a new vertex, add it to the 'hds' and return the descriptor of this new vertex.
-{
- typedef typename vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>::ContainerGen ContainerGen;
- typedef typename vertex_gen<VertexS, HalfedgeDescriptor, VertexBase>::vertex_type vertex_type;
-
- vertex_type vertex_f;
- return *ContainerGen::container_add(vertex_f, hds.m_container);
-}
 
 } // namespace hdstl
 } // namespace boost

Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/vertex_selectors.t.cpp
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/vertex_selectors.t.cpp (original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/vertex_selectors.t.cpp 2007-08-01 23:26:04 EDT (Wed, 01 Aug 2007)
@@ -66,6 +66,7 @@
     typedef typename VertexGen::vertex_iterator vertex_iterator;
     typedef typename VertexGen::vertex_type vertex_type;
     typedef typename VertexGen::container_type container_type;
+ typedef typename VertexGen::ContainerGen container_gen;
 
     vertex_type fa;
     vertex_type fb;
@@ -80,11 +81,14 @@
     container_type temp_con(array,array+4);
     VertexGen vertexGen;
     vertexGen.m_container = temp_con;
- BOOST_CHECK(( num_vertices(vertexGen) == 4 ));
     
- vertex_descriptor vn = new_vertex(vertexGen);
- (void) vn;
- BOOST_CHECK(( num_vertices(vertexGen) == 5 ));
+ BOOST_CHECK(( vertexGen.m_container.size() == 4 ));
+
+ vertex_iterator vertexs_begin = container_gen::container_begin(vertexGen.m_container);
+ vertex_descriptor first_vertex = *vertexs_begin;
+ vertex_type& first_vertex_ref = container_gen::value(first_vertex, vertexGen.m_container);
+
+ BOOST_CHECK(( &first_vertex_ref == &(*vertexGen.m_container.begin())));
     return true;
 }
 
@@ -97,6 +101,7 @@
     typedef typename VertexGen::vertex_iterator vertex_iterator;
     typedef typename VertexGen::vertex_type vertex_type;
     typedef typename VertexGen::container_type container_type;
+ typedef typename VertexGen::ContainerGen container_gen;
 
     vertex_type fa(1);
     vertex_type fb(2);
@@ -111,16 +116,17 @@
     container_type temp_con(array,array+4);
     VertexGen vertexGen;
     vertexGen.m_container = temp_con;
- BOOST_CHECK(( num_vertices(vertexGen) == 4 ));
- BOOST_CHECK(( vertices_begin(vertexGen)->m_vertexLink == 1 ));
- BOOST_CHECK(( (--vertices_end(vertexGen))->m_vertexLink == 4 ));
-
- BOOST_CHECK(( halfedge(*vertices_begin(vertexGen), vertexGen) == 1 ));
- BOOST_CHECK(( halfedge(*(--vertices_end(vertexGen)), vertexGen) == 4 ));
-
- vertex_descriptor vn = new_vertex(vertexGen);
- (void) vn;
- BOOST_CHECK(( num_vertices(vertexGen) == 5 ));
+
+ BOOST_CHECK(( vertexGen.m_container.size() == 4 ));
+
+ vertex_iterator vertices_begin = container_gen::container_begin(vertexGen.m_container);
+ vertex_iterator vertices_end = --container_gen::container_end(vertexGen.m_container);
+ vertex_descriptor first_vertex = *vertices_begin;
+ vertex_type& first_vertex_ref = container_gen::value(first_vertex, vertexGen.m_container);
+
+ BOOST_CHECK(( &first_vertex_ref == &(*vertexGen.m_container.begin())));
+ BOOST_CHECK(( vertices_begin->m_vertexLink == 1 ));
+ BOOST_CHECK(( vertices_end->m_vertexLink == 4 ));
     
     return true;
 }
@@ -133,6 +139,7 @@
     typedef typename VertexGen::vertex_iterator vertex_iterator;
     typedef typename VertexGen::vertex_type vertex_type;
     typedef typename VertexGen::container_type container_type;
+ typedef typename VertexGen::ContainerGen container_gen;
 
     vertex_type fa(Base(1));
     vertex_type fb(Base(2));
@@ -145,16 +152,19 @@
     container_type temp_con(array,array+4);
     VertexGen vertexGen;
     vertexGen.m_container = temp_con;
- BOOST_CHECK(( num_vertices(vertexGen) == 4 ));
-
- // Plus: get the base back from the vertices and making sure it matches.
- BOOST_CHECK(( vertices_begin(vertexGen)->base() == 1 ));
- BOOST_CHECK(( (--vertices_end(vertexGen))->base() == 4 ));
+
+ BOOST_CHECK(( vertexGen.m_container.size() == 4 ));
 
+ vertex_iterator vertices_begin = container_gen::container_begin(vertexGen.m_container);
+ vertex_iterator vertices_end = --container_gen::container_end(vertexGen.m_container);
+ vertex_descriptor first_vertex = *vertices_begin;
+ vertex_type& first_vertex_ref = container_gen::value(first_vertex, vertexGen.m_container);
+
+ BOOST_CHECK(( &first_vertex_ref == &(*vertexGen.m_container.begin())));
     
- vertex_descriptor vn = new_vertex(vertexGen);
- (void) vn;
- BOOST_CHECK(( num_vertices(vertexGen) == 5 ));
+ // Plus: get the base back from the vertices and making sure it matches.
+ BOOST_CHECK(( vertices_begin->base() == 1 ));
+ BOOST_CHECK(( vertices_end->base() == 4 ));
 
     return true;
 }
@@ -167,6 +177,7 @@
     typedef typename VertexGen::vertex_iterator vertex_iterator;
     typedef typename VertexGen::vertex_type vertex_type;
     typedef typename VertexGen::container_type container_type;
+ typedef typename VertexGen::ContainerGen container_gen;
 
     vertex_type fa(1, Base(1));
     vertex_type fb(2, Base(2));
@@ -178,22 +189,22 @@
     container_type temp_con(array,array+4);
     VertexGen vertexGen;
     vertexGen.m_container = temp_con;
- BOOST_CHECK(( num_vertices(vertexGen) == 4 ));
-
- BOOST_CHECK(( vertices_begin(vertexGen)->m_vertexLink == 1 ));
- BOOST_CHECK(( (--vertices_end(vertexGen))->m_vertexLink == 4 ));
+
+ BOOST_CHECK(( vertexGen.m_container.size() == 4 ));
 
- BOOST_CHECK(( halfedge(*vertices_begin(vertexGen), vertexGen) == 1 ));
- BOOST_CHECK(( halfedge(*(--vertices_end(vertexGen)), vertexGen) == 4 ));
+ vertex_iterator vertices_begin = container_gen::container_begin(vertexGen.m_container);
+ vertex_iterator vertices_end = --container_gen::container_end(vertexGen.m_container);
+ vertex_descriptor first_vertex = *vertices_begin;
+ vertex_type& first_vertex_ref = container_gen::value(first_vertex, vertexGen.m_container);
+
+ BOOST_CHECK(( &first_vertex_ref == &(*vertexGen.m_container.begin())));
+ BOOST_CHECK(( vertices_begin->m_vertexLink == 1 ));
+ BOOST_CHECK(( vertices_end->m_vertexLink == 4 ));
     
     // Plus: get the base back from the vertices and making sure it matches.
- BOOST_CHECK(( vertices_begin(vertexGen)->base() == 1 ));
- BOOST_CHECK(( (--vertices_end(vertexGen))->base() == 4 ));
+ BOOST_CHECK(( vertices_begin->base() == 1 ));
+ BOOST_CHECK(( vertices_end->base() == 4 ));
 
-
- vertex_descriptor vn = new_vertex(vertexGen);
- (void) vn;
- BOOST_CHECK(( num_vertices(vertexGen) == 5 ));
     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