xref: /petsc/src/dm/impls/composite/packimpl.h (revision d5b43468fb8780a8feea140ccd6fa3e6a50411cc)
1 #ifndef PETSC_PACKIMPL_H
2 #define PETSC_PACKIMPL_H
3 
4 #include <petscdmcomposite.h>     /*I "petscdmcomposite.h" I*/
5 #include <petsc/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 struct DMCompositeLink {
13   struct DMCompositeLink *next;
14   PetscInt                n;       /* number of owned */
15   PetscInt                rstart;  /* rstart is relative to this process */
16   PetscInt                grstart; /* grstart is relative to all processes */
17   PetscInt                nlocal;
18 
19   /* only used for DMCOMPOSITE_DM */
20   PetscInt *grstarts; /* global row for first unknown of this DM on each process */
21   DM        dm;
22 };
23 
24 typedef struct {
25   PetscInt                n, N, rstart; /* rstart is relative to all processors, n unknowns owned by this process, N is total unknowns */
26   PetscInt                nghost;       /* number of all local entries (includes DMDA ghost points) */
27   PetscInt                nDM, nmine;   /* how many DM's and separate redundant arrays used to build DM(nmine is ones on this process) */
28   PetscBool               setup;        /* after this is set, cannot add new links to the DM*/
29   struct DMCompositeLink *next;
30 
31   PetscErrorCode (*FormCoupleLocations)(DM, Mat, PetscInt *, PetscInt *, PetscInt, PetscInt, PetscInt, PetscInt);
32 } DM_Composite;
33 
34 PETSC_INTERN PetscErrorCode DMCreateMatrix_Composite(DM, Mat *);
35 
36 #endif // PETSC_PACKIMPL_H
37