MEPP2 Project
test_complying_concepts_surfacemesh.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 #include <CGAL/Surface_mesh.h>
12 #include <CGAL/Cartesian.h>
13 #include <boost/graph/graph_concepts.hpp>
15 
16 typedef CGAL::Cartesian< double > Kernel;
17 typedef CGAL::Surface_mesh< Kernel::Point_3 > Mesh;
18 // Technical type alias in order for the tests for the different data
19 // structures to share some code (preparing generic test for the day
20 // when all data structure are fully compliant).
21 typedef Mesh G;
22 
23 int
24 main(void)
25 {
26  using namespace boost;
27  // Assertions are sometimes redundant (IncidenceGraph concept assertion
28  // already internally assert the Graph concept). We nevertheless do such
29  // redudant checks along the concept "inheritance" hieararchy in order
30  // for the test to provide the simplest feedback when failing (fail early).
31  BOOST_CONCEPT_ASSERT((GraphConcept< G >));
32  BOOST_CONCEPT_ASSERT((IncidenceGraphConcept< G >));
33  BOOST_CONCEPT_ASSERT((BidirectionalGraphConcept< G >));
34 
35  // Graph already asserted
36  BOOST_CONCEPT_ASSERT((EdgeListGraphConcept< G >));
37  BOOST_CONCEPT_ASSERT((VertexListGraphConcept< G >));
38  BOOST_CONCEPT_ASSERT((VertexAndEdgeListGraphConcept< G >));
39 
42  // The following is the unfolding of the boost::EdgeMutableGraphConcept
43  // concept on debugging (of SurfaceMesh) purposes
44  { // Technical scope to avoid variable/type collisions with other tests
45  typedef typename graph_traits< G >::edge_descriptor edge_descriptor;
46  G g;
47  edge_descriptor e;
48  // std::pair<edge_descriptor, bool> p;
49  // typename graph_traits<G>::vertex_descriptor u, v;
50 
51  // The following assertion fails with message:
52  // error: no matching function for call to 'add_edge'
53  // UNCOMMENT ME (FIXME) p = add_edge(u, v, g);
54 
55  // The following assertion fails because the returned type is not
56  // convertible to an edge_descriptor. UNCOMMENT ME (FIXME) remove_edge(u, v,
57  // g);
58 
59  remove_edge(e, g);
60 
61  // The following assertion fails with message:
62  // error: use of undeclared identifier 'clear_vertex(v, g);`
63  // UNCOMMENT ME (FIXME) clear_vertex(v, g);
64  } // Technical scope
65 
66  BOOST_CONCEPT_ASSERT((VertexMutableGraphConcept< G >));
67 
70  // MutableGraph concept doesn't introduce new expressions. It only fails
71  // because the EdgeMutableGraph concept from which MutableGraph inherits
72  // fails.
73 
75  BOOST_CONCEPT_ASSERT(
76  (PropertyGraphConcept< G,
78  vertex_point_t >));
79  BOOST_CONCEPT_ASSERT((FEVV::CGALHalfedgeGraph< G >));
80  BOOST_CONCEPT_ASSERT((FEVV::CGALHalfedgeListGraph< G >));
81  BOOST_CONCEPT_ASSERT((FEVV::CGALMutableHalfedgeGraph< G >));
82 
83  BOOST_CONCEPT_ASSERT((FEVV::CGALFaceGraph< G >));
84  BOOST_CONCEPT_ASSERT((FEVV::CGALFaceListGraph< G >));
85  BOOST_CONCEPT_ASSERT((FEVV::CGALMutableFaceGraph< G >));
86 
87  // Just to test the implementation of the FEVV::MutableHalfedgeFaceListGraph
88  // concept as opposed to the concept itself. Indeed this concept is
89  // just a syntactic gathering of above already asserted concepts (and
90  // as such should never fails provided the above succeeds).
91  BOOST_CONCEPT_ASSERT((FEVV::MutableHalfedgeFaceListGraph< G >));
92 
94  // The following are not mandatory within the FEVV layer. It is just to
95  // to document some technical perks or failures of SurfaceMesh.
96  // effective.
97  // BOOST_CONCEPT_ASSERT( (concepts::AdjacencyGraph< G >) );
98  // Above assertion fails.
99 
100  return 0;
101 }
Mesh
CGAL::Surface_mesh< Kernel::Point_3 > Mesh
Definition: test_complying_concepts_surfacemesh.cpp:17
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
main
int main(void)
Definition: test_complying_concepts_surfacemesh.cpp:24
GraphConcept
Definition: test_boost_graph_concept_aif.cpp:20
G
Mesh G
Definition: test_complying_concepts_surfacemesh.cpp:21
msdm2::vertex_descriptor
boost::graph_traits< MeshT >::vertex_descriptor vertex_descriptor
Definition: msdm2_surfacemesh.h:33
Kernel
CGAL::Cartesian< double > Kernel
Definition: test_complying_concepts_surfacemesh.cpp:16
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