Actual source code: dlregisdmdm.c
petsc-3.7.3 2016-08-01
2: #include <petsc/private/dmdaimpl.h>
3: #include <petsc/private/dmpleximpl.h>
4: #include <petsc/private/petscdsimpl.h>
5: #include <petsc/private/petscfeimpl.h>
6: #include <petsc/private/petscfvimpl.h>
8: static PetscBool DMPackageInitialized = PETSC_FALSE;
11: /*@C
12: DMFinalizePackage - This function finalizes everything in the DM package. It is called
13: from PetscFinalize().
15: Level: developer
17: .keywords: AO, initialize, package
18: .seealso: PetscInitialize()
19: @*/
20: PetscErrorCode DMFinalizePackage(void)
21: {
25: PetscFunctionListDestroy(&PetscPartitionerList);
26: PetscFunctionListDestroy(&DMList);
27: DMPackageInitialized = PETSC_FALSE;
28: DMRegisterAllCalled = PETSC_FALSE;
29: PetscPartitionerRegisterAllCalled = PETSC_FALSE;
30: return(0);
31: }
33: #if defined(PETSC_HAVE_HYPRE)
34: PETSC_EXTERN PetscErrorCode MatCreate_HYPREStruct(Mat);
35: #endif
39: /*@C
40: DMInitializePackage - This function initializes everything in the DM package. It is called
41: from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to AOCreate()
42: or DMDACreate() when using static libraries.
44: Level: developer
46: .keywords: AO, initialize, package
47: .seealso: PetscInitialize()
48: @*/
49: PetscErrorCode DMInitializePackage(void)
50: {
51: char logList[256];
52: char *className;
53: PetscBool opt;
57: if (DMPackageInitialized) return(0);
58: DMPackageInitialized = PETSC_TRUE;
60: /* Register Classes */
61: PetscClassIdRegister("Distributed Mesh",&DM_CLASSID);
62: PetscClassIdRegister("GraphPartitioner",&PETSCPARTITIONER_CLASSID);
64: #if defined(PETSC_HAVE_HYPRE)
65: MatRegister(MATHYPRESTRUCT, MatCreate_HYPREStruct);
66: #endif
68: /* Register Constructors */
69: DMRegisterAll();
70: /* Register Events */
71: PetscLogEventRegister("DMConvert", DM_CLASSID,&DM_Convert);
72: PetscLogEventRegister("DMGlobalToLocal", DM_CLASSID,&DM_GlobalToLocal);
73: PetscLogEventRegister("DMLocalToGlobal", DM_CLASSID,&DM_LocalToGlobal);
74: PetscLogEventRegister("DMLocatePoints", DM_CLASSID,&DM_LocatePoints);
75: PetscLogEventRegister("DMCoarsen", DM_CLASSID,&DM_Coarsen);
76: PetscLogEventRegister("DMCreateInterp", DM_CLASSID,&DM_CreateInterpolation);
77: PetscLogEventRegister("DMCreateRestrict", DM_CLASSID,&DM_CreateRestriction);
79: PetscLogEventRegister("DMDALocalADFunc", DM_CLASSID,&DMDA_LocalADFunction);
81: PetscLogEventRegister("Mesh Partition", PETSCPARTITIONER_CLASSID,&PETSCPARTITIONER_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("DMPlexDistribSF", DM_CLASSID,&DMPLEX_DistributeSF);
88: PetscLogEventRegister("DMPlexDistribOL", DM_CLASSID,&DMPLEX_DistributeOverlap);
89: PetscLogEventRegister("DMPlexDistField", DM_CLASSID,&DMPLEX_DistributeField);
90: PetscLogEventRegister("DMPlexDistData", DM_CLASSID,&DMPLEX_DistributeData);
91: PetscLogEventRegister("DMPlexGToNBegin", DM_CLASSID,&DMPLEX_GlobalToNaturalBegin);
92: PetscLogEventRegister("DMPlexGToNEnd", DM_CLASSID,&DMPLEX_GlobalToNaturalEnd);
93: PetscLogEventRegister("DMPlexNToGBegin", DM_CLASSID,&DMPLEX_NaturalToGlobalBegin);
94: PetscLogEventRegister("DMPlexNToGEnd", DM_CLASSID,&DMPLEX_NaturalToGlobalEnd);
95: PetscLogEventRegister("DMPlexStratify", DM_CLASSID,&DMPLEX_Stratify);
96: PetscLogEventRegister("DMPlexPrealloc", DM_CLASSID,&DMPLEX_Preallocate);
97: PetscLogEventRegister("DMPlexResidualFE", DM_CLASSID,&DMPLEX_ResidualFEM);
98: PetscLogEventRegister("DMPlexJacobianFE", DM_CLASSID,&DMPLEX_JacobianFEM);
99: PetscLogEventRegister("DMPlexInterpFE", DM_CLASSID,&DMPLEX_InterpolatorFEM);
100: PetscLogEventRegister("DMPlexInjectorFE", DM_CLASSID,&DMPLEX_InjectorFEM);
101: PetscLogEventRegister("DMPlexIntegralFEM", DM_CLASSID,&DMPLEX_IntegralFEM);
102: PetscLogEventRegister("DMPlexCreateGmsh", DM_CLASSID,&DMPLEX_CreateGmsh);
103: /* Process info exclusions */
104: PetscOptionsGetString(NULL,NULL, "-info_exclude", logList, 256, &opt);
105: if (opt) {
106: PetscStrstr(logList, "da", &className);
107: if (className) {
108: PetscInfoDeactivateClass(DM_CLASSID);
109: }
110: }
111: /* Process summary exclusions */
112: PetscOptionsGetString(NULL,NULL, "-log_exclude", logList, 256, &opt);
113: if (opt) {
114: PetscStrstr(logList, "da", &className);
115: if (className) {
116: PetscLogEventDeactivateClass(DM_CLASSID);
117: }
118: }
119: PetscRegisterFinalize(DMFinalizePackage);
120: return(0);
121: }
122: #include <petscfe.h>
124: static PetscBool PetscFEPackageInitialized = PETSC_FALSE;
127: /*@C
128: PetscFEFinalizePackage - This function finalizes everything in the PetscFE package. It is called
129: from PetscFinalize().
131: Level: developer
133: .keywords: PetscFE, initialize, package
134: .seealso: PetscInitialize()
135: @*/
136: PetscErrorCode PetscFEFinalizePackage(void)
137: {
141: PetscFunctionListDestroy(&PetscSpaceList);
142: PetscFunctionListDestroy(&PetscDualSpaceList);
143: PetscFunctionListDestroy(&PetscFEList);
144: PetscFEPackageInitialized = PETSC_FALSE;
145: PetscSpaceRegisterAllCalled = PETSC_FALSE;
146: PetscDualSpaceRegisterAllCalled = PETSC_FALSE;
147: PetscFERegisterAllCalled = PETSC_FALSE;
148: return(0);
149: }
153: /*@C
154: PetscFEInitializePackage - This function initializes everything in the FE package. It is called
155: from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to PetscSpaceCreate()
156: when using static libraries.
158: Level: developer
160: .keywords: PetscFE, initialize, package
161: .seealso: PetscInitialize()
162: @*/
163: PetscErrorCode PetscFEInitializePackage(void)
164: {
165: char logList[256];
166: char *className;
167: PetscBool opt;
171: if (PetscFEPackageInitialized) return(0);
172: PetscFEPackageInitialized = PETSC_TRUE;
174: /* Register Classes */
175: PetscClassIdRegister("Linear Space", &PETSCSPACE_CLASSID);
176: PetscClassIdRegister("Dual Space", &PETSCDUALSPACE_CLASSID);
177: PetscClassIdRegister("FE Space", &PETSCFE_CLASSID);
179: /* Register Constructors */
180: PetscSpaceRegisterAll();
181: PetscDualSpaceRegisterAll();
182: PetscFERegisterAll();
183: /* Register Events */
184: /* Process info exclusions */
185: PetscOptionsGetString(NULL,NULL, "-info_exclude", logList, 256, &opt);
186: if (opt) {
187: PetscStrstr(logList, "fe", &className);
188: if (className) {PetscInfoDeactivateClass(PETSCFE_CLASSID);}
189: }
190: /* Process summary exclusions */
191: PetscOptionsGetString(NULL,NULL, "-log_exclude", logList, 256, &opt);
192: if (opt) {
193: PetscStrstr(logList, "fe", &className);
194: if (className) {PetscLogEventDeactivateClass(PETSCFE_CLASSID);}
195: }
196: PetscRegisterFinalize(PetscFEFinalizePackage);
197: return(0);
198: }
199: #include <petscfv.h>
201: static PetscBool PetscFVPackageInitialized = PETSC_FALSE;
204: /*@C
205: PetscFVFinalizePackage - This function finalizes everything in the PetscFV package. It is called
206: from PetscFinalize().
208: Level: developer
210: .keywords: PetscFV, initialize, package
211: .seealso: PetscInitialize()
212: @*/
213: PetscErrorCode PetscFVFinalizePackage(void)
214: {
218: PetscFunctionListDestroy(&PetscLimiterList);
219: PetscFunctionListDestroy(&PetscFVList);
220: PetscFVPackageInitialized = PETSC_FALSE;
221: PetscFVRegisterAllCalled = PETSC_FALSE;
222: PetscLimiterRegisterAllCalled = PETSC_FALSE;
223: return(0);
224: }
228: /*@C
229: PetscFVInitializePackage - This function initializes everything in the FV package. It is called
230: from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to PetscFVCreate()
231: when using static libraries.
233: Level: developer
235: .keywords: PetscFV, initialize, package
236: .seealso: PetscInitialize()
237: @*/
238: PetscErrorCode PetscFVInitializePackage(void)
239: {
240: char logList[256];
241: char *className;
242: PetscBool opt;
246: if (PetscFVPackageInitialized) return(0);
247: PetscFVPackageInitialized = PETSC_TRUE;
249: /* Register Classes */
250: PetscClassIdRegister("FV Space", &PETSCFV_CLASSID);
251: PetscClassIdRegister("Limiter", &PETSCLIMITER_CLASSID);
253: /* Register Constructors */
254: PetscFVRegisterAll();
255: /* Register Events */
256: /* Process info exclusions */
257: PetscOptionsGetString(NULL,NULL, "-info_exclude", logList, 256, &opt);
258: if (opt) {
259: PetscStrstr(logList, "fv", &className);
260: if (className) {PetscInfoDeactivateClass(PETSCFV_CLASSID);}
261: PetscStrstr(logList, "limiter", &className);
262: if (className) {PetscInfoDeactivateClass(PETSCLIMITER_CLASSID);}
263: }
264: /* Process summary exclusions */
265: PetscOptionsGetString(NULL,NULL, "-log_exclude", logList, 256, &opt);
266: if (opt) {
267: PetscStrstr(logList, "fv", &className);
268: if (className) {PetscLogEventDeactivateClass(PETSCFV_CLASSID);}
269: PetscStrstr(logList, "limiter", &className);
270: if (className) {PetscLogEventDeactivateClass(PETSCLIMITER_CLASSID);}
271: }
272: PetscRegisterFinalize(PetscFVFinalizePackage);
273: return(0);
274: }
275: #include <petscds.h>
277: static PetscBool PetscDSPackageInitialized = PETSC_FALSE;
280: /*@C
281: PetscDSFinalizePackage - This function finalizes everything in the PetscDS package. It is called
282: from PetscFinalize().
284: Level: developer
286: .keywords: PetscDS, initialize, package
287: .seealso: PetscInitialize()
288: @*/
289: PetscErrorCode PetscDSFinalizePackage(void)
290: {
294: PetscFunctionListDestroy(&PetscDSList);
295: PetscDSPackageInitialized = PETSC_FALSE;
296: PetscDSRegisterAllCalled = PETSC_FALSE;
297: return(0);
298: }
302: /*@C
303: PetscDSInitializePackage - This function initializes everything in the DS package. It is called
304: from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to PetscDSCreate()
305: when using static libraries.
307: Level: developer
309: .keywords: PetscDS, initialize, package
310: .seealso: PetscInitialize()
311: @*/
312: PetscErrorCode PetscDSInitializePackage(void)
313: {
314: char logList[256];
315: char *className;
316: PetscBool opt;
320: if (PetscDSPackageInitialized) return(0);
321: PetscDSPackageInitialized = PETSC_TRUE;
323: /* Register Classes */
324: PetscClassIdRegister("Discrete System", &PETSCDS_CLASSID);
326: /* Register Constructors */
327: PetscDSRegisterAll();
328: /* Register Events */
329: /* Process info exclusions */
330: PetscOptionsGetString(NULL,NULL, "-info_exclude", logList, 256, &opt);
331: if (opt) {
332: PetscStrstr(logList, "ds", &className);
333: if (className) {PetscInfoDeactivateClass(PETSCDS_CLASSID);}
334: }
335: /* Process summary exclusions */
336: PetscOptionsGetString(NULL,NULL, "-log_exclude", logList, 256, &opt);
337: if (opt) {
338: PetscStrstr(logList, "ds", &className);
339: if (className) {PetscLogEventDeactivateClass(PETSCDS_CLASSID);}
340: }
341: PetscRegisterFinalize(PetscDSFinalizePackage);
342: return(0);
343: }
345: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
348: /*
349: PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.
351: This one registers all the mesh generators and partitioners that are in
352: the basic DM library.
354: */
355: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscdm(void)
356: {
360: AOInitializePackage();
361: DMInitializePackage();
362: PetscFEInitializePackage();
363: PetscFVInitializePackage();
364: return(0);
365: }
367: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */