Actual source code: dlregisvec.c
1: #define PETSCVEC_DLL
3: #include petscvec.h
4: #include petscpf.h
16: const char *NormTypes[] = {"1","2","FROBENIUS","INFINITY","1_AND_2","NormType","NORM_",0};
17: PetscInt NormIds[7]; /* map from NormType to IDs used to cache Normvalues */
21: /*@C
22: VecInitializePackage - This function initializes everything in the Vec package. It is called
23: from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to VecCreate()
24: when using static libraries.
26: Input Parameter:
27: . path - The dynamic library path, or PETSC_NULL
29: Level: developer
31: .keywords: Vec, initialize, package
32: .seealso: PetscInitialize()
33: @*/
34: PetscErrorCode VecInitializePackage(const char path[])
35: {
36: static PetscTruth initialized = PETSC_FALSE;
37: char logList[256];
38: char *className;
39: PetscTruth opt;
40: PetscErrorCode ierr;
41: PetscInt i;
44: if (initialized) return(0);
45: initialized = PETSC_TRUE;
46: /* Register Classes */
47: PetscLogClassRegister(&IS_COOKIE, "Index Set");
48: PetscLogClassRegister(&VEC_COOKIE, "Vec");
49: PetscLogClassRegister(&VEC_SCATTER_COOKIE, "Vec Scatter");
50: /* Register Constructors */
51: VecRegisterAll(path);
52: /* Register Events */
85: /* Turn off high traffic events by default */
92: /* Process info exclusions */
93: PetscOptionsGetString(PETSC_NULL, "-info_exclude", logList, 256, &opt);
94: if (opt) {
95: PetscStrstr(logList, "is", &className);
96: if (className) {
97: PetscInfoDeactivateClass(IS_COOKIE);
98: }
99: PetscStrstr(logList, "vec", &className);
100: if (className) {
101: PetscInfoDeactivateClass(VEC_COOKIE);
102: }
103: }
104: /* Process summary exclusions */
105: PetscOptionsGetString(PETSC_NULL, "-log_summary_exclude", logList, 256, &opt);
106: if (opt) {
107: PetscStrstr(logList, "is", &className);
108: if (className) {
110: }
111: PetscStrstr(logList, "vec", &className);
112: if (className) {
114: }
115: }
116: /* Special processing */
117: PetscOptionsHasName(PETSC_NULL, "-log_sync", &opt);
118: if (opt) {
124: }
126: /*
127: Create the special MPI reduction operation that may be used by VecNorm/DotBegin()
128: */
129: MPI_Op_create(PetscSplitReduction_Local,1,&PetscSplitReduction_Op);
130: MPI_Op_create(VecMax_Local,2,&VecMax_Local_Op);
131: MPI_Op_create(VecMin_Local,2,&VecMin_Local_Op);
133: /* Register the different norm types for cached norms */
134: for (i=0; i<4; i++) {
135: PetscObjectComposedDataRegister(NormIds+i);
136: }
137: return(0);
138: }
140: #ifdef PETSC_USE_DYNAMIC_LIBRARIES
144: /*
145: PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.
147: This one registers all the methods that are in the basic PETSc Vec library.
149: Input Parameter:
150: path - library path
151: */
152: PetscErrorCode PetscDLLibraryRegister_petscvec(const char path[])
153: {
156: PetscInitializeNoArguments(); if (ierr) return 1;
159: /*
160: If we got here then PETSc was properly loaded
161: */
162: VecInitializePackage(path);
163: PFInitializePackage(path);
164: return(0);
165: }
168: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */