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);
Definition of convex structures.
Mesh structure definition.
bool is_convex_valid(size_type i)
Return true if i is in convex_index()
short_type nb_points_of_convex(size_type ic) const
Return the number of points of convex ic.
const dal::bit_vector & convex_index() const
Return the list of valid convex IDs.
short_type nb_faces_of_convex(size_type ic) const
Return the number of faces of convex ic.
bool is_convex_face_having_points(size_type ic, short_type face_num, short_type nb, ITER pit) const
Return true if the face of the convex contains the given list of points.
bool is_convex_having_points(size_type ic, short_type nb, ITER pit) const
Return true if the convex contains the listed points.
ind_pt_face_ct ind_points_of_face_of_convex(size_type ic, short_type f) const
Return a container of the (global) point number for face f or convex ic.
size_type nb_convex() const
The total number of convexes in the mesh.
void sup_convex_with_points(ITER ipts, short_type nb)
Remove a convex given its points.
const ind_cv_ct & convex_to_point(size_type ip) const
Return a container of the convexes attached to point ip.
size_type first_convex_of_point(size_type ip) const
Convex ID of the first convex attached to the point ip.
size_type add_convex(pconvex_structure cs, ITER ipts, bool *present=0)
Insert a new convex in the mesh_structure.
pconvex_structure structure_of_convex(size_type ic) const
Return the pconvex_structure of the convex ic.
const ind_set & ind_points_of_convex(size_type ic) const
Return a container to the list of points attached to convex ic.
bool is_point_valid(size_type i) const
Return true if the point i is used by at least one convex.
size_type nb_allocated_convex() const
The number of convex indexes from 0 to the index of the last convex.
void sup_convex(size_type ic)
Remove the convex ic.
bool empty(void) const
True if no space is allocated.
size_type size(void) const
Number of allocated elements.
indexed array reference (given a container X, and a set of indexes I, this class provides a pseudo-co...
a balanced tree stored in a dal::dynamic_array
gmm::uint16_type short_type
used as the common short type integer in the library
std::shared_ptr< const convex_structure > pconvex_structure
Pointer on a convex structure description.
void cuthill_mckee_on_convexes(const bgeot::mesh_structure &ms, std::vector< size_type > &cmk)
Return the cuthill_mc_kee ordering on the convexes.
pconvex_structure simplex_structure(dim_type nc)
Give a pointer on the structures of a simplex of dimension d.
size_t size_type
used as the common size type in the library