Actual source code: dlregisdmdm.c

petsc-3.6.4 2016-04-12
Report Typos and Errors
  2: #include <petsc/private/dmdaimpl.h>
  3: #include <petsc/private/dmpleximpl.h>
  4: #include <petsc/private/petscdsimpl.h>
  5: #include <petsc/private/petscfeimpl.h>
  6: #include <petsc/private/petscfvimpl.h>

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

 15:   Level: developer

 17: .keywords: AO, initialize, package
 18: .seealso: PetscInitialize()
 19: @*/
 20: PetscErrorCode  DMFinalizePackage(void)
 21: {

 25:   PetscFunctionListDestroy(&PetscPartitionerList);
 26:   PetscFunctionListDestroy(&DMList);
 27:   DMPackageInitialized = PETSC_FALSE;
 28:   DMRegisterAllCalled  = PETSC_FALSE;
 29:   PetscPartitionerRegisterAllCalled = PETSC_FALSE;
 30:   return(0);
 31: }

 33: #if defined(PETSC_HAVE_HYPRE)
 34: PETSC_EXTERN PetscErrorCode MatCreate_HYPREStruct(Mat);
 35: #endif

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

 44:   Level: developer

 46: .keywords: AO, initialize, package
 47: .seealso: PetscInitialize()
 48: @*/
 49: PetscErrorCode  DMInitializePackage(void)
 50: {
 51:   char           logList[256];
 52:   char           *className;
 53:   PetscBool      opt;

 57:   if (DMPackageInitialized) return(0);
 58:   DMPackageInitialized = PETSC_TRUE;

 60:   /* Register Classes */
 61:   PetscClassIdRegister("Distributed Mesh",&DM_CLASSID);
 62:   PetscClassIdRegister("GraphPartitioner",&PETSCPARTITIONER_CLASSID);

 64: #if defined(PETSC_HAVE_HYPRE)
 65:   MatRegister(MATHYPRESTRUCT, MatCreate_HYPREStruct);
 66: #endif

 68:   /* Register Constructors */
 69:   DMRegisterAll();
 70:   /* Register Events */
 71:   PetscLogEventRegister("DMConvert",              DM_CLASSID,&DM_Convert);
 72:   PetscLogEventRegister("DMGlobalToLocal",        DM_CLASSID,&DM_GlobalToLocal);
 73:   PetscLogEventRegister("DMLocalToGlobal",        DM_CLASSID,&DM_LocalToGlobal);

 75:   PetscLogEventRegister("DMDALocalADFunc",        DM_CLASSID,&DMDA_LocalADFunction);

 77:   PetscLogEventRegister("Mesh Partition",         PETSCPARTITIONER_CLASSID,&PETSCPARTITIONER_Partition);
 78:   PetscLogEventRegister("Mesh Migration",         DM_CLASSID,&DMPLEX_Migrate);
 79:   PetscLogEventRegister("DMPlexInterp",           DM_CLASSID,&DMPLEX_Interpolate);
 80:   PetscLogEventRegister("DMPlexDistribute",       DM_CLASSID,&DMPLEX_Distribute);
 81:   PetscLogEventRegister("DMPlexDistCones",        DM_CLASSID,&DMPLEX_DistributeCones);
 82:   PetscLogEventRegister("DMPlexDistLabels",       DM_CLASSID,&DMPLEX_DistributeLabels);
 83:   PetscLogEventRegister("DMPlexDistribSF",        DM_CLASSID,&DMPLEX_DistributeSF);
 84:   PetscLogEventRegister("DMPlexDistribOL",        DM_CLASSID,&DMPLEX_DistributeOverlap);
 85:   PetscLogEventRegister("DMPlexDistField",        DM_CLASSID,&DMPLEX_DistributeField);
 86:   PetscLogEventRegister("DMPlexDistData",         DM_CLASSID,&DMPLEX_DistributeData);
 87:   PetscLogEventRegister("DMPlexStratify",         DM_CLASSID,&DMPLEX_Stratify);
 88:   PetscLogEventRegister("DMPlexPrealloc",         DM_CLASSID,&DMPLEX_Preallocate);
 89:   PetscLogEventRegister("DMPlexResidualFE",       DM_CLASSID,&DMPLEX_ResidualFEM);
 90:   PetscLogEventRegister("DMPlexJacobianFE",       DM_CLASSID,&DMPLEX_JacobianFEM);
 91:   PetscLogEventRegister("DMPlexInterpFE",         DM_CLASSID,&DMPLEX_InterpolatorFEM);
 92:   PetscLogEventRegister("DMPlexInjectorFE",       DM_CLASSID,&DMPLEX_InjectorFEM);
 93:   PetscLogEventRegister("DMPlexIntegralFEM",      DM_CLASSID,&DMPLEX_IntegralFEM);
 94:   PetscLogEventRegister("DMPlexCreateGmsh",       DM_CLASSID,&DMPLEX_CreateGmsh);
 95:   /* Process info exclusions */
 96:   PetscOptionsGetString(NULL, "-info_exclude", logList, 256, &opt);
 97:   if (opt) {
 98:     PetscStrstr(logList, "da", &className);
 99:     if (className) {
100:       PetscInfoDeactivateClass(DM_CLASSID);
101:     }
102:   }
103:   /* Process summary exclusions */
104:   PetscOptionsGetString(NULL, "-log_summary_exclude", logList, 256, &opt);
105:   if (opt) {
106:     PetscStrstr(logList, "da", &className);
107:     if (className) {
108:       PetscLogEventDeactivateClass(DM_CLASSID);
109:     }
110:   }
111:   PetscRegisterFinalize(DMFinalizePackage);
112:   return(0);
113: }
114: #include <petscfe.h>

116: static PetscBool PetscFEPackageInitialized = PETSC_FALSE;
119: /*@C
120:   PetscFEFinalizePackage - This function finalizes everything in the PetscFE package. It is called
121:   from PetscFinalize().

123:   Level: developer

125: .keywords: PetscFE, initialize, package
126: .seealso: PetscInitialize()
127: @*/
128: PetscErrorCode PetscFEFinalizePackage(void)
129: {

133:   PetscFunctionListDestroy(&PetscSpaceList);
134:   PetscFunctionListDestroy(&PetscDualSpaceList);
135:   PetscFunctionListDestroy(&PetscFEList);
136:   PetscFEPackageInitialized       = PETSC_FALSE;
137:   PetscSpaceRegisterAllCalled     = PETSC_FALSE;
138:   PetscDualSpaceRegisterAllCalled = PETSC_FALSE;
139:   PetscFERegisterAllCalled        = PETSC_FALSE;
140:   return(0);
141: }

145: /*@C
146:   PetscFEInitializePackage - This function initializes everything in the FE package. It is called
147:   from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to PetscSpaceCreate()
148:   when using static libraries.

150:   Level: developer

152: .keywords: PetscFE, initialize, package
153: .seealso: PetscInitialize()
154: @*/
155: PetscErrorCode PetscFEInitializePackage(void)
156: {
157:   char           logList[256];
158:   char          *className;
159:   PetscBool      opt;

163:   if (PetscFEPackageInitialized) return(0);
164:   PetscFEPackageInitialized = PETSC_TRUE;

166:   /* Register Classes */
167:   PetscClassIdRegister("Linear Space", &PETSCSPACE_CLASSID);
168:   PetscClassIdRegister("Dual Space",   &PETSCDUALSPACE_CLASSID);
169:   PetscClassIdRegister("FE Space",     &PETSCFE_CLASSID);

171:   /* Register Constructors */
172:   PetscSpaceRegisterAll();
173:   PetscDualSpaceRegisterAll();
174:   PetscFERegisterAll();
175:   /* Register Events */
176:   /* Process info exclusions */
177:   PetscOptionsGetString(NULL, "-info_exclude", logList, 256, &opt);
178:   if (opt) {
179:     PetscStrstr(logList, "fe", &className);
180:     if (className) {PetscInfoDeactivateClass(PETSCFE_CLASSID);}
181:   }
182:   /* Process summary exclusions */
183:   PetscOptionsGetString(NULL, "-log_summary_exclude", logList, 256, &opt);
184:   if (opt) {
185:     PetscStrstr(logList, "fe", &className);
186:     if (className) {PetscLogEventDeactivateClass(PETSCFE_CLASSID);}
187:   }
188:   PetscRegisterFinalize(PetscFEFinalizePackage);
189:   return(0);
190: }
191: #include <petscfv.h>

193: static PetscBool PetscFVPackageInitialized = PETSC_FALSE;
196: /*@C
197:   PetscFVFinalizePackage - This function finalizes everything in the PetscFV package. It is called
198:   from PetscFinalize().

200:   Level: developer

202: .keywords: PetscFV, initialize, package
203: .seealso: PetscInitialize()
204: @*/
205: PetscErrorCode PetscFVFinalizePackage(void)
206: {

210:   PetscFunctionListDestroy(&PetscLimiterList);
211:   PetscFunctionListDestroy(&PetscFVList);
212:   PetscFVPackageInitialized     = PETSC_FALSE;
213:   PetscFVRegisterAllCalled      = PETSC_FALSE;
214:   PetscLimiterRegisterAllCalled = PETSC_FALSE;
215:   return(0);
216: }

220: /*@C
221:   PetscFVInitializePackage - This function initializes everything in the FV package. It is called
222:   from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to PetscFVCreate()
223:   when using static libraries.

225:   Level: developer

227: .keywords: PetscFV, initialize, package
228: .seealso: PetscInitialize()
229: @*/
230: PetscErrorCode PetscFVInitializePackage(void)
231: {
232:   char           logList[256];
233:   char          *className;
234:   PetscBool      opt;

238:   if (PetscFVPackageInitialized) return(0);
239:   PetscFVPackageInitialized = PETSC_TRUE;

241:   /* Register Classes */
242:   PetscClassIdRegister("FV Space", &PETSCFV_CLASSID);
243:   PetscClassIdRegister("Limiter",  &PETSCLIMITER_CLASSID);

245:   /* Register Constructors */
246:   PetscFVRegisterAll();
247:   /* Register Events */
248:   /* Process info exclusions */
249:   PetscOptionsGetString(NULL, "-info_exclude", logList, 256, &opt);
250:   if (opt) {
251:     PetscStrstr(logList, "fv", &className);
252:     if (className) {PetscInfoDeactivateClass(PETSCFV_CLASSID);}
253:     PetscStrstr(logList, "limiter", &className);
254:     if (className) {PetscInfoDeactivateClass(PETSCLIMITER_CLASSID);}
255:   }
256:   /* Process summary exclusions */
257:   PetscOptionsGetString(NULL, "-log_summary_exclude", logList, 256, &opt);
258:   if (opt) {
259:     PetscStrstr(logList, "fv", &className);
260:     if (className) {PetscLogEventDeactivateClass(PETSCFV_CLASSID);}
261:     PetscStrstr(logList, "limiter", &className);
262:     if (className) {PetscLogEventDeactivateClass(PETSCLIMITER_CLASSID);}
263:   }
264:   PetscRegisterFinalize(PetscFVFinalizePackage);
265:   return(0);
266: }
267: #include <petscds.h>

269: static PetscBool PetscDSPackageInitialized = PETSC_FALSE;
272: /*@C
273:   PetscDSFinalizePackage - This function finalizes everything in the PetscDS package. It is called
274:   from PetscFinalize().

276:   Level: developer

278: .keywords: PetscDS, initialize, package
279: .seealso: PetscInitialize()
280: @*/
281: PetscErrorCode PetscDSFinalizePackage(void)
282: {

286:   PetscFunctionListDestroy(&PetscDSList);
287:   PetscDSPackageInitialized = PETSC_FALSE;
288:   PetscDSRegisterAllCalled  = PETSC_FALSE;
289:   return(0);
290: }

294: /*@C
295:   PetscDSInitializePackage - This function initializes everything in the DS package. It is called
296:   from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to PetscDSCreate()
297:   when using static libraries.

299:   Level: developer

301: .keywords: PetscDS, initialize, package
302: .seealso: PetscInitialize()
303: @*/
304: PetscErrorCode PetscDSInitializePackage(void)
305: {
306:   char           logList[256];
307:   char          *className;
308:   PetscBool      opt;

312:   if (PetscDSPackageInitialized) return(0);
313:   PetscDSPackageInitialized = PETSC_TRUE;

315:   /* Register Classes */
316:   PetscClassIdRegister("Discrete System", &PETSCDS_CLASSID);

318:   /* Register Constructors */
319:   PetscDSRegisterAll();
320:   /* Register Events */
321:   /* Process info exclusions */
322:   PetscOptionsGetString(NULL, "-info_exclude", logList, 256, &opt);
323:   if (opt) {
324:     PetscStrstr(logList, "ds", &className);
325:     if (className) {PetscInfoDeactivateClass(PETSCDS_CLASSID);}
326:   }
327:   /* Process summary exclusions */
328:   PetscOptionsGetString(NULL, "-log_summary_exclude", logList, 256, &opt);
329:   if (opt) {
330:     PetscStrstr(logList, "ds", &className);
331:     if (className) {PetscLogEventDeactivateClass(PETSCDS_CLASSID);}
332:   }
333:   PetscRegisterFinalize(PetscDSFinalizePackage);
334:   return(0);
335: }

337: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
340: /*
341:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

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

346: */
347: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscdm(void)
348: {

352:   AOInitializePackage();
353:   DMInitializePackage();
354:   PetscFEInitializePackage();
355:   PetscFVInitializePackage();
356:   return(0);
357: }

359: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */