Actual source code: dlregisdmdm.c

petsc-3.11.4 2019-09-28
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: .keywords: AO, initialize, package
 19: .seealso: PetscInitialize()
 20: @*/
 21: PetscErrorCode  DMFinalizePackage(void)
 22: {

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

 34: #if defined(PETSC_HAVE_HYPRE)
 35: PETSC_EXTERN PetscErrorCode MatCreate_HYPREStruct(Mat);
 36: PETSC_EXTERN PetscErrorCode MatCreate_HYPRESStruct(Mat);
 37: #endif

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

 44:   Level: developer

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

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

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

 64: #if defined(PETSC_HAVE_HYPRE)
 65:   MatRegister(MATHYPRESTRUCT, MatCreate_HYPREStruct);
 66:   MatRegister(MATHYPRESSTRUCT, MatCreate_HYPRESStruct);
 67: #endif
 68:   PetscSectionSymRegister(PETSCSECTIONSYMLABEL,PetscSectionSymCreate_Label);

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

 81:   PetscLogEventRegister("Mesh Partition",         DM_CLASSID,&DMPLEX_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("DMPlexDistSF",           DM_CLASSID,&DMPLEX_DistributeSF);
 88:   PetscLogEventRegister("DMPlexDistOvrlp",        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);

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);

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) {PetscLogEventExcludeClass(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) {PetscLogEventExcludeClass(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) {PetscLogEventExcludeClass(PETSCFV_CLASSID);}
271:     PetscStrInList("limiter",logList,',',&pkg);
272:     if (pkg) {PetscLogEventExcludeClass(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) {PetscLogEventExcludeClass(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:   DMFieldInitializePackage();
361:   return(0);
362: }

364: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */