Actual source code: dlregisdmdm.c

petsc-3.8.4 2018-03-24
Report Typos and Errors

  2:  #include <petsc/private/dmlabelimpl.h>
  3:  #include <petsc/private/dmdaimpl.h>
  4:  #include <petsc/private/dmpleximpl.h>
  5:  #include <petsc/private/petscdsimpl.h>
  6:  #include <petsc/private/petscfeimpl.h>
  7:  #include <petsc/private/petscfvimpl.h>
  8:  #include <petsc/private/dmswarmimpl.h>

 10: 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

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

 42:   Level: developer

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

 55:   if (DMPackageInitialized) return(0);
 56:   DMPackageInitialized = PETSC_TRUE;

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

 62: #if defined(PETSC_HAVE_HYPRE)
 63:   MatRegister(MATHYPRESTRUCT, MatCreate_HYPREStruct);
 64: #endif
 65:   PetscSectionSymRegister(PETSCSECTIONSYMLABEL,PetscSectionSymCreate_Label);

 67:   /* Register Constructors */
 68:   DMRegisterAll();
 69:   /* Register Events */
 70:   PetscLogEventRegister("DMConvert",              DM_CLASSID,&DM_Convert);
 71:   PetscLogEventRegister("DMGlobalToLocal",        DM_CLASSID,&DM_GlobalToLocal);
 72:   PetscLogEventRegister("DMLocalToGlobal",        DM_CLASSID,&DM_LocalToGlobal);
 73:   PetscLogEventRegister("DMLocatePoints",         DM_CLASSID,&DM_LocatePoints);
 74:   PetscLogEventRegister("DMCoarsen",              DM_CLASSID,&DM_Coarsen);
 75:   PetscLogEventRegister("DMCreateInterp",         DM_CLASSID,&DM_CreateInterpolation);
 76:   PetscLogEventRegister("DMCreateRestrict",       DM_CLASSID,&DM_CreateRestriction);

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

 80:   PetscLogEventRegister("Mesh Partition",         PETSCPARTITIONER_CLASSID,&PETSCPARTITIONER_Partition);
 81:   PetscLogEventRegister("Mesh Migration",         DM_CLASSID,&DMPLEX_Migrate);
 82:   PetscLogEventRegister("DMPlexInterp",           DM_CLASSID,&DMPLEX_Interpolate);
 83:   PetscLogEventRegister("DMPlexDistribute",       DM_CLASSID,&DMPLEX_Distribute);
 84:   PetscLogEventRegister("DMPlexDistCones",        DM_CLASSID,&DMPLEX_DistributeCones);
 85:   PetscLogEventRegister("DMPlexDistLabels",       DM_CLASSID,&DMPLEX_DistributeLabels);
 86:   PetscLogEventRegister("DMPlexDistribSF",        DM_CLASSID,&DMPLEX_DistributeSF);
 87:   PetscLogEventRegister("DMPlexDistribOL",        DM_CLASSID,&DMPLEX_DistributeOverlap);
 88:   PetscLogEventRegister("DMPlexDistField",        DM_CLASSID,&DMPLEX_DistributeField);
 89:   PetscLogEventRegister("DMPlexDistData",         DM_CLASSID,&DMPLEX_DistributeData);
 90:   PetscLogEventRegister("DMPlexInterpSF",         DM_CLASSID,&DMPLEX_InterpolateSF);
 91:   PetscLogEventRegister("DMPlexGToNBegin",        DM_CLASSID,&DMPLEX_GlobalToNaturalBegin);
 92:   PetscLogEventRegister("DMPlexGToNEnd",          DM_CLASSID,&DMPLEX_GlobalToNaturalEnd);
 93:   PetscLogEventRegister("DMPlexNToGBegin",        DM_CLASSID,&DMPLEX_NaturalToGlobalBegin);
 94:   PetscLogEventRegister("DMPlexNToGEnd",          DM_CLASSID,&DMPLEX_NaturalToGlobalEnd);
 95:   PetscLogEventRegister("DMPlexStratify",         DM_CLASSID,&DMPLEX_Stratify);
 96:   PetscLogEventRegister("DMPlexPrealloc",         DM_CLASSID,&DMPLEX_Preallocate);
 97:   PetscLogEventRegister("DMPlexResidualFE",       DM_CLASSID,&DMPLEX_ResidualFEM);
 98:   PetscLogEventRegister("DMPlexJacobianFE",       DM_CLASSID,&DMPLEX_JacobianFEM);
 99:   PetscLogEventRegister("DMPlexInterpFE",         DM_CLASSID,&DMPLEX_InterpolatorFEM);
100:   PetscLogEventRegister("DMPlexInjectorFE",       DM_CLASSID,&DMPLEX_InjectorFEM);
101:   PetscLogEventRegister("DMPlexIntegralFEM",      DM_CLASSID,&DMPLEX_IntegralFEM);
102:   PetscLogEventRegister("DMPlexCreateGmsh",       DM_CLASSID,&DMPLEX_CreateGmsh);
103: 
104:   PetscLogEventRegister("DMSwarmMigrate",         DM_CLASSID,&DMSWARM_Migrate);
105:   PetscLogEventRegister("DMSwarmDETSetup",        DM_CLASSID,&DMSWARM_DataExchangerTopologySetup);
106:   PetscLogEventRegister("DMSwarmDExBegin",        DM_CLASSID,&DMSWARM_DataExchangerBegin);
107:   PetscLogEventRegister("DMSwarmDExEnd",          DM_CLASSID,&DMSWARM_DataExchangerEnd);
108:   PetscLogEventRegister("DMSwarmDESendCnt",       DM_CLASSID,&DMSWARM_DataExchangerSendCount);
109:   PetscLogEventRegister("DMSwarmDEPack",          DM_CLASSID,&DMSWARM_DataExchangerPack);
110:   PetscLogEventRegister("DMSwarmAddPnts",         DM_CLASSID,&DMSWARM_AddPoints);
111:   PetscLogEventRegister("DMSwarmRmvPnts",         DM_CLASSID,&DMSWARM_RemovePoints);
112:   PetscLogEventRegister("DMSwarmSort",            DM_CLASSID,&DMSWARM_Sort);
113:   PetscLogEventRegister("DMSwarmSetSizes",        DM_CLASSID,&DMSWARM_SetSizes);
114: 
115:   /* Process info exclusions */
116:   PetscOptionsGetString(NULL,NULL, "-info_exclude", logList, 256, &opt);
117:   if (opt) {
118:     PetscStrstr(logList, "da", &className);
119:     if (className) {
120:       PetscInfoDeactivateClass(DM_CLASSID);
121:     }
122:   }
123:   /* Process summary exclusions */
124:   PetscOptionsGetString(NULL,NULL, "-log_exclude", logList, 256, &opt);
125:   if (opt) {
126:     PetscStrstr(logList, "da", &className);
127:     if (className) {
128:       PetscLogEventDeactivateClass(DM_CLASSID);
129:     }
130:   }
131:   PetscRegisterFinalize(DMFinalizePackage);
132:   return(0);
133: }
134:  #include <petscfe.h>

136: static PetscBool PetscFEPackageInitialized = PETSC_FALSE;
137: /*@C
138:   PetscFEFinalizePackage - This function finalizes everything in the PetscFE package. It is called
139:   from PetscFinalize().

141:   Level: developer

143: .keywords: PetscFE, initialize, package
144: .seealso: PetscInitialize()
145: @*/
146: PetscErrorCode PetscFEFinalizePackage(void)
147: {

151:   PetscFunctionListDestroy(&PetscSpaceList);
152:   PetscFunctionListDestroy(&PetscDualSpaceList);
153:   PetscFunctionListDestroy(&PetscFEList);
154:   PetscFEPackageInitialized       = PETSC_FALSE;
155:   PetscSpaceRegisterAllCalled     = PETSC_FALSE;
156:   PetscDualSpaceRegisterAllCalled = PETSC_FALSE;
157:   PetscFERegisterAllCalled        = PETSC_FALSE;
158:   return(0);
159: }

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

166:   Level: developer

168: .keywords: PetscFE, initialize, package
169: .seealso: PetscInitialize()
170: @*/
171: PetscErrorCode PetscFEInitializePackage(void)
172: {
173:   char           logList[256];
174:   char          *className;
175:   PetscBool      opt;

179:   if (PetscFEPackageInitialized) return(0);
180:   PetscFEPackageInitialized = PETSC_TRUE;

182:   /* Register Classes */
183:   PetscClassIdRegister("Linear Space", &PETSCSPACE_CLASSID);
184:   PetscClassIdRegister("Dual Space",   &PETSCDUALSPACE_CLASSID);
185:   PetscClassIdRegister("FE Space",     &PETSCFE_CLASSID);

187:   /* Register Constructors */
188:   PetscSpaceRegisterAll();
189:   PetscDualSpaceRegisterAll();
190:   PetscFERegisterAll();
191:   /* Register Events */
192:   /* Process info exclusions */
193:   PetscOptionsGetString(NULL,NULL, "-info_exclude", logList, 256, &opt);
194:   if (opt) {
195:     PetscStrstr(logList, "fe", &className);
196:     if (className) {PetscInfoDeactivateClass(PETSCFE_CLASSID);}
197:   }
198:   /* Process summary exclusions */
199:   PetscOptionsGetString(NULL,NULL, "-log_exclude", logList, 256, &opt);
200:   if (opt) {
201:     PetscStrstr(logList, "fe", &className);
202:     if (className) {PetscLogEventDeactivateClass(PETSCFE_CLASSID);}
203:   }
204:   PetscRegisterFinalize(PetscFEFinalizePackage);
205:   return(0);
206: }
207:  #include <petscfv.h>

209: static PetscBool PetscFVPackageInitialized = PETSC_FALSE;
210: /*@C
211:   PetscFVFinalizePackage - This function finalizes everything in the PetscFV package. It is called
212:   from PetscFinalize().

214:   Level: developer

216: .keywords: PetscFV, initialize, package
217: .seealso: PetscInitialize()
218: @*/
219: PetscErrorCode PetscFVFinalizePackage(void)
220: {

224:   PetscFunctionListDestroy(&PetscLimiterList);
225:   PetscFunctionListDestroy(&PetscFVList);
226:   PetscFVPackageInitialized     = PETSC_FALSE;
227:   PetscFVRegisterAllCalled      = PETSC_FALSE;
228:   PetscLimiterRegisterAllCalled = PETSC_FALSE;
229:   return(0);
230: }

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

237:   Level: developer

239: .keywords: PetscFV, initialize, package
240: .seealso: PetscInitialize()
241: @*/
242: PetscErrorCode PetscFVInitializePackage(void)
243: {
244:   char           logList[256];
245:   char          *className;
246:   PetscBool      opt;

250:   if (PetscFVPackageInitialized) return(0);
251:   PetscFVPackageInitialized = PETSC_TRUE;

253:   /* Register Classes */
254:   PetscClassIdRegister("FV Space", &PETSCFV_CLASSID);
255:   PetscClassIdRegister("Limiter",  &PETSCLIMITER_CLASSID);

257:   /* Register Constructors */
258:   PetscFVRegisterAll();
259:   /* Register Events */
260:   /* Process info exclusions */
261:   PetscOptionsGetString(NULL,NULL, "-info_exclude", logList, 256, &opt);
262:   if (opt) {
263:     PetscStrstr(logList, "fv", &className);
264:     if (className) {PetscInfoDeactivateClass(PETSCFV_CLASSID);}
265:     PetscStrstr(logList, "limiter", &className);
266:     if (className) {PetscInfoDeactivateClass(PETSCLIMITER_CLASSID);}
267:   }
268:   /* Process summary exclusions */
269:   PetscOptionsGetString(NULL,NULL, "-log_exclude", logList, 256, &opt);
270:   if (opt) {
271:     PetscStrstr(logList, "fv", &className);
272:     if (className) {PetscLogEventDeactivateClass(PETSCFV_CLASSID);}
273:     PetscStrstr(logList, "limiter", &className);
274:     if (className) {PetscLogEventDeactivateClass(PETSCLIMITER_CLASSID);}
275:   }
276:   PetscRegisterFinalize(PetscFVFinalizePackage);
277:   return(0);
278: }
279:  #include <petscds.h>

281: static PetscBool PetscDSPackageInitialized = PETSC_FALSE;
282: /*@C
283:   PetscDSFinalizePackage - This function finalizes everything in the PetscDS package. It is called
284:   from PetscFinalize().

286:   Level: developer

288: .keywords: PetscDS, initialize, package
289: .seealso: PetscInitialize()
290: @*/
291: PetscErrorCode PetscDSFinalizePackage(void)
292: {

296:   PetscFunctionListDestroy(&PetscDSList);
297:   PetscDSPackageInitialized = PETSC_FALSE;
298:   PetscDSRegisterAllCalled  = PETSC_FALSE;
299:   return(0);
300: }

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

307:   Level: developer

309: .keywords: PetscDS, initialize, package
310: .seealso: PetscInitialize()
311: @*/
312: PetscErrorCode PetscDSInitializePackage(void)
313: {
314:   char           logList[256];
315:   char          *className;
316:   PetscBool      opt;

320:   if (PetscDSPackageInitialized) return(0);
321:   PetscDSPackageInitialized = PETSC_TRUE;

323:   /* Register Classes */
324:   PetscClassIdRegister("Discrete System", &PETSCDS_CLASSID);

326:   /* Register Constructors */
327:   PetscDSRegisterAll();
328:   /* Register Events */
329:   /* Process info exclusions */
330:   PetscOptionsGetString(NULL,NULL, "-info_exclude", logList, 256, &opt);
331:   if (opt) {
332:     PetscStrstr(logList, "ds", &className);
333:     if (className) {PetscInfoDeactivateClass(PETSCDS_CLASSID);}
334:   }
335:   /* Process summary exclusions */
336:   PetscOptionsGetString(NULL,NULL, "-log_exclude", logList, 256, &opt);
337:   if (opt) {
338:     PetscStrstr(logList, "ds", &className);
339:     if (className) {PetscLogEventDeactivateClass(PETSCDS_CLASSID);}
340:   }
341:   PetscRegisterFinalize(PetscDSFinalizePackage);
342:   return(0);
343: }

345: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
346: /*
347:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

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

352: */
353: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscdm(void)
354: {

358:   AOInitializePackage();
359:   DMInitializePackage();
360:   PetscFEInitializePackage();
361:   PetscFVInitializePackage();
362:   return(0);
363: }

365: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */