Actual source code: dmmbimpl.h

  1: #ifndef _DMMBIMPL_H
  2: #define _DMMBIMPL_H

  4: #include <petscdmmoab.h>
  5: #include "petsc/private/dmimpl.h"

  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;

 27: namespace moab
 28: {
 29: class NestedRefine;
 30: } // namespace moab

 32: typedef struct {
 33:   /* common data */
 34:   PetscInt dim; /* Current topological dimension handled by DMMoab */
 35:   PetscInt bs;  /* Block size that controls the strided vs interlaced configuration in discrete systems -
 36:                                                              This affects the layout and hence the degree-of-freedom of the different fields (components) */

 38:   PetscInt *dfill, *ofill; /* The diagonal and off-diagonal block-fill to indicate coupling between components */
 39:   PetscInt *materials;     /* The array that caches the material data for each element */

 41:   PetscInt     numFields;
 42:   const char **fieldNames;

 44:   /* level specific data */
 45:   PetscInt  n, nloc, nghost;          /* Number of global, local only and shared vertices for current partition */
 46:   PetscInt  nele, neleloc, neleghost; /* Number of global, local only and shared elements for current partition */
 47:   PetscInt *gsindices;                /* Global ID for all local+ghosted vertices */
 48:   PetscInt *gidmap, *lidmap;          /* Global ID indices, Local ID indices, field-based local map, field-based global map */
 49:   PetscInt  seqstart, seqend;         /* Local start and end entity IDs for vertices */
 50:   PetscInt  vstart, vend;             /* Global start and end index for distributed Vec */
 51:   PetscInt  nghostrings;              /* Number of ghost ring layers */
 52:   PetscInt  gminmax[2], lminmax[2];   /* Local and global min/max in the ID sequence */
 53:   PetscInt  refct;

 55:   /* store the mapping information */
 56:   ISLocalToGlobalMapping ltog_map;
 57:   VecScatter             ltog_sendrecv;

 59:   /* MOAB objects cached internally in DMMoab */

 61:   /* common data */
 62:   moab::Interface *mbiface; /* MOAB Interface/Core reference */
 63: #ifdef MOAB_HAVE_MPI
 64:   moab::ParallelComm *pcomm; /* MOAB ParallelComm reference */
 65: #endif
 66:   moab::Tag ltog_tag;         /* MOAB supports "global id" tags */
 67:   moab::Tag material_tag;     /* MOAB supports "material_set" tags */
 68:   PetscBool icreatedinstance; /* true if DM created moab instance internally, will destroy instance in DMDestroy */

 70:   /* store options to customize DMMoab I/O */
 71:   PetscInt      rw_dbglevel;
 72:   PetscBool     partition_by_rank;
 73:   char          extra_read_options[PETSC_MAX_PATH_LEN];
 74:   char          extra_write_options[PETSC_MAX_PATH_LEN];
 75:   MoabReadMode  read_mode;
 76:   MoabWriteMode write_mode;

 78:   /* level specific data */
 79:   moab::Range       *vowned, *vghost, *vlocal;        /* Vertex entities: strictly owned, strictly ghosted, owned+ghosted */
 80:   moab::Range       *elocal, *eghost;                 /* Topological dimensional entities: strictly owned, strictly ghosted */
 81:   moab::Range       *bndyvtx, *bndyfaces, *bndyelems; /* Boundary entities: skin vertices, skin faces and elements on the outer skin */
 82:   moab::EntityHandle fileset;                         /* The Global set to which all local entities belong */

 84:   /* level hierarchy in MOAB */
 85:   moab::NestedRefine *hierarchy;
 86:   PetscInt            nhlevels, hlevel;
 87:   moab::EntityHandle *hsets;

 89:   /* Sub-mesh level data-strucuture */
 90:   DM *parent;

 92: } DM_Moab;

 94: typedef struct {
 95:   DM_Moab            *pdmmoab;
 96:   moab::NestedRefine *hierarchy;
 97:   PetscInt            nhlevels, hlevel;
 98:   moab::EntityHandle *hsets;
 99: } SubDM_MOAB;

101: #endif /* _DMMBIMPL_H */