Actual source code: dlregis.c
1: /*$Id: dlregis.c,v 1.19 2001/03/23 23:24:34 balay Exp $*/
3: #include petscvec.h
4: #include petscpf.h
6: /*@C
7: VecInitializePackage - This function initializes everything in the Vec package. It is called
8: from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to VecCreate()
9: when using static libraries.
11: Input Parameter:
12: path - The dynamic library path, or PETSC_NULL
14: Level: developer
16: .keywords: Vec, initialize, package
17: .seealso: PetscInitialize()
18: @*/
19: int VecInitializePackage(char *path) {
20: static PetscTruth initialized = PETSC_FALSE;
21: char logList[256];
22: char *className;
23: PetscTruth opt;
24: int ierr;
27: if (initialized == PETSC_TRUE) return(0);
28: initialized = PETSC_TRUE;
29: /* Register Classes */
30: PetscLogClassRegister(&IS_COOKIE, "Index Set");
31: PetscLogClassRegister(&MAP_COOKIE, "Map");
32: PetscLogClassRegister(&VEC_COOKIE, "Vec");
33: PetscLogClassRegister(&VEC_SCATTER_COOKIE, "Vec Scatter");
34: PetscLogClassRegister(&PF_COOKIE, "PointFunction");
35: /* Register Constructors and Serializers */
36: PetscMapRegisterAll(path);
37: VecRegisterAll(path);
38: PFRegisterAll(path);
39: /* Register Events */
40: PetscLogEventRegister(&VEC_View, "VecView", VEC_COOKIE);
41: PetscLogEventRegister(&VEC_Max, "VecMax", VEC_COOKIE);
42: PetscLogEventRegister(&VEC_Min, "VecMin", VEC_COOKIE);
43: PetscLogEventRegister(&VEC_DotBarrier, "VecDotBarrier", VEC_COOKIE);
44: PetscLogEventRegister(&VEC_Dot, "VecDot", VEC_COOKIE);
45: PetscLogEventRegister(&VEC_MDotBarrier, "VecMDotBarrier", VEC_COOKIE);
46: PetscLogEventRegister(&VEC_MDot, "VecMDot", VEC_COOKIE);
47: PetscLogEventRegister(&VEC_TDot, "VecTDot", VEC_COOKIE);
48: PetscLogEventRegister(&VEC_MTDot, "VecMTDot", VEC_COOKIE);
49: PetscLogEventRegister(&VEC_NormBarrier, "VecNormBarrier", VEC_COOKIE);
50: PetscLogEventRegister(&VEC_Norm, "VecNorm", VEC_COOKIE);
51: PetscLogEventRegister(&VEC_Scale, "VecScale", VEC_COOKIE);
52: PetscLogEventRegister(&VEC_Copy, "VecCopy", VEC_COOKIE);
53: PetscLogEventRegister(&VEC_Set, "VecSet", VEC_COOKIE);
54: PetscLogEventRegister(&VEC_AXPY, "VecAXPY", VEC_COOKIE);
55: PetscLogEventRegister(&VEC_AYPX, "VecAYPX", VEC_COOKIE);
56: PetscLogEventRegister(&VEC_WAXPY, "VecWAXPY", VEC_COOKIE);
57: PetscLogEventRegister(&VEC_MAXPY, "VecMAXPY", VEC_COOKIE);
58: PetscLogEventRegister(&VEC_Swap, "VecSwap", VEC_COOKIE);
59: PetscLogEventRegister(&VEC_AssemblyBegin, "VecAssemblyBegin", VEC_COOKIE);
60: PetscLogEventRegister(&VEC_AssemblyEnd, "VecAssemblyEnd", VEC_COOKIE);
61: PetscLogEventRegister(&VEC_PointwiseMult, "VecPointwiseMult", VEC_COOKIE);
62: PetscLogEventRegister(&VEC_SetValues, "VecSetValues", VEC_COOKIE);
63: PetscLogEventRegister(&VEC_Load, "VecLoad", VEC_COOKIE);
64: PetscLogEventRegister(&VEC_ScatterBarrier, "VecScatterBarrie", VEC_COOKIE);
65: PetscLogEventRegister(&VEC_ScatterBegin, "VecScatterBegin", VEC_COOKIE);
66: PetscLogEventRegister(&VEC_ScatterEnd, "VecScatterEnd", VEC_COOKIE);
67: PetscLogEventRegister(&VEC_SetRandom, "VecSetRandom", VEC_COOKIE);
68: PetscLogEventRegister(&VEC_ReduceArithmetic, "VecReduceArith", VEC_COOKIE);
69: PetscLogEventRegister(&VEC_ReduceBarrier, "VecReduceBarrier", VEC_COOKIE);
70: PetscLogEventRegister(&VEC_ReduceCommunication, "VecReduceComm", VEC_COOKIE);
71: /* Process info exclusions */
72: PetscOptionsGetString(PETSC_NULL, "-log_info_exclude", logList, 256, &opt);
73: if (opt == PETSC_TRUE) {
74: PetscStrstr(logList, "is", &className);
75: if (className) {
76: PetscLogInfoDeactivateClass(IS_COOKIE);
77: }
78: PetscStrstr(logList, "map", &className);
79: if (className) {
80: PetscLogInfoDeactivateClass(MAP_COOKIE);
81: }
82: PetscStrstr(logList, "vec", &className);
83: if (className) {
84: PetscLogInfoDeactivateClass(VEC_COOKIE);
85: }
86: }
87: /* Process summary exclusions */
88: PetscOptionsGetString(PETSC_NULL, "-log_summary_exclude", logList, 256, &opt);
89: if (opt == PETSC_TRUE) {
90: PetscStrstr(logList, "is", &className);
91: if (className) {
92: PetscLogEventDeactivateClass(IS_COOKIE);
93: }
94: PetscStrstr(logList, "map", &className);
95: if (className) {
96: PetscLogEventDeactivateClass(MAP_COOKIE);
97: }
98: PetscStrstr(logList, "vec", &className);
99: if (className) {
100: PetscLogEventDeactivateClass(VEC_COOKIE);
101: }
102: }
103: /* Special processing */
104: PetscOptionsHasName(PETSC_NULL, "-log_sync", &opt);
105: if (opt == PETSC_TRUE) {
106: PetscLogEventActivate(VEC_ScatterBarrier);
107: PetscLogEventActivate(VEC_NormBarrier);
108: PetscLogEventActivate(VEC_DotBarrier);
109: PetscLogEventActivate(VEC_MDotBarrier);
110: PetscLogEventActivate(VEC_ReduceBarrier);
111: }
112: return(0);
113: }
115: #ifdef PETSC_USE_DYNAMIC_LIBRARIES
116: EXTERN_C_BEGIN
117: /*
118: PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.
120: This one registers all the methods that are in the basic PETSc Vec library.
122: Input Parameter:
123: path - library path
124: */
125: int PetscDLLibraryRegister(char *path)
126: {
129: PetscInitializeNoArguments(); if (ierr) return 1;
132: /*
133: If we got here then PETSc was properly loaded
134: */
135: VecInitializePackage(path);
136: return(0);
137: }
138: EXTERN_C_END
140: /* --------------------------------------------------------------------------*/
141: static char *contents = "PETSc Vector library. n";
142: static char *authors = PETSC_AUTHOR_INFO;
144: #include src/sys/src/utils/dlregis.h
146: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */