111
|
1 // { dg-do compile }
|
131
|
2 // { dg-additional-options "-Wno-return-type" }
|
111
|
3
|
|
4 namespace std {
|
|
5 template<class,class>struct pair{};
|
|
6 template<typename _Tp> struct _Vector_base {
|
|
7 struct _Vector_impl
|
|
8 {
|
|
9 _Tp* _M_start;
|
|
10 _Tp* _M_finish;
|
|
11 _Tp* _M_end_of_storage;
|
|
12 };
|
|
13 _Vector_impl _M_impl;
|
|
14 };
|
|
15 template<typename _Tp >
|
|
16 struct vector : _Vector_base<_Tp>
|
|
17 {
|
|
18 vector(const vector& __x);
|
|
19 };
|
|
20 }
|
|
21 namespace boost {
|
|
22 struct G{};
|
|
23 template <class T, class U >
|
|
24 struct modable2
|
|
25 : G
|
|
26 { };
|
|
27 }
|
|
28 namespace CGAL {
|
|
29 struct Rep { };
|
|
30 struct Handle
|
|
31 {
|
|
32 Handle() ;
|
|
33 Handle(const Handle& x) ;
|
|
34 Rep* PTR;
|
|
35 };
|
|
36 template <typename ET_> class Lazy_exact_nt
|
|
37 : Handle
|
|
38 , boost::modable2< Lazy_exact_nt<ET_>, int >
|
|
39 , boost::modable2< Lazy_exact_nt<ET_>, double >
|
|
40 { };
|
|
41 struct CC_iterator { };
|
|
42 struct Triangulation_data_structure_3 {
|
|
43 typedef CC_iterator Vertex_handle;
|
|
44 typedef CC_iterator Cell_handle;
|
|
45 typedef std::pair<Cell_handle, int> Facet;
|
|
46 };
|
|
47 template < class GT, class Tds_ > struct Triangulation_3 {
|
|
48 typedef Tds_ Tds;
|
|
49 typedef typename GT::Point_3 Point;
|
|
50 typedef typename Tds::Facet Facet;
|
|
51 typedef typename Tds::Vertex_handle Vertex_handle;
|
|
52 enum Locate_type { VERTEX=0, EDGE, FACET, CELL, OUTSIDE_CONVEX_HULL, OUTSIDE_AFFINE_HULL };
|
|
53 Tds _tds;
|
|
54 bool is_infinite(const Facet & f) const ;
|
|
55 };
|
|
56 template < class Gt, class Tds_ > struct Delaunay_triangulation_3 : public Triangulation_3<Gt, Tds_> { };
|
|
57 namespace Surface_mesher { enum Verbose_flag { VERBOSE, NOT_VERBOSE }; }
|
|
58 enum Mesher_level_conflict_status { NO_CONFLICT = 0, CONFLICT_BUT_ELEMENT_CAN_BE_RECONSIDERED, CONFLICT_AND_ELEMENT_SHOULD_BE_DROPPED };
|
|
59 struct Null_mesher_level {
|
|
60 template <typename P, typename Z> Mesher_level_conflict_status test_point_conflict_from_superior(P, Z) ;
|
|
61 };
|
|
62 template < class Tr, class Derived, class Element, class Previous, class Triangulation_traits > struct Mesher_level {
|
|
63 typedef Tr Triangulation;
|
|
64 typedef typename Triangulation::Point Point;
|
|
65 typedef typename Triangulation::Vertex_handle Vertex_handle;
|
|
66 typedef typename Triangulation_traits::Zone Zone;
|
|
67 typedef Previous Previous_level;
|
|
68 Derived& derived() { return static_cast<Derived&>(*this); }
|
|
69 Previous& previous_level;
|
|
70 Mesher_level(Previous_level& previous)
|
|
71 : previous_level(previous)
|
|
72 { }
|
|
73 Vertex_handle insert(Point p, Zone& z) ; // { dg-warning "used but never defined" }
|
|
74 Zone conflicts_zone(const Point& p, Element e) ; // { dg-warning "used but never defined" }
|
|
75 Element get_next_element() ; // { dg-warning "used but never defined" }
|
|
76 template <class Mesh_visitor> void before_insertion(Element& e, const Point& p, Zone& zone, Mesh_visitor visitor) {
|
|
77 visitor.before_insertion(e, p, zone);
|
|
78 }
|
|
79 template <class Mesh_visitor> void after_insertion(Vertex_handle vh, Mesh_visitor visitor) {
|
|
80 derived().after_insertion_impl(vh);
|
|
81 }
|
|
82 template <class Mesh_visitor> void after_no_insertion(const Element& e, const Point& p, Zone& zone, Mesh_visitor visitor) {
|
|
83 visitor.after_no_insertion(e, p, zone);
|
|
84 }
|
|
85 template <class Mesh_visitor> void refine(Mesh_visitor visitor)
|
|
86 {
|
|
87 Element e = get_next_element();
|
|
88 const Mesher_level_conflict_status result = try_to_refine_element(e, visitor);
|
|
89 }
|
|
90 template <class Mesh_visitor> Mesher_level_conflict_status try_to_refine_element(Element e, Mesh_visitor visitor)
|
|
91 {
|
|
92 Point p ;
|
|
93 Zone zone = conflicts_zone(p, e);
|
|
94 const Mesher_level_conflict_status result = test_point_conflict(p, zone);
|
|
95 before_insertion(e, p, zone, visitor);
|
|
96 Vertex_handle v = insert(p, zone);
|
|
97 after_insertion(v, visitor);
|
|
98 after_no_insertion(e, p, zone, visitor);
|
|
99 }
|
|
100 Mesher_level_conflict_status test_point_conflict(const Point& p, Zone& zone)
|
|
101 {
|
|
102 return previous_level.test_point_conflict_from_superior(p, zone);
|
|
103 }
|
|
104 };
|
|
105 struct Null_mesh_visitor {
|
|
106 template <typename E, typename P, typename Z> void before_insertion(E, P, Z) const {}
|
|
107 template <typename E, typename P, typename Z> void after_no_insertion(E, P, Z) const {}
|
|
108 };
|
|
109 template <class Tr> struct Triangulation_ref_impl {
|
|
110 Triangulation_ref_impl(Tr& t);
|
|
111 };
|
|
112 template <typename Tr> struct Triangulation_mesher_level_traits_3
|
|
113 : public Triangulation_ref_impl<Tr>
|
|
114 {
|
|
115 typedef typename Tr::Facet Facet;
|
|
116 Triangulation_mesher_level_traits_3(Tr& t)
|
|
117 : Triangulation_ref_impl<Tr>(t)
|
|
118 { }
|
|
119 struct Zone {
|
|
120 typedef std::vector<int*> Cells;
|
|
121 typedef std::vector<Facet> Facets;
|
|
122 typedef typename Tr::Locate_type Locate_type;
|
|
123 Locate_type locate_type;
|
|
124 Cells cells;
|
|
125 Facets boundary_facets;
|
|
126 Facets internal_facets;
|
|
127 };
|
|
128 };
|
|
129 namespace Surface_mesher {
|
|
130 namespace details {
|
|
131 template <typename Base> struct Triangulation_generator {
|
|
132 typedef typename Base::Complex_2_in_triangulation_3 C2T3;
|
|
133 typedef typename C2T3::Triangulation Triangulation;
|
|
134 typedef Triangulation Type;
|
|
135 typedef Type type;
|
|
136 };
|
|
137 template <typename Base> struct Facet_generator {
|
|
138 typedef typename Triangulation_generator<Base>::type Tr;
|
|
139 typedef typename Tr::Facet Type;
|
|
140 typedef Type type;
|
|
141 };
|
|
142 template <typename Base, typename Self, typename Element, typename PreviousLevel = Null_mesher_level> struct Mesher_level_generator {
|
|
143 typedef typename Base::Complex_2_in_triangulation_3 C2T3;
|
|
144 typedef typename C2T3::Triangulation Triangulation;
|
|
145 typedef Triangulation_mesher_level_traits_3<Triangulation> Tr_m_l_traits_3;
|
|
146 typedef Mesher_level <Triangulation, Self, Element, PreviousLevel, Tr_m_l_traits_3> Type;
|
|
147 };
|
|
148 }
|
|
149 template < class C2T3, class Surface_, class SurfaceMeshTraits, class Criteria_ > struct Surface_mesher_base
|
|
150 : public Triangulation_mesher_level_traits_3<typename C2T3::Triangulation>
|
|
151 {
|
|
152 typedef C2T3 Complex_2_in_triangulation_3;
|
|
153 typedef Surface_ Surface;
|
|
154 typedef SurfaceMeshTraits Surface_mesh_traits;
|
|
155 typedef Criteria_ Criteria;
|
|
156 typedef typename C2T3::Triangulation Tr;
|
|
157 typedef typename Tr::Vertex_handle Vertex_handle;
|
|
158 typedef typename Tr::Facet Facet;
|
|
159 Surface_mesher_base (C2T3& co, const Surface& s, const Surface_mesh_traits& mesh_traits, const Criteria& c)
|
|
160 : Triangulation_mesher_level_traits_3<Tr>(co.triangulation()), c2t3(co), tr(co.triangulation()), surf(s), meshtraits(mesh_traits), criteria(c)
|
|
161 { }
|
|
162 C2T3& c2t3;
|
|
163 Tr& tr;
|
|
164 const Surface& surf;
|
|
165 const Surface_mesh_traits& meshtraits;
|
|
166 const Criteria& criteria;
|
|
167 void after_insertion_impl(const Vertex_handle& v) {
|
|
168 after_insertion_handle_opposite_facet (Facet ());
|
|
169 after_insertion_handle_incident_facet (Facet ());
|
|
170 }
|
|
171 void after_insertion_handle_incident_facet (const Facet& f) {
|
|
172 tr.is_infinite(f) ;
|
|
173 new_facet<false>(f);
|
|
174 }
|
|
175 template <bool remove_from_complex_if_not_in_restricted_Delaunay> void new_facet (const Facet& f) ; // { dg-warning "used but never defined" }
|
|
176 void after_insertion_handle_opposite_facet (const Facet& f) {
|
|
177 after_insertion_handle_incident_facet (f);
|
|
178 }
|
|
179 };
|
|
180 template < typename Base, typename Element = typename details::Facet_generator<Base>::type, typename PreviousLevel = Null_mesher_level, Verbose_flag verbose = NOT_VERBOSE > struct Surface_mesher
|
|
181 : public Base , public details::Mesher_level_generator< Base, Surface_mesher<Base, Element, PreviousLevel, verbose>, Element, PreviousLevel >::Type
|
|
182 {
|
|
183 typedef typename Base::Complex_2_in_triangulation_3 C2T3;
|
|
184 typedef typename Base::Surface Surface;
|
|
185 typedef typename Base::Criteria Criteria;
|
|
186 typedef typename Base::Surface_mesh_traits Surface_mesh_traits;
|
|
187 typedef typename details::Mesher_level_generator< Base, Surface_mesher<Base, Element, PreviousLevel, verbose>, Element, PreviousLevel >::Type Mesher_lvl;
|
|
188 using Mesher_lvl::refine;
|
|
189 Null_mesher_level null_mesher_level;
|
|
190 Null_mesh_visitor null_visitor;
|
|
191 bool initialized;
|
|
192 Surface_mesher(C2T3& c2t3, const Surface& surface, const Surface_mesh_traits& mesh_traits, const Criteria& criteria)
|
|
193 : Base(c2t3, surface, mesh_traits, criteria), Mesher_lvl(null_mesher_level), initialized(false)
|
|
194 { }
|
|
195 void refine_mesh () {
|
|
196 refine(null_visitor);
|
|
197 }
|
|
198 };
|
|
199 }
|
|
200 template <typename Surface> struct Surface_mesh_traits_generator_3 {
|
|
201 typedef typename Surface::Surface_mesher_traits_3 Type;
|
|
202 typedef Type type;
|
|
203 };
|
|
204 template < class Tr, typename Edge_info_ = void > struct Complex_2_in_triangulation_3 {
|
|
205 typedef Tr Triangulation;
|
|
206 Triangulation& triangulation();
|
|
207 };
|
|
208 template <class Tr> struct Surface_mesh_complex_2_in_triangulation_3
|
|
209 : public Complex_2_in_triangulation_3<Tr>
|
|
210 { };
|
|
211 struct Non_manifold_tag {};
|
|
212 template < typename C2T3, typename SurfaceMeshTraits_3, typename Criteria, typename Tag > struct Make_surface_mesh_helper {
|
|
213 typedef Surface_mesher::Surface_mesher_base< C2T3, typename SurfaceMeshTraits_3::Surface_3, SurfaceMeshTraits_3, Criteria> Mesher_base;
|
|
214 };
|
|
215 template <typename C2T3, typename SurfaceMeshTraits_3, typename Criteria, typename Tag, Surface_mesher::Verbose_flag verbosity = Surface_mesher::NOT_VERBOSE > struct Surface_mesher_generator {
|
|
216 typedef typename Make_surface_mesh_helper< C2T3, SurfaceMeshTraits_3, Criteria, Tag>::Mesher_base Mesher_base;
|
|
217 typedef Surface_mesher::Surface_mesher< Mesher_base, typename Surface_mesher::details::Facet_generator<Mesher_base>::type, Null_mesher_level, verbosity> Mesher;
|
|
218 typedef Mesher type;
|
|
219 };
|
|
220 template <typename C2T3, typename SurfaceMeshTraits_3, typename Criteria> void make_surface_mesh(C2T3& c2t3, const typename SurfaceMeshTraits_3::Surface_3& surface, const SurfaceMeshTraits_3& surface_mesh_traits, const Criteria& criteria) {
|
|
221 typedef typename Surface_mesher_generator< C2T3, SurfaceMeshTraits_3, Criteria, Non_manifold_tag, Surface_mesher::NOT_VERBOSE >::type Mesher;
|
|
222 Mesher mesher(c2t3, surface, surface_mesh_traits, criteria);
|
|
223 mesher.refine_mesh();
|
|
224 }
|
|
225 template <class Kernel> struct Surface_mesh_triangulation_generator_3 {
|
|
226 typedef CGAL::Triangulation_data_structure_3 Tds;
|
|
227 typedef CGAL::Delaunay_triangulation_3<Kernel, Tds> Type;
|
|
228 };
|
|
229 namespace Surface_mesher {
|
|
230 namespace { struct Return_min { }; }
|
|
231 template < class GT, class Surface, class Unused = Return_min > struct Implicit_surface_oracle_3 {
|
|
232 typedef Surface Surface_3;
|
|
233 };
|
|
234 }
|
|
235 template< typename GT> struct Implicit_surface_3 {
|
|
236 typedef GT Geom_traits;
|
|
237 typedef Implicit_surface_3<Geom_traits > Self;
|
|
238 typedef Surface_mesher::Implicit_surface_oracle_3< Geom_traits, Self> Surface_mesher_traits_3;
|
|
239 };
|
|
240 }
|
|
241 struct K {
|
|
242 struct Point_3 {
|
|
243 CGAL::Lazy_exact_nt<double> a[3];
|
|
244 };
|
|
245 };
|
|
246 typedef CGAL::Surface_mesh_triangulation_generator_3<K>::Type Tr;
|
|
247 typedef CGAL::Surface_mesh_complex_2_in_triangulation_3<Tr> C2T3;
|
|
248 typedef CGAL::Implicit_surface_3<K > Surface;
|
|
249 typedef CGAL::Surface_mesh_traits_generator_3<Surface>::type Traits;
|
|
250 void f() {
|
|
251 C2T3 c2t3 ;
|
|
252 CGAL::make_surface_mesh(c2t3, Surface(), Traits(), 3);
|
|
253 }
|