|
Boost-Commit : |
From: huseyinakcan_at_[hidden]
Date: 2007-06-24 13:29:56
Author: huseyinakcan
Date: 2007-06-24 13:29:54 EDT (Sun, 24 Jun 2007)
New Revision: 7135
URL: http://svn.boost.org/trac/boost/changeset/7135
Log:
commit on behalf of Herve:
Minor typos, adjustments in phrasing. Substantial changes
(requirements, etc.):
* facet_hds_concept: add requirements
* mutable_facet_hds_concept: change syntax
* mutable_hds_concept: change syntax, fix.
Added:
sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/hds_concept.cpp
sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/hds_concept.t.cpp
sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_traits.hpp
Text files modified:
sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/backward_hds_concept.hpp | 18 ++++++++++-----
sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/bidirectional_hds_concept.hpp | 45 ++++++++++++++++++---------------------
sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/facet_hds_concept.hpp | 25 ++++++++++++++++-----
sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/facet_list_hds_concept.hpp | 39 ++++++++++++++++-----------------
sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/forward_hds_concept.hpp | 24 +++++++++++++++------
sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/halfedge_list_hds_concept.hpp | 34 +++++++++++++----------------
sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/hds_concept.hpp | 5 +++
sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/mutable_backward_hds_concept.hpp | 4 +-
sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/mutable_facet_hds_concept.hpp | 34 +++++++++++------------------
sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/mutable_hds_concept.hpp | 44 +++++++++++++++++---------------------
10 files changed, 142 insertions(+), 130 deletions(-)
Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/backward_hds_concept.hpp
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/backward_hds_concept.hpp (original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/backward_hds_concept.hpp 2007-06-24 13:29:54 EDT (Sun, 24 Jun 2007)
@@ -61,9 +61,9 @@
///Valid Expressions
///-----------------
// In addition to the valid expressions of the 'HDS' concept:
-// - 'prev_in_facet(hds,h)' must return a value assignable to h.
-// - 'prev_at_source(hds,h)' must return a value assignable to h.
-// - 'prev_at_target(hds,h)' must return a value assignable to h.
+// - 'prev_in_facet(hds,h)' must return a value assignable to 'h'.
+// - 'prev_at_source(hds,h)' must return a value assignable to 'h'.
+// - 'prev_at_target(hds,h)' must return a value assignable to 'h'.
//
///Expression Semantics
///--------------------
@@ -152,9 +152,12 @@
typedef typename hds_traits<HDS>::backward_category backward_category;
// MANIPULATORS
- void constraints() {
+ void constraints()
+ // Check that the 'HDS' template parameter satisfies all the
+ // constraints of 'BackwardHDSConcept' on page
+ // [backwardhdsconcept].
+ {
using namespace boost;
-
function_requires<HDSConcept<HDS> >();
function_requires<ConvertibleConcept<traversal_category,
backward_traversal_tag> >();
@@ -168,7 +171,10 @@
}
// ACCESSORS
- void const_constraints(HDS const& hds){
+ void const_constraints(HDS const& hds)
+ // Check that the non-modifiable 'HDS' template parameters
+ // satisfies all the constraints of 'BackwardHDSConcept'.
+ {
h = prev_in_facet(hds,h);
h = prev_at_source(hds,h);
h = prev_at_target(hds,h);
Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/bidirectional_hds_concept.hpp
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/bidirectional_hds_concept.hpp (original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/bidirectional_hds_concept.hpp 2007-06-24 13:29:54 EDT (Sun, 24 Jun 2007)
@@ -35,20 +35,15 @@
// - 'ForwardHDSConcept'
// - 'BackwardHDSConcept'
//
-///Notation
-///--------
-// - 'HDS' A type that is a model of 'BidirectionalHDSConcept'
-// - 'hds' A non-modifiable instance of 'HDS'
-// - 'h','g' Halfedge descriptors, of type
-// 'hds_traits<HDS>::halfedge_descriptor'
-//
///Associated types
///----------------
// - 'hds_traits<HDS>::halfedge_descriptor': from 'HDSConcept'.
-// - 'hds_traits<HDS>::traversal_category' : must be convertible to
-// 'hds_traits<HDS>::bidirectional_traversal_tag'.
-// - 'hds_traits<HDS>::forward_category' : from 'ForwardHDSConcept'
-// - 'hds_traits<HDS>::backward_category' : from 'BackwardHDSConcept'
+// - 'hds_traits<HDS>::traversal_category' : from 'HDSConcept', with
+// the additional requirement that this type must be convertible to
+// the 'hds_traits<HDS>::bidirectional_traversal_tag' type which is
+// defined in '<boost/hdstl.hpp>'.
+// - 'hds_traits<HDS>::forward_category': from 'ForwardHDSConcept'
+// - 'hds_traits<HDS>::backward_category': from 'BackwardHDSConcept'
//
///Definitions
///-----------
@@ -61,23 +56,25 @@
// in '<boost/hdstl.hpp>'.
// - 'forward_category' defines the primary accessor of the forward
// information for use by algorithms which desire the most direct access.
+// (See the 'ForwardHDSConcept' for a full definition.)
// - 'backward_category' defines the primary accessor of the backward
// information for use by algorithms which desire the most direct access.
+// (See the 'BackwardHDSConcept' for a full definition.)
//
///Valid Expressions
///-----------------
-// See the valid expressions of the 'ForwardHDSConcept' and
-// the 'BackwardHDSConcept'.
+// None besides the valid expressions of the 'ForwardHDSConcept' and
+// the 'BackwardHDSConcept'.
//
///Expression Semantics
///--------------------
-// See the expression semantics of the 'ForwardHDSConcept' and
-// the 'BackwardHDSConcept'.
+// Same as the expression semantics of the 'ForwardHDSConcept' and
+// the 'BackwardHDSConcept'.
//
///Complexity guarantees
///---------------------
-// See the complexity guarantees of the 'ForwardHDSConcept' and
-// the 'BackwardHDSConcept'.
+// Same as the complexity guarantees of the 'ForwardHDSConcept' and
+// the 'BackwardHDSConcept'.
//
///Invariants
///----------
@@ -133,14 +130,14 @@
typedef typename hds_traits<HDS>::traversal_category traversal_category;
typedef typename hds_traits<HDS>::forward_category forward_category;
typedef typename hds_traits<HDS>::backward_category backward_category;
- // The specialization of 'hds_traits<HDS>' must have these required
- // types, obeying the types requirements stated in the detailed
- // description of the 'BidirectionalHDS' concept on page
- // [bidirectionalhdsconcept].
+ // The specialization of 'hds_traits<HDS>' must have these required
+ // types, obeying the types requirements stated in the detailed
+ // description of the 'BidirectionalHDS' concept on page
+ // [bidirectionalhdsconcept].
//MANIPULATORS
void constraints()
- // Check that the 'HDS' template parameters satisfies all the
+ // Check that the 'HDS' template parameter satisfies all the
// constraints of 'BidirectionalHDSConcept' on page
// [bidirectionalhdsconcept].
{
@@ -158,9 +155,9 @@
{
}
- private:
+ private:
//DATA
- BidirectionalHDS hds; // a halfedge data structure object
+ BidirectionalHDS hds; // a halfedge data structure object
};
} // close namespace concepts
Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/facet_hds_concept.hpp
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/facet_hds_concept.hpp (original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/facet_hds_concept.hpp 2007-06-24 13:29:54 EDT (Sun, 24 Jun 2007)
@@ -18,7 +18,7 @@
//
///Definition
///----------
-// This concept refines the 'HDSConcept', and specifies additional facet
+// This concept refines the 'HDSConcept', and requires an additional facet
// descriptor to handle facets in the 'HDS' data structure.
//
///Refinement of:
@@ -29,10 +29,12 @@
///--------
// - 'HDS' A type that is a model of FacetHDSConcept
// - 'hds' A non-modifiable instance of HDS
+// - 'h' Halfedge descriptor, of type 'hds_traits<HDS>::halfedge_descriptor'
// - 'f' Facet descriptor, of type 'hds_traits<HDS>::facet_descriptor'
//
///Associated types
///----------------
+// In addition to the types required by the 'HDSConcept':
// - 'hds_traits<HDS>::facet_descriptor': must be 'DefaultConstructible',
// 'CopyConstructible', 'EqualityComparable', and 'Assignable'.
//
@@ -41,19 +43,26 @@
// - 'halfedge_descriptor' is a type that contains information to access
// the halfedge. (See the 'HDSConcept' for a full definition.)
// - 'facet_descriptor' is a type that contains information to access the
-// facet to the left of the halfedge (in counter clockwise rotation).
+// facet to the left of the halfedge, if forward facet cycles are
+// ordered in counter clockwise rotation around the facet.
//
///Valid Expressions
///-----------------
-// See the valid expressions of the 'HDS' concept.
+// In addition to the valid expressions of the 'HDSConcept':
+// - 'facet(hds,h)' must return a value assignable to 'f'.
//
///Expression Semantics
///--------------------
-// See the expression semantics of the 'HDS' concept.
+// In addition to the expressions semantics of the 'HDSConcept':
+// - 'hds_traits<HDS>::supports_facets': must compare equal to 'true'.
+// - 'facet(hds,h)' returns the facet descriptor of the facet to the
+// left of 'h', when forward facet cycles are oriented in
+// counter-clockwise order.
//
///Complexity guarantees
///---------------------
-// See the complexity guarantees of the 'HDS' concept.
+// In addition to the complexity guarantees of the 'HDSConcept':
+// - 'facet(hds,h)': amortized constant time.
//
///Invariants
///----------
@@ -72,9 +81,11 @@
// function_requires<CopyConstructibleConcept<facet_descriptor> >();
// function_requires<EqualityComparableConcept<facet_descriptor> >();
// function_requires<AssignableConcept<facet_descriptor> >();
+// BOOST_STATIC_ASSERT(hds_traits<HDS>::supports_facets);
// const_constraints(hds);
// }
// void const_constraints(HDS const& hds) {
+// f = facet(hds, h);
// }
// HDS hds;
// facet_descriptor f;
@@ -121,6 +132,7 @@
function_requires<EqualityComparableConcept<facet_descriptor> >();
function_requires<AssignableConcept<facet_descriptor> >();
+ BOOST_STATIC_ASSERT(hds_traits<HDS>::supports_facets);
const_constraints(hds);
}
@@ -129,9 +141,10 @@
// Check that the non-modifiable 'HDS' template parameters
// satisfies all the constraints of 'FacetHDSConcept'.
{
+ f = facet(hds,h);
}
- private:
+ private:
//DATA
FacetHDS hds; // a halfedge data structure object
facet_descriptor f; // a facet descriptor
Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/facet_list_hds_concept.hpp
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/facet_list_hds_concept.hpp (original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/facet_list_hds_concept.hpp 2007-06-24 13:29:54 EDT (Sun, 24 Jun 2007)
@@ -24,7 +24,7 @@
//
///Refinement of:
///--------------
-// - 'HDSConcept'
+// - 'FacetHDSConcept'
//
///Notation
///--------
@@ -32,19 +32,20 @@
// - 'hds' A non-modifiable instance of HDS
// - 'f' Facet descriptor, of type 'hds_traits<HDS>::facet_descriptor'
// - 'p' Facet iterator, of type 'hds_traits<HDS>::facet_iterator'
-// - 'n' Facet size type, of type 'hds_traits<HDS>::size_type'
+// - 'n' Facet list size, of type 'hds_traits<HDS>::size_type'
//
///Associated types
///----------------
-// - 'hds_traits<HDS>::facet_descriptor': must be 'DefaultConstructible',
-// 'CopyConstructible', 'EqualityComparable', and 'Assignable'.
-// - 'hds_traits<HDS>::facet_iterator': must be 'MultiPassInputIterator'.
-// - 'hds_traits<HDS>::size_type': unsigned size type.
+// In addition to the types of the 'FacetHDS' concept:
+// - 'hds_traits<HDS>::facet_iterator': must be a model of the
+// 'ForwardIterator' concept. The value type of the facet iterator
+// must be the same as the 'facet_descriptor'.
+// - 'hds_traits<HDS>::size_type': integral size type.
//
///Definitions
///-----------
// - 'facet_descriptor' is a type that contains information to access
-// the facet. (See the 'HDSConcept' for a full definition.)
+// the facet. (See the 'FacetHDSConcept' for a full definition.)
// - 'facet_iterator' is an iterator type for the facets.
// - 'size_type' defines the size type.
//
@@ -60,22 +61,22 @@
///--------------------
// In addition to the valid expression semantics of the 'HDS' concept:
// - 'facets_begin(hds)' returns a 'facet_iterator' 'p' pointing to the
-// beginning of the 'facet list'.
+// beginning of the "facet list".
// - 'facets_end(hds)' returns a 'facet_iterator' 'p' pointing to the
-// end of the 'facet list'.
+// end of the "facet list".
// - 'num_facets(HDS)' returns the number of facets in the 'HDS' data
// structure.
//
///Complexity guarantees
///---------------------
+// In addition to the complexity guarantees of the 'FacetHDS' concept:
// - 'facets_begin(hds)': amortized constant time.
-// - 'facets_end(hds)' : amortized constant time.
-// - 'num_facets(hds)' : amortized constant time.
+// - 'facets_end(hds)': amortized constant time.
+// - 'num_facets(hds)': amortized constant time.
//
///Invariants
///----------
-// 'FacetListHDSConcept' should validate all the invariants for the
-// 'HDSConcept'.
+// - 'std::distance(facets_begin(hds), facets_end(hds)) == num_facets(hds)'
//
///Concept-checking class
///----------------------
@@ -90,11 +91,8 @@
// using namespace boost;
// function_requires<HDSConcept>();
// function_requires<FacetHDSConcept>();
-// function_requires<hdstl_detail::MultiPassInputIteratorConcept<
-// facet_iterator> >();
-// b = facets_begin(hds);
-// e = facets_end(hds);
-// n = num_facets(hds);
+// function_requires<ForwardIteratorConcept<facet_iterator> >();
+// function_requires<ConvertibleConcept<size_type,int> >();
// const_constraints(hds);
// }
// void const_constraints(HDS const& hds)
@@ -153,8 +151,9 @@
using namespace boost;
function_requires<HDSConcept>();
function_requires<FacetHDSConcept>();
- function_requires<hdstl_detail::MultiPassInputIteratorConcept<
+ function_requires<hdstl_detail::ForwardIteratorConcept<
facet_iterator> >();
+ function_requires<ConvertibleConcept<size_type,int> >();
b = facets_begin(hds);
e = facets_end(hds);
n = num_facets(hds);
@@ -171,7 +170,7 @@
n = num_facets(hds);
}
- private:
+ private:
//DATA
FacetListHDS hds; // a halfedge data structure object
facet_descriptor f; // a facet descriptor
Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/forward_hds_concept.hpp
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/forward_hds_concept.hpp (original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/forward_hds_concept.hpp 2007-06-24 13:29:54 EDT (Sun, 24 Jun 2007)
@@ -36,7 +36,7 @@
///--------
// - 'HDS' A type that is a model of 'ForwardHDSConcept'
// - 'hds' A non-modifiable instance of 'HDS'
-// - 'h','g' Halfedge descriptors, of type 'hds_traits<HDS>::halfedge_descriptor'
+// - 'h' Halfedge descriptors, of type 'hds_traits<HDS>::halfedge_descriptor'
//
///Associated types
///----------------
@@ -61,9 +61,9 @@
///Valid Expressions
///-----------------
// In addition to the valid expressions of the 'HDS' concept:
-// - 'next_in_facet(hds,h)' must return a value assignable to h.
-// - 'next_at_source(hds,h)' must return a value assignable to h.
-// - 'next_at_target(hds,h)' must return a value assignable to h.
+// - 'next_in_facet(hds,h)' must return a value assignable to 'h'.
+// - 'next_at_source(hds,h)' must return a value assignable to 'h'.
+// - 'next_at_target(hds,h)' must return a value assignable to 'h'.
//
///Expression Semantics
///--------------------
@@ -150,11 +150,18 @@
typedef typename hds_traits<HDS>::halfedge_descriptor halfedge_descriptor;
typedef typename hds_traits<HDS>::traversal_category traversal_category;
typedef typename hds_traits<HDS>::forward_category forward_category;
+ // The specialization of 'hds_traits<HDS>' must have these required
+ // types, obeying the types requirements stated in the detailed
+ // description of the 'ForwardHDS' concept on page
+ // [forwardhdsconcept].
// MANIPULATORS
- void constraints() {
+ void constraints()
+ // Check that the 'HDS' template parameter satisfies all the
+ // constraints of 'ForwardHDSConcept' on page
+ // [forwardhdsconcept].
+ {
using namespace boost;
-
function_requires<HDSConcept<HDS> >();
function_requires<ConvertibleConcept<traversal_category,
forward_traversal_tag> >();
@@ -168,7 +175,10 @@
}
// ACCESSORS
- void const_constraints(HDS const& hds){
+ void const_constraints(HDS const& hds)
+ // Check that the non-modifiable 'HDS' template parameters
+ // satisfies all the constraints of 'ForwardHDSConcept'.
+ {
h = next_in_facet(hds,h);
h = next_at_source(hds,h);
h = next_at_target(hds,h);
Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/halfedge_list_hds_concept.hpp
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/halfedge_list_hds_concept.hpp (original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/halfedge_list_hds_concept.hpp 2007-06-24 13:29:54 EDT (Sun, 24 Jun 2007)
@@ -38,8 +38,9 @@
///----------------
// - 'hds_traits<HDS>::halfedge_descriptor': must be 'DefaultConstructible',
// 'CopyConstructible', 'EqualityComparable', and 'Assignable'.
-// - 'hds_traits<HDS>::halfedge_iterator': must be 'MultiPassInputIterator'.
-// - 'hds_traits<HDS>::size_type': halfedge size type.
+// - 'hds_traits<HDS>::halfedge_iterator': must be 'ForwardIterator'.
+// Its value type must be the same as the 'halfedge_descriptor' type.
+// - 'hds_traits<HDS>::size_type': integral halfedge size type.
//
///Definitions
///-----------
@@ -58,9 +59,9 @@
///Expression Semantics
///--------------------
// In addition to the valid expression semantics of the 'HDS' concept:
-// - 'halfedges_begin(hds)' returns a 'halfedge_iterator' 'p' pointing to the
+// - 'halfedges_begin(hds)' returns a 'halfedge_iterator' pointing to the
// beginning of the 'halfedge list'.
-// - 'halfedges_end(hds)' returns a 'halfedge_iterator' 'p' pointing to the
+// - 'halfedges_end(hds)' returns a 'halfedge_iterator' pointing to the
// end of the 'halfedge list'.
// - 'num_halfedges(hds)' returns the number of halfedges in the 'HDS' data
// structure.
@@ -68,13 +69,13 @@
///Complexity guarantees
///---------------------
// - 'halfedges_begin(hds)': amortized constant time.
-// - 'halfedges_end(hds)' : amortized constant time.
-// - 'num_halfedges(HDS)' : amortized constant time.
+// - 'halfedges_end(hds)': amortized constant time.
+// - 'num_halfedges(hds)': amortized constant time.
//
///Invariants
///----------
-// 'HalfedgeListHDSConcept' should validate all the invariants for the
-// 'HDSConcept'.
+// In addition to the invariants of the 'HDSConcept':
+// - 'std::distance(halfedges_begin(hds), halfedges_end(hds)) == num_halfedges(hds)'
//
///Concept-checking class
///----------------------
@@ -92,10 +93,8 @@
// function_requires<CopyConstructibleConcept<halfedge_descriptor> >();
// function_requires<EqualityComparableConcept<halfedge_descriptor> >();
// function_requires<AssignableConcept<halfedge_descriptor> >();
-// function_requires<hdstl_detail::MultiPassInputIteratorConcept<halfedge_iterator> >();
-// b = halfedges_begin(hds);
-// e = halfedges_end(hds);
-// n = num_halfedges(hds);
+// function_requires<ForwardIteratorConcept<halfedge_iterator> >();
+// function_requires<ConvertibleConcept<halfedges_size_type> >();
// const_constraints(hds);
// }
// void const_constraints(HDS const& hds)
@@ -107,8 +106,7 @@
// private:
// HalfedgeListHDS hds;
// halfedge_descriptor h;
-// halfedge_iterator b;
-// halfedge_iterator e;
+// halfedge_iterator b, e;
// size_type n;
// };
//..
@@ -156,10 +154,8 @@
function_requires<CopyConstructibleConcept<halfedge_descriptor> >();
function_requires<EqualityComparableConcept<halfedge_descriptor> >();
function_requires<AssignableConcept<halfedge_descriptor> >();
- function_requires<hdstl_detail::MultiPassInputIteratorConcept<halfedge_iterator> >();
- b = halfedges_begin(hds);
- e = halfedges_end(hds);
- n = num_halfedges(hds);
+ function_requires<ForwardIteratorConcept<halfedge_iterator> >();
+ function_requires<ConvertibleConcept<halfedge_size_type> >();
const_constraints(hds);
}
@@ -173,7 +169,7 @@
n = num_halfedges(hds);
}
- private:
+ private:
//DATA
HalfedgeListHDS hds; // a halfedge data structure object
halfedge_descriptor h; // a halfedge descriptor
Added: sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/hds_concept.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/hds_concept.cpp 2007-06-24 13:29:54 EDT (Sun, 24 Jun 2007)
@@ -0,0 +1,4 @@
+// hds_concept.cpp -*- C++ -*-
+
+#include <boost/hdstl/concepts/hds_concept.hpp>
+
Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/hds_concept.hpp
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/hds_concept.hpp (original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/hds_concept.hpp 2007-06-24 13:29:54 EDT (Sun, 24 Jun 2007)
@@ -49,16 +49,19 @@
// member of the 'hds_traits<HDS>' type) is an opaque type. All that can be
// done to it is passing it to the function opposite and letting the hds use
// the information it contains to find the opposite halfedge. In
-// particular, there is no guarantee that it is a pointer type.
+// particular, there is no guarantee that the descriptor be a pointer type.
//
///Valid Expressions
///-----------------
// The following expression must be valid and obey the syntactic requirement:
// - 'opposite(hds, h)' must return a value assignable to 'h'.
+// - 'hds_traits<HDS>::supports_facets' must be usable as a Boolean.
//
///Expression Semantics
///--------------------
// The expressions semantics are as follows:
+// - 'hds_traits<HDS>::supports_facets' is true if and only if 'HDS'
+// is a model of the 'FacetHDS' concept (see the page [facethdsconcept]).
// - 'opposite(hds, h)' returns a descriptor to the halfedge opposite 'h' in
// the data structure 'hds'. Does not modify the state of either 'hds'
// or 'h'.
Added: sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/hds_concept.t.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/hds_concept.t.cpp 2007-06-24 13:29:54 EDT (Sun, 24 Jun 2007)
@@ -0,0 +1,66 @@
+//hds_concept.t.cpp -*- C++ -*-
+
+#include <boost/hdstl/hds_concepts/hds_concept.hpp>
+
+#include <boost/test/minimal.hpp>
+#include <boost/concept.hpp>
+
+//@OVERVIEW: The component under test is a concept-checking class. We
+// proceed with the standard test plan for such a class.
+//
+//@TEST_PLAN: Create a (loose) archetype of the concept, and verify
+// (using the Boost.ConceptCheck library macros) that it satisfies all
+// the concept requirements of the concept. Note that the purpose of
+// this test driver is to verify the validity of the concept checking
+// class, not of the archetype. This is why it suffices to take the
+// halfedge_descriptor as an int, although a real archetype would make
+// this into a custom-made class with the tailored minimal requirements.
+
+struct hds_archetype1 {
+ typedef int halfedge_descriptor;
+ halfedge_descriptor opposite(halfedge_descriptor h) const { return h; }
+};
+
+struct hds_archetype2 {
+ typedef int halfedge_descriptor;
+};
+int opposite(const hds_archetype2& hds, int h) { return h; }
+
+namespace boost {
+namespace hdstl {
+ template <>
+ class hds_traits<hds_archetype1>
+ {
+ typedef int halfedge_descriptor;
+ const bool supports_vertices = false;
+ const bool supports_facets = false;
+ };
+ template <>
+ class hds_traits<hds_archetype1>
+ {
+ typedef int halfedge_descriptor;
+ enum { supports_vertices = true };
+ enum { supports_facets = true };
+ };
+}
+}
+
+template <class HDS>
+struct class_concept_requirements
+{
+ BOOST_CLASS_REQUIRE(HDS, boost::hdstl::concepts, HDSConcept);
+};
+
+template <class HDS>
+bool concept_requirements()
+{
+ function_requires<boost::hdstl::concepts::HDSConcept<HDS> >();
+ class_concept_requirements<HDS>(); // force instantiation
+}
+
+int main()
+{
+ BOOST_CHECK(( concept_requirements<hds_archetype1>() ));
+ BOOST_CHECK(( concept_requirements<hds_archetype2>() ));
+ return 0;
+}
Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/mutable_backward_hds_concept.hpp
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/mutable_backward_hds_concept.hpp (original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/mutable_backward_hds_concept.hpp 2007-06-24 13:29:54 EDT (Sun, 24 Jun 2007)
@@ -53,8 +53,8 @@
//
///Valid Expressions
///-----------------
-// In addition to the valid expressions of the 'HDS' concept, and the
-// 'BackwardHDS' concept:
+// In addition to the valid expressions of the 'HDS' and the
+// 'BackwardHDS' concepts:
// - 'set_prev_in_facet(hds,h,g)' sets 'g' as the 'prev_in_facet' value of
// 'h'.
// - 'set_prev_at_source(hds,h,g)' sets 'g' as the 'prev_at_source' value of
Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/mutable_facet_hds_concept.hpp
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/mutable_facet_hds_concept.hpp (original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/mutable_facet_hds_concept.hpp 2007-06-24 13:29:54 EDT (Sun, 24 Jun 2007)
@@ -60,7 +60,8 @@
// 'MutableHDS' concept.
// - 'set_facet(hds,h,f)' sets the facet descriptor value of 'h' to 'f' for a
// single halfedge in the 'hds' data structure.
-// - 'add_facet(hds,f)' adds a new facet 'f' to the 'hds' data structure.
+// - 'add_facet(hds)' adds a new facet to the 'hds' data structure
+// and returns the facet descriptor of this new facet.
// By this operation the facet is added but no connections to the halfedges
// are set. In order to assign facets to halfedges 'set_facet(hds,h,f)'
// operation should be used.
@@ -71,13 +72,13 @@
///Complexity guarantees
///---------------------
// - 'set_facet(hds,h,f)' : amortized constant time.
-// - 'add_facet(hds,f)' : amortized constant time.
+// - 'add_facet(hds)': amortized constant time.
// - 'remove_facet(hds,f)': amortized constant time.
//
///Invariants
///----------
-// 'MutableFacetHDSConcept' should validate all the invariants for the
-// 'FacetHDSConcept' and the 'MutableHDSConcept'.
+// 'MutableFacetHDSConcept' should verify all the invariants for the
+// 'FacetHDSConcept' and the 'MutableHDSConcept'.
//
///Concept-checking class
///----------------------
@@ -92,15 +93,11 @@
// function_requires<CopyConstructibleConcept<facet_descriptor> >();
// function_requires<EqualityComparableConcept<facet_descriptor> >();
// function_requires<AssignableConcept<facet_descriptor> >();
-// set_facet(hds,h,f);
-// add_facet(hds,f);
-// delete_facet(hds,f);
-// const_constraints(hds);
// }
// void const_constraints(HDS const& hds) {
// set_facet(hds,h,f);
-// add_facet(hds,f);
-// delete_facet(hds,f);
+// f = add_facet(hds);
+// remove_facet(hds,f);
// }
// HDS hds;
// halfedge_descriptor h;
@@ -132,10 +129,10 @@
// TYPES
typedef typename hds_traits<HDS>::facet_descriptor facet_descriptor;
- // The specialization of 'hds_traits<HDS>' must have these required
- // types, obeying the types requirements stated in the detailed
- // description of the 'MutableFacetHDS' concept on page
- // [mutablefacethdsconcept].
+ // The specialization of 'hds_traits<HDS>' must have these required
+ // types, obeying the types requirements stated in the detailed
+ // description of the 'MutableFacetHDS' concept on page
+ // [mutablefacethdsconcept].
//MANIPULATORS
void constraints()
@@ -149,11 +146,6 @@
function_requires<CopyConstructibleConcept<facet_descriptor> >();
function_requires<EqualityComparableConcept<facet_descriptor> >();
function_requires<AssignableConcept<facet_descriptor> >();
-
- set_facet(hds,h,f);
- add_facet(hds,f);
- delete_facet(hds,f);
-
const_constraints(hds);
}
@@ -163,11 +155,11 @@
// satisfies all the constraints of 'MutableFacetHDSConcept'.
{
set_facet(hds,h,f);
- add_facet(hds,f);
+ f = add_facet(hds);
delete_facet(hds,f);
}
- private:
+ private:
//DATA
MutableFacetHDS hds; // a halfedge data structure object
halfedge_descriptor h; // a halfedge descriptor
Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/mutable_hds_concept.hpp
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/mutable_hds_concept.hpp (original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/mutable_hds_concept.hpp 2007-06-24 13:29:54 EDT (Sun, 24 Jun 2007)
@@ -32,9 +32,9 @@
///Notation
///--------
// - 'HDS' A type that is a model of 'MutableHDSConcept'
-// - 'hds' A non-modifiable instance of 'HDS'
-// - 'h1','h2' Halfedge descriptors, of type
-// 'hds_traits<HDS>::halfedge_descriptor'
+// - 'hds' A modifiable instance of 'HDS'
+// - 'h', h1','h2'
+// Halfedge descriptors, of type 'hds_traits<HDS>::halfedge_descriptor'
//
///Associated types
///----------------
@@ -52,30 +52,31 @@
//
///Valid Expressions
///-----------------
-// The following expression must be valid and obey the syntactic requirement:
-// - 'set_opposite(hds,h1,h2)': sets the opposite halfedge.
-// - 'h = new_edge(hds)': creates a new edge, with two halfedges.
-// - 'delete_edge(hds,h1,h2)': deletes the edge defined by halfedge pairs
-// 'h1' and 'h2'.
+// In addition to the valid expressions of the 'HDS' concept,
+// the following expressions must be valid and obey the syntactic requirement:
+// - 'set_opposite(hds,h1,h2)'
+// - 'h = new_edge(hds)'
+// - 'delete_edge(hds,h)'
//
///Expression Semantics
///--------------------
// The expressions semantics are as follows:
// - 'set_opposite(hds,h1,h2)' sets 'h1' and 'h2' as opposites of each other
// in the data structure 'hds'.
-// - 'h = new_edge(hds)' creates a new edge in data structure 'hds'.
-// Halfedges are created as pairs, and this call creates two halfedges
-// 'h' and 'opposite(hds,h)'.
-// - 'delete_edge(hds,h1,h2)' removes the opposite halfedges 'h1' and 'h2'
+// - 'new_edge(hds)' creates a new edge in data structure 'hds', and
+// returns the halfedge descriptor of one of the two halfedges created.
+// The other new halfedge can be obtained using 'opposite(hds,h)'.
+// Note that halfedges can only be created in opposite pairs.
+// - 'delete_edge(hds,h)' removes the halfedges 'h' and 'opposite(hds,h)'
// from the data structure 'hds'. Note that only the halfedges that form
// a pair by validating the 'opposite' function can be deleted by this
-// method, otherwise the behavior is undefined.
+// method.
//
///Complexity guarantees
///---------------------
// - 'set_opposite(hds,h1,h2)': amortized constant time.
-// - 'h=new_edge(hds)' : amortized constant time.
-// - 'delete_edge(hds,h1,h2)' : amortized constant time.
+// - 'new_edge(hds)': amortized constant time.
+// - 'delete_edge(hds,h)' : amortized constant time.
//
///Invariants
///----------
@@ -91,14 +92,11 @@
// using namespace boost;
// function_requires<HDSConcept<HDS> >();
// set_opposite(hds,h1,h2);
-// h = new_edge(hds,h1,h2);
-// delete_edge(hds,h1,h2);
+// h = new_edge(hds);
+// delete_edge(hds,h);
// const_constraints(hds);
// }
// void const_constraints(HDS const& hds) {
-// set_opposite(hds,h1,h2);
-// h = new_edge(hds,h1,h2);
-// delete_edge(hds,h1,h2);
// }
// HDS hds;
// halfedge_descriptor h1;
@@ -147,7 +145,7 @@
set_opposite(hds,h1,h2);
h = new_edge(hds);
- delete_edge(hds,h1,h2);
+ delete_edge(hds,h);
const_constraints(hds);
}
@@ -156,14 +154,12 @@
// Check that the non-modifiable 'HDS' template parameters
// satisfies all the constraints of 'MutableHDSConcept'.
{
- set_opposite(hds,h1,h2);
- h = new_edge(hds);
- delete_edge(hds,h1,h2);
}
private:
// DATA
HDS hds; // a halfedge data structure object
+ halfedge_descriptor h; // a halfedge descriptor
halfedge_descriptor h1; // a halfedge descriptor
halfedge_descriptor h2; // a halfedge descriptor
};
Added: sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_traits.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_traits.hpp 2007-06-24 13:29:54 EDT (Sun, 24 Jun 2007)
@@ -0,0 +1,47 @@
+#ifndef BOOST_HDSTL_HDS_TRAITS_HPP
+#define BOOST_HDSTL_HDS_TRAITS_HPP 1
+
+namespace boost{
+namespace hdstl {
+
+ template <typename HDS>
+ struct hds_traits{
+
+ typedef typename HDS::vertex_descriptor vertex_descriptor;
+ typedef typename HDS::halfedge_descriptor halfedge_descriptor;
+ typedef typename HDS::facet_descriptor facet_descriptor;
+
+ typedef typename HDS::vertex_iterator vertex_iterator;
+ typedef typename HDS::halfedge_iterator halfedge_iterator;
+ typedef typename HDS::facet_iterator facet_iterator;
+
+ typedef typename HDS::const_vertex_iterator
+ const_vertex_iterator;
+ typedef typename HDS::const_halfedge_iterator
+ const_halfedge_iterator;
+ typedef typename HDS::const_facet_iterator
+ const_facet_iterator;
+
+ typedef typename HDS::size_type size_type;
+
+ typedef typename HDS::traversal_category traversal_category;
+ typedef typename HDS::forward_category forward_category;
+ typedef typename HDS::backward_category backward_category;
+ };
+
+ struct forward_traversal_tag {};
+ struct backward_traversal_tag {};
+
+ struct next_in_facet_tag {};
+ struct next_at_source_tag {};
+ struct next_at_target_tag {};
+
+ struct prev_in_facet_tag {};
+ struct prev_at_source_tag {};
+ struct prev_at_target_tag {};
+
+} // namespace hdstl
+} // namespace boost
+
+#endif
+
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