MEPP2 Project
test_complying_concepts_linear_cell_complex.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 Lesser General Public License as
6 // published by the Free Software Foundation; either version 3 of
7 // the License, 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 #include <CGAL/Cartesian.h>
12 #include <CGAL/Linear_cell_complex_for_combinatorial_map.h>
13 
14 #include <boost/graph/graph_concepts.hpp>
16 
17 // The BGL wrappers (graph_traits)
18 #include <CGAL/boost/graph/graph_traits_Linear_cell_complex_for_combinatorial_map.h>
20 #include <CGAL/Linear_cell_complex_incremental_builder.h>
21 
22 typedef CGAL::Cartesian< double > Kernel;
23 typedef CGAL::Linear_cell_complex_traits< 3, Kernel > MyTraits;
24 
25 struct Myitem
26 {
27  template< class Refs >
28  struct Dart_wrapper
29  {
30  typedef CGAL::Tag_true Darts_with_id;
31  typedef CGAL::Cell_attribute_with_point_and_id< Refs > Vertex_attribute;
32  typedef CGAL::Cell_attribute_with_id< Refs > Face_attribute;
33  typedef CGAL::cpp11::tuple< Vertex_attribute, void, Face_attribute >
35  };
36 };
37 
38 typedef CGAL::
39  Linear_cell_complex_for_combinatorial_map< 2, 3, MyTraits, Myitem >
41 
42 // Technical type alias in order for the tests for the different data
43 // structures to share some code (preparing generic test for the day
44 // when all data structure are fully compliant).
45 typedef MeshLcc G;
46 
47 int
48 main(void)
49 {
50  using namespace boost;
51  // Assertions are sometimes redundant (IncidenceGraph concept assertion
52  // already internally assert the Graph concept). We nevertheless do such
53  // redudant checks along the concept "inheritance" hieararchy in order
54  // for the test to provide the simplest feedback when failing (fail early).
55  BOOST_CONCEPT_ASSERT((GraphConcept< G >));
56  BOOST_CONCEPT_ASSERT((IncidenceGraphConcept< G >));
57  BOOST_CONCEPT_ASSERT((BidirectionalGraphConcept< G >));
58 
59  // Graph already asserted
60  BOOST_CONCEPT_ASSERT((EdgeListGraphConcept< G >));
61  BOOST_CONCEPT_ASSERT((VertexListGraphConcept< G >));
62  BOOST_CONCEPT_ASSERT((VertexAndEdgeListGraphConcept< G >));
63 
66  // The following is the unfolding of the boost::EdgeMutableGraphConcept
67  // concept on debugging (of Linear Cell Complex) purposes
68  { // Technical scope to avoid variable/type collisions with other tests
69  typedef typename graph_traits< G >::edge_descriptor edge_descriptor;
70  G g;
71  edge_descriptor e;
72  // std::pair<edge_descriptor, bool> p;
73  // typename graph_traits<G>::vertex_descriptor u, v;
74 
75  // The following assertion fails with message:
76  // error: no matching function for call to 'add_edge'
77  // UNCOMMENT ME (FIXME) p = add_edge(u, v, g);
78 
79  // The following assertion fails with message
80  // error: no matching function for call to 'remove_edge
81  // UNCOMMENT ME (FIXME) remove_edge(u, v, g);
82 
83  remove_edge(e, g);
84 
85  // The following assertion fails with message:
86  // error: use of undeclared identifier 'clear_vertex(v, g);`
87  // UNCOMMENT ME (FIXME) clear_vertex(v, g);
88  } // Technical scope
89 
92  // The following is the unfolding of the boost::MutableIncidenceGraphConcept
93  // concept on debugging (of Linear Cell Complex) purposes.
94  // The following unfolding is necessary because the MutableIncidenceGraph
95  // concept indirectly (through MutableGraph) inherits from the
96  // EdgeMutableGraph concept that currently fails (refer above).
97  { // Technical scope to avoid variable/type collisions with other tests
98  //typedef typename graph_traits< G >::edge_descriptor edge_descriptor;
99  // G g;
100  // boost::concepts::dummy_edge_predicate<edge_descriptor> p;
101  // typename boost::graph_traits<G>::vertex_descriptor u;
102  // typename boost::graph_traits<G>::out_edge_iterator iter;
103  // The following assertion fails with message:
104  // no matching function for call to 'remove_edge'
105  // UNCOMMENT ME (FIXME) remove_edge(iter, g);
106 
107  // The following assertion fails with message:
108  // error: use of undeclared identifier 'remove_out_edge_if'
109  // UNCOMMENT ME (FIXME) remove_out_edge_if(u, p, g);
110  } // Technical scope
111 
114  // The following is the unfolding of the boost::MutableEdgeListGraphConcept
115  // concept on debugging (of Linear Cell Complex) purposes.
116  // The following unfolding is necessary because the MutableEdgeListGraph
117  // concept inherits from the EdgeMutableGraph concept that currently fails
118  // (refer above).
119  { // Technical scope to avoid variable/type collisions with other tests
120  //typedef typename graph_traits< G >::edge_descriptor edge_descriptor;
121  // G g;
122  // boost::concepts::dummy_edge_predicate<edge_descriptor> p;
123  // The following assertion fails with message:
124  // error: use of undeclared identifier 'remove_edge_if'
125  // UNCOMMENT ME (FIXME) remove_edge_if(p, g);
126  } // Technical scope
127 
130  // The following is the unfolding of the
131  // boost::MutableBidirectionalGraphConcept concept on debugging (of Linear
132  // Cell Complex) purposes. The following unfolding is necessary because
133  // the MutableBidirectionalGraph concept inherits from the
134  // EdgeMutableGraph concept that currently fails (refer above).
135  { // Technical scope to avoid variable/type collisions with other tests
136  //typedef typename graph_traits< G >::edge_descriptor edge_descriptor;
137  // G g;
138  // boost::concepts::dummy_edge_predicate<edge_descriptor> p;
139  // typename boost::graph_traits<G>::vertex_descriptor u;
140  // The following assertion fails with message:
141  // error: use of undeclared identifier 'remove_in_edge_if'
142  // UNCOMMENT ME (FIXME) remove_in_edge_if(u, p, g);
143  } // Technical scope
144 
145  BOOST_CONCEPT_ASSERT((VertexMutableGraphConcept< G >));
146 
149  // MutableGraph concept doesn't introduce new expressions. It only fails
150  // because the EdgeMutableGraph concept from which MutableGraph inherits
151  // fails.
152 
153  BOOST_CONCEPT_ASSERT(
154  (PropertyGraphConcept< G,
156  vertex_point_t >));
157  BOOST_CONCEPT_ASSERT((FEVV::CGALHalfedgeGraph< G >));
158  BOOST_CONCEPT_ASSERT((FEVV::CGALHalfedgeListGraph< G >));
159  BOOST_CONCEPT_ASSERT((FEVV::CGALMutableHalfedgeGraph< G >));
160 
161  BOOST_CONCEPT_ASSERT((FEVV::CGALFaceGraph< G >));
162  BOOST_CONCEPT_ASSERT((FEVV::CGALFaceListGraph< G >));
163  BOOST_CONCEPT_ASSERT((FEVV::CGALMutableFaceGraph< G >));
164 
165  // Just to test the implementation of the FEVV::MutableHalfedgeFaceListGraph
166  // concept as opposed to the concept itself. Indeed this concept is
167  // just a syntactic gathering of above already asserted concepts (and
168  // as such should never fails provided the above succeeds).
169  BOOST_CONCEPT_ASSERT((FEVV::MutableHalfedgeFaceListGraph< G >));
170 
172  // The following are not mandatory within the FEVV layer. It is just some
173  // technical perks offered by LCC that we wish to document as being
174  // effective.
175 #ifndef WIN32
176 
177  BOOST_CONCEPT_ASSERT(
178  (PropertyGraphConcept< G,
179  graph_traits< G >::halfedge_descriptor,
180  halfedge_index_t >));
181 
182  BOOST_CONCEPT_ASSERT(
183  (PropertyGraphConcept< G,
184  graph_traits< G >::face_descriptor,
185  face_index_t >));
186 
187 #endif
188 
190  // BOOST_CONCEPT_ASSERT( (concepts::AdjacencyGraph< G >) );
191  // Above assertion fails.
192 
193  return 0;
194 }
MeshLcc
CGAL::Linear_cell_complex_for_combinatorial_map< 2, 3, MyTraits, Myitem > MeshLcc
Definition: test_complying_concepts_linear_cell_complex.cpp:40
Myitem
Definition: test_complying_concepts_linear_cell_complex.cpp:26
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
G
MeshLcc G
Definition: test_complying_concepts_linear_cell_complex.cpp:45
Kernel
CGAL::Cartesian< double > Kernel
Definition: test_complying_concepts_linear_cell_complex.cpp:22
Myitem::Dart_wrapper::Face_attribute
CGAL::Cell_attribute_with_id< Refs > Face_attribute
Definition: test_complying_concepts_linear_cell_complex.cpp:32
GraphConcept
Definition: test_boost_graph_concept_aif.cpp:20
Myitem::Dart_wrapper::Vertex_attribute
CGAL::Cell_attribute_with_point_and_id< Refs > Vertex_attribute
Definition: test_complying_concepts_linear_cell_complex.cpp:31
Myitem::Dart_wrapper::Darts_with_id
CGAL::Tag_true Darts_with_id
Definition: test_complying_concepts_linear_cell_complex.cpp:30
main
int main(void)
Definition: test_complying_concepts_linear_cell_complex.cpp:48
Myitem::Dart_wrapper
Definition: test_complying_concepts_linear_cell_complex.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
Myitem::Dart_wrapper::Attributes
CGAL::cpp11::tuple< Vertex_attribute, void, Face_attribute > Attributes
Definition: test_complying_concepts_linear_cell_complex.cpp:34
Geometry_traits_cgal_linear_cell_complex.h
MyTraits
CGAL::Linear_cell_complex_traits< 3, Kernel > MyTraits
Definition: test_complying_concepts_linear_cell_complex.cpp:23