Actual source code: slregis.c

petsc-3.14.6 2021-03-30
Report Typos and Errors
  1: #include <petsc/private/characteristicimpl.h>

  3: static PetscBool CharacteristicPackageInitialized = PETSC_FALSE;
  4: /*@C
  5:   CharacteristicFinalizePackage - This function destroys everything in the Petsc interface to the characteristics package. It is
  6:   called from PetscFinalize().

  8:   Level: developer

 10: .seealso: PetscFinalize()
 11: @*/
 12: PetscErrorCode CharacteristicFinalizePackage(void)
 13: {

 17:   PetscFunctionListDestroy(&CharacteristicList);
 18:   CharacteristicPackageInitialized = PETSC_FALSE;
 19:   CharacteristicRegisterAllCalled  = PETSC_FALSE;
 20:   return(0);
 21: }

 23: /*@C
 24:   CharacteristicInitializePackage - This function initializes everything in the Characteristic package. It is called
 25:   from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to CharacteristicCreate()
 26:   when using static libraries.

 28:   Level: developer

 30: .seealso: PetscInitialize()
 31: @*/
 32: PetscErrorCode CharacteristicInitializePackage(void)
 33: {
 34:   char           logList[256];
 35:   PetscBool      opt,pkg;

 39:   if (CharacteristicPackageInitialized) return(0);
 40:   CharacteristicPackageInitialized = PETSC_TRUE;
 41:   /* Register Classes */
 42:   PetscClassIdRegister("Method of Characteristics",&CHARACTERISTIC_CLASSID);
 43:   /* Register Constructors */
 44:   CharacteristicRegisterAll();
 45:   /* Register Events */
 46:   PetscLogEventRegister("MOCSetUp",         CHARACTERISTIC_CLASSID,&CHARACTERISTIC_SetUp);
 47:   PetscLogEventRegister("MOCSolve",         CHARACTERISTIC_CLASSID,&CHARACTERISTIC_Solve);
 48:   PetscLogEventRegister("MOCQueueSetup",    CHARACTERISTIC_CLASSID,&CHARACTERISTIC_QueueSetup);
 49:   PetscLogEventRegister("MOCDAUpdate",      CHARACTERISTIC_CLASSID,&CHARACTERISTIC_DAUpdate);
 50:   PetscLogEventRegister("MOCHalfTimeLocal", CHARACTERISTIC_CLASSID,&CHARACTERISTIC_HalfTimeLocal);
 51:   PetscLogEventRegister("MOCHalfTimeRemot", CHARACTERISTIC_CLASSID,&CHARACTERISTIC_HalfTimeRemote);
 52:   PetscLogEventRegister("MOCHalfTimeExchg", CHARACTERISTIC_CLASSID,&CHARACTERISTIC_HalfTimeExchange);
 53:   PetscLogEventRegister("MOCFullTimeLocal", CHARACTERISTIC_CLASSID,&CHARACTERISTIC_FullTimeLocal);
 54:   PetscLogEventRegister("MOCFullTimeRemot", CHARACTERISTIC_CLASSID,&CHARACTERISTIC_FullTimeRemote);
 55:   PetscLogEventRegister("MOCFullTimeExchg", CHARACTERISTIC_CLASSID,&CHARACTERISTIC_FullTimeExchange);
 56:   /* Process Info */
 57:   {
 58:     PetscClassId  classids[1];

 60:     classids[0] = CHARACTERISTIC_CLASSID;
 61:     PetscInfoProcessClass("characteristic", 1, classids);
 62:   }
 63:   /* Process summary exclusions */
 64:   PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
 65:   if (opt) {
 66:     PetscStrInList("characteristic",logList,',',&pkg);
 67:     if (pkg) {PetscLogEventExcludeClass(CHARACTERISTIC_CLASSID);}
 68:   }
 69:   /* Process package finalizer */
 70:   PetscRegisterFinalize(CharacteristicFinalizePackage);
 71:   return(0);
 72: }

 74: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
 75: /*
 76:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

 78:   This one registers the method of characteristics code

 80:  */
 81: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petsccharacteristic(void)
 82: {

 86:   CharacteristicInitializePackage();
 87:   return(0);
 88: }

 90: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */