Actual source code: slregis.c

petsc-3.7.3 2016-08-01
Report Typos and Errors
  1: #include <petsc/private/characteristicimpl.h>

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

 10:   Level: developer

 12: .keywords: Petsc, destroy, package, finalize
 13: .seealso: PetscFinalize()
 14: @*/
 15: PetscErrorCode CharacteristicFinalizePackage(void)
 16: {

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

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

 33:   Level: developer

 35: .keywords: Characteristic, initialize, package
 36: .seealso: PetscInitialize()
 37: @*/
 38: PetscErrorCode CharacteristicInitializePackage(void)
 39: {
 40:   char           logList[256];
 41:   char           *className;
 42:   PetscBool      opt;

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

 83: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
 86: /*
 87:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

 89:   This one registers the method of characteristics code

 91:  */
 92: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petsccharacteristic(void)
 93: {

 97:   CharacteristicInitializePackage();
 98:   return(0);
 99: }

101: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */