Actual source code: dmnetworkimpl.h
petsc-3.12.1 2019-10-22
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/dmpleximpl.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  Nvtx, nvtx;     /* Number of global/local vertices */
     50:   PetscInt  Nedge,nedge;    /* Number of global/local edges */
     51:   PetscInt  eStart, eEnd;   /* Range of edge numbers (start, end+1) */
     52:   PetscInt  vStart, vEnd;   /* Range of vertex numbers (start, end+1) */
     53:   PetscInt  *edgelist;      /* User provided list of edges. Each edge has the format [from to] where from and to are the vertices covering the edge */
     54:   PetscInt  *vertices;      /* Vertices for this subnetwork. These are mapped to the vertex numbers for the whole network */
     55:   PetscInt  *edges;         /* Edges for this subnetwork. These are mapped to the edge numbers for the whole network */
     56: } DMSubnetwork;

     58: typedef struct {
     59:   PetscInt                          refct;       /* reference count */
     60:   PetscInt                          NEdges,nEdges;        /* Number of global/local edges */
     61:   PetscInt                          NVertices,nVertices; /* Number of global/local vertices */
     62:   PetscInt                          pStart,pEnd; /* Start and end indices for topological points */
     63:   PetscInt                          vStart,vEnd; /* Start and end indices for vertices */
     64:   PetscInt                          eStart,eEnd; /* Start and end indices for edges */
     65:   DM                                plex;        /* DM created from Plex */
     66:   PetscSection                      DataSection; /* Section for managing parameter distribution */
     67:   PetscSection                      DofSection;  /* Section for managing data distribution */
     68:   PetscSection                      GlobalDofSection; /* Global Dof section */
     69:   PetscBool                         distributecalled; /* Flag if DMNetworkDistribute() is called */
     70:   PetscInt                          *vltog;           /* Maps vertex local ordering to global ordering, include ghost vertices */

     72:   DMNetworkVertexInfo               vertex;
     73:   DMNetworkEdgeInfo                 edge;

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

     82:   PetscInt                          nsubnet;  /* Global number of subnetworks, including coupling subnetworks */
     83:   PetscInt                          ncsubnet; /* Global number of coupling subnetworks */
     84:   DMSubnetwork                      *subnet;  /* Subnetworks */
     85:   PetscInt                          *subnetvtx; /* Maps local vertex to local subnetwork's vertex */

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

     97: #endif /* _NETWORKIMPL_H */