Actual source code: slregis.c
petsc-3.12.5 2020-03-29
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 exclusions */
57: PetscOptionsGetString(NULL,NULL,"-info_exclude",logList,sizeof(logList),&opt);
58: if (opt) {
59: PetscStrInList("characteristic",logList,',',&pkg);
60: if (pkg) {PetscInfoDeactivateClass(CHARACTERISTIC_CLASSID);}
61: }
62: /* Process summary exclusions */
63: PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
64: if (opt) {
65: PetscStrInList("characteristic",logList,',',&pkg);
66: if (pkg) {PetscLogEventExcludeClass(CHARACTERISTIC_CLASSID);}
67: }
68: /* Process package finalizer */
69: PetscRegisterFinalize(CharacteristicFinalizePackage);
70: return(0);
71: }
73: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
74: /*
75: PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.
77: This one registers the method of characteristics code
79: */
80: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petsccharacteristic(void)
81: {
85: CharacteristicInitializePackage();
86: return(0);
87: }
89: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */