MEPP2 Project
test_complying_concepts_polyhedron.cpp
Go to the documentation of this file.
1 // Copyright (c) 2012-2019 University of Lyon and CNRS (France).
2 // All rights reserved.
3 //
4 // This file is part of MEPP2; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published
6 // by the Free Software Foundation; either version 3 of the License,
7 // or (at your option) any later version.
8 //
9 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
10 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11 // Work around the side effects of the indirect (through
12 // FEVV/Wrappings/properties.h) inclusion of DataStructures.h
13 
14 #include <CGAL/Cartesian.h>
15 #include <CGAL/Polyhedron_3.h>
16 #include <CGAL/Polyhedron_items_with_id_3.h>
17 #include <boost/graph/graph_concepts.hpp>
19 
20 typedef CGAL::Cartesian< double > Kernel;
21 typedef CGAL::Polyhedron_3< Kernel, CGAL::Polyhedron_items_with_id_3 >
23 // Technical type alias in order for the tests for the different data
24 // structures to share some code (preparing generic test for the day
25 // when all data structure are fully compliant).
26 typedef Polyhedron G;
27 
28 int
29 main(void)
30 {
31  using namespace boost;
32  // Assertions are sometimes redundant (IncidenceGraph concept assertion
33  // already internally assert the Graph concept). We nevertheless do such
34  // redudant checks along the concept "inheritance" hieararchy in order
35  // for the test to provide the simplest feedback when failing (fail early).
36  BOOST_CONCEPT_ASSERT((GraphConcept< G >));
37  BOOST_CONCEPT_ASSERT((IncidenceGraphConcept< G >));
38  BOOST_CONCEPT_ASSERT((BidirectionalGraphConcept< G >));
39 
40  // Graph already asserted
41  BOOST_CONCEPT_ASSERT((EdgeListGraphConcept< G >));
42  BOOST_CONCEPT_ASSERT((VertexListGraphConcept< G >));
43  BOOST_CONCEPT_ASSERT((VertexAndEdgeListGraphConcept< G >));
44 
47  // The following is the unfolding of the boost::EdgeMutableGraphConcept
48  // concept on debugging (of Polyhedron) purposes
49  { // Technical scope to avoid variable/type collisions with other tests
50  typedef typename graph_traits< G >::edge_descriptor edge_descriptor;
51  G g;
52  edge_descriptor e;
53  // std::pair<edge_descriptor, bool> p;
54  // typename graph_traits<G>::vertex_descriptor u, v;
55 
56  // The following assertion fails with message:
57  // error: no matching function for call to 'add_edge'
58  // UNCOMMENT ME (FIXME) p = add_edge(u, v, g);
59 
60  // The following assertion fails with message
61  // error: no matching function for call to 'remove_edge
62  // UNCOMMENT ME (FIXME) remove_edge(u, v, g);
63 
64  remove_edge(e, g);
65 
66  // The following assertion fails with message:
67  // error: use of undeclared identifier 'clear_vertex(v, g);`
68  // UNCOMMENT ME (FIXME) clear_vertex(v, g);
69  } // Technical scope
70 
73  // The following is the unfolding of the boost::MutableIncidenceGraphConcept
74  // concept on debugging (of Polyhedron) purposes.
75  // The following unfolding is necessary because the MutableIncidenceGraph
76  // concept indirectly (through MutableGraph) inherits from the
77  // EdgeMutableGraph concept that currently fails (refer above).
78  { // Technical scope to avoid variable/type collisions with other tests
79  //typedef typename graph_traits< G >::edge_descriptor edge_descriptor;
80  // G g;
81  // boost::concepts::dummy_edge_predicate<edge_descriptor> p;
82  // typename boost::graph_traits<G>::vertex_descriptor u;
83  // typename boost::graph_traits<G>::out_edge_iterator iter;
84 
85  // The following assertion fails with message:
86  // no matching function for call to 'remove_edge'
87  // UNCOMMENT ME (FIXME) remove_edge(iter, g);
88 
89  // The following assertion fails with message:
90  // error: use of undeclared identifier 'remove_out_edge_if'
91  // UNCOMMENT ME (FIXME) remove_out_edge_if(u, p, g);
92  } // Technical scope
93 
96  // The following is the unfolding of the boost::MutableEdgeListGraphConcept
97  // concept on debugging (of Polyhedron) purposes.
98  // The following unfolding is necessary because the MutableEdgeListGraph
99  // concept inherits from the EdgeMutableGraph concept that currently fails
100  // (refer above).
101  { // Technical scope to avoid variable/type collisions with other tests
102  //typedef typename graph_traits< G >::edge_descriptor edge_descriptor;
103  // G g;
104  // boost::concepts::dummy_edge_predicate<edge_descriptor> p;
105  // The following assertion fails with message:
106  // error: use of undeclared identifier 'remove_edge_if'
107  // UNCOMMENT ME (FIXME) remove_edge_if(p, g);
108  } // Technical scope
109 
112  // The following is the unfolding of the
113  // boost::MutableBidirectionalGraphConcept concept on debugging (of Linear
114  // Cell Complex) purposes. The following unfolding is necessary because
115  // the MutableBidirectionalGraph concept inherits from the
116  // EdgeMutableGraph concept that currently fails (refer above).
117  { // Technical scope to avoid variable/type collisions with other tests
118  //typedef typename graph_traits< G >::edge_descriptor edge_descriptor;
119  // G g;
120  // boost::concepts::dummy_edge_predicate<edge_descriptor> p;
121  // typename boost::graph_traits<G>::vertex_descriptor u;
122  // The following assertion fails with message:
123  // error: use of undeclared identifier 'remove_in_edge_if'
124  // UNCOMMENT ME (FIXME) remove_in_edge_if(u, p, g);
125  } // Technical scope
126 
127 
128  BOOST_CONCEPT_ASSERT((VertexMutableGraphConcept< G >));
129 
132  // MutableGraph concept doesn't introduce new expressions. It only fails
133  // because the EdgeMutableGraph concept from which MutableGraph inherits
134  // fails.
135 
136  BOOST_CONCEPT_ASSERT(
137  (PropertyGraphConcept< G,
139  vertex_point_t >));
140  BOOST_CONCEPT_ASSERT((FEVV::CGALHalfedgeGraph< G >));
141  BOOST_CONCEPT_ASSERT((FEVV::CGALHalfedgeListGraph< G >));
142  BOOST_CONCEPT_ASSERT((FEVV::CGALMutableHalfedgeGraph< G >));
143 
144  BOOST_CONCEPT_ASSERT((FEVV::CGALFaceGraph< G >));
145  BOOST_CONCEPT_ASSERT((FEVV::CGALFaceListGraph< G >));
146  BOOST_CONCEPT_ASSERT((FEVV::CGALMutableFaceGraph< G >));
147 
148  // Just to test the implementation of the FEVV::MutableHalfedgeFaceListGraph
149  // concept as opposed to the concept itself. Indeed this concept is
150  // just a syntactic gathering of above already asserted concepts (and
151  // as such should never fails provided the above succeeds).
152  BOOST_CONCEPT_ASSERT((FEVV::MutableHalfedgeFaceListGraph< G >));
153 
155  // The following are not mandatory within the FEVV layer. It is just to
156  // to document some technical perks or failures of OpenMesh.
157  // effective.
158  // BOOST_CONCEPT_ASSERT( (concepts::AdjacencyGraph< G >) );
159  // Above assertion fails.
160 
161  return 0;
162 }
Kernel
CGAL::Cartesian< double > Kernel
Definition: test_complying_concepts_polyhedron.cpp:20
Polyhedron
CGAL::Polyhedron_3< Kernel, CGAL::Polyhedron_items_with_id_3 > Polyhedron
Definition: test_complying_concepts_polyhedron.cpp:22
CGALConceptsCheck.h
FEVV::DataStructures::AIF::remove_edge
void remove_edge(typename boost::graph_traits< FEVV::DataStructures::AIF::AIFMesh >::edge_descriptor e, FEVV::DataStructures::AIF::AIFMesh &sm)
Remove edge e.
Definition: Graph_traits_aif.h:858
boost
Definition: Graph_properties_aif.h:48
GraphConcept
Definition: test_boost_graph_concept_aif.cpp:20
main
int main(void)
Definition: test_complying_concepts_polyhedron.cpp:29
msdm2::vertex_descriptor
boost::graph_traits< MeshT >::vertex_descriptor vertex_descriptor
Definition: msdm2_surfacemesh.h:33
FEVV::DataStructures::AIF::AIFMesh
This class represents an AIF structure. AIF structure can deal with both manifold and non-manifold su...
Definition: AIFMesh.hpp:47
G
Polyhedron G
Definition: test_complying_concepts_polyhedron.cpp:26