Actual source code: dmnetworkimpl.h

petsc-3.11.2 2019-05-18
Report Typos and Errors
  1: #if !defined(_NETWORKIMPL_H)
  2: #define _NETWORKIMPL_H

  4:  #include <petscmat.h>
  5:  #include <petscdmnetwork.h>
  6: #include "petsc/private/dmimpl.h"

  8: #define MAX_DATA_AT_POINT 36

 10: #define MAX_COMPONENTS 16

 12: typedef struct _p_DMNetworkComponentHeader *DMNetworkComponentHeader;
 13: struct _p_DMNetworkComponentHeader {
 14:   PetscInt index;    /* index for user input global edge and vertex */
 15:   PetscInt subnetid; /* Id for subnetwork */
 16:   PetscInt ndata;
 17:   PetscInt size[MAX_DATA_AT_POINT];
 18:   PetscInt key[MAX_DATA_AT_POINT];
 19:   PetscInt offset[MAX_DATA_AT_POINT];
 20: } PETSC_ATTRIBUTEALIGNED(sizeof(PetscScalar));

 22: typedef struct _p_DMNetworkComponentValue *DMNetworkComponentValue;
 23: struct _p_DMNetworkComponentValue {
 24:   void* data[MAX_DATA_AT_POINT];
 25: } PETSC_ATTRIBUTEALIGNED(sizeof(PetscScalar));

 27: typedef struct {
 28:   char     name[32-sizeof(PetscInt)];
 29:   PetscInt size;
 30: } DMNetworkComponent PETSC_ATTRIBUTEALIGNED(sizeof(PetscScalar));


 33: /* Indexing data structures for vertex and edges */
 34: typedef struct {
 35:   PetscSection                      DofSection;
 36:   PetscSection                      GlobalDofSection;
 37:   ISLocalToGlobalMapping            mapping;
 38:   PetscSF                           sf;
 39: } DMNetworkVertexInfo;

 41: typedef struct {
 42:   PetscSection                      DofSection;
 43:   PetscSection                      GlobalDofSection;
 44:   ISLocalToGlobalMapping            mapping;
 45:   PetscSF                           sf;
 46: } DMNetworkEdgeInfo;

 48: typedef struct {
 49:   PetscInt  id;             /* Subnetwork id */
 50:   PetscInt  Nvtx, nvtx;     /* Number of global/local vertices */
 51:   PetscInt  Nedge,nedge;    /* Number of global/local edges */
 52:   PetscInt eStart, eEnd;    /* Range of edge numbers (start, end+1) */
 53:   PetscInt vStart, vEnd;    /* Range of vertex numbers (start, end+1) */
 54:   PetscInt *edgelist;       /* User provided list of edges. Each edge has the format [from to] where from and to are the vertices covering the edge */
 55:   PetscInt  *vertices;      /* Vertices for this subnetwork. These are mapped to the vertex numbers for the whole network */
 56:   PetscInt *edges;          /* Edges for this subnetwork. These are mapped to the edge numbers for the whole network */
 57: } DMSubnetwork;

 59: typedef struct {
 60:   PetscInt                          refct;       /* reference count */
 61:   PetscInt                          NEdges;      /* Number of global edges */
 62:   PetscInt                          NVertices;   /* Number of global vertices */
 63:   PetscInt                          nEdges;      /* Number of local edges */
 64:   PetscInt                          nVertices;   /* Number of local vertices */
 65:   PetscInt                          *edges;      /* Edge list */
 66:   PetscInt                          pStart,pEnd; /* Start and end indices for topological points */
 67:   PetscInt                          vStart,vEnd; /* Start and end indices for vertices */
 68:   PetscInt                          eStart,eEnd; /* Start and end indices for edges */
 69:   DM                                plex;        /* DM created from Plex */
 70:   PetscSection                      DataSection; /* Section for managing parameter distribution */
 71:   PetscSection                      DofSection;  /* Section for managing data distribution */
 72:   PetscSection                      GlobalDofSection; /* Global Dof section */

 74:   DMNetworkVertexInfo               vertex;
 75:   DMNetworkEdgeInfo                 edge;

 77:   PetscInt                          ncomponent; /* Number of components */
 78:   DMNetworkComponent                component[MAX_COMPONENTS]; /* List of components */
 79:   DMNetworkComponentHeader          header;
 80:   DMNetworkComponentValue           cvalue;
 81:   PetscInt                          dataheadersize;
 82:   DMNetworkComponentGenericDataType *componentdataarray; /* Array to hold the data */

 84:   PetscInt                          nsubnet;  /* Total number of subnetworks, including coupling subnetworks */
 85:   PetscInt                          ncsubnet; /* Number of coupling subnetworks */
 86:   DMSubnetwork                      *subnet;  /* Subnetworks */

 88:   PetscBool                         userEdgeJacobian,userVertexJacobian;  /* Global flag for using user's sub Jacobians */
 89:   Mat                               *Je;  /* Pointer array to hold local sub Jacobians for edges, 3 elements for an edge */
 90:   Mat                               *Jv;  /* Pointer array to hold local sub Jacobians for vertices, 1+2*nsupportedges for a vertex */
 91:   PetscInt                          *Jvptr;   /* index of Jv for v-th vertex
 92:                                               Jvpt[v-vStart]:    Jacobian(v,v)
 93:                                               Jvpt[v-vStart]+2i+1: Jacobian(v,e[i]),   e[i]: i-th supporting edge
 94:                                               Jvpt[v-vStart]+2i+2: Jacobian(v,vc[i]), vc[i]: i-th connected vertex
 95:                                               */
 96: } DM_Network;

 98: #endif /* _NETWORKIMPL_H */