xref: /petsc/include/petsc/private/dmlabelimpl.h (revision cbb4c9996f029c8bb2e19153d781a22d5ed46cf9)
1 #if !defined(_LABELIMPL_H)
2 #define _LABELIMPL_H
3 
4 #include <petscdmlabel.h>
5 #include <petscbt.h>
6 #include <petscistypes.h>
7 #include <petsc/private/hashseti.h>
8 
9 /* This is an integer map, in addition it is also a container class
10    Design points:
11      - Low storage is the most important design point
12      - We want flexible insertion and deletion
13      - We can live with O(log) query, but we need O(1) iteration over strata
14 */
15 struct _n_DMLabel {
16   PETSCHEADER(int);
17   PetscInt    numStrata;      /* Number of integer values */
18   PetscInt    defaultValue;   /* Background value when no value explicitly given */
19   PetscInt   *stratumValues;  /* Value of each stratum */
20   /* Basic IS storage */
21   PetscBool  *validIS;        /* The IS is valid (no additions need to be merged in) */
22   PetscInt   *stratumSizes;   /* Size of each stratum */
23   IS         *points;         /* Points for each stratum, always sorted */
24   /* Hashtable for fast insertion */
25   PetscHSetI *ht;             /* Hash table for fast insertion */
26   /* Index for fast search */
27   PetscInt    pStart, pEnd;   /* Bounds for index lookup */
28   PetscBT     bt;             /* A bit-wise index */
29 };
30 
31 PETSC_INTERN PetscErrorCode PetscSectionSymCreate_Label(PetscSectionSym);
32 #endif
33