1 #if !defined(_DMMBIMPL_H)
2 #define _DMMBIMPL_H
3 
4 #include <petscdmmoab.h>    /*I      "petscdmmoab.h"    I*/
5 #include "petsc/private/dmimpl.h"
6 
7 /* This is an integer map, in addition it is also a container class
8    Design points:
9      - Low storage is the most important design point
10      - We want flexible insertion and deletion
11      - We can live with O(log) query, but we need O(1) iteration over strata
12 */
13 typedef struct {
14   moab::Interface    *mbiface;
15 #ifdef MOAB_HAVE_MPI
16   moab::ParallelComm *pcomm;
17 #endif
18   moab::Range        *tag_range; /* entities to which this tag applies */
19   moab::Tag           tag;
20   PetscInt            tag_size;
21   PetscBool           new_tag;
22   PetscBool           is_global_vec;
23   PetscBool           is_native_vec;
24   Vec                 local;
25 } Vec_MOAB;
26 
27 namespace moab {
28 class NestedRefine;
29 }
30 
31 typedef struct {
32   /* common data */
33   PetscInt                dim;                            /* Current topological dimension handled by DMMoab */
34   PetscInt                bs;                             /* Block size that controls the strided vs interlaced configuration in discrete systems -
35                                                              This affects the layout and hence the degree-of-freedom of the different fields (components) */
36 
37   PetscInt               *dfill, *ofill;                  /* The diagonal and off-diagonal block-fill to indicate coupling between components */
38   PetscInt               *materials;                      /* The array that caches the material data for each element */
39 
40   PetscInt                numFields;
41   const char              **fieldNames;
42 
43   /* level specific data */
44   PetscInt                n, nloc, nghost;                /* Number of global, local only and shared vertices for current partition */
45   PetscInt                nele, neleloc, neleghost;       /* Number of global, local only and shared elements for current partition */
46   PetscInt                *gsindices;                     /* Global ID for all local+ghosted vertices */
47   PetscInt                *gidmap, *lidmap;               /* Global ID indices, Local ID indices, field-based local map, field-based global map */
48   PetscInt                seqstart, seqend;               /* Local start and end entity IDs for vertices */
49   PetscInt                vstart, vend;                   /* Global start and end index for distributed Vec */
50   PetscInt                nghostrings;                    /* Number of ghost ring layers */
51   PetscInt                gminmax[2], lminmax[2];         /* Local and global min/max in the ID sequence */
52   PetscInt                refct;
53 
54   /* store the mapping information */
55   ISLocalToGlobalMapping  ltog_map;
56   VecScatter              ltog_sendrecv;
57 
58   /* MOAB objects cached internally in DMMoab */
59 
60   /* common data */
61   moab::Interface         *mbiface;                       /* MOAB Interface/Core reference */
62 #ifdef MOAB_HAVE_MPI
63   moab::ParallelComm      *pcomm;                         /* MOAB ParallelComm reference */
64 #endif
65   moab::Tag               ltog_tag;                       /* MOAB supports "global id" tags */
66   moab::Tag               material_tag;                   /* MOAB supports "material_set" tags */
67   PetscBool               icreatedinstance;               /* true if DM created moab instance internally, will destroy instance in DMDestroy */
68 
69   /* store options to customize DMMoab I/O */
70   PetscInt                rw_dbglevel;
71   PetscBool               partition_by_rank;
72   char                    extra_read_options[PETSC_MAX_PATH_LEN];
73   char                    extra_write_options[PETSC_MAX_PATH_LEN];
74   MoabReadMode            read_mode;
75   MoabWriteMode           write_mode;
76 
77   /* level specific data */
78   moab::Range             *vowned, *vghost, *vlocal;      /* Vertex entities: strictly owned, strictly ghosted, owned+ghosted */
79   moab::Range             *elocal, *eghost;               /* Topological dimensional entities: strictly owned, strictly ghosted */
80   moab::Range             *bndyvtx, *bndyfaces, *bndyelems; /* Boundary entities: skin vertices, skin faces and elements on the outer skin */
81   moab::EntityHandle      fileset;                        /* The Global set to which all local entities belong */
82 
83   /* level hierarchy in MOAB */
84   moab::NestedRefine     *hierarchy;
85   PetscInt                nhlevels, hlevel;
86   moab::EntityHandle     *hsets;
87 
88   /* Sub-mesh level data-strucuture */
89   DM                     *parent;
90 
91 } DM_Moab;
92 
93 typedef struct {
94   DM_Moab             *pdmmoab;
95   moab::NestedRefine  *hierarchy;
96   PetscInt             nhlevels, hlevel;
97   moab::EntityHandle  *hsets;
98 } SubDM_MOAB;
99 
100 #endif /* _DMMBIMPL_H */
101 
102