Actual source code: petscdmnetwork.h

  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: #define ALL_COMPONENTS -1

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

 19: PETSC_EXTERN PetscErrorCode DMNetworkCreate(MPI_Comm,DM*);
 20: PETSC_EXTERN PetscErrorCode DMNetworkSetNumSubNetworks(DM,PetscInt,PetscInt);
 21: PETSC_EXTERN PetscErrorCode DMNetworkGetNumSubNetworks(DM,PetscInt*,PetscInt*);
 22: PETSC_EXTERN PetscErrorCode DMNetworkLayoutSetUp(DM);
 23: PETSC_EXTERN PetscErrorCode DMNetworkRegisterComponent(DM,const char*,size_t,PetscInt*);
 24: PETSC_EXTERN PetscErrorCode DMNetworkGetVertexRange(DM,PetscInt*,PetscInt*);
 25: PETSC_EXTERN PetscErrorCode DMNetworkGetEdgeRange(DM,PetscInt*,PetscInt*);

 27: PETSC_EXTERN PetscErrorCode DMNetworkAddComponent(DM,PetscInt,PetscInt,void*,PetscInt);
 28: PETSC_EXTERN PetscErrorCode DMNetworkGetComponent(DM,PetscInt,PetscInt,PetscInt*,void**,PetscInt*);
 29: PETSC_EXTERN PetscErrorCode DMNetworkGetNumComponents(DM,PetscInt,PetscInt*);
 30: PETSC_EXTERN PetscErrorCode DMNetworkGetLocalVecOffset(DM,PetscInt,PetscInt,PetscInt*);
 31: PETSC_EXTERN PetscErrorCode DMNetworkGetGlobalVecOffset(DM,PetscInt,PetscInt,PetscInt*);

 33: PETSC_EXTERN PetscErrorCode DMNetworkGetEdgeOffset(DM,PetscInt,PetscInt*);
 34: PETSC_EXTERN PetscErrorCode DMNetworkGetVertexOffset(DM,PetscInt,PetscInt*);

 36: PETSC_EXTERN PetscErrorCode DMNetworkAssembleGraphStructures(DM);
 37: PETSC_EXTERN PetscErrorCode DMNetworkSetVertexLocalToGlobalOrdering(DM);
 38: PETSC_EXTERN PetscErrorCode DMNetworkGetVertexLocalToGlobalOrdering(DM,PetscInt,PetscInt*);
 39: PETSC_EXTERN PetscErrorCode PetscSFGetSubSF(PetscSF,ISLocalToGlobalMapping,PetscSF*);
 40: PETSC_EXTERN PetscErrorCode DMNetworkDistribute(DM*,PetscInt);
 41: PETSC_EXTERN PetscErrorCode DMNetworkGetSupportingEdges(DM,PetscInt,PetscInt*,const PetscInt*[]);
 42: PETSC_EXTERN PetscErrorCode DMNetworkGetConnectedVertices(DM,PetscInt,const PetscInt*[]);
 43: PETSC_EXTERN PetscErrorCode DMNetworkIsGhostVertex(DM,PetscInt,PetscBool*);
 44: PETSC_EXTERN PetscErrorCode DMNetworkIsSharedVertex(DM,PetscInt,PetscBool*);
 45: PETSC_EXTERN PetscErrorCode DMNetworkEdgeSetMatrix(DM,PetscInt,Mat[]);
 46: PETSC_EXTERN PetscErrorCode DMNetworkVertexSetMatrix(DM,PetscInt,Mat[]);
 47: PETSC_EXTERN PetscErrorCode DMNetworkHasJacobian(DM,PetscBool,PetscBool);
 48: PETSC_EXTERN PetscErrorCode DMNetworkGetPlex(DM,DM*);
 49: PETSC_EXTERN PetscErrorCode DMNetworkGetGlobalEdgeIndex(DM,PetscInt,PetscInt*);
 50: PETSC_EXTERN PetscErrorCode DMNetworkGetGlobalVertexIndex(DM,PetscInt,PetscInt*);

 52: PETSC_EXTERN PetscErrorCode DMNetworkAddSubnetwork(DM,const char*,PetscInt,PetscInt,PetscInt[],PetscInt*);
 53: PETSC_EXTERN PetscErrorCode DMNetworkGetSubnetwork(DM,PetscInt,PetscInt*,PetscInt*,const PetscInt**,const PetscInt**);
 54: PETSC_EXTERN PetscErrorCode DMNetworkAddSharedVertices(DM,PetscInt,PetscInt,PetscInt,PetscInt[],PetscInt[]);
 55: PETSC_EXTERN PetscErrorCode DMNetworkGetSharedVertices(DM,PetscInt*,const PetscInt**);

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

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

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

 83: #endif