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("DMPlexLabelsView", DM_CLASSID, &DMPLEX_LabelsView));
120:   PetscCall(PetscLogEventRegister("DMPlexCoordinatesView", DM_CLASSID, &DMPLEX_CoordinatesView));
121:   PetscCall(PetscLogEventRegister("DMPlexSectionView", DM_CLASSID, &DMPLEX_SectionView));
122:   PetscCall(PetscLogEventRegister("DMPlexGlobalVectorView", DM_CLASSID, &DMPLEX_GlobalVectorView));
123:   PetscCall(PetscLogEventRegister("DMPlexLocalVectorView", DM_CLASSID, &DMPLEX_LocalVectorView));
124:   PetscCall(PetscLogEventRegister("DMPlexTopologyLoad", DM_CLASSID, &DMPLEX_TopologyLoad));
125: #if defined(PETSC_HAVE_HDF5)
126:   PetscCall(PetscLogEventRegister("DMPlexDistributionView", DM_CLASSID, &DMPLEX_DistributionView));
127:   PetscCall(PetscLogEventRegister("DMPlexDistributionLoad", DM_CLASSID, &DMPLEX_DistributionLoad));
128: #endif
129:   PetscCall(PetscLogEventRegister("DMPlexLabelsLoad", DM_CLASSID, &DMPLEX_LabelsLoad));
130:   PetscCall(PetscLogEventRegister("DMPlexCoordinatesLoad", DM_CLASSID, &DMPLEX_CoordinatesLoad));
131:   PetscCall(PetscLogEventRegister("DMPlexSectionLoad", DM_CLASSID, &DMPLEX_SectionLoad));
132:   PetscCall(PetscLogEventRegister("DMPlexGlobalVectorLoad", DM_CLASSID, &DMPLEX_GlobalVectorLoad));
133:   PetscCall(PetscLogEventRegister("DMPlexLocalVectorLoad", DM_CLASSID, &DMPLEX_LocalVectorLoad));
134:   PetscCall(PetscLogEventRegister("DMPlexMetricEnforceSPD", DM_CLASSID, &DMPLEX_MetricEnforceSPD));
135:   PetscCall(PetscLogEventRegister("DMPlexMetricNormalize", DM_CLASSID, &DMPLEX_MetricNormalize));
136:   PetscCall(PetscLogEventRegister("DMPlexMetricAverage", DM_CLASSID, &DMPLEX_MetricAverage));
137:   PetscCall(PetscLogEventRegister("DMPlexMetricIntersect", DM_CLASSID, &DMPLEX_MetricIntersection));
138:   PetscCall(PetscLogEventRegister("DMPlexGenerate", DM_CLASSID, &DMPLEX_Generate));
139:   PetscCall(PetscLogEventRegister("DMPlexTransform", DM_CLASSID, &DMPLEX_Transform));
140:   PetscCall(PetscLogEventRegister("DMPlexGetLocOff", DM_CLASSID, &DMPLEX_GetLocalOffsets));

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

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

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

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

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

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

191: static PetscBool PetscFEPackageInitialized = PETSC_FALSE;

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

197:   Level: developer

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

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

219:   Level: developer

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

228:   PetscFunctionBegin;
229:   if (PetscFEPackageInitialized) PetscFunctionReturn(PETSC_SUCCESS);
230:   PetscFEPackageInitialized = PETSC_TRUE;

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

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

266: static PetscBool PetscFVPackageInitialized = PETSC_FALSE;

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

272:   Level: developer

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

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

292:   Level: developer

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

301:   PetscFunctionBegin;
302:   if (PetscFVPackageInitialized) PetscFunctionReturn(PETSC_SUCCESS);
303:   PetscFVPackageInitialized = PETSC_TRUE;

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

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

334: static PetscBool PetscDSPackageInitialized = PETSC_FALSE;

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

340:   Level: developer

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

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

358:   Level: developer

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

367:   PetscFunctionBegin;
368:   if (PetscDSPackageInitialized) PetscFunctionReturn(PETSC_SUCCESS);
369:   PetscDSPackageInitialized = PETSC_TRUE;

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

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

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

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

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

416: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */