Actual source code: dlregisdmdm.c

  1: #include <petscao.h>
  2: #include <petsc/private/dmlabelimpl.h>
  3: #include <petsc/private/dmfieldimpl.h>
  4: #include <petsc/private/dmpleximpl.h>
  5: #include <petsc/private/dmplextransformimpl.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>
 10: #include <petsc/private/dmnetworkimpl.h>

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

 17:   Level: developer

 19: .seealso: `PetscInitialize()`
 20: @*/
 21: PetscErrorCode DMFinalizePackage(void)
 22: {
 23:   PetscFunctionBegin;
 24:   PetscCall(PetscFunctionListDestroy(&DMList));
 25:   DMPackageInitialized = PETSC_FALSE;
 26:   DMRegisterAllCalled  = PETSC_FALSE;
 27:   PetscFunctionReturn(PETSC_SUCCESS);
 28: }

 30: #if defined(PETSC_HAVE_HYPRE)
 31: PETSC_EXTERN PetscErrorCode MatCreate_HYPREStruct(Mat);
 32: PETSC_EXTERN PetscErrorCode MatCreate_HYPRESStruct(Mat);
 33: #endif

 35: /*@C
 36:   DMInitializePackage - This function initializes everything in the `DM` package. It is called
 37:   from `PetscDLLibraryRegister_petscdm()` when using dynamic libraries, and on the first call to `DMCreate()`
 38:   or `DMDACreate()` when using shared or static libraries.

 40:   Level: developer

 42: .seealso: `PetscInitialize()`
 43: @*/
 44: PetscErrorCode DMInitializePackage(void)
 45: {
 46:   char      logList[256];
 47:   PetscBool opt, pkg;

 49:   PetscFunctionBegin;
 50:   if (DMPackageInitialized) PetscFunctionReturn(PETSC_SUCCESS);
 51:   DMPackageInitialized = PETSC_TRUE;

 53:   /* Register Classes */
 54:   PetscCall(PetscClassIdRegister("Distributed Mesh", &DM_CLASSID));
 55:   PetscCall(PetscClassIdRegister("DM Label", &DMLABEL_CLASSID));
 56:   PetscCall(PetscClassIdRegister("Quadrature", &PETSCQUADRATURE_CLASSID));
 57:   PetscCall(PetscClassIdRegister("Mesh Transform", &DMPLEXTRANSFORM_CLASSID));

 59: #if defined(PETSC_HAVE_HYPRE)
 60:   PetscCall(MatRegister(MATHYPRESTRUCT, MatCreate_HYPREStruct));
 61:   PetscCall(MatRegister(MATHYPRESSTRUCT, MatCreate_HYPRESStruct));
 62: #endif
 63:   PetscCall(PetscSectionSymRegister(PETSCSECTIONSYMLABEL, PetscSectionSymCreate_Label));

 65:   /* Register Constructors */
 66:   PetscCall(DMRegisterAll());
 67:   /* Register Events */
 68:   PetscCall(PetscLogEventRegister("DMConvert", DM_CLASSID, &DM_Convert));
 69:   PetscCall(PetscLogEventRegister("DMGlobalToLocal", DM_CLASSID, &DM_GlobalToLocal));
 70:   PetscCall(PetscLogEventRegister("DMLocalToGlobal", DM_CLASSID, &DM_LocalToGlobal));
 71:   PetscCall(PetscLogEventRegister("DMLocatePoints", DM_CLASSID, &DM_LocatePoints));
 72:   PetscCall(PetscLogEventRegister("DMCoarsen", DM_CLASSID, &DM_Coarsen));
 73:   PetscCall(PetscLogEventRegister("DMRefine", DM_CLASSID, &DM_Refine));
 74:   PetscCall(PetscLogEventRegister("DMCreateInterp", DM_CLASSID, &DM_CreateInterpolation));
 75:   PetscCall(PetscLogEventRegister("DMCreateRestrict", DM_CLASSID, &DM_CreateRestriction));
 76:   PetscCall(PetscLogEventRegister("DMCreateInject", DM_CLASSID, &DM_CreateInjection));
 77:   PetscCall(PetscLogEventRegister("DMCreateMat", DM_CLASSID, &DM_CreateMatrix));
 78:   PetscCall(PetscLogEventRegister("DMCreateMassMat", DM_CLASSID, &DM_CreateMassMatrix));
 79:   PetscCall(PetscLogEventRegister("DMLoad", DM_CLASSID, &DM_Load));
 80:   PetscCall(PetscLogEventRegister("DMView", DM_CLASSID, &DM_View));
 81:   PetscCall(PetscLogEventRegister("DMAdaptInterp", DM_CLASSID, &DM_AdaptInterpolator));
 82:   PetscCall(PetscLogEventRegister("DMProjectFunc", DM_CLASSID, &DM_ProjectFunction));

 84:   PetscCall(PetscLogEventRegister("DMPlexBuFrCeLi", DM_CLASSID, &DMPLEX_BuildFromCellList));
 85:   PetscCall(PetscLogEventRegister("DMPlexBuCoFrCeLi", DM_CLASSID, &DMPLEX_BuildCoordinatesFromCellList));
 86:   PetscCall(PetscLogEventRegister("DMPlexCreateGmsh", DM_CLASSID, &DMPLEX_CreateGmsh));
 87:   PetscCall(PetscLogEventRegister("DMPlexCrBoxSFC", DM_CLASSID, &DMPLEX_CreateBoxSFC));
 88:   PetscCall(PetscLogEventRegister("DMPlexCrFromFile", DM_CLASSID, &DMPLEX_CreateFromFile));
 89:   PetscCall(PetscLogEventRegister("DMPlexCrFromOpts", DM_CLASSID, &DMPLEX_CreateFromOptions));
 90:   PetscCall(PetscLogEventRegister("Mesh Partition", DM_CLASSID, &DMPLEX_Partition));
 91:   PetscCall(PetscLogEventRegister("Mesh Migration", DM_CLASSID, &DMPLEX_Migrate));
 92:   PetscCall(PetscLogEventRegister("DMPlexPartSelf", DM_CLASSID, &DMPLEX_PartSelf));
 93:   PetscCall(PetscLogEventRegister("DMPlexPartLblInv", DM_CLASSID, &DMPLEX_PartLabelInvert));
 94:   PetscCall(PetscLogEventRegister("DMPlexPartLblSF", DM_CLASSID, &DMPLEX_PartLabelCreateSF));
 95:   PetscCall(PetscLogEventRegister("DMPlexPartStrtSF", DM_CLASSID, &DMPLEX_PartStratSF));
 96:   PetscCall(PetscLogEventRegister("DMPlexPointSF", DM_CLASSID, &DMPLEX_CreatePointSF));
 97:   PetscCall(PetscLogEventRegister("DMPlexInterp", DM_CLASSID, &DMPLEX_Interpolate));
 98:   PetscCall(PetscLogEventRegister("DMPlexDistribute", DM_CLASSID, &DMPLEX_Distribute));
 99:   PetscCall(PetscLogEventRegister("DMPlexDistCones", DM_CLASSID, &DMPLEX_DistributeCones));
100:   PetscCall(PetscLogEventRegister("DMPlexDistLabels", DM_CLASSID, &DMPLEX_DistributeLabels));
101:   PetscCall(PetscLogEventRegister("DMPlexDistSF", DM_CLASSID, &DMPLEX_DistributeSF));
102:   PetscCall(PetscLogEventRegister("DMPlexDistOvrlp", DM_CLASSID, &DMPLEX_DistributeOverlap));
103:   PetscCall(PetscLogEventRegister("DMPlexDistField", DM_CLASSID, &DMPLEX_DistributeField));
104:   PetscCall(PetscLogEventRegister("DMPlexDistData", DM_CLASSID, &DMPLEX_DistributeData));
105:   PetscCall(PetscLogEventRegister("DMPlexInterpSF", DM_CLASSID, &DMPLEX_InterpolateSF));
106:   PetscCall(PetscLogEventRegister("DMPlexGToNBegin", DM_CLASSID, &DMPLEX_GlobalToNaturalBegin));
107:   PetscCall(PetscLogEventRegister("DMPlexGToNEnd", DM_CLASSID, &DMPLEX_GlobalToNaturalEnd));
108:   PetscCall(PetscLogEventRegister("DMPlexNToGBegin", DM_CLASSID, &DMPLEX_NaturalToGlobalBegin));
109:   PetscCall(PetscLogEventRegister("DMPlexNToGEnd", DM_CLASSID, &DMPLEX_NaturalToGlobalEnd));
110:   PetscCall(PetscLogEventRegister("DMPlexStratify", DM_CLASSID, &DMPLEX_Stratify));
111:   PetscCall(PetscLogEventRegister("DMPlexSymmetrize", DM_CLASSID, &DMPLEX_Symmetrize));
112:   PetscCall(PetscLogEventRegister("DMPlexPrealloc", DM_CLASSID, &DMPLEX_Preallocate));
113:   PetscCall(PetscLogEventRegister("DMPlexResidualFE", DM_CLASSID, &DMPLEX_ResidualFEM));
114:   PetscCall(PetscLogEventRegister("DMPlexJacobianFE", DM_CLASSID, &DMPLEX_JacobianFEM));
115:   PetscCall(PetscLogEventRegister("DMPlexInterpFE", DM_CLASSID, &DMPLEX_InterpolatorFEM));
116:   PetscCall(PetscLogEventRegister("DMPlexInjectorFE", DM_CLASSID, &DMPLEX_InjectorFEM));
117:   PetscCall(PetscLogEventRegister("DMPlexIntegralFE", DM_CLASSID, &DMPLEX_IntegralFEM));
118:   PetscCall(PetscLogEventRegister("DMPlexRebalance", DM_CLASSID, &DMPLEX_RebalanceSharedPoints));
119:   PetscCall(PetscLogEventRegister("DMPlexLocatePoints", DM_CLASSID, &DMPLEX_LocatePoints));
120:   PetscCall(PetscLogEventRegister("DMPlexTopologyView", DM_CLASSID, &DMPLEX_TopologyView));
121:   PetscCall(PetscLogEventRegister("DMPlexLabelsView", DM_CLASSID, &DMPLEX_LabelsView));
122:   PetscCall(PetscLogEventRegister("DMPlexCoordinatesView", DM_CLASSID, &DMPLEX_CoordinatesView));
123:   PetscCall(PetscLogEventRegister("DMPlexSectionView", DM_CLASSID, &DMPLEX_SectionView));
124:   PetscCall(PetscLogEventRegister("DMPlexGlobalVectorView", DM_CLASSID, &DMPLEX_GlobalVectorView));
125:   PetscCall(PetscLogEventRegister("DMPlexLocalVectorView", DM_CLASSID, &DMPLEX_LocalVectorView));
126:   PetscCall(PetscLogEventRegister("DMPlexTopologyLoad", DM_CLASSID, &DMPLEX_TopologyLoad));
127: #if defined(PETSC_HAVE_HDF5)
128:   PetscCall(PetscLogEventRegister("DMPlexDistributionView", DM_CLASSID, &DMPLEX_DistributionView));
129:   PetscCall(PetscLogEventRegister("DMPlexDistributionLoad", DM_CLASSID, &DMPLEX_DistributionLoad));
130: #endif
131:   PetscCall(PetscLogEventRegister("DMPlexLabelsLoad", DM_CLASSID, &DMPLEX_LabelsLoad));
132:   PetscCall(PetscLogEventRegister("DMPlexCoordinatesLoad", DM_CLASSID, &DMPLEX_CoordinatesLoad));
133:   PetscCall(PetscLogEventRegister("DMPlexSectionLoad", DM_CLASSID, &DMPLEX_SectionLoad));
134:   PetscCall(PetscLogEventRegister("DMPlexGlobalVectorLoad", DM_CLASSID, &DMPLEX_GlobalVectorLoad));
135:   PetscCall(PetscLogEventRegister("DMPlexLocalVectorLoad", DM_CLASSID, &DMPLEX_LocalVectorLoad));
136:   PetscCall(PetscLogEventRegister("DMPlexMetricEnforceSPD", DM_CLASSID, &DMPLEX_MetricEnforceSPD));
137:   PetscCall(PetscLogEventRegister("DMPlexMetricNormalize", DM_CLASSID, &DMPLEX_MetricNormalize));
138:   PetscCall(PetscLogEventRegister("DMPlexMetricAverage", DM_CLASSID, &DMPLEX_MetricAverage));
139:   PetscCall(PetscLogEventRegister("DMPlexMetricIntersect", DM_CLASSID, &DMPLEX_MetricIntersection));
140:   PetscCall(PetscLogEventRegister("DMPlexGenerate", DM_CLASSID, &DMPLEX_Generate));
141:   PetscCall(PetscLogEventRegister("DMPlexTransform", DM_CLASSID, &DMPLEX_Transform));
142:   PetscCall(PetscLogEventRegister("DMPlexGetLocOff", DM_CLASSID, &DMPLEX_GetLocalOffsets));

144:   PetscCall(PetscLogEventRegister("RebalBuildGraph", DM_CLASSID, &DMPLEX_RebalBuildGraph));
145:   PetscCall(PetscLogEventRegister("RebalGatherGraph", DM_CLASSID, &DMPLEX_RebalGatherGraph));
146:   PetscCall(PetscLogEventRegister("RebalPartition", DM_CLASSID, &DMPLEX_RebalPartition));
147:   PetscCall(PetscLogEventRegister("RebalScatterPart", DM_CLASSID, &DMPLEX_RebalScatterPart));
148:   PetscCall(PetscLogEventRegister("RebalRewriteSF", DM_CLASSID, &DMPLEX_RebalRewriteSF));
149:   PetscCall(PetscLogEventRegister("DMPlexUninterp", DM_CLASSID, &DMPLEX_Uninterpolate));

151:   PetscCall(PetscLogEventRegister("DMSwarmMigrate", DM_CLASSID, &DMSWARM_Migrate));
152:   PetscCall(PetscLogEventRegister("DMSwarmDETSetup", DM_CLASSID, &DMSWARM_DataExchangerTopologySetup));
153:   PetscCall(PetscLogEventRegister("DMSwarmDExBegin", DM_CLASSID, &DMSWARM_DataExchangerBegin));
154:   PetscCall(PetscLogEventRegister("DMSwarmDExEnd", DM_CLASSID, &DMSWARM_DataExchangerEnd));
155:   PetscCall(PetscLogEventRegister("DMSwarmDESendCnt", DM_CLASSID, &DMSWARM_DataExchangerSendCount));
156:   PetscCall(PetscLogEventRegister("DMSwarmDEPack", DM_CLASSID, &DMSWARM_DataExchangerPack));
157:   PetscCall(PetscLogEventRegister("DMSwarmAddPnts", DM_CLASSID, &DMSWARM_AddPoints));
158:   PetscCall(PetscLogEventRegister("DMSwarmRmvPnts", DM_CLASSID, &DMSWARM_RemovePoints));
159:   PetscCall(PetscLogEventRegister("DMSwarmSort", DM_CLASSID, &DMSWARM_Sort));
160:   PetscCall(PetscLogEventRegister("DMSwarmSetSizes", DM_CLASSID, &DMSWARM_SetSizes));

162:   PetscCall(PetscLogEventRegister("DMNtLayoutSetUp", DM_CLASSID, &DMNetwork_LayoutSetUp));
163:   PetscCall(PetscLogEventRegister("DMNtSetUp", DM_CLASSID, &DMNetwork_SetUpNetwork));
164:   PetscCall(PetscLogEventRegister("DMNtDistribute", DM_CLASSID, &DMNetwork_Distribute));
165:   /* Process Info */
166:   {
167:     PetscClassId classids[1];

169:     classids[0] = DM_CLASSID;
170:     PetscCall(PetscInfoProcessClass("dm", 1, classids));
171:   }

173:   /* Process summary exclusions */
174:   PetscCall(PetscOptionsGetString(NULL, NULL, "-log_exclude", logList, sizeof(logList), &opt));
175:   if (opt) {
176:     PetscCall(PetscStrInList("dm", logList, ',', &pkg));
177:     if (pkg) PetscCall(PetscLogEventExcludeClass(DM_CLASSID));
178:   }

180:   PetscCall(DMGenerateRegisterAll());
181:   PetscCall(PetscRegisterFinalize(DMGenerateRegisterDestroy));
182:   PetscCall(DMGeomModelRegisterAll());
183:   PetscCall(PetscRegisterFinalize(DMGeomModelRegisterDestroy));
184:   PetscCall(DMPlexTransformRegisterAll());
185:   PetscCall(PetscRegisterFinalize(DMPlexTransformRegisterDestroy));
186:   PetscCall(DMLabelRegisterAll());
187:   PetscCall(PetscRegisterFinalize(DMLabelRegisterDestroy));
188:   PetscCall(PetscRegisterFinalize(DMFinalizePackage));
189:   PetscFunctionReturn(PETSC_SUCCESS);
190: }
191: #include <petscfe.h>

193: static PetscBool PetscFEPackageInitialized = PETSC_FALSE;

195: /*@C
196:   PetscFEFinalizePackage - This function finalizes everything in the `PetscFE` package. It is called
197:   from `PetscFinalize()`.

199:   Level: developer

201: .seealso: `PetscInitialize()`
202: @*/
203: PetscErrorCode PetscFEFinalizePackage(void)
204: {
205:   PetscFunctionBegin;
206:   PetscCall(PetscFunctionListDestroy(&PetscSpaceList));
207:   PetscCall(PetscFunctionListDestroy(&PetscDualSpaceList));
208:   PetscCall(PetscFunctionListDestroy(&PetscFEList));
209:   PetscFEPackageInitialized       = PETSC_FALSE;
210:   PetscSpaceRegisterAllCalled     = PETSC_FALSE;
211:   PetscDualSpaceRegisterAllCalled = PETSC_FALSE;
212:   PetscFERegisterAllCalled        = PETSC_FALSE;
213:   PetscFunctionReturn(PETSC_SUCCESS);
214: }

216: /*@C
217:   PetscFEInitializePackage - This function initializes everything in the `PetscFE` package. It is called
218:   from `PetscDLLibraryRegister()` when using dynamic libraries, and on the first call to `PetscSpaceCreate()`
219:   when using static libraries.

221:   Level: developer

223: .seealso: `PetscInitialize()`
224: @*/
225: PetscErrorCode PetscFEInitializePackage(void)
226: {
227:   char      logList[256];
228:   PetscBool opt, pkg;

230:   PetscFunctionBegin;
231:   if (PetscFEPackageInitialized) PetscFunctionReturn(PETSC_SUCCESS);
232:   PetscFEPackageInitialized = PETSC_TRUE;

234:   /* Register Classes */
235:   PetscCall(PetscClassIdRegister("Linear Space", &PETSCSPACE_CLASSID));
236:   PetscCall(PetscClassIdRegister("Dual Space", &PETSCDUALSPACE_CLASSID));
237:   PetscCall(PetscClassIdRegister("FE Space", &PETSCFE_CLASSID));
238:   /* Register Constructors */
239:   PetscCall(PetscSpaceRegisterAll());
240:   PetscCall(PetscDualSpaceRegisterAll());
241:   PetscCall(PetscFERegisterAll());
242:   /* Register Events */
243:   PetscCall(PetscLogEventRegister("DualSpaceSetUp", PETSCDUALSPACE_CLASSID, &PETSCDUALSPACE_SetUp));
244:   PetscCall(PetscLogEventRegister("FESetUp", PETSCFE_CLASSID, &PETSCFE_SetUp));
245:   /* Process Info */
246:   {
247:     PetscClassId classids[3];

249:     classids[0] = PETSCFE_CLASSID;
250:     classids[1] = PETSCSPACE_CLASSID;
251:     classids[2] = PETSCDUALSPACE_CLASSID;
252:     PetscCall(PetscInfoProcessClass("fe", 1, classids));
253:     PetscCall(PetscInfoProcessClass("space", 1, &classids[1]));
254:     PetscCall(PetscInfoProcessClass("dualspace", 1, &classids[2]));
255:   }
256:   /* Process summary exclusions */
257:   PetscCall(PetscOptionsGetString(NULL, NULL, "-log_exclude", logList, sizeof(logList), &opt));
258:   if (opt) {
259:     PetscCall(PetscStrInList("fe", logList, ',', &pkg));
260:     if (pkg) PetscCall(PetscLogEventExcludeClass(PETSCFE_CLASSID));
261:   }
262:   /* Register package finalizer */
263:   PetscCall(PetscRegisterFinalize(PetscFEFinalizePackage));
264:   PetscFunctionReturn(PETSC_SUCCESS);
265: }
266: #include <petscfv.h>

268: static PetscBool PetscFVPackageInitialized = PETSC_FALSE;

270: /*@C
271:   PetscFVFinalizePackage - This function finalizes everything in the `PetscFV` package. It is called
272:   from `PetscFinalize()`.

274:   Level: developer

276: .seealso: `PetscInitialize()`
277: @*/
278: PetscErrorCode PetscFVFinalizePackage(void)
279: {
280:   PetscFunctionBegin;
281:   PetscCall(PetscFunctionListDestroy(&PetscLimiterList));
282:   PetscCall(PetscFunctionListDestroy(&PetscFVList));
283:   PetscFVPackageInitialized     = PETSC_FALSE;
284:   PetscFVRegisterAllCalled      = PETSC_FALSE;
285:   PetscLimiterRegisterAllCalled = PETSC_FALSE;
286:   PetscFunctionReturn(PETSC_SUCCESS);
287: }

289: /*@C
290:   PetscFVInitializePackage - This function initializes everything in the `PetscFV` package. It is called
291:   from `PetscDLLibraryRegister()` when using dynamic libraries, and on the first call to `PetscFVCreate()`
292:   when using static libraries.

294:   Level: developer

296: .seealso: `PetscInitialize()`
297: @*/
298: PetscErrorCode PetscFVInitializePackage(void)
299: {
300:   char      logList[256];
301:   PetscBool opt, pkg;

303:   PetscFunctionBegin;
304:   if (PetscFVPackageInitialized) PetscFunctionReturn(PETSC_SUCCESS);
305:   PetscFVPackageInitialized = PETSC_TRUE;

307:   /* Register Classes */
308:   PetscCall(PetscClassIdRegister("FV Space", &PETSCFV_CLASSID));
309:   PetscCall(PetscClassIdRegister("Limiter", &PETSCLIMITER_CLASSID));
310:   /* Register Constructors */
311:   PetscCall(PetscFVRegisterAll());
312:   /* Register Events */
313:   /* Process Info */
314:   {
315:     PetscClassId classids[2];

317:     classids[0] = PETSCFV_CLASSID;
318:     classids[1] = PETSCLIMITER_CLASSID;
319:     PetscCall(PetscInfoProcessClass("fv", 1, classids));
320:     PetscCall(PetscInfoProcessClass("limiter", 1, &classids[1]));
321:   }
322:   /* Process summary exclusions */
323:   PetscCall(PetscOptionsGetString(NULL, NULL, "-log_exclude", logList, sizeof(logList), &opt));
324:   if (opt) {
325:     PetscCall(PetscStrInList("fv", logList, ',', &pkg));
326:     if (pkg) PetscCall(PetscLogEventExcludeClass(PETSCFV_CLASSID));
327:     PetscCall(PetscStrInList("limiter", logList, ',', &pkg));
328:     if (pkg) PetscCall(PetscLogEventExcludeClass(PETSCLIMITER_CLASSID));
329:   }
330:   /* Register package finalizer */
331:   PetscCall(PetscRegisterFinalize(PetscFVFinalizePackage));
332:   PetscFunctionReturn(PETSC_SUCCESS);
333: }
334: #include <petscds.h>

