Actual source code: dmnetworkimpl.h

petsc-3.8.4 2018-03-24
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: typedef struct _p_DMNetworkComponentHeader *DMNetworkComponentHeader;
 11: struct _p_DMNetworkComponentHeader {
 12:   PetscInt index;    /* index for user input global edge and vertex */
 13:   PetscInt ndata;
 14:   PetscInt size[MAX_DATA_AT_POINT];
 15:   PetscInt key[MAX_DATA_AT_POINT];
 16:   PetscInt offset[MAX_DATA_AT_POINT];
 17: } PETSC_ATTRIBUTEALIGNED(sizeof(PetscScalar));

 19: typedef struct _p_DMNetworkComponentValue *DMNetworkComponentValue;
 20: struct _p_DMNetworkComponentValue {
 21:   void* data[MAX_DATA_AT_POINT];
 22: } PETSC_ATTRIBUTEALIGNED(sizeof(PetscScalar));

 24: typedef struct {
 25:   char     name[32-sizeof(PetscInt)];
 26:   PetscInt size;
 27: } DMNetworkComponent PETSC_ATTRIBUTEALIGNED(sizeof(PetscScalar));


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

 38: typedef struct {
 39:   PetscSection                      DofSection;
 40:   PetscSection                      GlobalDofSection;
 41:   ISLocalToGlobalMapping            mapping;
 42:   PetscSF                           sf;
 43: } DMNetworkEdgeInfo;

 45: typedef struct {
 46:   PetscInt                          refct;       /* reference count */
 47:   PetscInt                          NEdges;      /* Number of global edges */
 48:   PetscInt                          NVertices;   /* Number of global vertices */
 49:   PetscInt                          nEdges;      /* Number of local edges */
 50:   PetscInt                          nVertices;   /* Number of local vertices */
 51:   int                               *edges;      /* Edge list */
 52:   PetscInt                          pStart,pEnd; /* Start and end indices for topological points */
 53:   PetscInt                          vStart,vEnd; /* Start and end indices for vertices */
 54:   PetscInt                          eStart,eEnd; /* Start and end indices for edges */
 55:   DM                                plex;        /* DM created from Plex */
 56:   PetscSection                      DataSection; /* Section for managing parameter distribution */
 57:   PetscSection                      DofSection;  /* Section for managing data distribution */
 58:   PetscSection                      GlobalDofSection; /* Global Dof section */

 60:   DMNetworkVertexInfo               vertex;
 61:   DMNetworkEdgeInfo                 edge;

 63:   PetscInt                          ncomponent; /* Number of components */
 64:   DMNetworkComponent                component[10]; /* List of components */
 65:   DMNetworkComponentHeader          header;
 66:   DMNetworkComponentValue           cvalue;
 67:   PetscInt                          dataheadersize;
 68:   DMNetworkComponentGenericDataType *componentdataarray; /* Array to hold the data */

 70:   PetscBool                         userEdgeJacobian,userVertexJacobian;  /* Global flag for using user's sub Jacobians */
 71:   Mat                               *Je;  /* Pointer array to hold local sub Jacobians for edges, 3 elements for an edge */
 72:   Mat                               *Jv;  /* Pointer array to hold local sub Jacobians for vertices, 1+2*nsupportedges for a vertex */
 73:   PetscInt                          *Jvptr;   /* index of Jv for v-th vertex
 74:                                               Jvpt[v-vStart]:    Jacobian(v,v)
 75:                                               Jvpt[v-vStart]+2i+1: Jacobian(v,e[i]),   e[i]: i-th supporting edge
 76:                                               Jvpt[v-vStart]+2i+2: Jacobian(v,vc[i]), vc[i]: i-th connected vertex
 77:                                               */
 78: } DM_Network;

 80: #endif /* _NETWORKIMPL_H */