Actual source code: dlregisvec.c

  1: #define PETSCVEC_DLL

 3:  #include petscvec.h
 4:  #include petscpf.h

  8: /*@C
  9:       ISInitializePackage - This function initializes everything in the IS package. It is called
 10:   from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to ISCreateXXXX()
 11:   when using static libraries.

 13:   Input Parameter:
 14: . path - The dynamic library path, or PETSC_NULL

 16:   Level: developer

 18: .keywords: Vec, initialize, package
 19: .seealso: PetscInitialize()
 20: @*/
 21: PetscErrorCode  ISInitializePackage(const char path[])
 22: {
 23:   static PetscTruth initialized = PETSC_FALSE;
 24:   char              logList[256];
 25:   char              *className;
 26:   PetscTruth        opt;
 27:   PetscErrorCode    ierr;

 30:   if (initialized) return(0);
 31:   initialized = PETSC_TRUE;
 32:   /* Register Classes */
 33:   PetscLogClassRegister(&IS_COOKIE,          "Index Set");
 34:   PetscLogClassRegister(&IS_LTOGM_COOKIE,    "IS L to G Mapping");

 36:   /* Process info exclusions */
 37:   PetscOptionsGetString(PETSC_NULL, "-info_exclude", logList, 256, &opt);
 38:   if (opt) {
 39:     PetscStrstr(logList, "is", &className);
 40:     if (className) {
 41:       PetscInfoDeactivateClass(IS_COOKIE);
 42:       PetscInfoDeactivateClass(IS_LTOGM_COOKIE);
 43:     }
 44:   }
 45:   /* Process summary exclusions */
 46:   PetscOptionsGetString(PETSC_NULL, "-log_summary_exclude", logList, 256, &opt);
 47:   if (opt) {
 48:     PetscStrstr(logList, "is", &className);
 49:     if (className) {
 52:     }
 53:   }
 54:   return(0);
 55: }



 67: const char *NormTypes[] = {"1","2","FROBENIUS","INFINITY","1_AND_2","NormType","NORM_",0};
 68: PetscInt   NormIds[7];  /* map from NormType to IDs used to cache Normvalues */

 72: /*@C
 73:   VecInitializePackage - This function initializes everything in the Vec package. It is called
 74:   from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to VecCreate()
 75:   when using static libraries.

 77:   Input Parameter:
 78: . path - The dynamic library path, or PETSC_NULL

 80:   Level: developer

 82: .keywords: Vec, initialize, package
 83: .seealso: PetscInitialize()
 84: @*/
 85: PetscErrorCode  VecInitializePackage(const char path[])
 86: {
 87:   static PetscTruth initialized = PETSC_FALSE;
 88:   char              logList[256];
 89:   char              *className;
 90:   PetscTruth        opt;
 91:   PetscErrorCode    ierr;
 92:   PetscInt          i;

 95:   if (initialized) return(0);
 96:   initialized = PETSC_TRUE;
 97:   /* Register Classes */
 98:   PetscLogClassRegister(&VEC_COOKIE,         "Vec");
 99:   PetscLogClassRegister(&VEC_SCATTER_COOKIE, "Vec Scatter");
100:   /* Register Constructors */
101:   VecRegisterAll(path);
102:   /* Register Events */
137:   /* Turn off high traffic events by default */
145:   /* Process info exclusions */
146:   PetscOptionsGetString(PETSC_NULL, "-info_exclude", logList, 256, &opt);
147:   if (opt) {
148:     PetscStrstr(logList, "vec", &className);
149:     if (className) {
150:       PetscInfoDeactivateClass(VEC_COOKIE);
151:     }
152:   }
153:   /* Process summary exclusions */
154:   PetscOptionsGetString(PETSC_NULL, "-log_summary_exclude", logList, 256, &opt);
155:   if (opt) {
156:     PetscStrstr(logList, "vec", &className);
157:     if (className) {
159:     }
160:   }
161:   /* Special processing */
162:   PetscOptionsHasName(PETSC_NULL, "-log_sync", &opt);
163:   if (opt) {
170:   }

172:   /*
173:          Create the special MPI reduction operation that may be used by VecNorm/DotBegin()
174:   */
175:   MPI_Op_create(PetscSplitReduction_Local,1,&PetscSplitReduction_Op);
176:   MPI_Op_create(VecMax_Local,2,&VecMax_Local_Op);
177:   MPI_Op_create(VecMin_Local,2,&VecMin_Local_Op);

179:   /* Register the different norm types for cached norms */
180:   for (i=0; i<4; i++) {
181:     PetscObjectComposedDataRegister(NormIds+i);
182:   }
183:   return(0);
184: }

186: #ifdef PETSC_USE_DYNAMIC_LIBRARIES
190: /*
191:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

193:   This one registers all the methods that are in the basic PETSc Vec library.

195:   Input Parameter:
196:   path - library path
197:  */
198: PetscErrorCode  PetscDLLibraryRegister_petscvec(const char path[])
199: {

202:   PetscInitializeNoArguments(); if (ierr) return 1;

205:   /*
206:       If we got here then PETSc was properly loaded
207:   */
208:   ISInitializePackage(path);
209:   VecInitializePackage(path);
210:   PFInitializePackage(path);
211:   return(0);
212: }

215: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */