Actual source code: dlregissf.c
petsc-3.12.5 2020-03-29
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_BcastAndOpBegin;
12: PetscLogEvent PETSCSF_BcastAndOpEnd;
13: PetscLogEvent PETSCSF_ReduceBegin;
14: PetscLogEvent PETSCSF_ReduceEnd;
15: PetscLogEvent PETSCSF_FetchAndOpBegin;
16: PetscLogEvent PETSCSF_FetchAndOpEnd;
17: PetscLogEvent PETSCSF_EmbedSF;
18: PetscLogEvent PETSCSF_DistSect;
19: PetscLogEvent PETSCSF_SectSF;
20: PetscLogEvent PETSCSF_RemoteOff;
22: /*@C
23: PetscSFInitializePackage - Initialize SF package
25: Logically Collective
27: Level: developer
29: .seealso: PetscSFFinalizePackage()
30: @*/
31: PetscErrorCode PetscSFInitializePackage(void)
32: {
33: char logList[256];
34: PetscBool opt,pkg;
38: if (PetscSFPackageInitialized) return(0);
39: PetscSFPackageInitialized = PETSC_TRUE;
40: /* Register Class */
41: PetscClassIdRegister("Star Forest Graph", &PETSCSF_CLASSID);
42: /* Register Constructors */
43: PetscSFRegisterAll();
44: /* Register Events */
45: PetscLogEventRegister("SFSetGraph" , PETSCSF_CLASSID, &PETSCSF_SetGraph);
46: PetscLogEventRegister("SFSetUp" , PETSCSF_CLASSID, &PETSCSF_SetUp);
47: PetscLogEventRegister("SFBcastBegin" , PETSCSF_CLASSID, &PETSCSF_BcastBegin);
48: PetscLogEventRegister("SFBcastEnd" , PETSCSF_CLASSID, &PETSCSF_BcastEnd);
49: PetscLogEventRegister("SFBcastOpBegin" , PETSCSF_CLASSID, &PETSCSF_BcastAndOpBegin);
50: PetscLogEventRegister("SFBcastOpEnd" , PETSCSF_CLASSID, &PETSCSF_BcastAndOpEnd);
51: PetscLogEventRegister("SFReduceBegin" , PETSCSF_CLASSID, &PETSCSF_ReduceBegin);
52: PetscLogEventRegister("SFReduceEnd" , PETSCSF_CLASSID, &PETSCSF_ReduceEnd);
53: PetscLogEventRegister("SFFetchOpBegin" , PETSCSF_CLASSID, &PETSCSF_FetchAndOpBegin);
54: PetscLogEventRegister("SFFetchOpEnd" , PETSCSF_CLASSID, &PETSCSF_FetchAndOpEnd);
55: PetscLogEventRegister("SFCreateEmbed" , PETSCSF_CLASSID, &PETSCSF_EmbedSF);
56: PetscLogEventRegister("SFDistSection" , PETSCSF_CLASSID, &PETSCSF_DistSect);
57: PetscLogEventRegister("SFSectionSF" , PETSCSF_CLASSID, &PETSCSF_SectSF);
58: PetscLogEventRegister("SFRemoteOff" , PETSCSF_CLASSID, &PETSCSF_RemoteOff);
59: /* Process info exclusions */
60: PetscOptionsGetString(NULL,NULL,"-info_exclude",logList,sizeof(logList),&opt);
61: if (opt) {
62: PetscStrInList("sf",logList,',',&pkg);
63: if (pkg) {PetscInfoDeactivateClass(PETSCSF_CLASSID);}
64: }
65: /* Process summary exclusions */
66: PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
67: if (opt) {
68: PetscStrInList("sf",logList,',',&pkg);
69: if (pkg) {PetscLogEventExcludeClass(PETSCSF_CLASSID);}
70: }
71: /* Register package finalizer */
72: PetscRegisterFinalize(PetscSFFinalizePackage);
73: return(0);
74: }
76: /*@C
77: PetscSFFinalizePackage - Finalize PetscSF package, it is called from PetscFinalize()
79: Logically Collective
81: Level: developer
83: .seealso: PetscSFInitializePackage()
84: @*/
85: PetscErrorCode PetscSFFinalizePackage(void)
86: {
90: PetscFunctionListDestroy(&PetscSFList);
91: PetscSFPackageInitialized = PETSC_FALSE;
92: PetscSFRegisterAllCalled = PETSC_FALSE;
93: return(0);
94: }