Actual source code: dlregissf.c

      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;
     15: PetscLogEvent PETSCSF_EmbedSF;
     16: PetscLogEvent PETSCSF_DistSect;
     17: PetscLogEvent PETSCSF_SectSF;
     18: PetscLogEvent PETSCSF_RemoteOff;
     19: PetscLogEvent PETSCSF_Pack;
     20: PetscLogEvent PETSCSF_Unpack;

     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("SFReduceBegin"  , PETSCSF_CLASSID, &PETSCSF_ReduceBegin);
     50:   PetscLogEventRegister("SFReduceEnd"    , PETSCSF_CLASSID, &PETSCSF_ReduceEnd);
     51:   PetscLogEventRegister("SFFetchOpBegin" , PETSCSF_CLASSID, &PETSCSF_FetchAndOpBegin);
     52:   PetscLogEventRegister("SFFetchOpEnd"   , PETSCSF_CLASSID, &PETSCSF_FetchAndOpEnd);
     53:   PetscLogEventRegister("SFCreateEmbed"  , PETSCSF_CLASSID, &PETSCSF_EmbedSF);
     54:   PetscLogEventRegister("SFDistSection"  , PETSCSF_CLASSID, &PETSCSF_DistSect);
     55:   PetscLogEventRegister("SFSectionSF"    , PETSCSF_CLASSID, &PETSCSF_SectSF);
     56:   PetscLogEventRegister("SFRemoteOff"    , PETSCSF_CLASSID, &PETSCSF_RemoteOff);
     57:   PetscLogEventRegister("SFPack"         , PETSCSF_CLASSID, &PETSCSF_Pack);
     58:   PetscLogEventRegister("SFUnpack"       , PETSCSF_CLASSID, &PETSCSF_Unpack);
     59:   /* Process Info */
     60:   {
     61:     PetscClassId  classids[1];

     63:     classids[0] = PETSCSF_CLASSID;
     64:     PetscInfoProcessClass("sf", 1, classids);
     65:   }
     66:   /* Process summary exclusions */
     67:   PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
     68:   if (opt) {
     69:     PetscStrInList("sf",logList,',',&pkg);
     70:     if (pkg) {PetscLogEventExcludeClass(PETSCSF_CLASSID);}
     71:   }
     72:   /* Register package finalizer */
     73:   PetscRegisterFinalize(PetscSFFinalizePackage);
     74:   return(0);
     75: }

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

     80:    Logically Collective

     82:    Level: developer

     84: .seealso: PetscSFInitializePackage()
     85: @*/
     86: PetscErrorCode PetscSFFinalizePackage(void)
     87: {

     91:   PetscFunctionListDestroy(&PetscSFList);
     92:   PetscSFPackageInitialized = PETSC_FALSE;
     93:   PetscSFRegisterAllCalled  = PETSC_FALSE;
     94:   return(0);
     95: }