MEPP2 Project
test_complying_concepts_openmesh.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 #if(_MSC_VER >= 1400)
12 #ifndef _SCL_SECURE_NO_WARNINGS
13 #define _SCL_SECURE_NO_WARNINGS
14 #endif
15 #endif
16 
17 #include <OpenMesh/Core/IO/MeshIO.hh>
18 #include <boost/graph/graph_concepts.hpp>
19 #define CGAL_USE_OM_POINTS
20 #include <CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h>
21 #include <CGAL/boost/graph/properties_PolyMesh_ArrayKernelT.h>
23 
24 typedef OpenMesh::PolyMesh_ArrayKernelT< /*MyTraits*/ > Mesh;
25 // Technical type alias in order for the tests for the different data
26 // structures to share some code (preparing generic test for the day
27 // when all data structure are fully compliant).
28 typedef Mesh G;
29 
30 int
31 main(void)
32 {
33  using namespace boost;
34  // Assertions are sometimes redundant (IncidenceGraph concept assertion
35  // already internally assert the Graph concept). We nevertheless do such
36  // redudant checks along the concept "inheritance" hieararchy in order
37  // for the test to provide the simplest feedback when failing (fail early).
38  BOOST_CONCEPT_ASSERT((GraphConcept< G >));
39  BOOST_CONCEPT_ASSERT((IncidenceGraphConcept< G >));
40  BOOST_CONCEPT_ASSERT((BidirectionalGraphConcept< G >));
41 
42  // Graph already asserted
43  BOOST_CONCEPT_ASSERT((EdgeListGraphConcept< G >));
44  BOOST_CONCEPT_ASSERT((VertexListGraphConcept< G >));
45  BOOST_CONCEPT_ASSERT((VertexAndEdgeListGraphConcept< G >));
46 
49  // The following is the unfolding of the FEVV::CGALHalfedgeGraph concept
50  // on debugging (of Polyhedron) purposes
51  { // Technical scope to avoid variable/type collisions with other tests
52  typedef typename graph_traits< G >::edge_descriptor edge_descriptor;
53  G g;
54  edge_descriptor e;
55  // std::pair<edge_descriptor, bool> p;
56  // typename graph_traits<G>::vertex_descriptor u, v;
57 
58  // The following assertion fails with message:
59  // error: no matching function for call to 'add_edge'
60  // UNCOMMENT ME (FIXME) p = add_edge(u, v, g);
61 
62  // The following assertion fails because the returned type is not
63  // convertible to an edge_descriptor. UNCOMMENT ME (FIXME) remove_edge(u, v,
64  // g);
65 
66  remove_edge(e, g);
67 
68  // The following assertion fails with message:
69  // error: use of undeclared identifier 'clear_vertex(v, g);`
70  // UNCOMMENT ME (FIXME) clear_vertex(v, g);
71  } // Technical scope
72 
73  BOOST_CONCEPT_ASSERT((VertexMutableGraphConcept< G >));
74 
77  // MutableGraph concept doesn't introduce new expressions. It only fails
78  // because the EdgeMutableGraph concept from which MutableGraph inherits
79  // fails.
80 
82  // BOOST_CONCEPT_ASSERT(
83  // (boost::concepts::ReadablePropertyGraph< G,
84  // graph_traits< G >::vertex_descriptor,
85  // vertex_point_t >)
86  // );
87  // The following is the unfolding of the above failing concept assertion of
88  // ReadablePropertyGraph on debugging purposes:
89  { // Technical scope to avoid variable/type collisions with other tests
91  typedef vertex_point_t Property;
92 
93  typedef typename property_map< G, Property >::const_type const_Map;
94  typename property_traits< const_Map >::value_type pval;
95  G g;
96  X x;
97  const_Map pmap = get(Property(), g);
98  // The following assertion fails with message:
99  // error: no viable overloaded '='
100  // UNCOMMENT ME (FIXME) pval = get(Property(), g, x);
101  ignore_unused_variable_warning(pmap);
102  }
103  // UNCOMMENT the following FIXMEs once the above ReadablePropertyGraph
104  // succeeds.
105  // FIXME BOOST_CONCEPT_ASSERT(
106  // FIXME (PropertyGraphConcept< G,
107  // FIXME graph_traits< G >::vertex_descriptor,
108  // FIXME vertex_point_t >)
109  // FIXME );
110 
111  BOOST_CONCEPT_ASSERT((FEVV::CGALHalfedgeGraph< G >));
112  BOOST_CONCEPT_ASSERT((FEVV::CGALHalfedgeListGraph< G >));
113  BOOST_CONCEPT_ASSERT((FEVV::CGALMutableHalfedgeGraph< G >));
114 
115  BOOST_CONCEPT_ASSERT((FEVV::CGALFaceGraph< G >));
116  BOOST_CONCEPT_ASSERT((FEVV::CGALFaceListGraph< G >));
117  BOOST_CONCEPT_ASSERT((FEVV::CGALMutableFaceGraph< G >));
118 
119  // Just to test the implementation of the FEVV::MutableHalfedgeFaceListGraph
120  // concept as opposed to the concept itself. Indeed this concept is
121  // just a syntactic gathering of above already asserted concepts (and
122  // as such should never fails provided the above succeeds).
123  BOOST_CONCEPT_ASSERT((FEVV::MutableHalfedgeFaceListGraph< G >));
124 
126  // The following are not mandatory within the FEVV layer. It is just to
127  // to document some technical perks or failures of AIF.
128  // BOOST_CONCEPT_ASSERT( (concepts::AdjacencyGraph< G >) );
129 
130  return 0;
131 }
Mesh
OpenMesh::PolyMesh_ArrayKernelT< > Mesh
Definition: test_complying_concepts_openmesh.cpp:24
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
main
int main(void)
Definition: test_complying_concepts_openmesh.cpp:31
boost
Definition: Graph_properties_aif.h:48
GraphConcept
Definition: test_boost_graph_concept_aif.cpp:20
G
Mesh G
Definition: test_complying_concepts_openmesh.cpp:28
boost::get
boost::property_map< FEVV::DataStructures::AIF::AIFMesh, boost::vertex_index_t >::const_type get(const boost::vertex_index_t &, const FEVV::DataStructures::AIF::AIFMesh &)
Returns the vertex index property map of the mesh.
Definition: Graph_properties_aif.h:108
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