Actual source code: dlregisdmdm.c
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/dmplextransformimpl.h>
7: #include <petsc/private/petscdsimpl.h>
8: #include <petsc/private/petscfeimpl.h>
9: #include <petsc/private/petscfvimpl.h>
10: #include <petsc/private/dmswarmimpl.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: PetscFunctionListDestroy(&DMList);
24: DMPackageInitialized = PETSC_FALSE;
25: DMRegisterAllCalled = PETSC_FALSE;
26: return 0;
27: }
29: #if defined(PETSC_HAVE_HYPRE)
30: PETSC_EXTERN PetscErrorCode MatCreate_HYPREStruct(Mat);
31: PETSC_EXTERN PetscErrorCode MatCreate_HYPRESStruct(Mat);
32: #endif
34: /*@C
35: DMInitializePackage - This function initializes everything in the DM package. It is called
36: from PetscDLLibraryRegister_petscdm() when using dynamic libraries, and on the first call to AOCreate()
37: or DMDACreate() when using shared or static libraries.
39: Level: developer
41: .seealso: PetscInitialize()
42: @*/
43: PetscErrorCode DMInitializePackage(void)
44: {
45: char logList[256];
46: PetscBool opt,pkg;
48: if (DMPackageInitialized) return 0;
49: DMPackageInitialized = PETSC_TRUE;
51: /* Register Classes */
52: PetscClassIdRegister("Distributed Mesh",&DM_CLASSID);
53: PetscClassIdRegister("DM Label",&DMLABEL_CLASSID);
54: PetscClassIdRegister("Quadrature",&PETSCQUADRATURE_CLASSID);
55: PetscClassIdRegister("Mesh Transform",&DMPLEXTRANSFORM_CLASSID);
57: #if defined(PETSC_HAVE_HYPRE)
58: MatRegister(MATHYPRESTRUCT, MatCreate_HYPREStruct);
59: MatRegister(MATHYPRESSTRUCT, MatCreate_HYPRESStruct);
60: #endif
61: PetscSectionSymRegister(PETSCSECTIONSYMLABEL,PetscSectionSymCreate_Label);
63: /* Register Constructors */
64: DMRegisterAll();
65: /* Register Events */
66: PetscLogEventRegister("DMConvert", DM_CLASSID,&DM_Convert);
67: PetscLogEventRegister("DMGlobalToLocal", DM_CLASSID,&DM_GlobalToLocal);
68: PetscLogEventRegister("DMLocalToGlobal", DM_CLASSID,&DM_LocalToGlobal);
69: PetscLogEventRegister("DMLocatePoints", DM_CLASSID,&DM_LocatePoints);
70: PetscLogEventRegister("DMCoarsen", DM_CLASSID,&DM_Coarsen);
71: PetscLogEventRegister("DMRefine", DM_CLASSID,&DM_Refine);
72: PetscLogEventRegister("DMCreateInterp", DM_CLASSID,&DM_CreateInterpolation);
73: PetscLogEventRegister("DMCreateRestrict", DM_CLASSID,&DM_CreateRestriction);
74: PetscLogEventRegister("DMCreateInject", DM_CLASSID,&DM_CreateInjection);
75: PetscLogEventRegister("DMCreateMat", DM_CLASSID,&DM_CreateMatrix);
76: PetscLogEventRegister("DMLoad", DM_CLASSID,&DM_Load);
77: PetscLogEventRegister("DMAdaptInterp", DM_CLASSID,&DM_AdaptInterpolator);
79: PetscLogEventRegister("DMPlexBuFrCeLi", DM_CLASSID,&DMPLEX_BuildFromCellList);
80: PetscLogEventRegister("DMPlexBuCoFrCeLi", DM_CLASSID,&DMPLEX_BuildCoordinatesFromCellList);
81: PetscLogEventRegister("DMPlexCreateGmsh", DM_CLASSID,&DMPLEX_CreateGmsh);
82: PetscLogEventRegister("DMPlexCrFromFile", DM_CLASSID,&DMPLEX_CreateFromFile);
83: PetscLogEventRegister("Mesh Partition", DM_CLASSID,&DMPLEX_Partition);
84: PetscLogEventRegister("Mesh Migration", DM_CLASSID,&DMPLEX_Migrate);
85: PetscLogEventRegister("DMPlexPartSelf", DM_CLASSID,&DMPLEX_PartSelf);
86: PetscLogEventRegister("DMPlexPartLblInv", DM_CLASSID,&DMPLEX_PartLabelInvert);
87: PetscLogEventRegister("DMPlexPartLblSF", DM_CLASSID,&DMPLEX_PartLabelCreateSF);
88: PetscLogEventRegister("DMPlexPartStrtSF", DM_CLASSID,&DMPLEX_PartStratSF);
89: PetscLogEventRegister("DMPlexPointSF", DM_CLASSID,&DMPLEX_CreatePointSF);
90: PetscLogEventRegister("DMPlexInterp", DM_CLASSID,&DMPLEX_Interpolate);
91: PetscLogEventRegister("DMPlexDistribute", DM_CLASSID,&DMPLEX_Distribute);
92: PetscLogEventRegister("DMPlexDistCones", DM_CLASSID,&DMPLEX_DistributeCones);
93: PetscLogEventRegister("DMPlexDistLabels", DM_CLASSID,&DMPLEX_DistributeLabels);
94: PetscLogEventRegister("DMPlexDistSF", DM_CLASSID,&DMPLEX_DistributeSF);
95: PetscLogEventRegister("DMPlexDistOvrlp", DM_CLASSID,&DMPLEX_DistributeOverlap);
96: PetscLogEventRegister("DMPlexDistField", DM_CLASSID,&DMPLEX_DistributeField);
97: PetscLogEventRegister("DMPlexDistData", DM_CLASSID,&DMPLEX_DistributeData);
98: PetscLogEventRegister("DMPlexInterpSF", DM_CLASSID,&DMPLEX_InterpolateSF);
99: PetscLogEventRegister("DMPlexGToNBegin", DM_CLASSID,&DMPLEX_GlobalToNaturalBegin);
100: PetscLogEventRegister("DMPlexGToNEnd", DM_CLASSID,&DMPLEX_GlobalToNaturalEnd);
101: PetscLogEventRegister("DMPlexNToGBegin", DM_CLASSID,&DMPLEX_NaturalToGlobalBegin);
102: PetscLogEventRegister("DMPlexNToGEnd", DM_CLASSID,&DMPLEX_NaturalToGlobalEnd);
103: PetscLogEventRegister("DMPlexStratify", DM_CLASSID,&DMPLEX_Stratify);
104: PetscLogEventRegister("DMPlexSymmetrize", DM_CLASSID,&DMPLEX_Symmetrize);
105: PetscLogEventRegister("DMPlexPrealloc", DM_CLASSID,&DMPLEX_Preallocate);
106: PetscLogEventRegister("DMPlexResidualFE", DM_CLASSID,&DMPLEX_ResidualFEM);
107: PetscLogEventRegister("DMPlexJacobianFE", DM_CLASSID,&DMPLEX_JacobianFEM);
108: PetscLogEventRegister("DMPlexInterpFE", DM_CLASSID,&DMPLEX_InterpolatorFEM);
109: PetscLogEventRegister("DMPlexInjectorFE", DM_CLASSID,&DMPLEX_InjectorFEM);
110: PetscLogEventRegister("DMPlexIntegralFEM", DM_CLASSID,&DMPLEX_IntegralFEM);
111: PetscLogEventRegister("DMPlexRebalance", DM_CLASSID,&DMPLEX_RebalanceSharedPoints);
112: PetscLogEventRegister("DMPlexLocatePoints", DM_CLASSID,&DMPLEX_LocatePoints);
113: PetscLogEventRegister("DMPlexTopologyView", DM_CLASSID,&DMPLEX_TopologyView);
114: PetscLogEventRegister("DMPlexLabelsView", DM_CLASSID,&DMPLEX_LabelsView);
115: PetscLogEventRegister("DMPlexCoordinatesView", DM_CLASSID,&DMPLEX_CoordinatesView);
116: PetscLogEventRegister("DMPlexSectionView", DM_CLASSID,&DMPLEX_SectionView);
117: PetscLogEventRegister("DMPlexGlobalVectorView", DM_CLASSID,&DMPLEX_GlobalVectorView);
118: PetscLogEventRegister("DMPlexLocalVectorView", DM_CLASSID,&DMPLEX_LocalVectorView);
119: PetscLogEventRegister("DMPlexTopologyLoad", DM_CLASSID,&DMPLEX_TopologyLoad);
120: PetscLogEventRegister("DMPlexLabelsLoad", DM_CLASSID,&DMPLEX_LabelsLoad);
121: PetscLogEventRegister("DMPlexCoordinatesLoad", DM_CLASSID,&DMPLEX_CoordinatesLoad);
122: PetscLogEventRegister("DMPlexSectionLoad", DM_CLASSID,&DMPLEX_SectionLoad);
123: PetscLogEventRegister("DMPlexGlobalVectorLoad", DM_CLASSID,&DMPLEX_GlobalVectorLoad);
124: PetscLogEventRegister("DMPlexLocalVectorLoad", DM_CLASSID,&DMPLEX_LocalVectorLoad);
125: PetscLogEventRegister("DMPlexMetricEnforceSPD", DM_CLASSID,&DMPLEX_MetricEnforceSPD);
126: PetscLogEventRegister("DMPlexMetricNormalize", DM_CLASSID,&DMPLEX_MetricNormalize);
127: PetscLogEventRegister("DMPlexMetricAverage", DM_CLASSID,&DMPLEX_MetricAverage);
128: PetscLogEventRegister("DMPlexMetricIntersect", DM_CLASSID,&DMPLEX_MetricIntersection);
130: PetscLogEventRegister("DMSwarmMigrate", DM_CLASSID,&DMSWARM_Migrate);
131: PetscLogEventRegister("DMSwarmDETSetup", DM_CLASSID,&DMSWARM_DataExchangerTopologySetup);
132: PetscLogEventRegister("DMSwarmDExBegin", DM_CLASSID,&DMSWARM_DataExchangerBegin);
133: PetscLogEventRegister("DMSwarmDExEnd", DM_CLASSID,&DMSWARM_DataExchangerEnd);
134: PetscLogEventRegister("DMSwarmDESendCnt", DM_CLASSID,&DMSWARM_DataExchangerSendCount);
135: PetscLogEventRegister("DMSwarmDEPack", DM_CLASSID,&DMSWARM_DataExchangerPack);
136: PetscLogEventRegister("DMSwarmAddPnts", DM_CLASSID,&DMSWARM_AddPoints);
137: PetscLogEventRegister("DMSwarmRmvPnts", DM_CLASSID,&DMSWARM_RemovePoints);
138: PetscLogEventRegister("DMSwarmSort", DM_CLASSID,&DMSWARM_Sort);
139: PetscLogEventRegister("DMSwarmSetSizes", DM_CLASSID,&DMSWARM_SetSizes);
140: /* Process Info */
141: {
142: PetscClassId classids[1];
144: classids[0] = DM_CLASSID;
145: PetscInfoProcessClass("dm", 1, classids);
146: }
148: /* Process summary exclusions */
149: PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
150: if (opt) {
151: PetscStrInList("dm",logList,',',&pkg);
152: if (pkg) PetscLogEventExcludeClass(DM_CLASSID);
153: }
155: DMGenerateRegisterAll();
156: PetscRegisterFinalize(DMGenerateRegisterDestroy);
157: DMPlexTransformRegisterAll();
158: PetscRegisterFinalize(DMPlexTransformRegisterDestroy);
159: PetscRegisterFinalize(DMFinalizePackage);
160: return 0;
161: }
162: #include <petscfe.h>
164: static PetscBool PetscFEPackageInitialized = PETSC_FALSE;
165: /*@C
166: PetscFEFinalizePackage - This function finalizes everything in the PetscFE package. It is called
167: from PetscFinalize().
169: Level: developer
171: .seealso: PetscInitialize()
172: @*/
173: PetscErrorCode PetscFEFinalizePackage(void)
174: {
175: PetscFunctionListDestroy(&PetscSpaceList);
176: PetscFunctionListDestroy(&PetscDualSpaceList);
177: PetscFunctionListDestroy(&PetscFEList);
178: PetscFEPackageInitialized = PETSC_FALSE;
179: PetscSpaceRegisterAllCalled = PETSC_FALSE;
180: PetscDualSpaceRegisterAllCalled = PETSC_FALSE;
181: PetscFERegisterAllCalled = PETSC_FALSE;
182: return 0;
183: }
185: /*@C
186: PetscFEInitializePackage - This function initializes everything in the FE package. It is called
187: from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to PetscSpaceCreate()
188: when using static libraries.
190: Level: developer
192: .seealso: PetscInitialize()
193: @*/
194: PetscErrorCode PetscFEInitializePackage(void)
195: {
196: char logList[256];
197: PetscBool opt,pkg;
199: if (PetscFEPackageInitialized) return 0;
200: PetscFEPackageInitialized = PETSC_TRUE;
202: /* Register Classes */
203: PetscClassIdRegister("Linear Space", &PETSCSPACE_CLASSID);
204: PetscClassIdRegister("Dual Space", &PETSCDUALSPACE_CLASSID);
205: PetscClassIdRegister("FE Space", &PETSCFE_CLASSID);
206: /* Register Constructors */
207: PetscSpaceRegisterAll();
208: PetscDualSpaceRegisterAll();
209: PetscFERegisterAll();
210: /* Register Events */
211: PetscLogEventRegister("DualSpaceSetUp", PETSCDUALSPACE_CLASSID, &PETSCDUALSPACE_SetUp);
212: PetscLogEventRegister("FESetUp", PETSCFE_CLASSID, &PETSCFE_SetUp);
213: /* Process Info */
214: {
215: PetscClassId classids[3];
217: classids[0] = PETSCFE_CLASSID;
218: classids[1] = PETSCSPACE_CLASSID;
219: classids[2] = PETSCDUALSPACE_CLASSID;
220: PetscInfoProcessClass("fe", 1, classids);
221: PetscInfoProcessClass("space", 1, &classids[1]);
222: PetscInfoProcessClass("dualspace", 1, &classids[2]);
223: }
224: /* Process summary exclusions */
225: PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
226: if (opt) {
227: PetscStrInList("fe",logList,',',&pkg);
228: if (pkg) PetscLogEventExcludeClass(PETSCFE_CLASSID);
229: }
230: /* Register package finalizer */
231: PetscRegisterFinalize(PetscFEFinalizePackage);
232: return 0;
233: }
234: #include <petscfv.h>
236: static PetscBool PetscFVPackageInitialized = PETSC_FALSE;
237: /*@C
238: PetscFVFinalizePackage - This function finalizes everything in the PetscFV package. It is called
239: from PetscFinalize().
241: Level: developer
243: .seealso: PetscInitialize()
244: @*/
245: PetscErrorCode PetscFVFinalizePackage(void)
246: {
247: PetscFunctionListDestroy(&PetscLimiterList);
248: PetscFunctionListDestroy(&PetscFVList);
249: PetscFVPackageInitialized = PETSC_FALSE;
250: PetscFVRegisterAllCalled = PETSC_FALSE;
251: PetscLimiterRegisterAllCalled = PETSC_FALSE;
252: return 0;
253: }
255: /*@C
256: PetscFVInitializePackage - This function initializes everything in the FV package. It is called
257: from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to PetscFVCreate()
258: when using static libraries.
260: Level: developer
262: .seealso: PetscInitialize()
263: @*/
264: PetscErrorCode PetscFVInitializePackage(void)
265: {
266: char logList[256];
267: PetscBool opt,pkg;
269: if (PetscFVPackageInitialized) return 0;
270: PetscFVPackageInitialized = PETSC_TRUE;
272: /* Register Classes */
273: PetscClassIdRegister("FV Space", &PETSCFV_CLASSID);
274: PetscClassIdRegister("Limiter", &PETSCLIMITER_CLASSID);
275: /* Register Constructors */
276: PetscFVRegisterAll();
277: /* Register Events */
278: /* Process Info */
279: {
280: PetscClassId classids[2];
282: classids[0] = PETSCFV_CLASSID;
283: classids[1] = PETSCLIMITER_CLASSID;
284: PetscInfoProcessClass("fv", 1, classids);
285: PetscInfoProcessClass("limiter", 1, &classids[1]);
286: }
287: /* Process summary exclusions */
288: PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
289: if (opt) {
290: PetscStrInList("fv",logList,',',&pkg);
291: if (pkg) PetscLogEventExcludeClass(PETSCFV_CLASSID);
292: PetscStrInList("limiter",logList,',',&pkg);
293: if (pkg) PetscLogEventExcludeClass(PETSCLIMITER_CLASSID);
294: }
295: /* Register package finalizer */
296: PetscRegisterFinalize(PetscFVFinalizePackage);
297: return 0;
298: }
299: #include <petscds.h>
301: static PetscBool PetscDSPackageInitialized = PETSC_FALSE;
302: /*@C
303: PetscDSFinalizePackage - This function finalizes everything in the PetscDS package. It is called
304: from PetscFinalize().
306: Level: developer
308: .seealso: PetscInitialize()
309: @*/
310: PetscErrorCode PetscDSFinalizePackage(void)
311: {
312: PetscFunctionListDestroy(&PetscDSList);
313: PetscDSPackageInitialized = PETSC_FALSE;
314: PetscDSRegisterAllCalled = PETSC_FALSE;
315: return 0;
316: }
318: /*@C
319: PetscDSInitializePackage - This function initializes everything in the DS package. It is called
320: from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to PetscDSCreate()
321: when using static libraries.
323: Level: developer
325: .seealso: PetscInitialize()
326: @*/
327: PetscErrorCode PetscDSInitializePackage(void)
328: {
329: char logList[256];
330: PetscBool opt,pkg;
332: if (PetscDSPackageInitialized) return 0;
333: PetscDSPackageInitialized = PETSC_TRUE;
335: /* Register Classes */
336: PetscClassIdRegister("Discrete System", &PETSCDS_CLASSID);
337: PetscClassIdRegister("Weak Form", &PETSCWEAKFORM_CLASSID);
338: /* Register Constructors */
339: PetscDSRegisterAll();
340: /* Register Events */
341: /* Process Info */
342: {
343: PetscClassId classids[1];
345: classids[0] = PETSCDS_CLASSID;
346: PetscInfoProcessClass("ds", 1, classids);
347: }
348: /* Process summary exclusions */
349: PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
350: if (opt) {
351: PetscStrInList("ds",logList,',',&pkg);
352: if (pkg) PetscLogEventExcludeClass(PETSCDS_CLASSID);
353: }
354: /* Register package finalizer */
355: PetscRegisterFinalize(PetscDSFinalizePackage);
356: return 0;
357: }
359: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
360: /*
361: PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.
363: This one registers all the mesh generators and partitioners that are in
364: the basic DM library.
366: */
367: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscdm(void)
368: {
369: AOInitializePackage();
370: PetscPartitionerInitializePackage();
371: DMInitializePackage();
372: PetscFEInitializePackage();
373: PetscFVInitializePackage();
374: DMFieldInitializePackage();
375: return 0;
376: }
378: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */