Actual source code: dlregissf.c

petsc-3.11.3 2019-06-26
Report Typos and Errors
  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;

 18: /*@C
 19:    PetscSFInitializePackage - Initialize SF package

 21:    Logically Collective

 23:    Level: developer

 25: .seealso: PetscSFFinalizePackage()
 26: @*/
 27: PetscErrorCode PetscSFInitializePackage(void)
 28: {
 29:   char           logList[256];
 30:   PetscBool      opt,pkg;

 34:   if (PetscSFPackageInitialized) return(0);
 35:   PetscSFPackageInitialized = PETSC_TRUE;
 36:   /* Register Class */
 37:   PetscClassIdRegister("Star Forest Graph", &PETSCSF_CLASSID);
 38:   /* Register Constructors */
 39:   PetscSFRegisterAll();
 40:   /* Register Events */
 41:   PetscLogEventRegister("SFSetGraph"     , PETSCSF_CLASSID, &PETSCSF_SetGraph);
 42:   PetscLogEventRegister("SFSetUp"        , PETSCSF_CLASSID, &PETSCSF_SetUp);
 43:   PetscLogEventRegister("SFBcastBegin"   , PETSCSF_CLASSID, &PETSCSF_BcastBegin);
 44:   PetscLogEventRegister("SFBcastEnd"     , PETSCSF_CLASSID, &PETSCSF_BcastEnd);
 45:   PetscLogEventRegister("SFBcastOpBegin" , PETSCSF_CLASSID, &PETSCSF_BcastAndOpBegin);
 46:   PetscLogEventRegister("SFBcastOpEnd"   , PETSCSF_CLASSID, &PETSCSF_BcastAndOpEnd);
 47:   PetscLogEventRegister("SFReduceBegin"  , PETSCSF_CLASSID, &PETSCSF_ReduceBegin);
 48:   PetscLogEventRegister("SFReduceEnd"    , PETSCSF_CLASSID, &PETSCSF_ReduceEnd);
 49:   PetscLogEventRegister("SFFetchOpBegin" , PETSCSF_CLASSID, &PETSCSF_FetchAndOpBegin);
 50:   PetscLogEventRegister("SFFetchOpEnd"   , PETSCSF_CLASSID, &PETSCSF_FetchAndOpEnd);
 51:   /* Process info exclusions */
 52:   PetscOptionsGetString(NULL,NULL,"-info_exclude",logList,sizeof(logList),&opt);
 53:   if (opt) {
 54:     PetscStrInList("sf",logList,',',&pkg);
 55:     if (pkg) {PetscInfoDeactivateClass(PETSCSF_CLASSID);}
 56:   }
 57:   /* Process summary exclusions */
 58:   PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
 59:   if (opt) {
 60:     PetscStrInList("sf",logList,',',&pkg);
 61:     if (pkg) {PetscLogEventExcludeClass(PETSCSF_CLASSID);}
 62:   }
 63:   /* Register package finalizer */
 64:   PetscRegisterFinalize(PetscSFFinalizePackage);
 65:   return(0);
 66: }

 68: /*@C
 69:    PetscSFFinalizePackage - Finalize PetscSF package, it is called from PetscFinalize()

 71:    Logically Collective

 73:    Level: developer

 75: .seealso: PetscSFInitializePackage()
 76: @*/
 77: PetscErrorCode PetscSFFinalizePackage(void)
 78: {

 82:   PetscFunctionListDestroy(&PetscSFList);
 83:   PetscSFPackageInitialized = PETSC_FALSE;
 84:   PetscSFRegisterAllCalled  = PETSC_FALSE;
 85:   return(0);
 86: }