xref: /petsc/src/dm/impls/composite/packimpl.h (revision 9dd11ecf0918283bb567d8b33a92f53ac4ea7840)
1*a4963045SJacob Faibussowitsch #pragma once
2a12302e2SJed Brown 
33c48a1e8SJed Brown #include <petscdmcomposite.h>     /*I "petscdmcomposite.h" I*/
4af0996ceSBarry Smith #include <petsc/private/dmimpl.h> /*I      "petscdm.h"     I*/
5a12302e2SJed Brown 
6a12302e2SJed Brown /*
7a12302e2SJed Brown    rstart is where an array/subvector starts in the global parallel vector, so arrays
8a12302e2SJed Brown    rstarts are meaningless (and set to the previous one) except on the processor where the array lives
9a12302e2SJed Brown */
10a12302e2SJed Brown 
11a12302e2SJed Brown struct DMCompositeLink {
12a12302e2SJed Brown   struct DMCompositeLink *next;
13a12302e2SJed Brown   PetscInt                n;       /* number of owned */
14a12302e2SJed Brown   PetscInt                rstart;  /* rstart is relative to this process */
15a12302e2SJed Brown   PetscInt                grstart; /* grstart is relative to all processes */
16a12302e2SJed Brown   PetscInt                nlocal;
17a12302e2SJed Brown 
18a12302e2SJed Brown   /* only used for DMCOMPOSITE_DM */
19a12302e2SJed Brown   PetscInt *grstarts; /* global row for first unknown of this DM on each process */
20a12302e2SJed Brown   DM        dm;
21a12302e2SJed Brown };
22a12302e2SJed Brown 
23a12302e2SJed Brown typedef struct {
24a12302e2SJed Brown   PetscInt                n, N, rstart; /* rstart is relative to all processors, n unknowns owned by this process, N is total unknowns */
259ae5db72SJed Brown   PetscInt                nghost;       /* number of all local entries (includes DMDA ghost points) */
26bebe2cf6SSatish Balay   PetscInt                nDM, nmine;   /* how many DM's and separate redundant arrays used to build DM(nmine is ones on this process) */
27a12302e2SJed Brown   PetscBool               setup;        /* after this is set, cannot add new links to the DM*/
28a12302e2SJed Brown   struct DMCompositeLink *next;
29a12302e2SJed Brown 
30a12302e2SJed Brown   PetscErrorCode (*FormCoupleLocations)(DM, Mat, PetscInt *, PetscInt *, PetscInt, PetscInt, PetscInt, PetscInt);
31a12302e2SJed Brown } DM_Composite;
32a12302e2SJed Brown 
33b412c318SBarry Smith PETSC_INTERN PetscErrorCode DMCreateMatrix_Composite(DM, Mat *);
34