Actual source code: dlregis.c

  1: /*$Id: dlregis.c,v 1.19 2001/03/23 23:24:34 balay Exp $*/

 3:  #include petscvec.h

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

 10:   Input Parameter:
 11:   path - The dynamic library path, or PETSC_NULL

 13:   Level: developer

 15: .keywords: Vec, initialize, package
 16: .seealso: PetscInitialize()
 17: @*/
 18: int VecInitializePackage(char *path) {
 19:   static PetscTruth initialized = PETSC_FALSE;
 20:   char              logList[256];
 21:   char             *className;
 22:   PetscTruth        opt;
 23:   int               ierr;

 26:   if (initialized == PETSC_TRUE) return(0);
 27:   initialized = PETSC_TRUE;
 28:   /* Register Classes */
 29:   PetscLogClassRegister(&IS_COOKIE,          "Index Set");
 30:   PetscLogClassRegister(&MAP_COOKIE,         "Map");
 31:   PetscLogClassRegister(&VEC_COOKIE,         "Vec");
 32:   PetscLogClassRegister(&VEC_SCATTER_COOKIE, "Vec Scatter");
 33:   /* Register Constructors and Serializers */
 34:   PetscMapRegisterAll(path);
 35:   VecRegisterAll(path);
 36:   /* Register Events */
 37:   PetscLogEventRegister(&VEC_View,                "VecView",          VEC_COOKIE);
 38:   PetscLogEventRegister(&VEC_Max,                 "VecMax",           VEC_COOKIE);
 39:   PetscLogEventRegister(&VEC_Min,                 "VecMin",           VEC_COOKIE);
 40:   PetscLogEventRegister(&VEC_DotBarrier,          "VecDotBarrier",    VEC_COOKIE);
 41:   PetscLogEventRegister(&VEC_Dot,                 "VecDot",           VEC_COOKIE);
 42:   PetscLogEventRegister(&VEC_MDotBarrier,         "VecMDotBarrier",   VEC_COOKIE);
 43:   PetscLogEventRegister(&VEC_MDot,                "VecMDot",          VEC_COOKIE);
 44:   PetscLogEventRegister(&VEC_TDot,                "VecTDot",          VEC_COOKIE);
 45:   PetscLogEventRegister(&VEC_MTDot,               "VecMTDot",         VEC_COOKIE);
 46:   PetscLogEventRegister(&VEC_NormBarrier,         "VecNormBarrier",   VEC_COOKIE);
 47:   PetscLogEventRegister(&VEC_Norm,                "VecNorm",          VEC_COOKIE);
 48:   PetscLogEventRegister(&VEC_Scale,               "VecScale",         VEC_COOKIE);
 49:   PetscLogEventRegister(&VEC_Copy,                "VecCopy",          VEC_COOKIE);
 50:   PetscLogEventRegister(&VEC_Set,                 "VecSet",           VEC_COOKIE);
 51:   PetscLogEventRegister(&VEC_AXPY,                "VecAXPY",          VEC_COOKIE);
 52:   PetscLogEventRegister(&VEC_AYPX,                "VecAYPX",          VEC_COOKIE);
 53:   PetscLogEventRegister(&VEC_WAXPY,               "VecWAXPY",         VEC_COOKIE);
 54:   PetscLogEventRegister(&VEC_MAXPY,               "VecMAXPY",         VEC_COOKIE);
 55:   PetscLogEventRegister(&VEC_Swap,                "VecSwap",          VEC_COOKIE);
 56:   PetscLogEventRegister(&VEC_AssemblyBegin,       "VecAssemblyBegin", VEC_COOKIE);
 57:   PetscLogEventRegister(&VEC_AssemblyEnd,         "VecAssemblyEnd",   VEC_COOKIE);
 58:   PetscLogEventRegister(&VEC_PointwiseMult,       "VecPointwiseMult", VEC_COOKIE);
 59:   PetscLogEventRegister(&VEC_SetValues,           "VecSetValues",     VEC_COOKIE);
 60:   PetscLogEventRegister(&VEC_Load,                "VecLoad",          VEC_COOKIE);
 61:   PetscLogEventRegister(&VEC_ScatterBarrier,      "VecScatterBarrie", VEC_COOKIE);
 62:   PetscLogEventRegister(&VEC_ScatterBegin,        "VecScatterBegin",  VEC_COOKIE);
 63:   PetscLogEventRegister(&VEC_ScatterEnd,          "VecScatterEnd",    VEC_COOKIE);
 64:   PetscLogEventRegister(&VEC_SetRandom,           "VecSetRandom",     VEC_COOKIE);
 65:   PetscLogEventRegister(&VEC_ReduceArithmetic,    "VecReduceArith",   VEC_COOKIE);
 66:   PetscLogEventRegister(&VEC_ReduceBarrier,       "VecReduceBarrier", VEC_COOKIE);
 67:   PetscLogEventRegister(&VEC_ReduceCommunication, "VecReduceComm",    VEC_COOKIE);
 68:   /* Process info exclusions */
 69:   PetscOptionsGetString(PETSC_NULL, "-log_info_exclude", logList, 256, &opt);
 70:   if (opt == PETSC_TRUE) {
 71:     PetscStrstr(logList, "is", &className);
 72:     if (className) {
 73:       PetscLogInfoDeactivateClass(IS_COOKIE);
 74:     }
 75:     PetscStrstr(logList, "map", &className);
 76:     if (className) {
 77:       PetscLogInfoDeactivateClass(MAP_COOKIE);
 78:     }
 79:     PetscStrstr(logList, "vec", &className);
 80:     if (className) {
 81:       PetscLogInfoDeactivateClass(VEC_COOKIE);
 82:     }
 83:   }
 84:   /* Process summary exclusions */
 85:   PetscOptionsGetString(PETSC_NULL, "-log_summary_exclude", logList, 256, &opt);
 86:   if (opt == PETSC_TRUE) {
 87:     PetscStrstr(logList, "is", &className);
 88:     if (className) {
 89:       PetscLogEventDeactivateClass(IS_COOKIE);
 90:     }
 91:     PetscStrstr(logList, "map", &className);
 92:     if (className) {
 93:       PetscLogEventDeactivateClass(MAP_COOKIE);
 94:     }
 95:     PetscStrstr(logList, "vec", &className);
 96:     if (className) {
 97:       PetscLogEventDeactivateClass(VEC_COOKIE);
 98:     }
 99:   }
100:   /* Special processing */
101:   PetscOptionsHasName(PETSC_NULL, "-log_sync", &opt);
102:   if (opt == PETSC_TRUE) {
103:     PetscLogEventActivate(VEC_ScatterBarrier);
104:     PetscLogEventActivate(VEC_NormBarrier);
105:     PetscLogEventActivate(VEC_DotBarrier);
106:     PetscLogEventActivate(VEC_MDotBarrier);
107:     PetscLogEventActivate(VEC_ReduceBarrier);
108:   }
109:   return(0);
110: }

112: #ifdef PETSC_USE_DYNAMIC_LIBRARIES
113: EXTERN_C_BEGIN
114: /*
115:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

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

119:   Input Parameter:
120:   path - library path
121:  */
122: int PetscDLLibraryRegister(char *path)
123: {

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

129:   /*
130:       If we got here then PETSc was properly loaded
131:   */
132:   VecInitializePackage(path);
133:   return(0);
134: }
135: EXTERN_C_END

137: /* --------------------------------------------------------------------------*/
138: static char *contents = "PETSc Vector library. n";

140:  #include src/sys/src/utils/dlregis.h

142: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */