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("DMAdaptInterp", DM_CLASSID, &DM_AdaptInterpolator));
 81:   PetscCall(PetscLogEventRegister("DMProjectFunc", DM_CLASSID, &DM_ProjectFunction));

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

140:   PetscCall(PetscLogEventRegister("RebalBuildGraph", DM_CLASSID, &DMPLEX_RebalBuildGraph));
141:   PetscCall(PetscLogEventRegister("RebalGatherGraph", DM_CLASSID, &DMPLEX_RebalGatherGraph));
142:   PetscCall(PetscLogEventRegister("RebalPartition", DM_CLASSID, &DMPLEX_RebalPartition));
143:   PetscCall(PetscLogEventRegister("RebalScatterPart", DM_CLASSID, &DMPLEX_RebalScatterPart));
144:   PetscCall(PetscLogEventRegister("RebalRewriteSF", DM_CLASSID, &DMPLEX_RebalRewriteSF));
145:   PetscCall(PetscLogEventRegister("DMPlexUninterp", DM_CLASSID, &DMPLEX_Uninterpolate));

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

158:   PetscCall(PetscLogEventRegister("DMNtLayoutSetUp", DM_CLASSID, &DMNetwork_LayoutSetUp));
159:   PetscCall(PetscLogEventRegister("DMNtSetUp", DM_CLASSID, &DMNetwork_SetUpNetwork));
160:   PetscCall(PetscLogEventRegister("DMNtDistribute", DM_CLASSID, &DMNetwork_Distribute));
161:   /* Process Info */
162:   {
163:     PetscClassId classids[1];

165:     classids[0] = DM_CLASSID;
166:     PetscCall(PetscInfoProcessClass("dm", 1, classids));
167:   }

169:   /* Process summary exclusions */
170:   PetscCall(PetscOptionsGetString(NULL, NULL, "-log_exclude", logList, sizeof(logList), &opt));
171:   if (opt) {
172:     PetscCall(PetscStrInList("dm", logList, ',', &pkg));
173:     if (pkg) PetscCall(PetscLogEventExcludeClass(DM_CLASSID));
174:   }

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

189: static PetscBool PetscFEPackageInitialized = PETSC_FALSE;

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

195:   Level: developer

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

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

217:   Level: developer

219: .seealso: `PetscInitialize()`
220: @*/
221: PetscErrorCode PetscFEInitializePackage(void)
222: {
223:   char      logList[256];
224:   PetscBool opt, pkg;

226:   PetscFunctionBegin;
227:   if (PetscFEPackageInitialized) PetscFunctionReturn(PETSC_SUCCESS);
228:   PetscFEPackageInitialized = PETSC_TRUE;

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

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

264: static PetscBool PetscFVPackageInitialized = PETSC_FALSE;

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

270:   Level: developer

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

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

290:   Level: developer

292: .seealso: `PetscInitialize()`
293: @*/
294: PetscErrorCode PetscFVInitializePackage(void)
295: {
296:   char      logList[256];
297:   PetscBool opt, pkg;

299:   PetscFunctionBegin;
300:   if (PetscFVPackageInitialized) PetscFunctionReturn(PETSC_SUCCESS);
301:   PetscFVPackageInitialized = PETSC_TRUE;

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

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

332: static PetscBool PetscDSPackageInitialized = PETSC_FALSE;

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

338:   Level: developer

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

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

356:   Level: developer

358: .seealso: `PetscInitialize()`
359: @*/
360: PetscErrorCode PetscDSInitializePackage(void)
361: {
362:   char      logList[256];
363:   PetscBool opt, pkg;

365:   PetscFunctionBegin;
366:   if (PetscDSPackageInitialized) PetscFunctionReturn(PETSC_SUCCESS);
367:   PetscDSPackageInitialized = PETSC_TRUE;

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

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

393: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
394: /*
395:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

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

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

414: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */