xref: /petsc/src/dm/interface/dlregisdmdm.c (revision 1b858b308f387faaf0e89c12f7ddbb06ecdc929c)
1e8597998SBarry Smith 
24035e84dSBarry Smith #include <petsc-private/dmdaimpl.h>
334541f0dSBarry Smith #include <petsc-private/dmpleximpl.h>
4e8597998SBarry Smith 
5e8597998SBarry Smith static PetscBool DMPackageInitialized = PETSC_FALSE;
6e8597998SBarry Smith #undef __FUNCT__
7e8597998SBarry Smith #define __FUNCT__ "DMFinalizePackage"
8e8597998SBarry Smith /*@C
9e8597998SBarry Smith   DMFinalizePackage - This function finalizes everything in the DM package. It is called
10e8597998SBarry Smith   from PetscFinalize().
11e8597998SBarry Smith 
12e8597998SBarry Smith   Level: developer
13e8597998SBarry Smith 
14e8597998SBarry Smith .keywords: AO, initialize, package
15e8597998SBarry Smith .seealso: PetscInitialize()
16e8597998SBarry Smith @*/
17e8597998SBarry Smith PetscErrorCode  DMFinalizePackage(void)
18e8597998SBarry Smith {
19e8597998SBarry Smith   PetscErrorCode ierr;
20e8597998SBarry Smith 
21e8597998SBarry Smith   PetscFunctionBegin;
2277623264SMatthew G. Knepley   ierr = PetscFunctionListDestroy(&PetscPartitionerList);CHKERRQ(ierr);
2337e93019SBarry Smith   ierr = PetscFunctionListDestroy(&DMList);CHKERRQ(ierr);
24e8597998SBarry Smith   DMPackageInitialized = PETSC_FALSE;
25e8597998SBarry Smith   DMRegisterAllCalled  = PETSC_FALSE;
2677623264SMatthew G. Knepley   PetscPartitionerRegisterAllCalled = PETSC_FALSE;
27e8597998SBarry Smith   PetscFunctionReturn(0);
28e8597998SBarry Smith }
29e8597998SBarry Smith 
30e8597998SBarry Smith #if defined(PETSC_HAVE_HYPRE)
318cc058d9SJed Brown PETSC_EXTERN PetscErrorCode MatCreate_HYPREStruct(Mat);
32e8597998SBarry Smith #endif
33e8597998SBarry Smith 
34e8597998SBarry Smith #undef __FUNCT__
35e8597998SBarry Smith #define __FUNCT__ "DMInitializePackage"
36e8597998SBarry Smith /*@C
37e8597998SBarry Smith   DMInitializePackage - This function initializes everything in the DM package. It is called
38e8597998SBarry Smith   from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to AOCreate()
39e8597998SBarry Smith   or DMDACreate() when using static libraries.
40e8597998SBarry Smith 
41e8597998SBarry Smith   Level: developer
42e8597998SBarry Smith 
43e8597998SBarry Smith .keywords: AO, initialize, package
44e8597998SBarry Smith .seealso: PetscInitialize()
45e8597998SBarry Smith @*/
46607a6623SBarry Smith PetscErrorCode  DMInitializePackage(void)
47e8597998SBarry Smith {
48e8597998SBarry Smith   char           logList[256];
49e8597998SBarry Smith   char           *className;
50e8597998SBarry Smith   PetscBool      opt;
51e8597998SBarry Smith   PetscErrorCode ierr;
52e8597998SBarry Smith 
53e8597998SBarry Smith   PetscFunctionBegin;
54e8597998SBarry Smith   if (DMPackageInitialized) PetscFunctionReturn(0);
55e8597998SBarry Smith   DMPackageInitialized = PETSC_TRUE;
56e8597998SBarry Smith 
57e8597998SBarry Smith   /* Register Classes */
58e8597998SBarry Smith   ierr = PetscClassIdRegister("Distributed Mesh",&DM_CLASSID);CHKERRQ(ierr);
5977623264SMatthew G. Knepley   ierr = PetscClassIdRegister("GraphPartitioner",&PETSCPARTITIONER_CLASSID);CHKERRQ(ierr);
60e8597998SBarry Smith 
61e8597998SBarry Smith #if defined(PETSC_HAVE_HYPRE)
62bdf89e91SBarry Smith   ierr = MatRegister(MATHYPRESTRUCT, MatCreate_HYPREStruct);CHKERRQ(ierr);
63e8597998SBarry Smith #endif
64e8597998SBarry Smith 
65e8597998SBarry Smith   /* Register Constructors */
66607a6623SBarry Smith   ierr = DMRegisterAll();CHKERRQ(ierr);
67e8597998SBarry Smith   /* Register Events */
68e8597998SBarry Smith   ierr = PetscLogEventRegister("DMConvert",              DM_CLASSID,&DM_Convert);CHKERRQ(ierr);
69e8597998SBarry Smith   ierr = PetscLogEventRegister("DMGlobalToLocal",        DM_CLASSID,&DM_GlobalToLocal);CHKERRQ(ierr);
70e8597998SBarry Smith   ierr = PetscLogEventRegister("DMLocalToGlobal",        DM_CLASSID,&DM_LocalToGlobal);CHKERRQ(ierr);
71e8597998SBarry Smith 
72e8597998SBarry Smith   ierr = PetscLogEventRegister("DMDALocalADFunc",        DM_CLASSID,&DMDA_LocalADFunction);CHKERRQ(ierr);
73e8597998SBarry Smith 
7477623264SMatthew G. Knepley   ierr = PetscLogEventRegister("Mesh Partition",         PETSCPARTITIONER_CLASSID,&PETSCPARTITIONER_Partition);CHKERRQ(ierr);
75*1b858b30SMichael Lange   ierr = PetscLogEventRegister("Mesh Migration",         DM_CLASSID,&DMPLEX_Migrate);CHKERRQ(ierr);
7675a69067SMatthew G. Knepley   ierr = PetscLogEventRegister("DMPlexInterp",           DM_CLASSID,&DMPLEX_Interpolate);CHKERRQ(ierr);
77e8597998SBarry Smith   ierr = PetscLogEventRegister("DMPlexDistribute",       DM_CLASSID,&DMPLEX_Distribute);CHKERRQ(ierr);
7875a69067SMatthew G. Knepley   ierr = PetscLogEventRegister("DMPlexDistCones",        DM_CLASSID,&DMPLEX_DistributeCones);CHKERRQ(ierr);
7975a69067SMatthew G. Knepley   ierr = PetscLogEventRegister("DMPlexDistLabels",       DM_CLASSID,&DMPLEX_DistributeLabels);CHKERRQ(ierr);
801337e6e5SMatthew G. Knepley   ierr = PetscLogEventRegister("DMPlexDistribSF",        DM_CLASSID,&DMPLEX_DistributeSF);CHKERRQ(ierr);
813d822a50SMichael Lange   ierr = PetscLogEventRegister("DMPlexDistribOL",        DM_CLASSID,&DMPLEX_DistributeOverlap);CHKERRQ(ierr);
8275a69067SMatthew G. Knepley   ierr = PetscLogEventRegister("DMPlexDistField",        DM_CLASSID,&DMPLEX_DistributeField);CHKERRQ(ierr);
8375a69067SMatthew G. Knepley   ierr = PetscLogEventRegister("DMPlexDistData",         DM_CLASSID,&DMPLEX_DistributeData);CHKERRQ(ierr);
84e8597998SBarry Smith   ierr = PetscLogEventRegister("DMPlexStratify",         DM_CLASSID,&DMPLEX_Stratify);CHKERRQ(ierr);
8575a69067SMatthew G. Knepley   ierr = PetscLogEventRegister("DMPlexPrealloc",         DM_CLASSID,&DMPLEX_Preallocate);CHKERRQ(ierr);
8675a69067SMatthew G. Knepley   ierr = PetscLogEventRegister("DMPlexResidualFE",       DM_CLASSID,&DMPLEX_ResidualFEM);CHKERRQ(ierr);
8775a69067SMatthew G. Knepley   ierr = PetscLogEventRegister("DMPlexJacobianFE",       DM_CLASSID,&DMPLEX_JacobianFEM);CHKERRQ(ierr);
8875a69067SMatthew G. Knepley   ierr = PetscLogEventRegister("DMPlexInterpFE",         DM_CLASSID,&DMPLEX_InterpolatorFEM);CHKERRQ(ierr);
8975a69067SMatthew G. Knepley   ierr = PetscLogEventRegister("DMPlexInjectorFE",       DM_CLASSID,&DMPLEX_InjectorFEM);CHKERRQ(ierr);
90e8597998SBarry Smith   /* Process info exclusions */
91e8597998SBarry Smith   ierr = PetscOptionsGetString(NULL, "-info_exclude", logList, 256, &opt);CHKERRQ(ierr);
92e8597998SBarry Smith   if (opt) {
93e8597998SBarry Smith     ierr = PetscStrstr(logList, "da", &className);CHKERRQ(ierr);
94e8597998SBarry Smith     if (className) {
95e8597998SBarry Smith       ierr = PetscInfoDeactivateClass(DM_CLASSID);CHKERRQ(ierr);
96e8597998SBarry Smith     }
97e8597998SBarry Smith   }
98e8597998SBarry Smith   /* Process summary exclusions */
99e8597998SBarry Smith   ierr = PetscOptionsGetString(NULL, "-log_summary_exclude", logList, 256, &opt);CHKERRQ(ierr);
100e8597998SBarry Smith   if (opt) {
101e8597998SBarry Smith     ierr = PetscStrstr(logList, "da", &className);CHKERRQ(ierr);
102e8597998SBarry Smith     if (className) {
103e8597998SBarry Smith       ierr = PetscLogEventDeactivateClass(DM_CLASSID);CHKERRQ(ierr);
104e8597998SBarry Smith     }
105e8597998SBarry Smith   }
106e8597998SBarry Smith   ierr = PetscRegisterFinalize(DMFinalizePackage);CHKERRQ(ierr);
107e8597998SBarry Smith   PetscFunctionReturn(0);
108e8597998SBarry Smith }
10906759e06SMatthew G. Knepley #include <petscfe.h>
110e8597998SBarry Smith 
11106759e06SMatthew G. Knepley static PetscBool PetscFEPackageInitialized = PETSC_FALSE;
11206759e06SMatthew G. Knepley #undef __FUNCT__
11306759e06SMatthew G. Knepley #define __FUNCT__ "PetscFEFinalizePackage"
11406759e06SMatthew G. Knepley /*@C
11506759e06SMatthew G. Knepley   PetscFEFinalizePackage - This function finalizes everything in the PetscFE package. It is called
11606759e06SMatthew G. Knepley   from PetscFinalize().
117e8597998SBarry Smith 
11806759e06SMatthew G. Knepley   Level: developer
11906759e06SMatthew G. Knepley 
12006759e06SMatthew G. Knepley .keywords: PetscFE, initialize, package
12106759e06SMatthew G. Knepley .seealso: PetscInitialize()
12206759e06SMatthew G. Knepley @*/
12306759e06SMatthew G. Knepley PetscErrorCode PetscFEFinalizePackage(void)
12406759e06SMatthew G. Knepley {
12506759e06SMatthew G. Knepley   PetscErrorCode ierr;
12606759e06SMatthew G. Knepley 
12706759e06SMatthew G. Knepley   PetscFunctionBegin;
12806759e06SMatthew G. Knepley   ierr = PetscFunctionListDestroy(&PetscSpaceList);CHKERRQ(ierr);
12906759e06SMatthew G. Knepley   ierr = PetscFunctionListDestroy(&PetscDualSpaceList);CHKERRQ(ierr);
1300483ade4SMatthew G. Knepley   ierr = PetscFunctionListDestroy(&PetscFEList);CHKERRQ(ierr);
13106759e06SMatthew G. Knepley   PetscFEPackageInitialized       = PETSC_FALSE;
13206759e06SMatthew G. Knepley   PetscSpaceRegisterAllCalled     = PETSC_FALSE;
13306759e06SMatthew G. Knepley   PetscDualSpaceRegisterAllCalled = PETSC_FALSE;
1340483ade4SMatthew G. Knepley   PetscFERegisterAllCalled        = PETSC_FALSE;
13506759e06SMatthew G. Knepley   PetscFunctionReturn(0);
13606759e06SMatthew G. Knepley }
13706759e06SMatthew G. Knepley 
13806759e06SMatthew G. Knepley #undef __FUNCT__
13906759e06SMatthew G. Knepley #define __FUNCT__ "PetscFEInitializePackage"
14006759e06SMatthew G. Knepley /*@C
14106759e06SMatthew G. Knepley   PetscFEInitializePackage - This function initializes everything in the FE package. It is called
14206759e06SMatthew G. Knepley   from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to PetscSpaceCreate()
14306759e06SMatthew G. Knepley   when using static libraries.
14406759e06SMatthew G. Knepley 
14506759e06SMatthew G. Knepley   Level: developer
14606759e06SMatthew G. Knepley 
14706759e06SMatthew G. Knepley .keywords: PetscFE, initialize, package
14806759e06SMatthew G. Knepley .seealso: PetscInitialize()
14906759e06SMatthew G. Knepley @*/
15006759e06SMatthew G. Knepley PetscErrorCode PetscFEInitializePackage(void)
15106759e06SMatthew G. Knepley {
15206759e06SMatthew G. Knepley   char           logList[256];
15306759e06SMatthew G. Knepley   char          *className;
15406759e06SMatthew G. Knepley   PetscBool      opt;
15506759e06SMatthew G. Knepley   PetscErrorCode ierr;
15606759e06SMatthew G. Knepley 
15706759e06SMatthew G. Knepley   PetscFunctionBegin;
15806759e06SMatthew G. Knepley   if (PetscFEPackageInitialized) PetscFunctionReturn(0);
15906759e06SMatthew G. Knepley   PetscFEPackageInitialized = PETSC_TRUE;
16006759e06SMatthew G. Knepley 
16106759e06SMatthew G. Knepley   /* Register Classes */
16206759e06SMatthew G. Knepley   ierr = PetscClassIdRegister("Linear Space", &PETSCSPACE_CLASSID);CHKERRQ(ierr);
16306759e06SMatthew G. Knepley   ierr = PetscClassIdRegister("Dual Space",   &PETSCDUALSPACE_CLASSID);CHKERRQ(ierr);
16406759e06SMatthew G. Knepley   ierr = PetscClassIdRegister("FE Space",     &PETSCFE_CLASSID);CHKERRQ(ierr);
16506759e06SMatthew G. Knepley 
16606759e06SMatthew G. Knepley   /* Register Constructors */
16706759e06SMatthew G. Knepley   ierr = PetscSpaceRegisterAll();CHKERRQ(ierr);
1680483ade4SMatthew G. Knepley   ierr = PetscDualSpaceRegisterAll();CHKERRQ(ierr);
1690483ade4SMatthew G. Knepley   ierr = PetscFERegisterAll();CHKERRQ(ierr);
17006759e06SMatthew G. Knepley   /* Register Events */
17106759e06SMatthew G. Knepley   /* Process info exclusions */
17206759e06SMatthew G. Knepley   ierr = PetscOptionsGetString(NULL, "-info_exclude", logList, 256, &opt);CHKERRQ(ierr);
17306759e06SMatthew G. Knepley   if (opt) {
17406759e06SMatthew G. Knepley     ierr = PetscStrstr(logList, "fe", &className);CHKERRQ(ierr);
175f62f30faSMatthew G. Knepley     if (className) {ierr = PetscInfoDeactivateClass(PETSCFE_CLASSID);CHKERRQ(ierr);}
17606759e06SMatthew G. Knepley   }
17706759e06SMatthew G. Knepley   /* Process summary exclusions */
17806759e06SMatthew G. Knepley   ierr = PetscOptionsGetString(NULL, "-log_summary_exclude", logList, 256, &opt);CHKERRQ(ierr);
17906759e06SMatthew G. Knepley   if (opt) {
180f62f30faSMatthew G. Knepley     ierr = PetscStrstr(logList, "fe", &className);CHKERRQ(ierr);
181f62f30faSMatthew G. Knepley     if (className) {ierr = PetscLogEventDeactivateClass(PETSCFE_CLASSID);CHKERRQ(ierr);}
18206759e06SMatthew G. Knepley   }
18306759e06SMatthew G. Knepley   ierr = PetscRegisterFinalize(PetscFEFinalizePackage);CHKERRQ(ierr);
18406759e06SMatthew G. Knepley   PetscFunctionReturn(0);
18506759e06SMatthew G. Knepley }
186f62f30faSMatthew G. Knepley #include <petscfv.h>
187f62f30faSMatthew G. Knepley 
188f62f30faSMatthew G. Knepley static PetscBool PetscFVPackageInitialized = PETSC_FALSE;
189f62f30faSMatthew G. Knepley #undef __FUNCT__
190f62f30faSMatthew G. Knepley #define __FUNCT__ "PetscFVFinalizePackage"
191f62f30faSMatthew G. Knepley /*@C
192f62f30faSMatthew G. Knepley   PetscFVFinalizePackage - This function finalizes everything in the PetscFV package. It is called
193f62f30faSMatthew G. Knepley   from PetscFinalize().
194f62f30faSMatthew G. Knepley 
195f62f30faSMatthew G. Knepley   Level: developer
196f62f30faSMatthew G. Knepley 
197f62f30faSMatthew G. Knepley .keywords: PetscFV, initialize, package
198f62f30faSMatthew G. Knepley .seealso: PetscInitialize()
199f62f30faSMatthew G. Knepley @*/
200f62f30faSMatthew G. Knepley PetscErrorCode PetscFVFinalizePackage(void)
201f62f30faSMatthew G. Knepley {
202f62f30faSMatthew G. Knepley   PetscErrorCode ierr;
203f62f30faSMatthew G. Knepley 
204f62f30faSMatthew G. Knepley   PetscFunctionBegin;
205ab2453f0SMatthew G. Knepley   ierr = PetscFunctionListDestroy(&PetscLimiterList);CHKERRQ(ierr);
206f62f30faSMatthew G. Knepley   ierr = PetscFunctionListDestroy(&PetscFVList);CHKERRQ(ierr);
207f62f30faSMatthew G. Knepley   PetscFVPackageInitialized     = PETSC_FALSE;
208f62f30faSMatthew G. Knepley   PetscFVRegisterAllCalled      = PETSC_FALSE;
209ab2453f0SMatthew G. Knepley   PetscLimiterRegisterAllCalled = PETSC_FALSE;
210f62f30faSMatthew G. Knepley   PetscFunctionReturn(0);
211f62f30faSMatthew G. Knepley }
212f62f30faSMatthew G. Knepley 
213f62f30faSMatthew G. Knepley #undef __FUNCT__
214f62f30faSMatthew G. Knepley #define __FUNCT__ "PetscFVInitializePackage"
215f62f30faSMatthew G. Knepley /*@C
216f62f30faSMatthew G. Knepley   PetscFVInitializePackage - This function initializes everything in the FV package. It is called
217f62f30faSMatthew G. Knepley   from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to PetscFVCreate()
218f62f30faSMatthew G. Knepley   when using static libraries.
219f62f30faSMatthew G. Knepley 
220f62f30faSMatthew G. Knepley   Level: developer
221f62f30faSMatthew G. Knepley 
222f62f30faSMatthew G. Knepley .keywords: PetscFV, initialize, package
223f62f30faSMatthew G. Knepley .seealso: PetscInitialize()
224f62f30faSMatthew G. Knepley @*/
225f62f30faSMatthew G. Knepley PetscErrorCode PetscFVInitializePackage(void)
226f62f30faSMatthew G. Knepley {
227f62f30faSMatthew G. Knepley   char           logList[256];
228f62f30faSMatthew G. Knepley   char          *className;
229f62f30faSMatthew G. Knepley   PetscBool      opt;
230f62f30faSMatthew G. Knepley   PetscErrorCode ierr;
231f62f30faSMatthew G. Knepley 
232f62f30faSMatthew G. Knepley   PetscFunctionBegin;
233f62f30faSMatthew G. Knepley   if (PetscFVPackageInitialized) PetscFunctionReturn(0);
234f62f30faSMatthew G. Knepley   PetscFVPackageInitialized = PETSC_TRUE;
235f62f30faSMatthew G. Knepley 
236f62f30faSMatthew G. Knepley   /* Register Classes */
237f62f30faSMatthew G. Knepley   ierr = PetscClassIdRegister("FV Space", &PETSCFV_CLASSID);CHKERRQ(ierr);
238ab2453f0SMatthew G. Knepley   ierr = PetscClassIdRegister("Limiter",  &PETSCLIMITER_CLASSID);CHKERRQ(ierr);
239f62f30faSMatthew G. Knepley 
240f62f30faSMatthew G. Knepley   /* Register Constructors */
241f62f30faSMatthew G. Knepley   ierr = PetscFVRegisterAll();CHKERRQ(ierr);
242f62f30faSMatthew G. Knepley   /* Register Events */
243f62f30faSMatthew G. Knepley   /* Process info exclusions */
244f62f30faSMatthew G. Knepley   ierr = PetscOptionsGetString(NULL, "-info_exclude", logList, 256, &opt);CHKERRQ(ierr);
245f62f30faSMatthew G. Knepley   if (opt) {
246f62f30faSMatthew G. Knepley     ierr = PetscStrstr(logList, "fv", &className);CHKERRQ(ierr);
247f62f30faSMatthew G. Knepley     if (className) {ierr = PetscInfoDeactivateClass(PETSCFV_CLASSID);CHKERRQ(ierr);}
248ab2453f0SMatthew G. Knepley     ierr = PetscStrstr(logList, "limiter", &className);CHKERRQ(ierr);
249ab2453f0SMatthew G. Knepley     if (className) {ierr = PetscInfoDeactivateClass(PETSCLIMITER_CLASSID);CHKERRQ(ierr);}
250f62f30faSMatthew G. Knepley   }
251f62f30faSMatthew G. Knepley   /* Process summary exclusions */
252f62f30faSMatthew G. Knepley   ierr = PetscOptionsGetString(NULL, "-log_summary_exclude", logList, 256, &opt);CHKERRQ(ierr);
253f62f30faSMatthew G. Knepley   if (opt) {
254f62f30faSMatthew G. Knepley     ierr = PetscStrstr(logList, "fv", &className);CHKERRQ(ierr);
255f62f30faSMatthew G. Knepley     if (className) {ierr = PetscLogEventDeactivateClass(PETSCFV_CLASSID);CHKERRQ(ierr);}
256ab2453f0SMatthew G. Knepley     ierr = PetscStrstr(logList, "limiter", &className);CHKERRQ(ierr);
257ab2453f0SMatthew G. Knepley     if (className) {ierr = PetscLogEventDeactivateClass(PETSCLIMITER_CLASSID);CHKERRQ(ierr);}
258f62f30faSMatthew G. Knepley   }
259f62f30faSMatthew G. Knepley   ierr = PetscRegisterFinalize(PetscFVFinalizePackage);CHKERRQ(ierr);
260f62f30faSMatthew G. Knepley   PetscFunctionReturn(0);
261f62f30faSMatthew G. Knepley }
2622764a2aaSMatthew G. Knepley #include <petscds.h>
263022a7a5cSMatthew G. Knepley 
2642764a2aaSMatthew G. Knepley static PetscBool PetscDSPackageInitialized = PETSC_FALSE;
265022a7a5cSMatthew G. Knepley #undef __FUNCT__
2662764a2aaSMatthew G. Knepley #define __FUNCT__ "PetscDSFinalizePackage"
267022a7a5cSMatthew G. Knepley /*@C
2682764a2aaSMatthew G. Knepley   PetscDSFinalizePackage - This function finalizes everything in the PetscDS package. It is called
269022a7a5cSMatthew G. Knepley   from PetscFinalize().
270022a7a5cSMatthew G. Knepley 
271022a7a5cSMatthew G. Knepley   Level: developer
272022a7a5cSMatthew G. Knepley 
2732764a2aaSMatthew G. Knepley .keywords: PetscDS, initialize, package
274022a7a5cSMatthew G. Knepley .seealso: PetscInitialize()
275022a7a5cSMatthew G. Knepley @*/
2762764a2aaSMatthew G. Knepley PetscErrorCode PetscDSFinalizePackage(void)
277022a7a5cSMatthew G. Knepley {
278022a7a5cSMatthew G. Knepley   PetscErrorCode ierr;
279022a7a5cSMatthew G. Knepley 
280022a7a5cSMatthew G. Knepley   PetscFunctionBegin;
2812764a2aaSMatthew G. Knepley   ierr = PetscFunctionListDestroy(&PetscDSList);CHKERRQ(ierr);
2822764a2aaSMatthew G. Knepley   PetscDSPackageInitialized = PETSC_FALSE;
2832764a2aaSMatthew G. Knepley   PetscDSRegisterAllCalled  = PETSC_FALSE;
284022a7a5cSMatthew G. Knepley   PetscFunctionReturn(0);
285022a7a5cSMatthew G. Knepley }
286022a7a5cSMatthew G. Knepley 
287022a7a5cSMatthew G. Knepley #undef __FUNCT__
2882764a2aaSMatthew G. Knepley #define __FUNCT__ "PetscDSInitializePackage"
289022a7a5cSMatthew G. Knepley /*@C
2902764a2aaSMatthew G. Knepley   PetscDSInitializePackage - This function initializes everything in the DS package. It is called
2912764a2aaSMatthew G. Knepley   from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to PetscDSCreate()
292022a7a5cSMatthew G. Knepley   when using static libraries.
293022a7a5cSMatthew G. Knepley 
294022a7a5cSMatthew G. Knepley   Level: developer
295022a7a5cSMatthew G. Knepley 
2962764a2aaSMatthew G. Knepley .keywords: PetscDS, initialize, package
297022a7a5cSMatthew G. Knepley .seealso: PetscInitialize()
298022a7a5cSMatthew G. Knepley @*/
2992764a2aaSMatthew G. Knepley PetscErrorCode PetscDSInitializePackage(void)
300022a7a5cSMatthew G. Knepley {
301022a7a5cSMatthew G. Knepley   char           logList[256];
302022a7a5cSMatthew G. Knepley   char          *className;
303022a7a5cSMatthew G. Knepley   PetscBool      opt;
304022a7a5cSMatthew G. Knepley   PetscErrorCode ierr;
305022a7a5cSMatthew G. Knepley 
306022a7a5cSMatthew G. Knepley   PetscFunctionBegin;
3072764a2aaSMatthew G. Knepley   if (PetscDSPackageInitialized) PetscFunctionReturn(0);
3082764a2aaSMatthew G. Knepley   PetscDSPackageInitialized = PETSC_TRUE;
309022a7a5cSMatthew G. Knepley 
310022a7a5cSMatthew G. Knepley   /* Register Classes */
3112764a2aaSMatthew G. Knepley   ierr = PetscClassIdRegister("Discrete System", &PETSCDS_CLASSID);CHKERRQ(ierr);
312022a7a5cSMatthew G. Knepley 
313022a7a5cSMatthew G. Knepley   /* Register Constructors */
3142764a2aaSMatthew G. Knepley   ierr = PetscDSRegisterAll();CHKERRQ(ierr);
315022a7a5cSMatthew G. Knepley   /* Register Events */
316022a7a5cSMatthew G. Knepley   /* Process info exclusions */
317022a7a5cSMatthew G. Knepley   ierr = PetscOptionsGetString(NULL, "-info_exclude", logList, 256, &opt);CHKERRQ(ierr);
318022a7a5cSMatthew G. Knepley   if (opt) {
3192764a2aaSMatthew G. Knepley     ierr = PetscStrstr(logList, "ds", &className);CHKERRQ(ierr);
3202764a2aaSMatthew G. Knepley     if (className) {ierr = PetscInfoDeactivateClass(PETSCDS_CLASSID);CHKERRQ(ierr);}
321022a7a5cSMatthew G. Knepley   }
322022a7a5cSMatthew G. Knepley   /* Process summary exclusions */
323022a7a5cSMatthew G. Knepley   ierr = PetscOptionsGetString(NULL, "-log_summary_exclude", logList, 256, &opt);CHKERRQ(ierr);
324022a7a5cSMatthew G. Knepley   if (opt) {
3252764a2aaSMatthew G. Knepley     ierr = PetscStrstr(logList, "ds", &className);CHKERRQ(ierr);
3262764a2aaSMatthew G. Knepley     if (className) {ierr = PetscLogEventDeactivateClass(PETSCDS_CLASSID);CHKERRQ(ierr);}
327022a7a5cSMatthew G. Knepley   }
3282764a2aaSMatthew G. Knepley   ierr = PetscRegisterFinalize(PetscDSFinalizePackage);CHKERRQ(ierr);
329022a7a5cSMatthew G. Knepley   PetscFunctionReturn(0);
330022a7a5cSMatthew G. Knepley }
331e8597998SBarry Smith 
332aa2d57e9SJed Brown #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
333e8597998SBarry Smith #undef __FUNCT__
334e8597998SBarry Smith #define __FUNCT__ "PetscDLLibraryRegister_petscdm"
335e8597998SBarry Smith /*
336e8597998SBarry Smith   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.
337e8597998SBarry Smith 
338e8597998SBarry Smith   This one registers all the mesh generators and partitioners that are in
339e8597998SBarry Smith   the basic DM library.
340e8597998SBarry Smith 
341e8597998SBarry Smith */
342607a6623SBarry Smith PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscdm(void)
343e8597998SBarry Smith {
344e8597998SBarry Smith   PetscErrorCode ierr;
345e8597998SBarry Smith 
346e8597998SBarry Smith   PetscFunctionBegin;
347607a6623SBarry Smith   ierr = AOInitializePackage();CHKERRQ(ierr);
348607a6623SBarry Smith   ierr = DMInitializePackage();CHKERRQ(ierr);
34906759e06SMatthew G. Knepley   ierr = PetscFEInitializePackage();CHKERRQ(ierr);
350ab2453f0SMatthew G. Knepley   ierr = PetscFVInitializePackage();CHKERRQ(ierr);
351e8597998SBarry Smith   PetscFunctionReturn(0);
352e8597998SBarry Smith }
353e8597998SBarry Smith 
354aa2d57e9SJed Brown #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */
355