Actual source code: dlregisdmdm.c

petsc-3.12.0 2019-09-29
Report Typos and Errors

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

 11: static PetscBool 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: .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_petscdm() when using dynamic libraries, and on the first call to AOCreate()
 41:   or DMDACreate() when using shared or static libraries.

 43:   Level: developer

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

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

 57:   /* Register Classes */
 58:   PetscClassIdRegister("Distributed Mesh",&DM_CLASSID);
 59:   PetscClassIdRegister("DM Label",&DMLABEL_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);
 78:   PetscLogEventRegister("DMCreateInject",         DM_CLASSID,&DM_CreateInjection);
 79:   PetscLogEventRegister("DMCreateMat",            DM_CLASSID,&DM_CreateMatrix);

 81:   PetscLogEventRegister("Mesh Partition",         DM_CLASSID,&DMPLEX_Partition);
 82:   PetscLogEventRegister("Mesh Migration",         DM_CLASSID,&DMPLEX_Migrate);
 83:   PetscLogEventRegister("DMPlexPartSelf",         DM_CLASSID,&DMPLEX_PartSelf);
 84:   PetscLogEventRegister("DMPlexPartLblInv",       DM_CLASSID,&DMPLEX_PartLabelInvert);
 85:   PetscLogEventRegister("DMPlexPartLblSF",        DM_CLASSID,&DMPLEX_PartLabelCreateSF);
 86:   PetscLogEventRegister("DMPlexPartStrtSF",       DM_CLASSID,&DMPLEX_PartStratSF);
 87:   PetscLogEventRegister("DMPlexPointSF",          DM_CLASSID,&DMPLEX_CreatePointSF);
 88:   PetscLogEventRegister("DMPlexInterp",           DM_CLASSID,&DMPLEX_Interpolate);
 89:   PetscLogEventRegister("DMPlexDistribute",       DM_CLASSID,&DMPLEX_Distribute);
 90:   PetscLogEventRegister("DMPlexDistCones",        DM_CLASSID,&DMPLEX_DistributeCones);
 91:   PetscLogEventRegister("DMPlexDistLabels",       DM_CLASSID,&DMPLEX_DistributeLabels);
 92:   PetscLogEventRegister("DMPlexDistSF",           DM_CLASSID,&DMPLEX_DistributeSF);
 93:   PetscLogEventRegister("DMPlexDistOvrlp",        DM_CLASSID,&DMPLEX_DistributeOverlap);
 94:   PetscLogEventRegister("DMPlexDistField",        DM_CLASSID,&DMPLEX_DistributeField);
 95:   PetscLogEventRegister("DMPlexDistData",         DM_CLASSID,&DMPLEX_DistributeData);
 96:   PetscLogEventRegister("DMPlexInterpSF",         DM_CLASSID,&DMPLEX_InterpolateSF);
 97:   PetscLogEventRegister("DMPlexGToNBegin",        DM_CLASSID,&DMPLEX_GlobalToNaturalBegin);
 98:   PetscLogEventRegister("DMPlexGToNEnd",          DM_CLASSID,&DMPLEX_GlobalToNaturalEnd);
 99:   PetscLogEventRegister("DMPlexNToGBegin",        DM_CLASSID,&DMPLEX_NaturalToGlobalBegin);
100:   PetscLogEventRegister("DMPlexNToGEnd",          DM_CLASSID,&DMPLEX_NaturalToGlobalEnd);
101:   PetscLogEventRegister("DMPlexStratify",         DM_CLASSID,&DMPLEX_Stratify);
102:   PetscLogEventRegister("DMPlexSymmetrize",       DM_CLASSID,&DMPLEX_Symmetrize);
103:   PetscLogEventRegister("DMPlexPrealloc",         DM_CLASSID,&DMPLEX_Preallocate);
104:   PetscLogEventRegister("DMPlexResidualFE",       DM_CLASSID,&DMPLEX_ResidualFEM);
105:   PetscLogEventRegister("DMPlexJacobianFE",       DM_CLASSID,&DMPLEX_JacobianFEM);
106:   PetscLogEventRegister("DMPlexInterpFE",         DM_CLASSID,&DMPLEX_InterpolatorFEM);
107:   PetscLogEventRegister("DMPlexInjectorFE",       DM_CLASSID,&DMPLEX_InjectorFEM);
108:   PetscLogEventRegister("DMPlexIntegralFEM",      DM_CLASSID,&DMPLEX_IntegralFEM);
109:   PetscLogEventRegister("DMPlexCreateGmsh",       DM_CLASSID,&DMPLEX_CreateGmsh);
110:   PetscLogEventRegister("DMPlexRebalance",        DM_CLASSID,&DMPLEX_RebalanceSharedPoints);

112:   PetscLogEventRegister("DMSwarmMigrate",         DM_CLASSID,&DMSWARM_Migrate);
113:   PetscLogEventRegister("DMSwarmDETSetup",        DM_CLASSID,&DMSWARM_DataExchangerTopologySetup);
114:   PetscLogEventRegister("DMSwarmDExBegin",        DM_CLASSID,&DMSWARM_DataExchangerBegin);
115:   PetscLogEventRegister("DMSwarmDExEnd",          DM_CLASSID,&DMSWARM_DataExchangerEnd);
116:   PetscLogEventRegister("DMSwarmDESendCnt",       DM_CLASSID,&DMSWARM_DataExchangerSendCount);
117:   PetscLogEventRegister("DMSwarmDEPack",          DM_CLASSID,&DMSWARM_DataExchangerPack);
118:   PetscLogEventRegister("DMSwarmAddPnts",         DM_CLASSID,&DMSWARM_AddPoints);
119:   PetscLogEventRegister("DMSwarmRmvPnts",         DM_CLASSID,&DMSWARM_RemovePoints);
120:   PetscLogEventRegister("DMSwarmSort",            DM_CLASSID,&DMSWARM_Sort);
121:   PetscLogEventRegister("DMSwarmSetSizes",        DM_CLASSID,&DMSWARM_SetSizes);

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

130:   /* Process summary exclusions */
131:   PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
132:   if (opt) {
133:     PetscStrInList("dm",logList,',',&pkg);
134:     if (pkg) {PetscLogEventExcludeClass(DM_CLASSID);}
135:   }

137:   DMPlexGenerateRegisterAll();
138:   PetscRegisterFinalize(DMPlexGenerateRegisterDestroy);
139:   PetscRegisterFinalize(DMFinalizePackage);
140:   return(0);
141: }
142:  #include <petscfe.h>

144: static PetscBool PetscFEPackageInitialized = PETSC_FALSE;
145: /*@C
146:   PetscFEFinalizePackage - This function finalizes everything in the PetscFE package. It is called
147:   from PetscFinalize().

149:   Level: developer

151: .seealso: PetscInitialize()
152: @*/
153: PetscErrorCode PetscFEFinalizePackage(void)
154: {

158:   PetscFunctionListDestroy(&PetscSpaceList);
159:   PetscFunctionListDestroy(&PetscDualSpaceList);
160:   PetscFunctionListDestroy(&PetscFEList);
161:   PetscFEPackageInitialized       = PETSC_FALSE;
162:   PetscSpaceRegisterAllCalled     = PETSC_FALSE;
163:   PetscDualSpaceRegisterAllCalled = PETSC_FALSE;
164:   PetscFERegisterAllCalled        = PETSC_FALSE;
165:   return(0);
166: }

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

173:   Level: developer

175: .seealso: PetscInitialize()
176: @*/
177: PetscErrorCode PetscFEInitializePackage(void)
178: {
179:   char           logList[256];
180:   PetscBool      opt,pkg;

184:   if (PetscFEPackageInitialized) return(0);
185:   PetscFEPackageInitialized = PETSC_TRUE;

187:   /* Register Classes */
188:   PetscClassIdRegister("Linear Space", &PETSCSPACE_CLASSID);
189:   PetscClassIdRegister("Dual Space",   &PETSCDUALSPACE_CLASSID);
190:   PetscClassIdRegister("FE Space",     &PETSCFE_CLASSID);
191:   /* Register Constructors */
192:   PetscSpaceRegisterAll();
193:   PetscDualSpaceRegisterAll();
194:   PetscFERegisterAll();
195:   /* Register Events */
196:   /* Process info exclusions */
197:   PetscOptionsGetString(NULL,NULL,"-info_exclude",logList,sizeof(logList),&opt);
198:   if (opt) {
199:     PetscStrInList("fe",logList,',',&pkg);
200:     if (pkg) {PetscInfoDeactivateClass(PETSCFE_CLASSID);}
201:   }
202:   /* Process summary exclusions */
203:   PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
204:   if (opt) {
205:     PetscStrInList("fe",logList,',',&pkg);
206:     if (pkg) {PetscLogEventExcludeClass(PETSCFE_CLASSID);}
207:   }
208:   /* Register package finalizer */
209:   PetscRegisterFinalize(PetscFEFinalizePackage);
210:   return(0);
211: }
212:  #include <petscfv.h>

214: static PetscBool PetscFVPackageInitialized = PETSC_FALSE;
215: /*@C
216:   PetscFVFinalizePackage - This function finalizes everything in the PetscFV package. It is called
217:   from PetscFinalize().

219:   Level: developer

221: .seealso: PetscInitialize()
222: @*/
223: PetscErrorCode PetscFVFinalizePackage(void)
224: {

228:   PetscFunctionListDestroy(&PetscLimiterList);
229:   PetscFunctionListDestroy(&PetscFVList);
230:   PetscFVPackageInitialized     = PETSC_FALSE;
231:   PetscFVRegisterAllCalled      = PETSC_FALSE;
232:   PetscLimiterRegisterAllCalled = PETSC_FALSE;
233:   return(0);
234: }

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

241:   Level: developer

243: .seealso: PetscInitialize()
244: @*/
245: PetscErrorCode PetscFVInitializePackage(void)
246: {
247:   char           logList[256];
248:   PetscBool      opt,pkg;

252:   if (PetscFVPackageInitialized) return(0);
253:   PetscFVPackageInitialized = PETSC_TRUE;

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

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

288:   Level: developer

290: .seealso: PetscInitialize()
291: @*/
292: PetscErrorCode PetscDSFinalizePackage(void)
293: {

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

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

308:   Level: developer

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

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

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

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

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

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

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

365: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */