38 #ifndef BGEOT_MESH_STRUCTURE_H__
39 #define BGEOT_MESH_STRUCTURE_H__
47 struct APIDECL mesh_convex_structure {
48 typedef std::vector<size_type> ind_pt_ct;
55 mesh_convex_structure() : cstruct(0) {}
77 typedef std::vector<size_type> ind_cv_ct;
78 typedef std::vector<size_type> ind_set;
85 dal::dynamic_tas<mesh_convex_structure, 8> convex_tab;
92 {
return convex_tab.index(); }
94 dal::bit_vector convex_index(dim_type)
const;
99 {
return convex_tab.index().last_true()+1; }
102 size_type nb_max_points()
const {
return points_tab.
size(); }
108 {
return convex_tab[ic].pts; }
113 {
return convex_tab[ic].cstruct; }
116 {
return convex_tab[ic].cstruct->nb_points(); }
119 {
return short_type(convex_tab[ic].cstruct->nb_faces()); }
136 ITER ipts,
bool *present = 0);
137 template<
class ITER>
size_type add_simplex(dim_type dim, ITER ipts)
147 void sup_convex_with_points(ITER ipts,
short_type nb);
149 {
size_type t[2]; t[0] = a; t[1] = b; sup_convex_with_points(&t[0], 2); }
156 void to_faces(dim_type n);
163 std::vector<size_type> &ipt)
const;
167 {
return points_tab[ip]; }
169 void ind_points_to_point(
size_type, ind_set &)
const;
185 ind_pt_face_ct ind_points_of_face_of_convex(
size_type ic,
191 void optimize_structure();
203 IS_DEPRECATED { neighbors_of_convex(ic, f, s); }
212 const std::vector<short_type> &ftab,
215 const std::vector<short_type> &ftab,
216 ind_set &s)
const IS_DEPRECATED
217 { neighbors_of_convex(ic, ftab, s); }
223 void neighbors_of_convex(
size_type ic, ind_set &s)
const;
224 void neighbours_of_convex(
size_type ic, ind_set &s)
const
225 IS_DEPRECATED { neighbors_of_convex(ic, s); }
235 IS_DEPRECATED {
return neighbor_of_convex(ic, f); }
247 {
return (neighbor_of_convex(ic, f) !=
size_type(-1)); }
249 IS_DEPRECATED {
return (neighbor_of_convex(ic, f) !=
size_type(-1)); }
253 {
return points_tab[ip].
empty() ?
size_type(-1) : points_tab[ip][0]; }
269 std::vector<size_type> &cmk);
276 if (std::find(pt.begin(), pt.end(), *pit) == pt.end())
281 template<
class ITER>
bool
286 if (std::find(pt.begin(), pt.end(), *pit) == pt.end())
return false;
293 mesh_convex_structure s; s.cstruct = cs;
297 else is = convex_tab.add(s);
299 convex_tab[is].pts.resize(nb);
300 for (
size_type i = 0; i < nb; ++i, ++ipts)
301 { convex_tab[is].pts[i] = *ipts; points_tab[*ipts].push_back(is); }
307 ITER ipts,
bool *present) {
308 if (present) *present =
false;
312 {
if (present) *present =
true;
return points_tab[*ipts][i]; }
313 return add_convex_noverif(cs, ipts);
333 struct APIDECL edge_list_elt {
336 inline bool operator < (
const edge_list_elt &e)
const {
337 if (i < e.i)
return true;
338 if (i > e.i)
return false;
339 if (j < e.j)
return true;
else if (j > e.j)
return false;
340 if (cv < e.cv)
return true;
344 { i = std::min(ii, jj); j = std::max(ii, jj); }
348 typedef dal::dynamic_tree_sorted<edge_list_elt> edge_list;
352 std::vector<size_type> points_of_convex,
355 void APIDECL mesh_edge_list(
const mesh_structure &m, edge_list &el,
356 bool merge_convex =
true);