Actual source code: slregis.c
petsc-3.10.5 2019-03-28
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: PetscBool opt,pkg;
41: if (CharacteristicPackageInitialized) return(0);
42: CharacteristicPackageInitialized = PETSC_TRUE;
43: /* Register Classes */
44: PetscClassIdRegister("Method of Characteristics",&CHARACTERISTIC_CLASSID);
45: /* Register Constructors */
46: CharacteristicRegisterAll();
47: /* Register Events */
48: PetscLogEventRegister("MOCSetUp", CHARACTERISTIC_CLASSID,&CHARACTERISTIC_SetUp);
49: PetscLogEventRegister("MOCSolve", CHARACTERISTIC_CLASSID,&CHARACTERISTIC_Solve);
50: PetscLogEventRegister("MOCQueueSetup", CHARACTERISTIC_CLASSID,&CHARACTERISTIC_QueueSetup);
51: PetscLogEventRegister("MOCDAUpdate", CHARACTERISTIC_CLASSID,&CHARACTERISTIC_DAUpdate);
52: PetscLogEventRegister("MOCHalfTimeLocal", CHARACTERISTIC_CLASSID,&CHARACTERISTIC_HalfTimeLocal);
53: PetscLogEventRegister("MOCHalfTimeRemot", CHARACTERISTIC_CLASSID,&CHARACTERISTIC_HalfTimeRemote);
54: PetscLogEventRegister("MOCHalfTimeExchg", CHARACTERISTIC_CLASSID,&CHARACTERISTIC_HalfTimeExchange);
55: PetscLogEventRegister("MOCFullTimeLocal", CHARACTERISTIC_CLASSID,&CHARACTERISTIC_FullTimeLocal);
56: PetscLogEventRegister("MOCFullTimeRemot", CHARACTERISTIC_CLASSID,&CHARACTERISTIC_FullTimeRemote);
57: PetscLogEventRegister("MOCFullTimeExchg", CHARACTERISTIC_CLASSID,&CHARACTERISTIC_FullTimeExchange);
58: /* Process info exclusions */
59: PetscOptionsGetString(NULL,NULL,"-info_exclude",logList,sizeof(logList),&opt);
60: if (opt) {
61: PetscStrInList("characteristic",logList,',',&pkg);
62: if (pkg) {PetscInfoDeactivateClass(CHARACTERISTIC_CLASSID);}
63: }
64: /* Process summary exclusions */
65: PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
66: if (opt) {
67: PetscStrInList("characteristic",logList,',',&pkg);
68: if (pkg) {PetscLogEventExcludeClass(CHARACTERISTIC_CLASSID);}
69: }
70: /* Process package finalizer */
71: PetscRegisterFinalize(CharacteristicFinalizePackage);
72: return(0);
73: }
75: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
76: /*
77: PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.
79: This one registers the method of characteristics code
81: */
82: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petsccharacteristic(void)
83: {
87: CharacteristicInitializePackage();
88: return(0);
89: }
91: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */