xref: /petsc/src/dm/impls/composite/packimpl.h (revision 074cc835faa3d6c800494dd2ea2bd8f95d70c354)
1 #if !defined(_packimpl_h)
2 #define _packimpl_h
3 
4 #include <petscdmcomposite.h>    /*I "petscdmcomposite.h" I*/
5 #include <private/dmimpl.h>      /*I      "petscdm.h"     I*/
6 
7 /*
8    rstart is where an array/subvector starts in the global parallel vector, so arrays
9    rstarts are meaningless (and set to the previous one) except on the processor where the array lives
10 */
11 
12 typedef enum {DMCOMPOSITE_ARRAY, DMCOMPOSITE_DM} DMCompositeLinkType;
13 
14 struct DMCompositeLink {
15   DMCompositeLinkType    type;
16   struct DMCompositeLink *next;
17   PetscInt               n;             /* number of owned */
18   PetscInt               rstart;        /* rstart is relative to this process */
19   PetscInt               grstart;       /* grstart is relative to all processes */
20   PetscInt               nlocal;
21 
22   /* only used for DMCOMPOSITE_DM */
23   PetscInt               *grstarts;     /* global row for first unknown of this DM on each process */
24   DM                     dm;
25 
26   /* only used for DMCOMPOSITE_ARRAY */
27   PetscMPIInt            rank;          /* process where array unknowns live */
28 };
29 
30 typedef struct {
31   PetscInt               n,N,rstart;           /* rstart is relative to all processors, n unknowns owned by this process, N is total unknowns */
32   PetscInt               nghost;               /* number of all local entries include DMDA ghost points and any shared redundant arrays */
33   PetscInt               nDM,nredundant,nmine; /* how many DM's and seperate redundant arrays used to build DM(nmine is ones on this process) */
34   PetscBool              setup;                /* after this is set, cannot add new links to the DM*/
35   struct DMCompositeLink *next;
36 
37   PetscErrorCode (*FormCoupleLocations)(DM,Mat,PetscInt*,PetscInt*,PetscInt,PetscInt,PetscInt,PetscInt);
38 } DM_Composite;
39 
40 extern PetscErrorCode DMGetMatrix_Composite(DM,const MatType,Mat*);
41 
42 #endif
43