Actual source code: petscdmnetwork.h

  1: /*
  2:   DMNetwork, for parallel unstructured network problems.
  3: */
  4: #ifndef 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 DMNetworkFinalizeComponents(DM);
 30: PETSC_EXTERN PetscErrorCode DMNetworkGetNumComponents(DM, PetscInt, PetscInt *);
 31: PETSC_EXTERN PetscErrorCode DMNetworkGetLocalVecOffset(DM, PetscInt, PetscInt, PetscInt *);
 32: PETSC_EXTERN PetscErrorCode DMNetworkGetGlobalVecOffset(DM, PetscInt, PetscInt, PetscInt *);

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

 37: PETSC_EXTERN PetscErrorCode DMNetworkAssembleGraphStructures(DM);
 38: PETSC_EXTERN PetscErrorCode DMNetworkSetVertexLocalToGlobalOrdering(DM);
 39: PETSC_EXTERN PetscErrorCode DMNetworkGetVertexLocalToGlobalOrdering(DM, PetscInt, PetscInt *);
 40: PETSC_EXTERN PetscErrorCode PetscSFGetSubSF(PetscSF, ISLocalToGlobalMapping, PetscSF *);
 41: PETSC_EXTERN PetscErrorCode DMNetworkDistribute(DM *, PetscInt);
 42: PETSC_EXTERN PetscErrorCode DMNetworkGetSupportingEdges(DM, PetscInt, PetscInt *, const PetscInt *[]);
 43: PETSC_EXTERN PetscErrorCode DMNetworkGetConnectedVertices(DM, PetscInt, const PetscInt *[]);
 44: PETSC_EXTERN PetscErrorCode DMNetworkIsGhostVertex(DM, PetscInt, PetscBool *);
 45: PETSC_EXTERN PetscErrorCode DMNetworkIsSharedVertex(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 DMNetworkAddSubnetwork(DM, const char *, PetscInt, PetscInt[], PetscInt *);
 54: PETSC_EXTERN PetscErrorCode DMNetworkGetSubnetwork(DM, PetscInt, PetscInt *, PetscInt *, const PetscInt **, const PetscInt **);
 55: PETSC_EXTERN PetscErrorCode DMNetworkAddSharedVertices(DM, PetscInt, PetscInt, PetscInt, PetscInt[], PetscInt[]);
 56: PETSC_EXTERN PetscErrorCode DMNetworkGetSharedVertices(DM, PetscInt *, const PetscInt **);
 57: PETSC_EXTERN PetscErrorCode DMNetworkSharedVertexGetInfo(DM, PetscInt, PetscInt *, PetscInt *, const PetscInt **);
 58: PETSC_EXTERN PetscErrorCode DMNetworkCreateIS(DM, PetscInt, PetscInt[], PetscInt[], PetscInt[], PetscInt *[], IS *);
 59: PETSC_EXTERN PetscErrorCode DMNetworkCreateLocalIS(DM, PetscInt, PetscInt[], PetscInt[], PetscInt[], PetscInt *[], IS *);

 61: typedef struct _p_DMNetworkMonitorList *DMNetworkMonitorList;
 62: struct _p_DMNetworkMonitorList {
 63:   PetscViewer          viewer;
 64:   Vec                  v;
 65:   PetscInt             element;
 66:   PetscInt             nodes;
 67:   PetscInt             start;
 68:   PetscInt             blocksize;
 69:   DMNetworkMonitorList next;
 70: };

 72: typedef struct _p_DMNetworkMonitor *DMNetworkMonitor;
 73: struct _p_DMNetworkMonitor {
 74:   MPI_Comm             comm;
 75:   DM                   network;
 76:   DMNetworkMonitorList firstnode;
 77: };

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

 85: #endif