Actual source code: petscdmnetwork.h
petsc-3.9.4 2018-09-11
1: /*
2: DMNetwork, for parallel unstructured network problems.
3: */
7: #include <petscdm.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[],PetscInt[]);
19: PETSC_EXTERN PetscErrorCode DMNetworkSetEdgeList(DM,PetscInt*[],PetscInt*[]);
20: PETSC_EXTERN PetscErrorCode DMNetworkLayoutSetUp(DM);
21: PETSC_EXTERN PetscErrorCode DMNetworkRegisterComponent(DM,const char*,PetscInt,PetscInt*);
22: PETSC_EXTERN PetscErrorCode DMNetworkGetVertexRange(DM,PetscInt*,PetscInt*);
23: PETSC_EXTERN PetscErrorCode DMNetworkGetEdgeRange(DM,PetscInt*,PetscInt*);
24: PETSC_EXTERN PetscErrorCode DMNetworkAddComponent(DM,PetscInt,PetscInt,void*);
25: PETSC_EXTERN PetscErrorCode DMNetworkGetComponent(DM,PetscInt,PetscInt,PetscInt*,void**);
26: PETSC_EXTERN PetscErrorCode DMNetworkGetNumComponents(DM,PetscInt,PetscInt*);
27: PETSC_EXTERN PetscErrorCode DMNetworkGetVariableOffset(DM,PetscInt,PetscInt*);
28: PETSC_EXTERN PetscErrorCode DMNetworkGetVariableGlobalOffset(DM,PetscInt,PetscInt*);
29: PETSC_EXTERN PetscErrorCode DMNetworkGetEdgeOffset(DM,PetscInt,PetscInt*);
30: PETSC_EXTERN PetscErrorCode DMNetworkGetVertexOffset(DM,PetscInt,PetscInt*);
31: PETSC_EXTERN PetscErrorCode DMNetworkAddNumVariables(DM,PetscInt,PetscInt);
32: PETSC_EXTERN PetscErrorCode DMNetworkGetNumVariables(DM,PetscInt,PetscInt*);
33: PETSC_EXTERN PetscErrorCode DMNetworkSetNumVariables(DM,PetscInt,PetscInt);
34: PETSC_EXTERN PetscErrorCode DMNetworkAssembleGraphStructures(DM);
35: PETSC_EXTERN PetscErrorCode PetscSFGetSubSF(PetscSF,ISLocalToGlobalMapping,PetscSF*);
36: PETSC_EXTERN PetscErrorCode DMNetworkDistribute(DM*,PetscInt);
37: PETSC_EXTERN PetscErrorCode DMNetworkGetSupportingEdges(DM,PetscInt,PetscInt*,const PetscInt*[]);
38: PETSC_EXTERN PetscErrorCode DMNetworkGetConnectedVertices(DM,PetscInt,const PetscInt*[]);
39: PETSC_EXTERN PetscErrorCode DMNetworkIsGhostVertex(DM,PetscInt,PetscBool*);
40: PETSC_EXTERN PetscErrorCode DMNetworkEdgeSetMatrix(DM,PetscInt,Mat[]);
41: PETSC_EXTERN PetscErrorCode DMNetworkVertexSetMatrix(DM,PetscInt,Mat[]);
42: PETSC_EXTERN PetscErrorCode DMNetworkHasJacobian(DM,PetscBool,PetscBool);
43: PETSC_EXTERN PetscErrorCode DMNetworkGetPlex(DM,DM*);
44: PETSC_EXTERN PetscErrorCode DMNetworkGetGlobalEdgeIndex(DM,PetscInt,PetscInt*);
45: PETSC_EXTERN PetscErrorCode DMNetworkGetGlobalVertexIndex(DM,PetscInt,PetscInt*);
47: PETSC_EXTERN PetscErrorCode DMNetworkGetSubnetworkInfo(DM,PetscInt,PetscInt*,PetscInt*,const PetscInt**,const PetscInt**);
49: typedef struct _p_DMNetworkMonitorList *DMNetworkMonitorList;
50: struct _p_DMNetworkMonitorList
51: {
52: PetscViewer viewer;
53: Vec v;
54: PetscInt element;
55: PetscInt nodes;
56: PetscInt start;
57: PetscInt blocksize;
58: DMNetworkMonitorList next;
59: };
61: typedef struct _p_DMNetworkMonitor *DMNetworkMonitor;
62: struct _p_DMNetworkMonitor
63: {
64: MPI_Comm comm;
65: DM network;
66: DMNetworkMonitorList firstnode;
67: };
69: PETSC_EXTERN PetscErrorCode DMNetworkMonitorCreate(DM,DMNetworkMonitor*);
70: PETSC_EXTERN PetscErrorCode DMNetworkMonitorDestroy(DMNetworkMonitor*);
71: PETSC_EXTERN PetscErrorCode DMNetworkMonitorPop(DMNetworkMonitor);
72: PETSC_EXTERN PetscErrorCode DMNetworkMonitorAdd(DMNetworkMonitor,const char*,PetscInt,PetscInt,PetscInt,PetscInt,PetscReal,PetscReal,PetscBool);
73: PETSC_EXTERN PetscErrorCode DMNetworkMonitorView(DMNetworkMonitor,Vec);
75: #endif