Actual source code: dmmbimpl.h

  1: #pragma once

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

  6: /* This is an integer map, in addition it is also a container class
  7:    Design points:
  8:      - Low storage is the most important design point
  9:      - We want flexible insertion and deletion
 10:      - We can live with O(log) query, but we need O(1) iteration over strata
 11: */
 12: typedef struct {
 13:   moab::Interface *mbiface;
 14: #ifdef MOAB_HAVE_MPI
 15:   moab::ParallelComm *pcomm;
 16: #endif
 17:   moab::Range *tag_range; /* entities to which this tag applies */
 18:   moab::Tag    tag;
 19:   PetscInt     tag_size;
 20:   PetscBool    new_tag;
 21:   PetscBool    is_global_vec;
 22:   PetscBool    is_native_vec;
 23:   Vec          local;
 24: } Vec_MOAB;

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

 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) */

 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 */

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

 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;

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

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

 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 */

 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;

 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 */

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

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

 91: } DM_Moab;

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