336: static PetscBool PetscDSPackageInitialized = PETSC_FALSE;

338: /*@C
339:   PetscDSFinalizePackage - This function finalizes everything in the `PetscDS` package. It is called
340:   from `PetscFinalize()`.

342:   Level: developer

344: .seealso: `PetscInitialize()`
345: @*/
346: PetscErrorCode PetscDSFinalizePackage(void)
347: {
348:   PetscFunctionBegin;
349:   PetscCall(PetscFunctionListDestroy(&PetscDSList));
350:   PetscDSPackageInitialized = PETSC_FALSE;
351:   PetscDSRegisterAllCalled  = PETSC_FALSE;
352:   PetscFunctionReturn(PETSC_SUCCESS);
353: }

355: /*@C
356:   PetscDSInitializePackage - This function initializes everything in the `PetscDS` package. It is called
357:   from `PetscDLLibraryRegister()` when using dynamic libraries, and on the first call to `PetscDSCreate()`
358:   when using static libraries.

360:   Level: developer

362: .seealso: `PetscInitialize()`
363: @*/
364: PetscErrorCode PetscDSInitializePackage(void)
365: {
366:   char      logList[256];
367:   PetscBool opt, pkg;

369:   PetscFunctionBegin;
370:   if (PetscDSPackageInitialized) PetscFunctionReturn(PETSC_SUCCESS);
371:   PetscDSPackageInitialized = PETSC_TRUE;

373:   /* Register Classes */
374:   PetscCall(PetscClassIdRegister("Discrete System", &PETSCDS_CLASSID));
375:   PetscCall(PetscClassIdRegister("Weak Form", &PETSCWEAKFORM_CLASSID));
376:   /* Register Constructors */
377:   PetscCall(PetscDSRegisterAll());
378:   /* Register Events */
379:   /* Process Info */
380:   {
381:     PetscClassId classids[1];

383:     classids[0] = PETSCDS_CLASSID;
384:     PetscCall(PetscInfoProcessClass("ds", 1, classids));
385:   }
386:   /* Process summary exclusions */
387:   PetscCall(PetscOptionsGetString(NULL, NULL, "-log_exclude", logList, sizeof(logList), &opt));
388:   if (opt) {
389:     PetscCall(PetscStrInList("ds", logList, ',', &pkg));
390:     if (pkg) PetscCall(PetscLogEventExcludeClass(PETSCDS_CLASSID));
391:   }
392:   /* Register package finalizer */
393:   PetscCall(PetscRegisterFinalize(PetscDSFinalizePackage));
394:   PetscFunctionReturn(PETSC_SUCCESS);
395: }

397: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
398: /*
399:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

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

404: */
405: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscdm(void)
406: {
407:   PetscFunctionBegin;
408:   PetscCall(AOInitializePackage());
409:   PetscCall(PetscPartitionerInitializePackage());
410:   PetscCall(DMInitializePackage());
411:   PetscCall(PetscFEInitializePackage());
412:   PetscCall(PetscFVInitializePackage());
413:   PetscCall(DMFieldInitializePackage());
414:   PetscCall(PetscDSInitializePackage());
415:   PetscFunctionReturn(PETSC_SUCCESS);
416: }

418: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */