Actual source code: petscdmnetwork.h
petsc-3.8.4 2018-03-24
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);
19: PETSC_EXTERN PetscErrorCode DMNetworkSetEdgeList(DM,int[]);
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 DMNetworkGetNumComponents(DM,PetscInt,PetscInt*);
26: PETSC_EXTERN PetscErrorCode DMNetworkGetComponentKeyOffset(DM,PetscInt,PetscInt,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 DMNetworkGetComponentDataArray(DM,DMNetworkComponentGenericDataType**);
35: PETSC_EXTERN PetscErrorCode DMNetworkAssembleGraphStructures(DM);
36: PETSC_EXTERN PetscErrorCode PetscSFGetSubSF(PetscSF,ISLocalToGlobalMapping,PetscSF*);
37: PETSC_EXTERN PetscErrorCode DMNetworkDistribute(DM*,PetscInt);
38: PETSC_EXTERN PetscErrorCode DMNetworkGetSupportingEdges(DM,PetscInt,PetscInt*,const PetscInt*[]);
39: PETSC_EXTERN PetscErrorCode DMNetworkGetConnectedVertices(DM,PetscInt,const PetscInt*[]);
40: PETSC_EXTERN PetscErrorCode DMNetworkIsGhostVertex(DM,PetscInt,PetscBool*);
41: PETSC_EXTERN PetscErrorCode DMNetworkEdgeSetMatrix(DM,PetscInt,Mat[]);
42: PETSC_EXTERN PetscErrorCode DMNetworkVertexSetMatrix(DM,PetscInt,Mat[]);
43: PETSC_EXTERN PetscErrorCode DMNetworkHasJacobian(DM,PetscBool,PetscBool);
44: PETSC_EXTERN PetscErrorCode DMNetworkGetPlex(DM,DM*);
45: PETSC_EXTERN PetscErrorCode DMNetworkGetGlobalEdgeIndex(DM,PetscInt,PetscInt*);
46: PETSC_EXTERN PetscErrorCode DMNetworkGetGlobalVertexIndex(DM,PetscInt,PetscInt*);
48: typedef struct _p_DMNetworkMonitorList *DMNetworkMonitorList;
49: struct _p_DMNetworkMonitorList
50: {
51: PetscViewer viewer;
52: Vec v;
53: PetscInt element;
54: PetscInt nodes;
55: PetscInt start;
56: PetscInt blocksize;
57: DMNetworkMonitorList next;
58: };
60: typedef struct _p_DMNetworkMonitor *DMNetworkMonitor;
61: struct _p_DMNetworkMonitor
62: {
63: MPI_Comm comm;
64: DM network;
65: DMNetworkMonitorList firstnode;
66: };
68: PETSC_EXTERN PetscErrorCode DMNetworkMonitorCreate(DM,DMNetworkMonitor*);
69: PETSC_EXTERN PetscErrorCode DMNetworkMonitorDestroy(DMNetworkMonitor*);
70: PETSC_EXTERN PetscErrorCode DMNetworkMonitorPop(DMNetworkMonitor);
71: PETSC_EXTERN PetscErrorCode DMNetworkMonitorAdd(DMNetworkMonitor,const char*,PetscInt,PetscInt,PetscInt,PetscInt,PetscReal,PetscReal,PetscBool);
72: PETSC_EXTERN PetscErrorCode DMNetworkMonitorView(DMNetworkMonitor,Vec);
74: #endif