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(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: PetscLogClassRegister(&PF_COOKIE, "PointFunction");
51: /* Register Constructors */
52: VecRegisterAll(path);
53: PFRegisterAll(path);
54: /* Register Events */
87: /* Turn off high traffic events by default */
94: /* Process info exclusions */
95: PetscOptionsGetString(PETSC_NULL, "-info_exclude", logList, 256, &opt);
96: if (opt) {
97: PetscStrstr(logList, "is", &className);
98: if (className) {
99: PetscInfoDeactivateClass(IS_COOKIE);
100: }
101: PetscStrstr(logList, "vec", &className);
102: if (className) {
103: PetscInfoDeactivateClass(VEC_COOKIE);
104: }
105: }
106: /* Process summary exclusions */
107: PetscOptionsGetString(PETSC_NULL, "-log_summary_exclude", logList, 256, &opt);
108: if (opt) {
109: PetscStrstr(logList, "is", &className);
110: if (className) {
112: }
113: PetscStrstr(logList, "vec", &className);
114: if (className) {
116: }
117: }
118: /* Special processing */
119: PetscOptionsHasName(PETSC_NULL, "-log_sync", &opt);
120: if (opt) {
126: }
128: /*
129: Create the special MPI reduction operation that may be used by VecNorm/DotBegin()
130: */
131: MPI_Op_create(PetscSplitReduction_Local,1,&PetscSplitReduction_Op);
132: MPI_Op_create(VecMax_Local,2,&VecMax_Local_Op);
133: MPI_Op_create(VecMin_Local,2,&VecMin_Local_Op);
135: /* Register the different norm types for cached norms */
136: for (i=0; i<4; i++) {
137: PetscObjectComposedDataRegister(NormIds+i);
138: }
139: return(0);
140: }
142: #ifdef PETSC_USE_DYNAMIC_LIBRARIES
146: /*
147: PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.
149: This one registers all the methods that are in the basic PETSc Vec library.
151: Input Parameter:
152: path - library path
153: */
154: PetscErrorCode PetscDLLibraryRegister_petscvec(char *path)
155: {
158: PetscInitializeNoArguments(); if (ierr) return 1;
161: /*
162: If we got here then PETSc was properly loaded
163: */
164: VecInitializePackage(path);
165: return(0);
166: }
169: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */