Actual source code: dlregisdm.c

  1: #define PETSCDM_DLL

 3:  #include ../src/dm/ao/aoimpl.h
 4:  #include private/daimpl.h
  5: #ifdef PETSC_HAVE_SIEVE
 6:  #include private/meshimpl.h
  7: #endif

  9: static PetscTruth DMPackageInitialized = PETSC_FALSE;
 12: /*@C
 13:   DMFinalizePackage - This function finalizes everything in the DM package. It is called
 14:   from PetscFinalize().

 16:   Level: developer

 18: .keywords: AO, DA, initialize, package
 19: .seealso: PetscInitialize()
 20: @*/
 21: PetscErrorCode  DMFinalizePackage(void) {
 22: #ifdef PETSC_HAVE_SIEVE
 24: #endif

 27:   DMPackageInitialized = PETSC_FALSE;
 28: #ifdef PETSC_HAVE_SIEVE
 29:   MeshFinalize();
 30: #endif
 31:   return(0);
 32: }

 34: #if defined(PETSC_HAVE_HYPRE)
 36: EXTERN PetscErrorCode  MatCreate_HYPREStruct(Mat);
 38: #endif

 42: /*@C
 43:   DMInitializePackage - This function initializes everything in the DM package. It is called
 44:   from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to AOCreate()
 45:   or DACreate() when using static libraries.

 47:   Input Parameter:
 48:   path - The dynamic library path, or PETSC_NULL

 50:   Level: developer

 52: .keywords: AO, DA, initialize, package
 53: .seealso: PetscInitialize()
 54: @*/
 55: PetscErrorCode  DMInitializePackage(const char path[])
 56: {
 57:   char              logList[256];
 58:   char              *className;
 59:   PetscTruth        opt;
 60:   PetscErrorCode    ierr;

 63:   if (DMPackageInitialized) return(0);
 64:   DMPackageInitialized = PETSC_TRUE;
 65:   /* Register Classes */
 66:   PetscCookieRegister("Application Order",&AO_COOKIE);
 67:   PetscCookieRegister("Distributed array",&DM_COOKIE);
 68:   PetscCookieRegister("Arbitrary Dimension Distributed array",&ADDA_COOKIE);
 69: #ifdef PETSC_HAVE_SIEVE
 70:   PetscCookieRegister("Mesh",&MESH_COOKIE);
 71:   PetscCookieRegister("SectionReal",&SECTIONREAL_COOKIE);
 72:   PetscCookieRegister("SectionInt",&SECTIONINT_COOKIE);
 73: #endif

 75: #if defined(PETSC_HAVE_HYPRE)
 76:   MatRegisterDynamic(MATHYPRESTRUCT,    path,"MatCreate_HYPREStruct", MatCreate_HYPREStruct);
 77: #endif

 79:   /* Register Constructors */
 80:   DARegisterAll(path);
 81: #ifdef PETSC_HAVE_SIEVE
 82:   MeshRegisterAll(path);
 83: #endif
 84:   /* Register Events */
 85:   PetscLogEventRegister("AOPetscToApplication", AO_COOKIE,&AO_PetscToApplication);
 86:   PetscLogEventRegister("AOApplicationToPetsc", AO_COOKIE,&AO_ApplicationToPetsc);
 87:   PetscLogEventRegister("DAGlobalToLocal",      DM_COOKIE,&DA_GlobalToLocal);
 88:   PetscLogEventRegister("DALocalToGlobal",      DM_COOKIE,&DA_LocalToGlobal);
 89:   PetscLogEventRegister("DALocalADFunc",        DM_COOKIE,&DA_LocalADFunction);
 90: #ifdef PETSC_HAVE_SIEVE
 91:   PetscLogEventRegister("MeshView",             MESH_COOKIE,&Mesh_View);
 92:   PetscLogEventRegister("MeshGetGlobalScatter", MESH_COOKIE,&Mesh_GetGlobalScatter);
 93:   PetscLogEventRegister("MeshRestrictVector",   MESH_COOKIE,&Mesh_restrictVector);
 94:   PetscLogEventRegister("MeshAssembleVector",   MESH_COOKIE,&Mesh_assembleVector);
 95:   PetscLogEventRegister("MeshAssemVecComplete", MESH_COOKIE,&Mesh_assembleVectorComplete);
 96:   PetscLogEventRegister("MeshAssembleMatrix",   MESH_COOKIE,&Mesh_assembleMatrix);
 97:   PetscLogEventRegister("MeshUpdateOperator",   MESH_COOKIE,&Mesh_updateOperator);
 98:   PetscLogEventRegister("SectionRealView",      SECTIONREAL_COOKIE,&SectionReal_View);
 99:   PetscLogEventRegister("SectionIntView",       SECTIONINT_COOKIE,&SectionInt_View);
100: #endif
101:   /* Process info exclusions */
102:   PetscOptionsGetString(PETSC_NULL, "-info_exclude", logList, 256, &opt);
103:   if (opt) {
104:     PetscStrstr(logList, "ao", &className);
105:     if (className) {
106:       PetscInfoDeactivateClass(AO_COOKIE);
107:     }
108:     PetscStrstr(logList, "da", &className);
109:     if (className) {
110:       PetscInfoDeactivateClass(DM_COOKIE);
111:     }
112: #ifdef PETSC_HAVE_SIEVE
113:     PetscStrstr(logList, "mesh", &className);
114:     if (className) {
115:       PetscInfoDeactivateClass(MESH_COOKIE);
116:     }
117:     PetscStrstr(logList, "sectionreal", &className);
118:     if (className) {
119:       PetscInfoDeactivateClass(SECTIONREAL_COOKIE);
120:     }
121:     PetscStrstr(logList, "sectionint", &className);
122:     if (className) {
123:       PetscInfoDeactivateClass(SECTIONINT_COOKIE);
124:     }
125: #endif
126:   }
127:   /* Process summary exclusions */
128:   PetscOptionsGetString(PETSC_NULL, "-log_summary_exclude", logList, 256, &opt);
129:   if (opt) {
130:     PetscStrstr(logList, "ao", &className);
131:     if (className) {
132:       PetscLogEventDeactivateClass(AO_COOKIE);
133:     }
134:     PetscStrstr(logList, "da", &className);
135:     if (className) {
136:       PetscLogEventDeactivateClass(DM_COOKIE);
137:     }
138: #ifdef PETSC_HAVE_SIEVE
139:     PetscStrstr(logList, "mesh", &className);
140:     if (className) {
141:       PetscLogEventDeactivateClass(MESH_COOKIE);
142:     }
143:     PetscStrstr(logList, "sectionreal", &className);
144:     if (className) {
145:       PetscLogEventDeactivateClass(SECTIONREAL_COOKIE);
146:     }
147:     PetscStrstr(logList, "sectionint", &className);
148:     if (className) {
149:       PetscLogEventDeactivateClass(SECTIONINT_COOKIE);
150:     }
151: #endif
152:   }
153:   PetscRegisterFinalize(DMFinalizePackage);
154:   return(0);
155: }



159: #ifdef PETSC_USE_DYNAMIC_LIBRARIES
163: /*
164:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

166:   This one registers all the mesh generators and partitioners that are in
167:   the basic DM library.

169:   Input Parameter:
170:   path - library path
171: */
172: PetscErrorCode  PetscDLLibraryRegister_petscdm(const char path[])
173: {

176:   PetscInitializeNoArguments();
177:   if (ierr) return(1);

179:   /*
180:       If we got here then PETSc was properly loaded
181:   */
182:   DMInitializePackage(path);
183:   return(0);
184: }

187: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */