Actual source code: dlregisdmdm.c

petsc-3.9.2 2018-05-20
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: PETSC_EXTERN PetscErrorCode MatCreate_HYPRESStruct(Mat);
 36: #endif

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

 43:   Level: developer

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

 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:   MatRegister(MATHYPRESSTRUCT, MatCreate_HYPRESStruct);
 65: #endif
 66:   PetscSectionSymRegister(PETSCSECTIONSYMLABEL,PetscSectionSymCreate_Label);

 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);
 74:   PetscLogEventRegister("DMLocatePoints",         DM_CLASSID,&DM_LocatePoints);
 75:   PetscLogEventRegister("DMCoarsen",              DM_CLASSID,&DM_Coarsen);
 76:   PetscLogEventRegister("DMCreateInterp",         DM_CLASSID,&DM_CreateInterpolation);
 77:   PetscLogEventRegister("DMCreateRestrict",       DM_CLASSID,&DM_CreateRestriction);

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

 81:   PetscLogEventRegister("Mesh Partition",         PETSCPARTITIONER_CLASSID,&PETSCPARTITIONER_Partition);
 82:   PetscLogEventRegister("Mesh Migration",         DM_CLASSID,&DMPLEX_Migrate);
 83:   PetscLogEventRegister("DMPlexInterp",           DM_CLASSID,&DMPLEX_Interpolate);
 84:   PetscLogEventRegister("DMPlexDistribute",       DM_CLASSID,&DMPLEX_Distribute);
 85:   PetscLogEventRegister("DMPlexDistCones",        DM_CLASSID,&DMPLEX_DistributeCones);
 86:   PetscLogEventRegister("DMPlexDistLabels",       DM_CLASSID,&DMPLEX_DistributeLabels);
 87:   PetscLogEventRegister("DMPlexDistribSF",        DM_CLASSID,&DMPLEX_DistributeSF);
 88:   PetscLogEventRegister("DMPlexDistribOL",        DM_CLASSID,&DMPLEX_DistributeOverlap);
 89:   PetscLogEventRegister("DMPlexDistField",        DM_CLASSID,&DMPLEX_DistributeField);
 90:   PetscLogEventRegister("DMPlexDistData",         DM_CLASSID,&DMPLEX_DistributeData);
 91:   PetscLogEventRegister("DMPlexInterpSF",         DM_CLASSID,&DMPLEX_InterpolateSF);
 92:   PetscLogEventRegister("DMPlexGToNBegin",        DM_CLASSID,&DMPLEX_GlobalToNaturalBegin);
 93:   PetscLogEventRegister("DMPlexGToNEnd",          DM_CLASSID,&DMPLEX_GlobalToNaturalEnd);
 94:   PetscLogEventRegister("DMPlexNToGBegin",        DM_CLASSID,&DMPLEX_NaturalToGlobalBegin);
 95:   PetscLogEventRegister("DMPlexNToGEnd",          DM_CLASSID,&DMPLEX_NaturalToGlobalEnd);
 96:   PetscLogEventRegister("DMPlexStratify",         DM_CLASSID,&DMPLEX_Stratify);
 97:   PetscLogEventRegister("DMPlexPrealloc",         DM_CLASSID,&DMPLEX_Preallocate);
 98:   PetscLogEventRegister("DMPlexResidualFE",       DM_CLASSID,&DMPLEX_ResidualFEM);
 99:   PetscLogEventRegister("DMPlexJacobianFE",       DM_CLASSID,&DMPLEX_JacobianFEM);
100:   PetscLogEventRegister("DMPlexInterpFE",         DM_CLASSID,&DMPLEX_InterpolatorFEM);
101:   PetscLogEventRegister("DMPlexInjectorFE",       DM_CLASSID,&DMPLEX_InjectorFEM);
102:   PetscLogEventRegister("DMPlexIntegralFEM",      DM_CLASSID,&DMPLEX_IntegralFEM);
103:   PetscLogEventRegister("DMPlexCreateGmsh",       DM_CLASSID,&DMPLEX_CreateGmsh);
104: 
105:   PetscLogEventRegister("DMSwarmMigrate",         DM_CLASSID,&DMSWARM_Migrate);
106:   PetscLogEventRegister("DMSwarmDETSetup",        DM_CLASSID,&DMSWARM_DataExchangerTopologySetup);
107:   PetscLogEventRegister("DMSwarmDExBegin",        DM_CLASSID,&DMSWARM_DataExchangerBegin);
108:   PetscLogEventRegister("DMSwarmDExEnd",          DM_CLASSID,&DMSWARM_DataExchangerEnd);
109:   PetscLogEventRegister("DMSwarmDESendCnt",       DM_CLASSID,&DMSWARM_DataExchangerSendCount);
110:   PetscLogEventRegister("DMSwarmDEPack",          DM_CLASSID,&DMSWARM_DataExchangerPack);
111:   PetscLogEventRegister("DMSwarmAddPnts",         DM_CLASSID,&DMSWARM_AddPoints);
112:   PetscLogEventRegister("DMSwarmRmvPnts",         DM_CLASSID,&DMSWARM_RemovePoints);
113:   PetscLogEventRegister("DMSwarmSort",            DM_CLASSID,&DMSWARM_Sort);
114:   PetscLogEventRegister("DMSwarmSetSizes",        DM_CLASSID,&DMSWARM_SetSizes);
115: 
116:   /* Process info exclusions */
117:   PetscOptionsGetString(NULL,NULL,"-info_exclude",logList,sizeof(logList),&opt);
118:   if (opt) {
119:     PetscStrInList("dm",logList,',',&pkg);
120:     if (pkg) {PetscInfoDeactivateClass(DM_CLASSID);}
121:   }

123:   /* Process summary exclusions */
124:   PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
125:   if (opt) {
126:     PetscStrInList("dm",logList,',',&pkg);
127:     if (pkg) {PetscLogEventDeactivateClass(DM_CLASSID);}
128:   }

130:   DMPlexGenerateRegisterAll();
131:   PetscRegisterFinalize(DMPlexGenerateRegisterDestroy);
132:   PetscRegisterFinalize(DMFinalizePackage);
133:   return(0);
134: }
135:  #include <petscfe.h>

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

142:   Level: developer

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

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

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

167:   Level: developer

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

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);
186:   /* Register Constructors */
187:   PetscSpaceRegisterAll();
188:   PetscDualSpaceRegisterAll();
189:   PetscFERegisterAll();
190:   /* Register Events */
191:   /* Process info exclusions */
192:   PetscOptionsGetString(NULL,NULL,"-info_exclude",logList,sizeof(logList),&opt);
193:   if (opt) {
194:     PetscStrInList("fe",logList,',',&pkg);
195:     if (pkg) {PetscInfoDeactivateClass(PETSCFE_CLASSID);}
196:   }
197:   /* Process summary exclusions */
198:   PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
199:   if (opt) {
200:     PetscStrInList("fe",logList,',',&pkg);
201:     if (pkg) {PetscLogEventDeactivateClass(PETSCFE_CLASSID);}
202:   }
203:   /* Register package finalizer */
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:   PetscBool      opt,pkg;

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

252:   /* Register Classes */
253:   PetscClassIdRegister("FV Space", &PETSCFV_CLASSID);
254:   PetscClassIdRegister("Limiter",  &PETSCLIMITER_CLASSID);
255:   /* Register Constructors */
256:   PetscFVRegisterAll();
257:   /* Register Events */
258:   /* Process info exclusions */
259:   PetscOptionsGetString(NULL,NULL,"-info_exclude",logList,sizeof(logList),&opt);
260:   if (opt) {
261:     PetscStrInList("fv",logList,',',&pkg);
262:     if (pkg) {PetscInfoDeactivateClass(PETSCFV_CLASSID);}
263:     PetscStrInList("limiter",logList,',',&pkg);
264:     if (pkg) {PetscInfoDeactivateClass(PETSCLIMITER_CLASSID);}
265:   }
266:   /* Process summary exclusions */
267:   PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
268:   if (opt) {
269:     PetscStrInList("fv",logList,',',&pkg);
270:     if (pkg) {PetscLogEventDeactivateClass(PETSCFV_CLASSID);}
271:     PetscStrInList("limiter",logList,',',&pkg);
272:     if (pkg) {PetscLogEventDeactivateClass(PETSCLIMITER_CLASSID);}
273:   }
274:   /* Register package finalizer */
275:   PetscRegisterFinalize(PetscFVFinalizePackage);
276:   return(0);
277: }
278:  #include <petscds.h>

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

285:   Level: developer

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

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

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

306:   Level: developer

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

318:   if (PetscDSPackageInitialized) return(0);
319:   PetscDSPackageInitialized = PETSC_TRUE;

321:   /* Register Classes */
322:   PetscClassIdRegister("Discrete System", &PETSCDS_CLASSID);
323:   /* Register Constructors */
324:   PetscDSRegisterAll();
325:   /* Register Events */
326:   /* Process info exclusions */
327:   PetscOptionsGetString(NULL,NULL,"-info_exclude",logList,sizeof(logList),&opt);
328:   if (opt) {
329:     PetscStrInList("ds",logList,',',&pkg);
330:     if (pkg) {PetscInfoDeactivateClass(PETSCDS_CLASSID);}
331:   }
332:   /* Process summary exclusions */
333:   PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
334:   if (opt) {
335:     PetscStrInList("ds",logList,',',&pkg);
336:     if (pkg) {PetscLogEventDeactivateClass(PETSCDS_CLASSID);}
337:   }
338:   /* Register package finalizer */
339:   PetscRegisterFinalize(PetscDSFinalizePackage);
340:   return(0);
341: }

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

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

350: */
351: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscdm(void)
352: {

356:   AOInitializePackage();
357:   DMInitializePackage();
358:   PetscFEInitializePackage();
359:   PetscFVInitializePackage();
360:   return(0);
361: }

363: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */