Actual source code: slregis.c

petsc-3.8.4 2018-03-24
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: .keywords: Petsc, destroy, package, finalize
 11: .seealso: PetscFinalize()
 12: @*/
 13: PetscErrorCode CharacteristicFinalizePackage(void)
 14: {

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

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

 29:   Level: developer

 31: .keywords: Characteristic, initialize, package
 32: .seealso: PetscInitialize()
 33: @*/
 34: PetscErrorCode CharacteristicInitializePackage(void)
 35: {
 36:   char           logList[256];
 37:   char           *className;
 38:   PetscBool      opt;

 42:   if (CharacteristicPackageInitialized) return(0);
 43:   CharacteristicPackageInitialized = PETSC_TRUE;
 44:   /* Register Classes */
 45:   PetscClassIdRegister("Method of Characteristics",&CHARACTERISTIC_CLASSID);
 46:   /* Register Constructors */
 47:   CharacteristicRegisterAll();
 48:   /* Register Events */
 49:   PetscLogEventRegister("MOCSetUp",         CHARACTERISTIC_CLASSID,&CHARACTERISTIC_SetUp);
 50:   PetscLogEventRegister("MOCSolve",         CHARACTERISTIC_CLASSID,&CHARACTERISTIC_Solve);
 51:   PetscLogEventRegister("MOCQueueSetup",    CHARACTERISTIC_CLASSID,&CHARACTERISTIC_QueueSetup);
 52:   PetscLogEventRegister("MOCDAUpdate",      CHARACTERISTIC_CLASSID,&CHARACTERISTIC_DAUpdate);
 53:   PetscLogEventRegister("MOCHalfTimeLocal", CHARACTERISTIC_CLASSID,&CHARACTERISTIC_HalfTimeLocal);
 54:   PetscLogEventRegister("MOCHalfTimeRemot", CHARACTERISTIC_CLASSID,&CHARACTERISTIC_HalfTimeRemote);
 55:   PetscLogEventRegister("MOCHalfTimeExchg", CHARACTERISTIC_CLASSID,&CHARACTERISTIC_HalfTimeExchange);
 56:   PetscLogEventRegister("MOCFullTimeLocal", CHARACTERISTIC_CLASSID,&CHARACTERISTIC_FullTimeLocal);
 57:   PetscLogEventRegister("MOCFullTimeRemot", CHARACTERISTIC_CLASSID,&CHARACTERISTIC_FullTimeRemote);
 58:   PetscLogEventRegister("MOCFullTimeExchg", CHARACTERISTIC_CLASSID,&CHARACTERISTIC_FullTimeExchange);
 59:   /* Process info exclusions */
 60:   PetscOptionsGetString(NULL,NULL, "-log_info_exclude", logList, 256, &opt);
 61:   if (opt) {
 62:     PetscStrstr(logList, "characteristic", &className);
 63:     if (className) {
 64:       PetscInfoDeactivateClass(CHARACTERISTIC_CLASSID);
 65:     }
 66:   }
 67:   /* Process summary exclusions */
 68:   PetscOptionsGetString(NULL,NULL, "-log_exclude", logList, 256, &opt);
 69:   if (opt) {
 70:     PetscStrstr(logList, "characteristic", &className);
 71:     if (className) {
 72:       PetscLogEventDeactivateClass(CHARACTERISTIC_CLASSID);
 73:     }
 74:   }
 75:   PetscRegisterFinalize(CharacteristicFinalizePackage);
 76:   return(0);
 77: }

 79: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
 80: /*
 81:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

 83:   This one registers the method of characteristics code

 85:  */
 86: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petsccharacteristic(void)
 87: {

 91:   CharacteristicInitializePackage();
 92:   return(0);
 93: }

 95: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */