Actual source code: dlregis.c
1: #ifdef PETSC_RCS_HEADER
2: static char vcid[] = "$Id: dlregis.c,v 1.1 2000/01/10 06:34:46 knepley Exp $";
3: #endif
5: #include petscao.h
6: #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: int DMInitializePackage(char *path) {
22: static PetscTruth initialized = PETSC_FALSE;
23: char logList[256];
24: char *className;
25: PetscTruth opt;
26: int ierr;
29: if (initialized == PETSC_TRUE) 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 Constructors and Serializers */
36: AOSerializeRegisterAll(path);
37: /* Register Events */
38: PetscLogEventRegister(&AOEvents[AO_PetscToApplication], "AOPetscToApplication", AO_COOKIE);
39: PetscLogEventRegister(&AOEvents[AO_ApplicationToPetsc], "AOApplicationToPetsc", AO_COOKIE);
40: PetscLogEventRegister(&DAEvents[DA_GlobalToLocal], "DAGlobalToLocal", DA_COOKIE);
41: PetscLogEventRegister(&DAEvents[DA_LocalToGlobal], "DALocalToGlobal", DA_COOKIE);
42: /* Process info exclusions */
43: PetscOptionsGetString(PETSC_NULL, "-log_info_exclude", logList, 256, &opt);
44: if (opt == PETSC_TRUE) {
45: PetscStrstr(logList, "ao", &className);
46: if (className) {
47: PetscLogInfoDeactivateClass(AO_COOKIE);
48: }
49: PetscStrstr(logList, "da", &className);
50: if (className) {
51: PetscLogInfoDeactivateClass(DA_COOKIE);
52: }
53: }
54: /* Process summary exclusions */
55: PetscOptionsGetString(PETSC_NULL, "-log_summary_exclude", logList, 256, &opt);
56: if (opt == PETSC_TRUE) {
57: PetscStrstr(logList, "ao", &className);
58: if (className) {
59: PetscLogEventDeactivateClass(AO_COOKIE);
60: }
61: PetscStrstr(logList, "da", &className);
62: if (className) {
63: PetscLogEventDeactivateClass(DA_COOKIE);
64: }
65: }
66: return(0);
67: }
69: #ifdef PETSC_USE_DYNAMIC_LIBRARIES
70: EXTERN_C_BEGIN
71: /*
72: PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.
74: This one registers all the mesh generators and partitioners that are in
75: the basic DM library.
77: Input Parameter:
78: path - library path
79: */
80: int PetscDLLibraryRegister(char *path)
81: {
84: PetscInitializeNoArguments();
85: if (ierr) return(1);
87: /*
88: If we got here then PETSc was properly loaded
89: */
90: DMInitializePackage(path);
91: return(0);
92: }
93: EXTERN_C_END
95: /* --------------------------------------------------------------------------*/
96: static char *contents = "PETSc Distributed Structures library, includesn
97: Application Orderings, Application Data, and Distributed Arrays";
99: static char *authors = PETSC_AUTHOR_INFO;
100: static char *version = PETSC_VERSION_NUMBER;
102: /* --------------------------------------------------------------------------*/
103: EXTERN_C_BEGIN
104: int PetscDLLibraryInfo(char *path,char *type,char **mess)
105: {
106: PetscTruth iscontents, isauthors, isversion;
107: int ierr;
109: PetscStrcmp(type, "Contents", &iscontents);
110: PetscStrcmp(type, "Authors", &isauthors);
111: PetscStrcmp(type, "Version", &isversion);
112: if (iscontents == PETSC_TRUE) *mess = contents;
113: else if (isauthors == PETSC_TRUE) *mess = authors;
114: else if (isversion == PETSC_TRUE) *mess = version;
115: else *mess = PETSC_NULL;
117: return(0);
118: }
119: EXTERN_C_END
121: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */