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