Actual source code: dlregisdm.c

  1: #define PETSCDM_DLL


 4:  #include src/dm/ao/aoimpl.h
 5:  #include src/dm/da/daimpl.h
  6: #ifdef PETSC_HAVE_SIEVE
 7:  #include src/dm/mesh/meshimpl.h
  8: #endif

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

 17:   Input Parameter:
 18:   path - The dynamic library path, or PETSC_NULL

 20:   Level: developer

 22: .keywords: AO, DA, initialize, package
 23: .seealso: PetscInitialize()
 24: @*/
 25: PetscErrorCode  DMInitializePackage(const char path[]) {
 26:   static PetscTruth initialized = PETSC_FALSE;
 27:   char              logList[256];
 28:   char             *className;
 29:   PetscTruth        opt;

 33:   if (initialized) return(0);
 34:   initialized = PETSC_TRUE;
 35:   /* Register Classes */
 36:   PetscLogClassRegister(&AO_COOKIE,     "Application Order");
 37:   PetscLogClassRegister(&AODATA_COOKIE, "Application Data");
 38:   PetscLogClassRegister(&DA_COOKIE,     "Distributed array");
 39: #ifdef PETSC_HAVE_SIEVE
 40:   PetscLogClassRegister(&MESH_COOKIE,       "Mesh");
 41:   PetscLogClassRegister(&SECTIONREAL_COOKIE,"SectionReal");
 42:   PetscLogClassRegister(&SECTIONINT_COOKIE, "SectionInt");
 43:   PetscLogClassRegister(&SECTIONPAIR_COOKIE,"SectionPair");
 44: #endif
 45:   /* Register Events */
 51: #ifdef PETSC_HAVE_SIEVE
 62: #endif
 63:   /* Process info exclusions */
 64:   PetscOptionsGetString(PETSC_NULL, "-info_exclude", logList, 256, &opt);
 65:   if (opt) {
 66:     PetscStrstr(logList, "ao", &className);
 67:     if (className) {
 68:       PetscInfoDeactivateClass(AO_COOKIE);
 69:     }
 70:     PetscStrstr(logList, "da", &className);
 71:     if (className) {
 72:       PetscInfoDeactivateClass(DA_COOKIE);
 73:     }
 74: #ifdef PETSC_HAVE_SIEVE
 75:     PetscStrstr(logList, "mesh", &className);
 76:     if (className) {
 77:       PetscInfoDeactivateClass(MESH_COOKIE);
 78:     }
 79:     PetscStrstr(logList, "sectionreal", &className);
 80:     if (className) {
 81:       PetscInfoDeactivateClass(SECTIONREAL_COOKIE);
 82:     }
 83:     PetscStrstr(logList, "sectionint", &className);
 84:     if (className) {
 85:       PetscInfoDeactivateClass(SECTIONINT_COOKIE);
 86:     }
 87:     PetscStrstr(logList, "sectionpair", &className);
 88:     if (className) {
 89:       PetscInfoDeactivateClass(SECTIONPAIR_COOKIE);
 90:     }
 91: #endif
 92:   }
 93:   /* Process summary exclusions */
 94:   PetscOptionsGetString(PETSC_NULL, "-log_summary_exclude", logList, 256, &opt);
 95:   if (opt) {
 96:     PetscStrstr(logList, "ao", &className);
 97:     if (className) {
 99:     }
100:     PetscStrstr(logList, "da", &className);
101:     if (className) {
103:     }
104: #ifdef PETSC_HAVE_SIEVE
105:     PetscStrstr(logList, "mesh", &className);
106:     if (className) {
108:     }
109:     PetscStrstr(logList, "sectionreal", &className);
110:     if (className) {
112:     }
113:     PetscStrstr(logList, "sectionint", &className);
114:     if (className) {
116:     }
117:     PetscStrstr(logList, "sectionpair", &className);
118:     if (className) {
120:     }
121: #endif
122:   }
123:   return(0);
124: }

126: #ifdef PETSC_USE_DYNAMIC_LIBRARIES
130: /*@C
131:   DMFinalizePackage - This function finalizes everything in the DM package. It is called
132:   from PetscFinalize().

134:   Level: developer

136: .keywords: AO, DA, initialize, package
137: .seealso: PetscInitialize()
138: @*/
139: PetscErrorCode  DMFinalizePackage() {
140: #ifdef PETSC_HAVE_SIEVE
142: #endif

145: #ifdef PETSC_HAVE_SIEVE
146:   MeshFinalize();
147: #endif
148:   return(0);
149: }

153: /*
154:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

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

159:   Input Parameter:
160:   path - library path
161: */
162: PetscErrorCode  PetscDLLibraryRegister_petscdm(char *path)
163: {

166:   PetscInitializeNoArguments();
167:   if (ierr) return(1);

169:   /*
170:       If we got here then PETSc was properly loaded
171:   */
172:   DMInitializePackage(path);
173:   return(0);
174: }

177: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */