Actual source code: dlregissf.c
petsc-3.9.4 2018-09-11
1: #include <petsc/private/sfimpl.h>
3: static PetscBool PetscSFPackageInitialized = PETSC_FALSE;
5: PetscClassId PETSCSF_CLASSID;
7: PetscLogEvent PETSCSF_SetGraph;
8: PetscLogEvent PETSCSF_SetUp;
9: PetscLogEvent PETSCSF_BcastBegin;
10: PetscLogEvent PETSCSF_BcastEnd;
11: PetscLogEvent PETSCSF_ReduceBegin;
12: PetscLogEvent PETSCSF_ReduceEnd;
13: PetscLogEvent PETSCSF_FetchAndOpBegin;
14: PetscLogEvent PETSCSF_FetchAndOpEnd;
16: /*@C
17: PetscSFInitializePackage - Initialize SF package
19: Logically Collective
21: Level: developer
23: .seealso: PetscSFFinalizePackage()
24: @*/
25: PetscErrorCode PetscSFInitializePackage(void)
26: {
27: char logList[256];
28: PetscBool opt,pkg;
32: if (PetscSFPackageInitialized) return(0);
33: PetscSFPackageInitialized = PETSC_TRUE;
34: /* Register Class */
35: PetscClassIdRegister("Star Forest Graph", &PETSCSF_CLASSID);
36: /* Register Constructors */
37: PetscSFRegisterAll();
38: /* Register Events */
39: PetscLogEventRegister("SFSetGraph" , PETSCSF_CLASSID, &PETSCSF_SetGraph);
40: PetscLogEventRegister("SFSetUp" , PETSCSF_CLASSID, &PETSCSF_SetUp);
41: PetscLogEventRegister("SFBcastBegin" , PETSCSF_CLASSID, &PETSCSF_BcastBegin);
42: PetscLogEventRegister("SFBcastEnd" , PETSCSF_CLASSID, &PETSCSF_BcastEnd);
43: PetscLogEventRegister("SFReduceBegin" , PETSCSF_CLASSID, &PETSCSF_ReduceBegin);
44: PetscLogEventRegister("SFReduceEnd" , PETSCSF_CLASSID, &PETSCSF_ReduceEnd);
45: PetscLogEventRegister("SFFetchOpBegin" , PETSCSF_CLASSID, &PETSCSF_FetchAndOpBegin);
46: PetscLogEventRegister("SFFetchOpEnd" , PETSCSF_CLASSID, &PETSCSF_FetchAndOpEnd);
47: /* Process info exclusions */
48: PetscOptionsGetString(NULL,NULL,"-info_exclude",logList,sizeof(logList),&opt);
49: if (opt) {
50: PetscStrInList("sf",logList,',',&pkg);
51: if (pkg) {PetscInfoDeactivateClass(PETSCSF_CLASSID);}
52: }
53: /* Process summary exclusions */
54: PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
55: if (opt) {
56: PetscStrInList("sf",logList,',',&pkg);
57: if (pkg) {PetscLogEventDeactivateClass(PETSCSF_CLASSID);}
58: }
59: /* Register package finalizer */
60: PetscRegisterFinalize(PetscSFFinalizePackage);
61: return(0);
62: }
64: /*@C
65: PetscSFFinalizePackage - Finalize PetscSF package, it is called from PetscFinalize()
67: Logically Collective
69: Level: developer
71: .seealso: PetscSFInitializePackage()
72: @*/
73: PetscErrorCode PetscSFFinalizePackage(void)
74: {
78: PetscFunctionListDestroy(&PetscSFList);
79: PetscSFPackageInitialized = PETSC_FALSE;
80: PetscSFRegisterAllCalled = PETSC_FALSE;
81: return(0);
82: }