1e8597998SBarry Smith 24b5b0a90SBarry Smith #include <petscao.h> 35fdea053SToby Isaac #include <petsc/private/dmlabelimpl.h> 43da551e6SToby Isaac #include <petsc/private/dmfieldimpl.h> 5af0996ceSBarry Smith #include <petsc/private/dmpleximpl.h> 6af0996ceSBarry Smith #include <petsc/private/petscdsimpl.h> 7af0996ceSBarry Smith #include <petsc/private/petscfeimpl.h> 8af0996ceSBarry Smith #include <petsc/private/petscfvimpl.h> 9ed923d71SDave May #include <petsc/private/dmswarmimpl.h> 10e8597998SBarry Smith 11e8597998SBarry Smith static PetscBool DMPackageInitialized = PETSC_FALSE; 12e8597998SBarry Smith /*@C 13e8597998SBarry Smith DMFinalizePackage - This function finalizes everything in the DM package. It is called 14e8597998SBarry Smith from PetscFinalize(). 15e8597998SBarry Smith 16e8597998SBarry Smith Level: developer 17e8597998SBarry Smith 18e8597998SBarry Smith .keywords: AO, initialize, package 19e8597998SBarry Smith .seealso: PetscInitialize() 20e8597998SBarry Smith @*/ 21e8597998SBarry Smith PetscErrorCode DMFinalizePackage(void) 22e8597998SBarry Smith { 23e8597998SBarry Smith PetscErrorCode ierr; 24e8597998SBarry Smith 25e8597998SBarry Smith PetscFunctionBegin; 2677623264SMatthew G. Knepley ierr = PetscFunctionListDestroy(&PetscPartitionerList);CHKERRQ(ierr); 2737e93019SBarry Smith ierr = PetscFunctionListDestroy(&DMList);CHKERRQ(ierr); 28e8597998SBarry Smith DMPackageInitialized = PETSC_FALSE; 29e8597998SBarry Smith DMRegisterAllCalled = PETSC_FALSE; 3077623264SMatthew G. Knepley PetscPartitionerRegisterAllCalled = PETSC_FALSE; 31e8597998SBarry Smith PetscFunctionReturn(0); 32e8597998SBarry Smith } 33e8597998SBarry Smith 34e8597998SBarry Smith #if defined(PETSC_HAVE_HYPRE) 358cc058d9SJed Brown PETSC_EXTERN PetscErrorCode MatCreate_HYPREStruct(Mat); 3661710fbeSStefano Zampini PETSC_EXTERN PetscErrorCode MatCreate_HYPRESStruct(Mat); 37e8597998SBarry Smith #endif 38e8597998SBarry Smith 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]; 528e81d068SLisandro Dalcin PetscBool opt,pkg; 53e8597998SBarry Smith PetscErrorCode ierr; 54e8597998SBarry Smith 55e8597998SBarry Smith PetscFunctionBegin; 56e8597998SBarry Smith if (DMPackageInitialized) PetscFunctionReturn(0); 57e8597998SBarry Smith DMPackageInitialized = PETSC_TRUE; 58e8597998SBarry Smith 59e8597998SBarry Smith /* Register Classes */ 60e8597998SBarry Smith ierr = PetscClassIdRegister("Distributed Mesh",&DM_CLASSID);CHKERRQ(ierr); 61*d67d17b1SMatthew G. Knepley ierr = PetscClassIdRegister("DM Label",&DMLABEL_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); 6661710fbeSStefano Zampini ierr = MatRegister(MATHYPRESSTRUCT, MatCreate_HYPRESStruct);CHKERRQ(ierr); 67e8597998SBarry Smith #endif 685fdea053SToby Isaac ierr = PetscSectionSymRegister(PETSCSECTIONSYMLABEL,PetscSectionSymCreate_Label);CHKERRQ(ierr); 69e8597998SBarry Smith 70e8597998SBarry Smith /* Register Constructors */ 71607a6623SBarry Smith ierr = DMRegisterAll();CHKERRQ(ierr); 72e8597998SBarry Smith /* Register Events */ 73e8597998SBarry Smith ierr = PetscLogEventRegister("DMConvert", DM_CLASSID,&DM_Convert);CHKERRQ(ierr); 74e8597998SBarry Smith ierr = PetscLogEventRegister("DMGlobalToLocal", DM_CLASSID,&DM_GlobalToLocal);CHKERRQ(ierr); 75e8597998SBarry Smith ierr = PetscLogEventRegister("DMLocalToGlobal", DM_CLASSID,&DM_LocalToGlobal);CHKERRQ(ierr); 7647a35634SPatrick Farrell ierr = PetscLogEventRegister("DMLocatePoints", DM_CLASSID,&DM_LocatePoints);CHKERRQ(ierr); 7747a35634SPatrick Farrell ierr = PetscLogEventRegister("DMCoarsen", DM_CLASSID,&DM_Coarsen);CHKERRQ(ierr); 7842ac0407SBarry Smith ierr = PetscLogEventRegister("DMCreateInterp", DM_CLASSID,&DM_CreateInterpolation);CHKERRQ(ierr); 7942ac0407SBarry Smith ierr = PetscLogEventRegister("DMCreateRestrict", DM_CLASSID,&DM_CreateRestriction);CHKERRQ(ierr); 80e8597998SBarry Smith 8167eb269bSLisandro Dalcin ierr = PetscLogEventRegister("Mesh Partition", DM_CLASSID,&DMPLEX_Partition);CHKERRQ(ierr); 821b858b30SMichael Lange ierr = PetscLogEventRegister("Mesh Migration", DM_CLASSID,&DMPLEX_Migrate);CHKERRQ(ierr); 8375a69067SMatthew G. Knepley ierr = PetscLogEventRegister("DMPlexInterp", DM_CLASSID,&DMPLEX_Interpolate);CHKERRQ(ierr); 84e8597998SBarry Smith ierr = PetscLogEventRegister("DMPlexDistribute", DM_CLASSID,&DMPLEX_Distribute);CHKERRQ(ierr); 8575a69067SMatthew G. Knepley ierr = PetscLogEventRegister("DMPlexDistCones", DM_CLASSID,&DMPLEX_DistributeCones);CHKERRQ(ierr); 8675a69067SMatthew G. Knepley ierr = PetscLogEventRegister("DMPlexDistLabels", DM_CLASSID,&DMPLEX_DistributeLabels);CHKERRQ(ierr); 8765694654SLisandro Dalcin ierr = PetscLogEventRegister("DMPlexDistSF", DM_CLASSID,&DMPLEX_DistributeSF);CHKERRQ(ierr); 8865694654SLisandro Dalcin ierr = PetscLogEventRegister("DMPlexDistOvrlp", DM_CLASSID,&DMPLEX_DistributeOverlap);CHKERRQ(ierr); 8975a69067SMatthew G. Knepley ierr = PetscLogEventRegister("DMPlexDistField", DM_CLASSID,&DMPLEX_DistributeField);CHKERRQ(ierr); 9075a69067SMatthew G. Knepley ierr = PetscLogEventRegister("DMPlexDistData", DM_CLASSID,&DMPLEX_DistributeData);CHKERRQ(ierr); 9125afeb17SMatthew G. Knepley ierr = PetscLogEventRegister("DMPlexInterpSF", DM_CLASSID,&DMPLEX_InterpolateSF);CHKERRQ(ierr); 92fa534816SMatthew G. Knepley ierr = PetscLogEventRegister("DMPlexGToNBegin", DM_CLASSID,&DMPLEX_GlobalToNaturalBegin);CHKERRQ(ierr); 93fa534816SMatthew G. Knepley ierr = PetscLogEventRegister("DMPlexGToNEnd", DM_CLASSID,&DMPLEX_GlobalToNaturalEnd);CHKERRQ(ierr); 94fa534816SMatthew G. Knepley ierr = PetscLogEventRegister("DMPlexNToGBegin", DM_CLASSID,&DMPLEX_NaturalToGlobalBegin);CHKERRQ(ierr); 95fa534816SMatthew G. Knepley ierr = PetscLogEventRegister("DMPlexNToGEnd", DM_CLASSID,&DMPLEX_NaturalToGlobalEnd);CHKERRQ(ierr); 96e8597998SBarry Smith ierr = PetscLogEventRegister("DMPlexStratify", DM_CLASSID,&DMPLEX_Stratify);CHKERRQ(ierr); 9775a69067SMatthew G. Knepley ierr = PetscLogEventRegister("DMPlexPrealloc", DM_CLASSID,&DMPLEX_Preallocate);CHKERRQ(ierr); 9875a69067SMatthew G. Knepley ierr = PetscLogEventRegister("DMPlexResidualFE", DM_CLASSID,&DMPLEX_ResidualFEM);CHKERRQ(ierr); 9975a69067SMatthew G. Knepley ierr = PetscLogEventRegister("DMPlexJacobianFE", DM_CLASSID,&DMPLEX_JacobianFEM);CHKERRQ(ierr); 10075a69067SMatthew G. Knepley ierr = PetscLogEventRegister("DMPlexInterpFE", DM_CLASSID,&DMPLEX_InterpolatorFEM);CHKERRQ(ierr); 10175a69067SMatthew G. Knepley ierr = PetscLogEventRegister("DMPlexInjectorFE", DM_CLASSID,&DMPLEX_InjectorFEM);CHKERRQ(ierr); 102c1f031eeSMatthew G. Knepley ierr = PetscLogEventRegister("DMPlexIntegralFEM", DM_CLASSID,&DMPLEX_IntegralFEM);CHKERRQ(ierr); 1033b3bc66dSMichael Lange ierr = PetscLogEventRegister("DMPlexCreateGmsh", DM_CLASSID,&DMPLEX_CreateGmsh);CHKERRQ(ierr); 104ed923d71SDave May 105ed923d71SDave May ierr = PetscLogEventRegister("DMSwarmMigrate", DM_CLASSID,&DMSWARM_Migrate);CHKERRQ(ierr); 106ed923d71SDave May ierr = PetscLogEventRegister("DMSwarmDETSetup", DM_CLASSID,&DMSWARM_DataExchangerTopologySetup);CHKERRQ(ierr); 107ed923d71SDave May ierr = PetscLogEventRegister("DMSwarmDExBegin", DM_CLASSID,&DMSWARM_DataExchangerBegin);CHKERRQ(ierr); 108ed923d71SDave May ierr = PetscLogEventRegister("DMSwarmDExEnd", DM_CLASSID,&DMSWARM_DataExchangerEnd);CHKERRQ(ierr); 109ed923d71SDave May ierr = PetscLogEventRegister("DMSwarmDESendCnt", DM_CLASSID,&DMSWARM_DataExchangerSendCount);CHKERRQ(ierr); 110ed923d71SDave May ierr = PetscLogEventRegister("DMSwarmDEPack", DM_CLASSID,&DMSWARM_DataExchangerPack);CHKERRQ(ierr); 111f2b2bee7SDave May ierr = PetscLogEventRegister("DMSwarmAddPnts", DM_CLASSID,&DMSWARM_AddPoints);CHKERRQ(ierr); 112f2b2bee7SDave May ierr = PetscLogEventRegister("DMSwarmRmvPnts", DM_CLASSID,&DMSWARM_RemovePoints);CHKERRQ(ierr); 113f2b2bee7SDave May ierr = PetscLogEventRegister("DMSwarmSort", DM_CLASSID,&DMSWARM_Sort);CHKERRQ(ierr); 114f2b2bee7SDave May ierr = PetscLogEventRegister("DMSwarmSetSizes", DM_CLASSID,&DMSWARM_SetSizes);CHKERRQ(ierr); 115ed923d71SDave May 116e8597998SBarry Smith /* Process info exclusions */ 1178e81d068SLisandro Dalcin ierr = PetscOptionsGetString(NULL,NULL,"-info_exclude",logList,sizeof(logList),&opt);CHKERRQ(ierr); 118e8597998SBarry Smith if (opt) { 1198e81d068SLisandro Dalcin ierr = PetscStrInList("dm",logList,',',&pkg);CHKERRQ(ierr); 1208e81d068SLisandro Dalcin if (pkg) {ierr = PetscInfoDeactivateClass(DM_CLASSID);CHKERRQ(ierr);} 121e8597998SBarry Smith } 1228e81d068SLisandro Dalcin 123e8597998SBarry Smith /* Process summary exclusions */ 1248e81d068SLisandro Dalcin ierr = PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);CHKERRQ(ierr); 125e8597998SBarry Smith if (opt) { 1268e81d068SLisandro Dalcin ierr = PetscStrInList("dm",logList,',',&pkg);CHKERRQ(ierr); 127fa2bb9feSLisandro Dalcin if (pkg) {ierr = PetscLogEventExcludeClass(DM_CLASSID);CHKERRQ(ierr);} 128e8597998SBarry Smith } 1298e81d068SLisandro Dalcin 1303a074057SBarry Smith ierr = DMPlexGenerateRegisterAll();CHKERRQ(ierr); 1313a074057SBarry Smith ierr = PetscRegisterFinalize(DMPlexGenerateRegisterDestroy);CHKERRQ(ierr); 132e8597998SBarry Smith ierr = PetscRegisterFinalize(DMFinalizePackage);CHKERRQ(ierr); 133e8597998SBarry Smith PetscFunctionReturn(0); 134e8597998SBarry Smith } 13506759e06SMatthew G. Knepley #include <petscfe.h> 136e8597998SBarry Smith 13706759e06SMatthew G. Knepley static PetscBool PetscFEPackageInitialized = PETSC_FALSE; 13806759e06SMatthew G. Knepley /*@C 13906759e06SMatthew G. Knepley PetscFEFinalizePackage - This function finalizes everything in the PetscFE package. It is called 14006759e06SMatthew G. Knepley from PetscFinalize(). 141e8597998SBarry Smith 14206759e06SMatthew G. Knepley Level: developer 14306759e06SMatthew G. Knepley 14406759e06SMatthew G. Knepley .keywords: PetscFE, initialize, package 14506759e06SMatthew G. Knepley .seealso: PetscInitialize() 14606759e06SMatthew G. Knepley @*/ 14706759e06SMatthew G. Knepley PetscErrorCode PetscFEFinalizePackage(void) 14806759e06SMatthew G. Knepley { 14906759e06SMatthew G. Knepley PetscErrorCode ierr; 15006759e06SMatthew G. Knepley 15106759e06SMatthew G. Knepley PetscFunctionBegin; 15206759e06SMatthew G. Knepley ierr = PetscFunctionListDestroy(&PetscSpaceList);CHKERRQ(ierr); 15306759e06SMatthew G. Knepley ierr = PetscFunctionListDestroy(&PetscDualSpaceList);CHKERRQ(ierr); 1540483ade4SMatthew G. Knepley ierr = PetscFunctionListDestroy(&PetscFEList);CHKERRQ(ierr); 15506759e06SMatthew G. Knepley PetscFEPackageInitialized = PETSC_FALSE; 15606759e06SMatthew G. Knepley PetscSpaceRegisterAllCalled = PETSC_FALSE; 15706759e06SMatthew G. Knepley PetscDualSpaceRegisterAllCalled = PETSC_FALSE; 1580483ade4SMatthew G. Knepley PetscFERegisterAllCalled = PETSC_FALSE; 15906759e06SMatthew G. Knepley PetscFunctionReturn(0); 16006759e06SMatthew G. Knepley } 16106759e06SMatthew G. Knepley 16206759e06SMatthew G. Knepley /*@C 16306759e06SMatthew G. Knepley PetscFEInitializePackage - This function initializes everything in the FE package. It is called 16406759e06SMatthew G. Knepley from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to PetscSpaceCreate() 16506759e06SMatthew G. Knepley when using static libraries. 16606759e06SMatthew G. Knepley 16706759e06SMatthew G. Knepley Level: developer 16806759e06SMatthew G. Knepley 16906759e06SMatthew G. Knepley .keywords: PetscFE, initialize, package 17006759e06SMatthew G. Knepley .seealso: PetscInitialize() 17106759e06SMatthew G. Knepley @*/ 17206759e06SMatthew G. Knepley PetscErrorCode PetscFEInitializePackage(void) 17306759e06SMatthew G. Knepley { 17406759e06SMatthew G. Knepley char logList[256]; 1758e81d068SLisandro Dalcin PetscBool opt,pkg; 17606759e06SMatthew G. Knepley PetscErrorCode ierr; 17706759e06SMatthew G. Knepley 17806759e06SMatthew G. Knepley PetscFunctionBegin; 17906759e06SMatthew G. Knepley if (PetscFEPackageInitialized) PetscFunctionReturn(0); 18006759e06SMatthew G. Knepley PetscFEPackageInitialized = PETSC_TRUE; 18106759e06SMatthew G. Knepley 18206759e06SMatthew G. Knepley /* Register Classes */ 18306759e06SMatthew G. Knepley ierr = PetscClassIdRegister("Linear Space", &PETSCSPACE_CLASSID);CHKERRQ(ierr); 18406759e06SMatthew G. Knepley ierr = PetscClassIdRegister("Dual Space", &PETSCDUALSPACE_CLASSID);CHKERRQ(ierr); 18506759e06SMatthew G. Knepley ierr = PetscClassIdRegister("FE Space", &PETSCFE_CLASSID);CHKERRQ(ierr); 18606759e06SMatthew G. Knepley /* Register Constructors */ 18706759e06SMatthew G. Knepley ierr = PetscSpaceRegisterAll();CHKERRQ(ierr); 1880483ade4SMatthew G. Knepley ierr = PetscDualSpaceRegisterAll();CHKERRQ(ierr); 1890483ade4SMatthew G. Knepley ierr = PetscFERegisterAll();CHKERRQ(ierr); 19006759e06SMatthew G. Knepley /* Register Events */ 19106759e06SMatthew G. Knepley /* Process info exclusions */ 1928e81d068SLisandro Dalcin ierr = PetscOptionsGetString(NULL,NULL,"-info_exclude",logList,sizeof(logList),&opt);CHKERRQ(ierr); 19306759e06SMatthew G. Knepley if (opt) { 1948e81d068SLisandro Dalcin ierr = PetscStrInList("fe",logList,',',&pkg);CHKERRQ(ierr); 1958e81d068SLisandro Dalcin if (pkg) {ierr = PetscInfoDeactivateClass(PETSCFE_CLASSID);CHKERRQ(ierr);} 19606759e06SMatthew G. Knepley } 19706759e06SMatthew G. Knepley /* Process summary exclusions */ 1988e81d068SLisandro Dalcin ierr = PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);CHKERRQ(ierr); 19906759e06SMatthew G. Knepley if (opt) { 2008e81d068SLisandro Dalcin ierr = PetscStrInList("fe",logList,',',&pkg);CHKERRQ(ierr); 201fa2bb9feSLisandro Dalcin if (pkg) {ierr = PetscLogEventExcludeClass(PETSCFE_CLASSID);CHKERRQ(ierr);} 20206759e06SMatthew G. Knepley } 2038e81d068SLisandro Dalcin /* Register package finalizer */ 20406759e06SMatthew G. Knepley ierr = PetscRegisterFinalize(PetscFEFinalizePackage);CHKERRQ(ierr); 20506759e06SMatthew G. Knepley PetscFunctionReturn(0); 20606759e06SMatthew G. Knepley } 207f62f30faSMatthew G. Knepley #include <petscfv.h> 208f62f30faSMatthew G. Knepley 209f62f30faSMatthew G. Knepley static PetscBool PetscFVPackageInitialized = PETSC_FALSE; 210f62f30faSMatthew G. Knepley /*@C 211f62f30faSMatthew G. Knepley PetscFVFinalizePackage - This function finalizes everything in the PetscFV package. It is called 212f62f30faSMatthew G. Knepley from PetscFinalize(). 213f62f30faSMatthew G. Knepley 214f62f30faSMatthew G. Knepley Level: developer 215f62f30faSMatthew G. Knepley 216f62f30faSMatthew G. Knepley .keywords: PetscFV, initialize, package 217f62f30faSMatthew G. Knepley .seealso: PetscInitialize() 218f62f30faSMatthew G. Knepley @*/ 219f62f30faSMatthew G. Knepley PetscErrorCode PetscFVFinalizePackage(void) 220f62f30faSMatthew G. Knepley { 221f62f30faSMatthew G. Knepley PetscErrorCode ierr; 222f62f30faSMatthew G. Knepley 223f62f30faSMatthew G. Knepley PetscFunctionBegin; 224ab2453f0SMatthew G. Knepley ierr = PetscFunctionListDestroy(&PetscLimiterList);CHKERRQ(ierr); 225f62f30faSMatthew G. Knepley ierr = PetscFunctionListDestroy(&PetscFVList);CHKERRQ(ierr); 226f62f30faSMatthew G. Knepley PetscFVPackageInitialized = PETSC_FALSE; 227f62f30faSMatthew G. Knepley PetscFVRegisterAllCalled = PETSC_FALSE; 228ab2453f0SMatthew G. Knepley PetscLimiterRegisterAllCalled = PETSC_FALSE; 229f62f30faSMatthew G. Knepley PetscFunctionReturn(0); 230f62f30faSMatthew G. Knepley } 231f62f30faSMatthew G. Knepley 232f62f30faSMatthew G. Knepley /*@C 233f62f30faSMatthew G. Knepley PetscFVInitializePackage - This function initializes everything in the FV package. It is called 234f62f30faSMatthew G. Knepley from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to PetscFVCreate() 235f62f30faSMatthew G. Knepley when using static libraries. 236f62f30faSMatthew G. Knepley 237f62f30faSMatthew G. Knepley Level: developer 238f62f30faSMatthew G. Knepley 239f62f30faSMatthew G. Knepley .keywords: PetscFV, initialize, package 240f62f30faSMatthew G. Knepley .seealso: PetscInitialize() 241f62f30faSMatthew G. Knepley @*/ 242f62f30faSMatthew G. Knepley PetscErrorCode PetscFVInitializePackage(void) 243f62f30faSMatthew G. Knepley { 244f62f30faSMatthew G. Knepley char logList[256]; 2458e81d068SLisandro Dalcin PetscBool opt,pkg; 246f62f30faSMatthew G. Knepley PetscErrorCode ierr; 247f62f30faSMatthew G. Knepley 248f62f30faSMatthew G. Knepley PetscFunctionBegin; 249f62f30faSMatthew G. Knepley if (PetscFVPackageInitialized) PetscFunctionReturn(0); 250f62f30faSMatthew G. Knepley PetscFVPackageInitialized = PETSC_TRUE; 251f62f30faSMatthew G. Knepley 252f62f30faSMatthew G. Knepley /* Register Classes */ 253f62f30faSMatthew G. Knepley ierr = PetscClassIdRegister("FV Space", &PETSCFV_CLASSID);CHKERRQ(ierr); 254ab2453f0SMatthew G. Knepley ierr = PetscClassIdRegister("Limiter", &PETSCLIMITER_CLASSID);CHKERRQ(ierr); 255f62f30faSMatthew G. Knepley /* Register Constructors */ 256f62f30faSMatthew G. Knepley ierr = PetscFVRegisterAll();CHKERRQ(ierr); 257f62f30faSMatthew G. Knepley /* Register Events */ 258f62f30faSMatthew G. Knepley /* Process info exclusions */ 2598e81d068SLisandro Dalcin ierr = PetscOptionsGetString(NULL,NULL,"-info_exclude",logList,sizeof(logList),&opt);CHKERRQ(ierr); 260f62f30faSMatthew G. Knepley if (opt) { 2618e81d068SLisandro Dalcin ierr = PetscStrInList("fv",logList,',',&pkg);CHKERRQ(ierr); 2628e81d068SLisandro Dalcin if (pkg) {ierr = PetscInfoDeactivateClass(PETSCFV_CLASSID);CHKERRQ(ierr);} 2638e81d068SLisandro Dalcin ierr = PetscStrInList("limiter",logList,',',&pkg);CHKERRQ(ierr); 2648e81d068SLisandro Dalcin if (pkg) {ierr = PetscInfoDeactivateClass(PETSCLIMITER_CLASSID);CHKERRQ(ierr);} 265f62f30faSMatthew G. Knepley } 266f62f30faSMatthew G. Knepley /* Process summary exclusions */ 2678e81d068SLisandro Dalcin ierr = PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);CHKERRQ(ierr); 268f62f30faSMatthew G. Knepley if (opt) { 2698e81d068SLisandro Dalcin ierr = PetscStrInList("fv",logList,',',&pkg);CHKERRQ(ierr); 270fa2bb9feSLisandro Dalcin if (pkg) {ierr = PetscLogEventExcludeClass(PETSCFV_CLASSID);CHKERRQ(ierr);} 2718e81d068SLisandro Dalcin ierr = PetscStrInList("limiter",logList,',',&pkg);CHKERRQ(ierr); 272fa2bb9feSLisandro Dalcin if (pkg) {ierr = PetscLogEventExcludeClass(PETSCLIMITER_CLASSID);CHKERRQ(ierr);} 273f62f30faSMatthew G. Knepley } 2748e81d068SLisandro Dalcin /* Register package finalizer */ 275f62f30faSMatthew G. Knepley ierr = PetscRegisterFinalize(PetscFVFinalizePackage);CHKERRQ(ierr); 276f62f30faSMatthew G. Knepley PetscFunctionReturn(0); 277f62f30faSMatthew G. Knepley } 2782764a2aaSMatthew G. Knepley #include <petscds.h> 279022a7a5cSMatthew G. Knepley 2802764a2aaSMatthew G. Knepley static PetscBool PetscDSPackageInitialized = PETSC_FALSE; 281022a7a5cSMatthew G. Knepley /*@C 2822764a2aaSMatthew G. Knepley PetscDSFinalizePackage - This function finalizes everything in the PetscDS package. It is called 283022a7a5cSMatthew G. Knepley from PetscFinalize(). 284022a7a5cSMatthew G. Knepley 285022a7a5cSMatthew G. Knepley Level: developer 286022a7a5cSMatthew G. Knepley 2872764a2aaSMatthew G. Knepley .keywords: PetscDS, initialize, package 288022a7a5cSMatthew G. Knepley .seealso: PetscInitialize() 289022a7a5cSMatthew G. Knepley @*/ 2902764a2aaSMatthew G. Knepley PetscErrorCode PetscDSFinalizePackage(void) 291022a7a5cSMatthew G. Knepley { 292022a7a5cSMatthew G. Knepley PetscErrorCode ierr; 293022a7a5cSMatthew G. Knepley 294022a7a5cSMatthew G. Knepley PetscFunctionBegin; 2952764a2aaSMatthew G. Knepley ierr = PetscFunctionListDestroy(&PetscDSList);CHKERRQ(ierr); 2962764a2aaSMatthew G. Knepley PetscDSPackageInitialized = PETSC_FALSE; 2972764a2aaSMatthew G. Knepley PetscDSRegisterAllCalled = PETSC_FALSE; 298022a7a5cSMatthew G. Knepley PetscFunctionReturn(0); 299022a7a5cSMatthew G. Knepley } 300022a7a5cSMatthew G. Knepley 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]; 3148e81d068SLisandro Dalcin PetscBool opt,pkg; 315022a7a5cSMatthew G. Knepley PetscErrorCode ierr; 316022a7a5cSMatthew G. Knepley 317022a7a5cSMatthew G. Knepley PetscFunctionBegin; 3182764a2aaSMatthew G. Knepley if (PetscDSPackageInitialized) PetscFunctionReturn(0); 3192764a2aaSMatthew G. Knepley PetscDSPackageInitialized = PETSC_TRUE; 320022a7a5cSMatthew G. Knepley 321022a7a5cSMatthew G. Knepley /* Register Classes */ 3222764a2aaSMatthew G. Knepley ierr = PetscClassIdRegister("Discrete System", &PETSCDS_CLASSID);CHKERRQ(ierr); 323022a7a5cSMatthew G. Knepley /* Register Constructors */ 3242764a2aaSMatthew G. Knepley ierr = PetscDSRegisterAll();CHKERRQ(ierr); 325022a7a5cSMatthew G. Knepley /* Register Events */ 326022a7a5cSMatthew G. Knepley /* Process info exclusions */ 3278e81d068SLisandro Dalcin ierr = PetscOptionsGetString(NULL,NULL,"-info_exclude",logList,sizeof(logList),&opt);CHKERRQ(ierr); 328022a7a5cSMatthew G. Knepley if (opt) { 3298e81d068SLisandro Dalcin ierr = PetscStrInList("ds",logList,',',&pkg);CHKERRQ(ierr); 3308e81d068SLisandro Dalcin if (pkg) {ierr = PetscInfoDeactivateClass(PETSCDS_CLASSID);CHKERRQ(ierr);} 331022a7a5cSMatthew G. Knepley } 332022a7a5cSMatthew G. Knepley /* Process summary exclusions */ 3338e81d068SLisandro Dalcin ierr = PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);CHKERRQ(ierr); 334022a7a5cSMatthew G. Knepley if (opt) { 3358e81d068SLisandro Dalcin ierr = PetscStrInList("ds",logList,',',&pkg);CHKERRQ(ierr); 336fa2bb9feSLisandro Dalcin if (pkg) {ierr = PetscLogEventExcludeClass(PETSCDS_CLASSID);CHKERRQ(ierr);} 337022a7a5cSMatthew G. Knepley } 3388e81d068SLisandro Dalcin /* Register package finalizer */ 3392764a2aaSMatthew G. Knepley ierr = PetscRegisterFinalize(PetscDSFinalizePackage);CHKERRQ(ierr); 340022a7a5cSMatthew G. Knepley PetscFunctionReturn(0); 341022a7a5cSMatthew G. Knepley } 342e8597998SBarry Smith 343aa2d57e9SJed Brown #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES) 344e8597998SBarry Smith /* 345e8597998SBarry Smith PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened. 346e8597998SBarry Smith 347e8597998SBarry Smith This one registers all the mesh generators and partitioners that are in 348e8597998SBarry Smith the basic DM library. 349e8597998SBarry Smith 350e8597998SBarry Smith */ 351607a6623SBarry Smith PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscdm(void) 352e8597998SBarry Smith { 353e8597998SBarry Smith PetscErrorCode ierr; 354e8597998SBarry Smith 355e8597998SBarry Smith PetscFunctionBegin; 356607a6623SBarry Smith ierr = AOInitializePackage();CHKERRQ(ierr); 357607a6623SBarry Smith ierr = DMInitializePackage();CHKERRQ(ierr); 35806759e06SMatthew G. Knepley ierr = PetscFEInitializePackage();CHKERRQ(ierr); 359ab2453f0SMatthew G. Knepley ierr = PetscFVInitializePackage();CHKERRQ(ierr); 3603da551e6SToby Isaac ierr = DMFieldInitializePackage();CHKERRQ(ierr); 361e8597998SBarry Smith PetscFunctionReturn(0); 362e8597998SBarry Smith } 363e8597998SBarry Smith 364aa2d57e9SJed Brown #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */ 365