Actual source code: dlregisdm.c
1: #define PETSCDM_DLL
3: #include petscao.h
4: #include petscda.h
8: /*@C
9: DMInitializePackage - This function initializes everything in the DM package. It is called
10: from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to AOCreate()
11: or DACreate() when using static libraries.
13: Input Parameter:
14: path - The dynamic library path, or PETSC_NULL
16: Level: developer
18: .keywords: AO, DA, initialize, package
19: .seealso: PetscInitialize()
20: @*/
21: PetscErrorCode PETSCDM_DLLEXPORT DMInitializePackage(const char path[]) {
22: static PetscTruth initialized = PETSC_FALSE;
23: char logList[256];
24: char *className;
25: PetscTruth opt;
29: if (initialized) return(0);
30: initialized = PETSC_TRUE;
31: /* Register Classes */
32: PetscLogClassRegister(&AO_COOKIE, "Application Order");
33: PetscLogClassRegister(&AODATA_COOKIE, "Application Data");
34: PetscLogClassRegister(&DA_COOKIE, "Distributed array");
35: /* Register Events */
36: PetscLogEventRegister(&AO_PetscToApplication, "AOPetscToApplication", AO_COOKIE);
37: PetscLogEventRegister(&AO_ApplicationToPetsc, "AOApplicationToPetsc", AO_COOKIE);
38: PetscLogEventRegister(&DA_GlobalToLocal, "DAGlobalToLocal", DA_COOKIE);
39: PetscLogEventRegister(&DA_LocalToGlobal, "DALocalToGlobal", DA_COOKIE);
40: PetscLogEventRegister(&DA_LocalADFunction, "DALocalADFunc", DA_COOKIE);
41: /* Process info exclusions */
42: PetscOptionsGetString(PETSC_NULL, "-log_info_exclude", logList, 256, &opt);
43: if (opt) {
44: PetscStrstr(logList, "ao", &className);
45: if (className) {
46: PetscLogInfoDeactivateClass(AO_COOKIE);
47: }
48: PetscStrstr(logList, "da", &className);
49: if (className) {
50: PetscLogInfoDeactivateClass(DA_COOKIE);
51: }
52: }
53: /* Process summary exclusions */
54: PetscOptionsGetString(PETSC_NULL, "-log_summary_exclude", logList, 256, &opt);
55: if (opt) {
56: PetscStrstr(logList, "ao", &className);
57: if (className) {
58: PetscLogEventDeactivateClass(AO_COOKIE);
59: }
60: PetscStrstr(logList, "da", &className);
61: if (className) {
62: PetscLogEventDeactivateClass(DA_COOKIE);
63: }
64: }
65: return(0);
66: }
68: #ifdef PETSC_USE_DYNAMIC_LIBRARIES
72: /*
73: PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.
75: This one registers all the mesh generators and partitioners that are in
76: the basic DM library.
78: Input Parameter:
79: path - library path
80: */
81: PetscErrorCode PETSCDM_DLLEXPORT PetscDLLibraryRegister_petscdm(char *path)
82: {
85: PetscInitializeNoArguments();
86: if (ierr) return(1);
88: /*
89: If we got here then PETSc was properly loaded
90: */
91: DMInitializePackage(path);
92: return(0);
93: }
96: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */