Actual source code: petscdmnetwork.h

petsc-3.13.6 2020-09-29
Report Typos and Errors
  1: /*
  2:   DMNetwork, for parallel unstructured network problems.
  3: */
  4: #if !defined(PETSCDMNETWORK_H)
  5: #define PETSCDMNETWORK_H

  7:  #include <petscdmplex.h>
  8:  #include <petscviewer.h>

 10: /*
 11:   DMNetworkComponentGenericDataType - This is the data type that PETSc uses for storing the component data.
 12:             For compatibility with PetscSF, which is used for data distribution, its declared as PetscInt.
 13:             To get the user-specific data type, one needs to cast it to the appropriate type.
 14: */
 15: typedef PetscInt DMNetworkComponentGenericDataType;

 17: PETSC_EXTERN PetscErrorCode DMNetworkCreate(MPI_Comm,DM*);
 18: PETSC_EXTERN PetscErrorCode DMNetworkSetSizes(DM,PetscInt,PetscInt[],PetscInt[],PetscInt,PetscInt[]);
 19: PETSC_EXTERN PetscErrorCode DMNetworkGetSizes(DM,PetscInt*,PetscInt*);
 20: PETSC_EXTERN PetscErrorCode DMNetworkSetEdgeList(DM,PetscInt*[],PetscInt*[]);
 21: PETSC_EXTERN PetscErrorCode DMNetworkLayoutSetUp(DM);
 22: PETSC_EXTERN PetscErrorCode DMNetworkRegisterComponent(DM,const char*,size_t,PetscInt*);
 23: PETSC_EXTERN PetscErrorCode DMNetworkGetVertexRange(DM,PetscInt*,PetscInt*);
 24: PETSC_EXTERN PetscErrorCode DMNetworkGetEdgeRange(DM,PetscInt*,PetscInt*);
 25: PETSC_EXTERN PetscErrorCode DMNetworkAddComponent(DM,PetscInt,PetscInt,void*);
 26: PETSC_EXTERN PetscErrorCode DMNetworkGetComponent(DM,PetscInt,PetscInt,PetscInt*,void**);
 27: PETSC_EXTERN PetscErrorCode DMNetworkSetComponentNumVariables(DM,PetscInt,PetscInt,PetscInt);
 28: PETSC_EXTERN PetscErrorCode DMNetworkGetNumComponents(DM,PetscInt,PetscInt*);
 29: PETSC_EXTERN PetscErrorCode DMNetworkGetVariableOffset(DM,PetscInt,PetscInt*);
 30: PETSC_EXTERN PetscErrorCode DMNetworkGetVariableGlobalOffset(DM,PetscInt,PetscInt*);
 31: PETSC_EXTERN PetscErrorCode DMNetworkGetComponentVariableOffset(DM,PetscInt,PetscInt,PetscInt*);
 32: PETSC_EXTERN PetscErrorCode DMNetworkGetComponentVariableGlobalOffset(DM,PetscInt,PetscInt,PetscInt*);
 33: PETSC_EXTERN PetscErrorCode DMNetworkGetEdgeOffset(DM,PetscInt,PetscInt*);
 34: PETSC_EXTERN PetscErrorCode DMNetworkGetVertexOffset(DM,PetscInt,PetscInt*);
 35: PETSC_EXTERN PetscErrorCode DMNetworkAddNumVariables(DM,PetscInt,PetscInt);
 36: PETSC_EXTERN PetscErrorCode DMNetworkGetNumVariables(DM,PetscInt,PetscInt*);
 37: PETSC_EXTERN PetscErrorCode DMNetworkSetNumVariables(DM,PetscInt,PetscInt);
 38: PETSC_EXTERN PetscErrorCode DMNetworkAssembleGraphStructures(DM);
 39: PETSC_EXTERN PetscErrorCode DMNetworkSetVertexLocalToGlobalOrdering(DM);
 40: PETSC_EXTERN PetscErrorCode DMNetworkGetVertexLocalToGlobalOrdering(DM,PetscInt,PetscInt*);
 41: PETSC_EXTERN PetscErrorCode PetscSFGetSubSF(PetscSF,ISLocalToGlobalMapping,PetscSF*);
 42: PETSC_EXTERN PetscErrorCode DMNetworkDistribute(DM*,PetscInt);
 43: PETSC_EXTERN PetscErrorCode DMNetworkGetSupportingEdges(DM,PetscInt,PetscInt*,const PetscInt*[]);
 44: PETSC_EXTERN PetscErrorCode DMNetworkGetConnectedVertices(DM,PetscInt,const PetscInt*[]);
 45: PETSC_EXTERN PetscErrorCode DMNetworkIsGhostVertex(DM,PetscInt,PetscBool*);
 46: PETSC_EXTERN PetscErrorCode DMNetworkEdgeSetMatrix(DM,PetscInt,Mat[]);
 47: PETSC_EXTERN PetscErrorCode DMNetworkVertexSetMatrix(DM,PetscInt,Mat[]);
 48: PETSC_EXTERN PetscErrorCode DMNetworkHasJacobian(DM,PetscBool,PetscBool);
 49: PETSC_EXTERN PetscErrorCode DMNetworkGetPlex(DM,DM*);
 50: PETSC_EXTERN PetscErrorCode DMNetworkGetGlobalEdgeIndex(DM,PetscInt,PetscInt*);
 51: PETSC_EXTERN PetscErrorCode DMNetworkGetGlobalVertexIndex(DM,PetscInt,PetscInt*);

 53: PETSC_EXTERN PetscErrorCode DMNetworkGetSubnetworkInfo(DM,PetscInt,PetscInt*,PetscInt*,const PetscInt**,const PetscInt**);
 54: PETSC_EXTERN PetscErrorCode DMNetworkGetSubnetworkCoupleInfo(DM,PetscInt,PetscInt*,const PetscInt**);

 56: typedef struct _p_DMNetworkMonitorList *DMNetworkMonitorList;
 57: struct _p_DMNetworkMonitorList
 58: {
 59:   PetscViewer viewer;
 60:   Vec         v;
 61:   PetscInt    element;
 62:   PetscInt    nodes;
 63:   PetscInt    start;
 64:   PetscInt    blocksize;
 65:   DMNetworkMonitorList next;
 66: };

 68: typedef struct _p_DMNetworkMonitor *DMNetworkMonitor;
 69: struct _p_DMNetworkMonitor
 70: {
 71:   MPI_Comm             comm;
 72:   DM                   network;
 73:   DMNetworkMonitorList firstnode;
 74: };

 76: PETSC_EXTERN PetscErrorCode DMNetworkMonitorCreate(DM,DMNetworkMonitor*);
 77: PETSC_EXTERN PetscErrorCode DMNetworkMonitorDestroy(DMNetworkMonitor*);
 78: PETSC_EXTERN PetscErrorCode DMNetworkMonitorPop(DMNetworkMonitor);
 79: PETSC_EXTERN PetscErrorCode DMNetworkMonitorAdd(DMNetworkMonitor,const char*,PetscInt,PetscInt,PetscInt,PetscInt,PetscReal,PetscReal,PetscReal,PetscReal,PetscBool);
 80: PETSC_EXTERN PetscErrorCode DMNetworkMonitorView(DMNetworkMonitor,Vec);

 82: #endif