1e8597998SBarry Smith 2af0996ceSBarry Smith #include <petsc/private/dmdaimpl.h> 3af0996ceSBarry Smith #include <petsc/private/dmpleximpl.h> 4af0996ceSBarry Smith #include <petsc/private/petscdsimpl.h> 5af0996ceSBarry Smith #include <petsc/private/petscfeimpl.h> 6af0996ceSBarry Smith #include <petsc/private/petscfvimpl.h> 7e8597998SBarry Smith 8e8597998SBarry Smith static PetscBool DMPackageInitialized = PETSC_FALSE; 9e8597998SBarry Smith #undef __FUNCT__ 10e8597998SBarry Smith #define __FUNCT__ "DMFinalizePackage" 11e8597998SBarry Smith /*@C 12e8597998SBarry Smith DMFinalizePackage - This function finalizes everything in the DM package. It is called 13e8597998SBarry Smith from PetscFinalize(). 14e8597998SBarry Smith 15e8597998SBarry Smith Level: developer 16e8597998SBarry Smith 17e8597998SBarry Smith .keywords: AO, initialize, package 18e8597998SBarry Smith .seealso: PetscInitialize() 19e8597998SBarry Smith @*/ 20e8597998SBarry Smith PetscErrorCode DMFinalizePackage(void) 21e8597998SBarry Smith { 22e8597998SBarry Smith PetscErrorCode ierr; 23e8597998SBarry Smith 24e8597998SBarry Smith PetscFunctionBegin; 2577623264SMatthew G. Knepley ierr = PetscFunctionListDestroy(&PetscPartitionerList);CHKERRQ(ierr); 2637e93019SBarry Smith ierr = PetscFunctionListDestroy(&DMList);CHKERRQ(ierr); 27e8597998SBarry Smith DMPackageInitialized = PETSC_FALSE; 28e8597998SBarry Smith DMRegisterAllCalled = PETSC_FALSE; 2977623264SMatthew G. Knepley PetscPartitionerRegisterAllCalled = PETSC_FALSE; 30e8597998SBarry Smith PetscFunctionReturn(0); 31e8597998SBarry Smith } 32e8597998SBarry Smith 33e8597998SBarry Smith #if defined(PETSC_HAVE_HYPRE) 348cc058d9SJed Brown PETSC_EXTERN PetscErrorCode MatCreate_HYPREStruct(Mat); 35e8597998SBarry Smith #endif 36e8597998SBarry Smith 37e8597998SBarry Smith #undef __FUNCT__ 38e8597998SBarry Smith #define __FUNCT__ "DMInitializePackage" 39e8597998SBarry Smith /*@C 40e8597998SBarry Smith DMInitializePackage - This function initializes everything in the DM package. It is called 41e8597998SBarry Smith from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to AOCreate() 42e8597998SBarry Smith or DMDACreate() when using static libraries. 43e8597998SBarry Smith 44e8597998SBarry Smith Level: developer 45e8597998SBarry Smith 46e8597998SBarry Smith .keywords: AO, initialize, package 47e8597998SBarry Smith .seealso: PetscInitialize() 48e8597998SBarry Smith @*/ 49607a6623SBarry Smith PetscErrorCode DMInitializePackage(void) 50e8597998SBarry Smith { 51e8597998SBarry Smith char logList[256]; 52e8597998SBarry Smith char *className; 53e8597998SBarry Smith PetscBool opt; 54e8597998SBarry Smith PetscErrorCode ierr; 55e8597998SBarry Smith 56e8597998SBarry Smith PetscFunctionBegin; 57e8597998SBarry Smith if (DMPackageInitialized) PetscFunctionReturn(0); 58e8597998SBarry Smith DMPackageInitialized = PETSC_TRUE; 59e8597998SBarry Smith 60e8597998SBarry Smith /* Register Classes */ 61e8597998SBarry Smith ierr = PetscClassIdRegister("Distributed Mesh",&DM_CLASSID);CHKERRQ(ierr); 6277623264SMatthew G. Knepley ierr = PetscClassIdRegister("GraphPartitioner",&PETSCPARTITIONER_CLASSID);CHKERRQ(ierr); 63e8597998SBarry Smith 64e8597998SBarry Smith #if defined(PETSC_HAVE_HYPRE) 65bdf89e91SBarry Smith ierr = MatRegister(MATHYPRESTRUCT, MatCreate_HYPREStruct);CHKERRQ(ierr); 66e8597998SBarry Smith #endif 67e8597998SBarry Smith 68e8597998SBarry Smith /* Register Constructors */ 69607a6623SBarry Smith ierr = DMRegisterAll();CHKERRQ(ierr); 70e8597998SBarry Smith /* Register Events */ 71e8597998SBarry Smith ierr = PetscLogEventRegister("DMConvert", DM_CLASSID,&DM_Convert);CHKERRQ(ierr); 72e8597998SBarry Smith ierr = PetscLogEventRegister("DMGlobalToLocal", DM_CLASSID,&DM_GlobalToLocal);CHKERRQ(ierr); 73e8597998SBarry Smith ierr = PetscLogEventRegister("DMLocalToGlobal", DM_CLASSID,&DM_LocalToGlobal);CHKERRQ(ierr); 7447a35634SPatrick Farrell ierr = PetscLogEventRegister("DMLocatePoints", DM_CLASSID,&DM_LocatePoints);CHKERRQ(ierr); 7547a35634SPatrick Farrell ierr = PetscLogEventRegister("DMCoarsen", DM_CLASSID,&DM_Coarsen);CHKERRQ(ierr); 76cea54e9dSPatrick Farrell ierr = PetscLogEventRegister("DMCreateInterpolation", DM_CLASSID,&DM_CreateInterpolation);CHKERRQ(ierr); 77e8597998SBarry Smith 78e8597998SBarry Smith ierr = PetscLogEventRegister("DMDALocalADFunc", DM_CLASSID,&DMDA_LocalADFunction);CHKERRQ(ierr); 79e8597998SBarry Smith 8077623264SMatthew G. Knepley ierr = PetscLogEventRegister("Mesh Partition", PETSCPARTITIONER_CLASSID,&PETSCPARTITIONER_Partition);CHKERRQ(ierr); 811b858b30SMichael Lange ierr = PetscLogEventRegister("Mesh Migration", DM_CLASSID,&DMPLEX_Migrate);CHKERRQ(ierr); 8275a69067SMatthew G. Knepley ierr = PetscLogEventRegister("DMPlexInterp", DM_CLASSID,&DMPLEX_Interpolate);CHKERRQ(ierr); 83e8597998SBarry Smith ierr = PetscLogEventRegister("DMPlexDistribute", DM_CLASSID,&DMPLEX_Distribute);CHKERRQ(ierr); 8475a69067SMatthew G. Knepley ierr = PetscLogEventRegister("DMPlexDistCones", DM_CLASSID,&DMPLEX_DistributeCones);CHKERRQ(ierr); 8575a69067SMatthew G. Knepley ierr = PetscLogEventRegister("DMPlexDistLabels", DM_CLASSID,&DMPLEX_DistributeLabels);CHKERRQ(ierr); 861337e6e5SMatthew G. Knepley ierr = PetscLogEventRegister("DMPlexDistribSF", DM_CLASSID,&DMPLEX_DistributeSF);CHKERRQ(ierr); 873d822a50SMichael Lange ierr = PetscLogEventRegister("DMPlexDistribOL", DM_CLASSID,&DMPLEX_DistributeOverlap);CHKERRQ(ierr); 8875a69067SMatthew G. Knepley ierr = PetscLogEventRegister("DMPlexDistField", DM_CLASSID,&DMPLEX_DistributeField);CHKERRQ(ierr); 8975a69067SMatthew G. Knepley ierr = PetscLogEventRegister("DMPlexDistData", DM_CLASSID,&DMPLEX_DistributeData);CHKERRQ(ierr); 90fa534816SMatthew G. Knepley ierr = PetscLogEventRegister("DMPlexGToNBegin", DM_CLASSID,&DMPLEX_GlobalToNaturalBegin);CHKERRQ(ierr); 91fa534816SMatthew G. Knepley ierr = PetscLogEventRegister("DMPlexGToNEnd", DM_CLASSID,&DMPLEX_GlobalToNaturalEnd);CHKERRQ(ierr); 92fa534816SMatthew G. Knepley ierr = PetscLogEventRegister("DMPlexNToGBegin", DM_CLASSID,&DMPLEX_NaturalToGlobalBegin);CHKERRQ(ierr); 93fa534816SMatthew G. Knepley ierr = PetscLogEventRegister("DMPlexNToGEnd", DM_CLASSID,&DMPLEX_NaturalToGlobalEnd);CHKERRQ(ierr); 94e8597998SBarry Smith ierr = PetscLogEventRegister("DMPlexStratify", DM_CLASSID,&DMPLEX_Stratify);CHKERRQ(ierr); 9575a69067SMatthew G. Knepley ierr = PetscLogEventRegister("DMPlexPrealloc", DM_CLASSID,&DMPLEX_Preallocate);CHKERRQ(ierr); 9675a69067SMatthew G. Knepley ierr = PetscLogEventRegister("DMPlexResidualFE", DM_CLASSID,&DMPLEX_ResidualFEM);CHKERRQ(ierr); 9775a69067SMatthew G. Knepley ierr = PetscLogEventRegister("DMPlexJacobianFE", DM_CLASSID,&DMPLEX_JacobianFEM);CHKERRQ(ierr); 9875a69067SMatthew G. Knepley ierr = PetscLogEventRegister("DMPlexInterpFE", DM_CLASSID,&DMPLEX_InterpolatorFEM);CHKERRQ(ierr); 9975a69067SMatthew G. Knepley ierr = PetscLogEventRegister("DMPlexInjectorFE", DM_CLASSID,&DMPLEX_InjectorFEM);CHKERRQ(ierr); 100c1f031eeSMatthew G. Knepley ierr = PetscLogEventRegister("DMPlexIntegralFEM", DM_CLASSID,&DMPLEX_IntegralFEM);CHKERRQ(ierr); 1013b3bc66dSMichael Lange ierr = PetscLogEventRegister("DMPlexCreateGmsh", DM_CLASSID,&DMPLEX_CreateGmsh);CHKERRQ(ierr); 102e8597998SBarry Smith /* Process info exclusions */ 103*c5929fdfSBarry Smith ierr = PetscOptionsGetString(NULL,NULL, "-info_exclude", logList, 256, &opt);CHKERRQ(ierr); 104e8597998SBarry Smith if (opt) { 105e8597998SBarry Smith ierr = PetscStrstr(logList, "da", &className);CHKERRQ(ierr); 106e8597998SBarry Smith if (className) { 107e8597998SBarry Smith ierr = PetscInfoDeactivateClass(DM_CLASSID);CHKERRQ(ierr); 108e8597998SBarry Smith } 109e8597998SBarry Smith } 110e8597998SBarry Smith /* Process summary exclusions */ 111*c5929fdfSBarry Smith ierr = PetscOptionsGetString(NULL,NULL, "-log_summary_exclude", logList, 256, &opt);CHKERRQ(ierr); 112e8597998SBarry Smith if (opt) { 113e8597998SBarry Smith ierr = PetscStrstr(logList, "da", &className);CHKERRQ(ierr); 114e8597998SBarry Smith if (className) { 115e8597998SBarry Smith ierr = PetscLogEventDeactivateClass(DM_CLASSID);CHKERRQ(ierr); 116e8597998SBarry Smith } 117e8597998SBarry Smith } 118e8597998SBarry Smith ierr = PetscRegisterFinalize(DMFinalizePackage);CHKERRQ(ierr); 119e8597998SBarry Smith PetscFunctionReturn(0); 120e8597998SBarry Smith } 12106759e06SMatthew G. Knepley #include <petscfe.h> 122e8597998SBarry Smith 12306759e06SMatthew G. Knepley static PetscBool PetscFEPackageInitialized = PETSC_FALSE; 12406759e06SMatthew G. Knepley #undef __FUNCT__ 12506759e06SMatthew G. Knepley #define __FUNCT__ "PetscFEFinalizePackage" 12606759e06SMatthew G. Knepley /*@C 12706759e06SMatthew G. Knepley PetscFEFinalizePackage - This function finalizes everything in the PetscFE package. It is called 12806759e06SMatthew G. Knepley from PetscFinalize(). 129e8597998SBarry Smith 13006759e06SMatthew G. Knepley Level: developer 13106759e06SMatthew G. Knepley 13206759e06SMatthew G. Knepley .keywords: PetscFE, initialize, package 13306759e06SMatthew G. Knepley .seealso: PetscInitialize() 13406759e06SMatthew G. Knepley @*/ 13506759e06SMatthew G. Knepley PetscErrorCode PetscFEFinalizePackage(void) 13606759e06SMatthew G. Knepley { 13706759e06SMatthew G. Knepley PetscErrorCode ierr; 13806759e06SMatthew G. Knepley 13906759e06SMatthew G. Knepley PetscFunctionBegin; 14006759e06SMatthew G. Knepley ierr = PetscFunctionListDestroy(&PetscSpaceList);CHKERRQ(ierr); 14106759e06SMatthew G. Knepley ierr = PetscFunctionListDestroy(&PetscDualSpaceList);CHKERRQ(ierr); 1420483ade4SMatthew G. Knepley ierr = PetscFunctionListDestroy(&PetscFEList);CHKERRQ(ierr); 14306759e06SMatthew G. Knepley PetscFEPackageInitialized = PETSC_FALSE; 14406759e06SMatthew G. Knepley PetscSpaceRegisterAllCalled = PETSC_FALSE; 14506759e06SMatthew G. Knepley PetscDualSpaceRegisterAllCalled = PETSC_FALSE; 1460483ade4SMatthew G. Knepley PetscFERegisterAllCalled = PETSC_FALSE; 14706759e06SMatthew G. Knepley PetscFunctionReturn(0); 14806759e06SMatthew G. Knepley } 14906759e06SMatthew G. Knepley 15006759e06SMatthew G. Knepley #undef __FUNCT__ 15106759e06SMatthew G. Knepley #define __FUNCT__ "PetscFEInitializePackage" 15206759e06SMatthew G. Knepley /*@C 15306759e06SMatthew G. Knepley PetscFEInitializePackage - This function initializes everything in the FE package. It is called 15406759e06SMatthew G. Knepley from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to PetscSpaceCreate() 15506759e06SMatthew G. Knepley when using static libraries. 15606759e06SMatthew G. Knepley 15706759e06SMatthew G. Knepley Level: developer 15806759e06SMatthew G. Knepley 15906759e06SMatthew G. Knepley .keywords: PetscFE, initialize, package 16006759e06SMatthew G. Knepley .seealso: PetscInitialize() 16106759e06SMatthew G. Knepley @*/ 16206759e06SMatthew G. Knepley PetscErrorCode PetscFEInitializePackage(void) 16306759e06SMatthew G. Knepley { 16406759e06SMatthew G. Knepley char logList[256]; 16506759e06SMatthew G. Knepley char *className; 16606759e06SMatthew G. Knepley PetscBool opt; 16706759e06SMatthew G. Knepley PetscErrorCode ierr; 16806759e06SMatthew G. Knepley 16906759e06SMatthew G. Knepley PetscFunctionBegin; 17006759e06SMatthew G. Knepley if (PetscFEPackageInitialized) PetscFunctionReturn(0); 17106759e06SMatthew G. Knepley PetscFEPackageInitialized = PETSC_TRUE; 17206759e06SMatthew G. Knepley 17306759e06SMatthew G. Knepley /* Register Classes */ 17406759e06SMatthew G. Knepley ierr = PetscClassIdRegister("Linear Space", &PETSCSPACE_CLASSID);CHKERRQ(ierr); 17506759e06SMatthew G. Knepley ierr = PetscClassIdRegister("Dual Space", &PETSCDUALSPACE_CLASSID);CHKERRQ(ierr); 17606759e06SMatthew G. Knepley ierr = PetscClassIdRegister("FE Space", &PETSCFE_CLASSID);CHKERRQ(ierr); 17706759e06SMatthew G. Knepley 17806759e06SMatthew G. Knepley /* Register Constructors */ 17906759e06SMatthew G. Knepley ierr = PetscSpaceRegisterAll();CHKERRQ(ierr); 1800483ade4SMatthew G. Knepley ierr = PetscDualSpaceRegisterAll();CHKERRQ(ierr); 1810483ade4SMatthew G. Knepley ierr = PetscFERegisterAll();CHKERRQ(ierr); 18206759e06SMatthew G. Knepley /* Register Events */ 18306759e06SMatthew G. Knepley /* Process info exclusions */ 184*c5929fdfSBarry Smith ierr = PetscOptionsGetString(NULL,NULL, "-info_exclude", logList, 256, &opt);CHKERRQ(ierr); 18506759e06SMatthew G. Knepley if (opt) { 18606759e06SMatthew G. Knepley ierr = PetscStrstr(logList, "fe", &className);CHKERRQ(ierr); 187f62f30faSMatthew G. Knepley if (className) {ierr = PetscInfoDeactivateClass(PETSCFE_CLASSID);CHKERRQ(ierr);} 18806759e06SMatthew G. Knepley } 18906759e06SMatthew G. Knepley /* Process summary exclusions */ 190*c5929fdfSBarry Smith ierr = PetscOptionsGetString(NULL,NULL, "-log_summary_exclude", logList, 256, &opt);CHKERRQ(ierr); 19106759e06SMatthew G. Knepley if (opt) { 192f62f30faSMatthew G. Knepley ierr = PetscStrstr(logList, "fe", &className);CHKERRQ(ierr); 193f62f30faSMatthew G. Knepley if (className) {ierr = PetscLogEventDeactivateClass(PETSCFE_CLASSID);CHKERRQ(ierr);} 19406759e06SMatthew G. Knepley } 19506759e06SMatthew G. Knepley ierr = PetscRegisterFinalize(PetscFEFinalizePackage);CHKERRQ(ierr); 19606759e06SMatthew G. Knepley PetscFunctionReturn(0); 19706759e06SMatthew G. Knepley } 198f62f30faSMatthew G. Knepley #include <petscfv.h> 199f62f30faSMatthew G. Knepley 200f62f30faSMatthew G. Knepley static PetscBool PetscFVPackageInitialized = PETSC_FALSE; 201f62f30faSMatthew G. Knepley #undef __FUNCT__ 202f62f30faSMatthew G. Knepley #define __FUNCT__ "PetscFVFinalizePackage" 203f62f30faSMatthew G. Knepley /*@C 204f62f30faSMatthew G. Knepley PetscFVFinalizePackage - This function finalizes everything in the PetscFV package. It is called 205f62f30faSMatthew G. Knepley from PetscFinalize(). 206f62f30faSMatthew G. Knepley 207f62f30faSMatthew G. Knepley Level: developer 208f62f30faSMatthew G. Knepley 209f62f30faSMatthew G. Knepley .keywords: PetscFV, initialize, package 210f62f30faSMatthew G. Knepley .seealso: PetscInitialize() 211f62f30faSMatthew G. Knepley @*/ 212f62f30faSMatthew G. Knepley PetscErrorCode PetscFVFinalizePackage(void) 213f62f30faSMatthew G. Knepley { 214f62f30faSMatthew G. Knepley PetscErrorCode ierr; 215f62f30faSMatthew G. Knepley 216f62f30faSMatthew G. Knepley PetscFunctionBegin; 217ab2453f0SMatthew G. Knepley ierr = PetscFunctionListDestroy(&PetscLimiterList);CHKERRQ(ierr); 218f62f30faSMatthew G. Knepley ierr = PetscFunctionListDestroy(&PetscFVList);CHKERRQ(ierr); 219f62f30faSMatthew G. Knepley PetscFVPackageInitialized = PETSC_FALSE; 220f62f30faSMatthew G. Knepley PetscFVRegisterAllCalled = PETSC_FALSE; 221ab2453f0SMatthew G. Knepley PetscLimiterRegisterAllCalled = PETSC_FALSE; 222f62f30faSMatthew G. Knepley PetscFunctionReturn(0); 223f62f30faSMatthew G. Knepley } 224f62f30faSMatthew G. Knepley 225f62f30faSMatthew G. Knepley #undef __FUNCT__ 226f62f30faSMatthew G. Knepley #define __FUNCT__ "PetscFVInitializePackage" 227f62f30faSMatthew G. Knepley /*@C 228f62f30faSMatthew G. Knepley PetscFVInitializePackage - This function initializes everything in the FV package. It is called 229f62f30faSMatthew G. Knepley from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to PetscFVCreate() 230f62f30faSMatthew G. Knepley when using static libraries. 231f62f30faSMatthew G. Knepley 232f62f30faSMatthew G. Knepley Level: developer 233f62f30faSMatthew G. Knepley 234f62f30faSMatthew G. Knepley .keywords: PetscFV, initialize, package 235f62f30faSMatthew G. Knepley .seealso: PetscInitialize() 236f62f30faSMatthew G. Knepley @*/ 237f62f30faSMatthew G. Knepley PetscErrorCode PetscFVInitializePackage(void) 238f62f30faSMatthew G. Knepley { 239f62f30faSMatthew G. Knepley char logList[256]; 240f62f30faSMatthew G. Knepley char *className; 241f62f30faSMatthew G. Knepley PetscBool opt; 242f62f30faSMatthew G. Knepley PetscErrorCode ierr; 243f62f30faSMatthew G. Knepley 244f62f30faSMatthew G. Knepley PetscFunctionBegin; 245f62f30faSMatthew G. Knepley if (PetscFVPackageInitialized) PetscFunctionReturn(0); 246f62f30faSMatthew G. Knepley PetscFVPackageInitialized = PETSC_TRUE; 247f62f30faSMatthew G. Knepley 248f62f30faSMatthew G. Knepley /* Register Classes */ 249f62f30faSMatthew G. Knepley ierr = PetscClassIdRegister("FV Space", &PETSCFV_CLASSID);CHKERRQ(ierr); 250ab2453f0SMatthew G. Knepley ierr = PetscClassIdRegister("Limiter", &PETSCLIMITER_CLASSID);CHKERRQ(ierr); 251f62f30faSMatthew G. Knepley 252f62f30faSMatthew G. Knepley /* Register Constructors */ 253f62f30faSMatthew G. Knepley ierr = PetscFVRegisterAll();CHKERRQ(ierr); 254f62f30faSMatthew G. Knepley /* Register Events */ 255f62f30faSMatthew G. Knepley /* Process info exclusions */ 256*c5929fdfSBarry Smith ierr = PetscOptionsGetString(NULL,NULL, "-info_exclude", logList, 256, &opt);CHKERRQ(ierr); 257f62f30faSMatthew G. Knepley if (opt) { 258f62f30faSMatthew G. Knepley ierr = PetscStrstr(logList, "fv", &className);CHKERRQ(ierr); 259f62f30faSMatthew G. Knepley if (className) {ierr = PetscInfoDeactivateClass(PETSCFV_CLASSID);CHKERRQ(ierr);} 260ab2453f0SMatthew G. Knepley ierr = PetscStrstr(logList, "limiter", &className);CHKERRQ(ierr); 261ab2453f0SMatthew G. Knepley if (className) {ierr = PetscInfoDeactivateClass(PETSCLIMITER_CLASSID);CHKERRQ(ierr);} 262f62f30faSMatthew G. Knepley } 263f62f30faSMatthew G. Knepley /* Process summary exclusions */ 264*c5929fdfSBarry Smith ierr = PetscOptionsGetString(NULL,NULL, "-log_summary_exclude", logList, 256, &opt);CHKERRQ(ierr); 265f62f30faSMatthew G. Knepley if (opt) { 266f62f30faSMatthew G. Knepley ierr = PetscStrstr(logList, "fv", &className);CHKERRQ(ierr); 267f62f30faSMatthew G. Knepley if (className) {ierr = PetscLogEventDeactivateClass(PETSCFV_CLASSID);CHKERRQ(ierr);} 268ab2453f0SMatthew G. Knepley ierr = PetscStrstr(logList, "limiter", &className);CHKERRQ(ierr); 269ab2453f0SMatthew G. Knepley if (className) {ierr = PetscLogEventDeactivateClass(PETSCLIMITER_CLASSID);CHKERRQ(ierr);} 270f62f30faSMatthew G. Knepley } 271f62f30faSMatthew G. Knepley ierr = PetscRegisterFinalize(PetscFVFinalizePackage);CHKERRQ(ierr); 272f62f30faSMatthew G. Knepley PetscFunctionReturn(0); 273f62f30faSMatthew G. Knepley } 2742764a2aaSMatthew G. Knepley #include <petscds.h> 275022a7a5cSMatthew G. Knepley 2762764a2aaSMatthew G. Knepley static PetscBool PetscDSPackageInitialized = PETSC_FALSE; 277022a7a5cSMatthew G. Knepley #undef __FUNCT__ 2782764a2aaSMatthew G. Knepley #define __FUNCT__ "PetscDSFinalizePackage" 279022a7a5cSMatthew G. Knepley /*@C 2802764a2aaSMatthew G. Knepley PetscDSFinalizePackage - This function finalizes everything in the PetscDS package. It is called 281022a7a5cSMatthew G. Knepley from PetscFinalize(). 282022a7a5cSMatthew G. Knepley 283022a7a5cSMatthew G. Knepley Level: developer 284022a7a5cSMatthew G. Knepley 2852764a2aaSMatthew G. Knepley .keywords: PetscDS, initialize, package 286022a7a5cSMatthew G. Knepley .seealso: PetscInitialize() 287022a7a5cSMatthew G. Knepley @*/ 2882764a2aaSMatthew G. Knepley PetscErrorCode PetscDSFinalizePackage(void) 289022a7a5cSMatthew G. Knepley { 290022a7a5cSMatthew G. Knepley PetscErrorCode ierr; 291022a7a5cSMatthew G. Knepley 292022a7a5cSMatthew G. Knepley PetscFunctionBegin; 2932764a2aaSMatthew G. Knepley ierr = PetscFunctionListDestroy(&PetscDSList);CHKERRQ(ierr); 2942764a2aaSMatthew G. Knepley PetscDSPackageInitialized = PETSC_FALSE; 2952764a2aaSMatthew G. Knepley PetscDSRegisterAllCalled = PETSC_FALSE; 296022a7a5cSMatthew G. Knepley PetscFunctionReturn(0); 297022a7a5cSMatthew G. Knepley } 298022a7a5cSMatthew G. Knepley 299022a7a5cSMatthew G. Knepley #undef __FUNCT__ 3002764a2aaSMatthew G. Knepley #define __FUNCT__ "PetscDSInitializePackage" 301022a7a5cSMatthew G. Knepley /*@C 3022764a2aaSMatthew G. Knepley PetscDSInitializePackage - This function initializes everything in the DS package. It is called 3032764a2aaSMatthew G. Knepley from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to PetscDSCreate() 304022a7a5cSMatthew G. Knepley when using static libraries. 305022a7a5cSMatthew G. Knepley 306022a7a5cSMatthew G. Knepley Level: developer 307022a7a5cSMatthew G. Knepley 3082764a2aaSMatthew G. Knepley .keywords: PetscDS, initialize, package 309022a7a5cSMatthew G. Knepley .seealso: PetscInitialize() 310022a7a5cSMatthew G. Knepley @*/ 3112764a2aaSMatthew G. Knepley PetscErrorCode PetscDSInitializePackage(void) 312022a7a5cSMatthew G. Knepley { 313022a7a5cSMatthew G. Knepley char logList[256]; 314022a7a5cSMatthew G. Knepley char *className; 315022a7a5cSMatthew G. Knepley PetscBool opt; 316022a7a5cSMatthew G. Knepley PetscErrorCode ierr; 317022a7a5cSMatthew G. Knepley 318022a7a5cSMatthew G. Knepley PetscFunctionBegin; 3192764a2aaSMatthew G. Knepley if (PetscDSPackageInitialized) PetscFunctionReturn(0); 3202764a2aaSMatthew G. Knepley PetscDSPackageInitialized = PETSC_TRUE; 321022a7a5cSMatthew G. Knepley 322022a7a5cSMatthew G. Knepley /* Register Classes */ 3232764a2aaSMatthew G. Knepley ierr = PetscClassIdRegister("Discrete System", &PETSCDS_CLASSID);CHKERRQ(ierr); 324022a7a5cSMatthew G. Knepley 325022a7a5cSMatthew G. Knepley /* Register Constructors */ 3262764a2aaSMatthew G. Knepley ierr = PetscDSRegisterAll();CHKERRQ(ierr); 327022a7a5cSMatthew G. Knepley /* Register Events */ 328022a7a5cSMatthew G. Knepley /* Process info exclusions */ 329*c5929fdfSBarry Smith ierr = PetscOptionsGetString(NULL,NULL, "-info_exclude", logList, 256, &opt);CHKERRQ(ierr); 330022a7a5cSMatthew G. Knepley if (opt) { 3312764a2aaSMatthew G. Knepley ierr = PetscStrstr(logList, "ds", &className);CHKERRQ(ierr); 3322764a2aaSMatthew G. Knepley if (className) {ierr = PetscInfoDeactivateClass(PETSCDS_CLASSID);CHKERRQ(ierr);} 333022a7a5cSMatthew G. Knepley } 334022a7a5cSMatthew G. Knepley /* Process summary exclusions */ 335*c5929fdfSBarry Smith ierr = PetscOptionsGetString(NULL,NULL, "-log_summary_exclude", logList, 256, &opt);CHKERRQ(ierr); 336022a7a5cSMatthew G. Knepley if (opt) { 3372764a2aaSMatthew G. Knepley ierr = PetscStrstr(logList, "ds", &className);CHKERRQ(ierr); 3382764a2aaSMatthew G. Knepley if (className) {ierr = PetscLogEventDeactivateClass(PETSCDS_CLASSID);CHKERRQ(ierr);} 339022a7a5cSMatthew G. Knepley } 3402764a2aaSMatthew G. Knepley ierr = PetscRegisterFinalize(PetscDSFinalizePackage);CHKERRQ(ierr); 341022a7a5cSMatthew G. Knepley PetscFunctionReturn(0); 342022a7a5cSMatthew G. Knepley } 343e8597998SBarry Smith 344aa2d57e9SJed Brown #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES) 345e8597998SBarry Smith #undef __FUNCT__ 346e8597998SBarry Smith #define __FUNCT__ "PetscDLLibraryRegister_petscdm" 347e8597998SBarry Smith /* 348e8597998SBarry Smith PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened. 349e8597998SBarry Smith 350e8597998SBarry Smith This one registers all the mesh generators and partitioners that are in 351e8597998SBarry Smith the basic DM library. 352e8597998SBarry Smith 353e8597998SBarry Smith */ 354607a6623SBarry Smith PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscdm(void) 355e8597998SBarry Smith { 356e8597998SBarry Smith PetscErrorCode ierr; 357e8597998SBarry Smith 358e8597998SBarry Smith PetscFunctionBegin; 359607a6623SBarry Smith ierr = AOInitializePackage();CHKERRQ(ierr); 360607a6623SBarry Smith ierr = DMInitializePackage();CHKERRQ(ierr); 36106759e06SMatthew G. Knepley ierr = PetscFEInitializePackage();CHKERRQ(ierr); 362ab2453f0SMatthew G. Knepley ierr = PetscFVInitializePackage();CHKERRQ(ierr); 363e8597998SBarry Smith PetscFunctionReturn(0); 364e8597998SBarry Smith } 365e8597998SBarry Smith 366aa2d57e9SJed Brown #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */ 367