Date: 2022-03-04T17:38:37+00:00

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: {

     26:   PetscFunctionListDestroy(&DMList);
     27:   DMPackageInitialized = PETSC_FALSE;
     28:   DMRegisterAllCalled  = PETSC_FALSE;
     29:   return(0);
     30: }

     32: #if defined(PETSC_HAVE_HYPRE)
     33: PETSC_EXTERN PetscErrorCode MatCreate_HYPREStruct(Mat);
     34: PETSC_EXTERN PetscErrorCode MatCreate_HYPRESStruct(Mat);
     35: #endif

     37: /*@C
     38:   DMInitializePackage - This function initializes everything in the DM package. It is called
     39:   from PetscDLLibraryRegister_petscdm() when using dynamic libraries, and on the first call to AOCreate()
     40:   or DMDACreate() when using shared or static libraries.

     42:   Level: developer

     44: .seealso: PetscInitialize()
     45: @*/
     46: PetscErrorCode  DMInitializePackage(void)
     47: {
     48:   char           logList[256];
     49:   PetscBool      opt,pkg;

     53:   if (DMPackageInitialized) return(0);
     54:   DMPackageInitialized = PETSC_TRUE;

     56:   /* Register Classes */
     57:   PetscClassIdRegister("Distributed Mesh",&DM_CLASSID);
     58:   PetscClassIdRegister("DM Label",&DMLABEL_CLASSID);
     59:   PetscClassIdRegister("Quadrature",&PETSCQUADRATURE_CLASSID);
     60:   PetscClassIdRegister("Mesh Transform",&DMPLEXTRANSFORM_CLASSID);

     62: #if defined(PETSC_HAVE_HYPRE)
     63:   MatRegister(MATHYPRESTRUCT, MatCreate_HYPREStruct);
     64:   MatRegister(MATHYPRESSTRUCT, MatCreate_HYPRESStruct);
     65: #endif
     66:   PetscSectionSymRegister(PETSCSECTIONSYMLABEL,PetscSectionSymCreate_Label);

     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);
     78:   PetscLogEventRegister("DMCreateInject",         DM_CLASSID,&DM_CreateInjection);
     79:   PetscLogEventRegister("DMCreateMat",            DM_CLASSID,&DM_CreateMatrix);
     80:   PetscLogEventRegister("DMLoad",                 DM_CLASSID,&DM_Load);
     81:   PetscLogEventRegister("DMAdaptInterp",          DM_CLASSID,&DM_AdaptInterpolator);

     83:   PetscLogEventRegister("DMPlexBuFrCeLi",         DM_CLASSID,&DMPLEX_BuildFromCellList);
     84:   PetscLogEventRegister("DMPlexBuCoFrCeLi",       DM_CLASSID,&DMPLEX_BuildCoordinatesFromCellList);
     85:   PetscLogEventRegister("DMPlexCreateGmsh",       DM_CLASSID,&DMPLEX_CreateGmsh);
     86:   PetscLogEventRegister("DMPlexCrFromFile",       DM_CLASSID,&DMPLEX_CreateFromFile);
     87:   PetscLogEventRegister("Mesh Partition",         DM_CLASSID,&DMPLEX_Partition);
     88:   PetscLogEventRegister("Mesh Migration",         DM_CLASSID,&DMPLEX_Migrate);
     89:   PetscLogEventRegister("DMPlexPartSelf",         DM_CLASSID,&DMPLEX_PartSelf);
     90:   PetscLogEventRegister("DMPlexPartLblInv",       DM_CLASSID,&DMPLEX_PartLabelInvert);
     91:   PetscLogEventRegister("DMPlexPartLblSF",        DM_CLASSID,&DMPLEX_PartLabelCreateSF);
     92:   PetscLogEventRegister("DMPlexPartStrtSF",       DM_CLASSID,&DMPLEX_PartStratSF);
     93:   PetscLogEventRegister("DMPlexPointSF",          DM_CLASSID,&DMPLEX_CreatePointSF);
     94:   PetscLogEventRegister("DMPlexInterp",           DM_CLASSID,&DMPLEX_Interpolate);
     95:   PetscLogEventRegister("DMPlexDistribute",       DM_CLASSID,&DMPLEX_Distribute);
     96:   PetscLogEventRegister("DMPlexDistCones",        DM_CLASSID,&DMPLEX_DistributeCones);
     97:   PetscLogEventRegister("DMPlexDistLabels",       DM_CLASSID,&DMPLEX_DistributeLabels);
     98:   PetscLogEventRegister("DMPlexDistSF",           DM_CLASSID,&DMPLEX_DistributeSF);
     99:   PetscLogEventRegister("DMPlexDistOvrlp",        DM_CLASSID,&DMPLEX_DistributeOverlap);
    100:   PetscLogEventRegister("DMPlexDistField",        DM_CLASSID,&DMPLEX_DistributeField);
    101:   PetscLogEventRegister("DMPlexDistData",         DM_CLASSID,&DMPLEX_DistributeData);
    102:   PetscLogEventRegister("DMPlexInterpSF",         DM_CLASSID,&DMPLEX_InterpolateSF);
    103:   PetscLogEventRegister("DMPlexGToNBegin",        DM_CLASSID,&DMPLEX_GlobalToNaturalBegin);
    104:   PetscLogEventRegister("DMPlexGToNEnd",          DM_CLASSID,&DMPLEX_GlobalToNaturalEnd);
    105:   PetscLogEventRegister("DMPlexNToGBegin",        DM_CLASSID,&DMPLEX_NaturalToGlobalBegin);
    106:   PetscLogEventRegister("DMPlexNToGEnd",          DM_CLASSID,&DMPLEX_NaturalToGlobalEnd);
    107:   PetscLogEventRegister("DMPlexStratify",         DM_CLASSID,&DMPLEX_Stratify);
    108:   PetscLogEventRegister("DMPlexSymmetrize",       DM_CLASSID,&DMPLEX_Symmetrize);
    109:   PetscLogEventRegister("DMPlexPrealloc",         DM_CLASSID,&DMPLEX_Preallocate);
    110:   PetscLogEventRegister("DMPlexResidualFE",       DM_CLASSID,&DMPLEX_ResidualFEM);
    111:   PetscLogEventRegister("DMPlexJacobianFE",       DM_CLASSID,&DMPLEX_JacobianFEM);
    112:   PetscLogEventRegister("DMPlexInterpFE",         DM_CLASSID,&DMPLEX_InterpolatorFEM);
    113:   PetscLogEventRegister("DMPlexInjectorFE",       DM_CLASSID,&DMPLEX_InjectorFEM);
    114:   PetscLogEventRegister("DMPlexIntegralFEM",      DM_CLASSID,&DMPLEX_IntegralFEM);
    115:   PetscLogEventRegister("DMPlexRebalance",        DM_CLASSID,&DMPLEX_RebalanceSharedPoints);
    116:   PetscLogEventRegister("DMPlexLocatePoints",     DM_CLASSID,&DMPLEX_LocatePoints);

    118:   PetscLogEventRegister("DMSwarmMigrate",         DM_CLASSID,&DMSWARM_Migrate);
    119:   PetscLogEventRegister("DMSwarmDETSetup",        DM_CLASSID,&DMSWARM_DataExchangerTopologySetup);
    120:   PetscLogEventRegister("DMSwarmDExBegin",        DM_CLASSID,&DMSWARM_DataExchangerBegin);
    121:   PetscLogEventRegister("DMSwarmDExEnd",          DM_CLASSID,&DMSWARM_DataExchangerEnd);
    122:   PetscLogEventRegister("DMSwarmDESendCnt",       DM_CLASSID,&DMSWARM_DataExchangerSendCount);
    123:   PetscLogEventRegister("DMSwarmDEPack",          DM_CLASSID,&DMSWARM_DataExchangerPack);
    124:   PetscLogEventRegister("DMSwarmAddPnts",         DM_CLASSID,&DMSWARM_AddPoints);
    125:   PetscLogEventRegister("DMSwarmRmvPnts",         DM_CLASSID,&DMSWARM_RemovePoints);
    126:   PetscLogEventRegister("DMSwarmSort",            DM_CLASSID,&DMSWARM_Sort);
    127:   PetscLogEventRegister("DMSwarmSetSizes",        DM_CLASSID,&DMSWARM_SetSizes);
    128:   /* Process Info */
    129:   {
    130:     PetscClassId  classids[1];

    132:     classids[0] = DM_CLASSID;
    133:     PetscInfoProcessClass("dm", 1, classids);
    134:   }

    136:   /* Process summary exclusions */
    137:   PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
    138:   if (opt) {
    139:     PetscStrInList("dm",logList,',',&pkg);
    140:     if (pkg) {PetscLogEventExcludeClass(DM_CLASSID);}
    141:   }

    143:   DMPlexGenerateRegisterAll();
    144:   PetscRegisterFinalize(DMPlexGenerateRegisterDestroy);
    145:   DMPlexTransformRegisterAll();
    146:   PetscRegisterFinalize(DMPlexTransformRegisterDestroy);
    147:   PetscRegisterFinalize(DMFinalizePackage);
    148:   return(0);
    149: }
    150: #include <petscfe.h>

    152: static PetscBool PetscFEPackageInitialized = PETSC_FALSE;
    153: /*@C
    154:   PetscFEFinalizePackage - This function finalizes everything in the PetscFE package. It is called
    155:   from PetscFinalize().

    157:   Level: developer

    159: .seealso: PetscInitialize()
    160: @*/
    161: PetscErrorCode PetscFEFinalizePackage(void)
    162: {

    166:   PetscFunctionListDestroy(&PetscSpaceList);
    167:   PetscFunctionListDestroy(&PetscDualSpaceList);
    168:   PetscFunctionListDestroy(&PetscFEList);
    169:   PetscFEPackageInitialized       = PETSC_FALSE;
    170:   PetscSpaceRegisterAllCalled     = PETSC_FALSE;
    171:   PetscDualSpaceRegisterAllCalled = PETSC_FALSE;
    172:   PetscFERegisterAllCalled        = PETSC_FALSE;
    173:   return(0);
    174: }

    176: /*@C
    177:   PetscFEInitializePackage - This function initializes everything in the FE package. It is called
    178:   from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to PetscSpaceCreate()
    179:   when using static libraries.

    181:   Level: developer

    183: .seealso: PetscInitialize()
    184: @*/
    185: PetscErrorCode PetscFEInitializePackage(void)
    186: {
    187:   char           logList[256];
    188:   PetscBool      opt,pkg;

    192:   if (PetscFEPackageInitialized) return(0);
    193:   PetscFEPackageInitialized = PETSC_TRUE;

    195:   /* Register Classes */
    196:   PetscClassIdRegister("Linear Space", &PETSCSPACE_CLASSID);
    197:   PetscClassIdRegister("Dual Space",   &PETSCDUALSPACE_CLASSID);
    198:   PetscClassIdRegister("FE Space",     &PETSCFE_CLASSID);
    199:   /* Register Constructors */
    200:   PetscSpaceRegisterAll();
    201:   PetscDualSpaceRegisterAll();
    202:   PetscFERegisterAll();
    203:   /* Register Events */
    204:   PetscLogEventRegister("DualSpaceSetUp", PETSCDUALSPACE_CLASSID, &PETSCDUALSPACE_SetUp);
    205:   PetscLogEventRegister("FESetUp",        PETSCFE_CLASSID,        &PETSCFE_SetUp);
    206:   /* Process Info */
    207:   {
    208:     PetscClassId  classids[3];

    210:     classids[0] = PETSCFE_CLASSID;
    211:     classids[1] = PETSCSPACE_CLASSID;
    212:     classids[2] = PETSCDUALSPACE_CLASSID;
    213:     PetscInfoProcessClass("fe", 1, classids);
    214:     PetscInfoProcessClass("space", 1, &classids[1]);
    215:     PetscInfoProcessClass("dualspace", 1, &classids[2]);
    216:   }
    217:   /* Process summary exclusions */
    218:   PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
    219:   if (opt) {
    220:     PetscStrInList("fe",logList,',',&pkg);
    221:     if (pkg) {PetscLogEventExcludeClass(PETSCFE_CLASSID);}
    222:   }
    223:   /* Register package finalizer */
    224:   PetscRegisterFinalize(PetscFEFinalizePackage);
    225:   return(0);
    226: }
    227: #include <petscfv.h>

    229: static PetscBool PetscFVPackageInitialized = PETSC_FALSE;
    230: /*@C
    231:   PetscFVFinalizePackage - This function finalizes everything in the PetscFV package. It is called
    232:   from PetscFinalize().

    234:   Level: developer

    236: .seealso: PetscInitialize()
    237: @*/
    238: PetscErrorCode PetscFVFinalizePackage(void)
    239: {

    243:   PetscFunctionListDestroy(&PetscLimiterList);
    244:   PetscFunctionListDestroy(&PetscFVList);
    245:   PetscFVPackageInitialized     = PETSC_FALSE;
    246:   PetscFVRegisterAllCalled      = PETSC_FALSE;
    247:   PetscLimiterRegisterAllCalled = PETSC_FALSE;
    248:   return(0);
    249: }

    251: /*@C
    252:   PetscFVInitializePackage - This function initializes everything in the FV package. It is called
    253:   from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to PetscFVCreate()
    254:   when using static libraries.

    256:   Level: developer

    258: .seealso: PetscInitialize()
    259: @*/
    260: PetscErrorCode PetscFVInitializePackage(void)
    261: {
    262:   char           logList[256];
    263:   PetscBool      opt,pkg;

    267:   if (PetscFVPackageInitialized) return(0);
    268:   PetscFVPackageInitialized = PETSC_TRUE;

    270:   /* Register Classes */
    271:   PetscClassIdRegister("FV Space", &PETSCFV_CLASSID);
    272:   PetscClassIdRegister("Limiter",  &PETSCLIMITER_CLASSID);
    273:   /* Register Constructors */
    274:   PetscFVRegisterAll();
    275:   /* Register Events */
    276:   /* Process Info */
    277:   {
    278:     PetscClassId  classids[2];

    280:     classids[0] = PETSCFV_CLASSID;
    281:     classids[1] = PETSCLIMITER_CLASSID;
    282:     PetscInfoProcessClass("fv", 1, classids);
    283:     PetscInfoProcessClass("limiter", 1, &classids[1]);
    284:   }
    285:   /* Process summary exclusions */
    286:   PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
    287:   if (opt) {
    288:     PetscStrInList("fv",logList,',',&pkg);
    289:     if (pkg) {PetscLogEventExcludeClass(PETSCFV_CLASSID);}
    290:     PetscStrInList("limiter",logList,',',&pkg);
    291:     if (pkg) {PetscLogEventExcludeClass(PETSCLIMITER_CLASSID);}
    292:   }
    293:   /* Register package finalizer */
    294:   PetscRegisterFinalize(PetscFVFinalizePackage);
    295:   return(0);
    296: }
    297: #include <petscds.h>

    299: static PetscBool PetscDSPackageInitialized = PETSC_FALSE;
    300: /*@C
    301:   PetscDSFinalizePackage - This function finalizes everything in the PetscDS package. It is called
    302:   from PetscFinalize().

    304:   Level: developer

    306: .seealso: PetscInitialize()
    307: @*/
    308: PetscErrorCode PetscDSFinalizePackage(void)
    309: {

    313:   PetscFunctionListDestroy(&PetscDSList);
    314:   PetscDSPackageInitialized = PETSC_FALSE;
    315:   PetscDSRegisterAllCalled  = PETSC_FALSE;
    316:   return(0);
    317: }

    319: /*@C
    320:   PetscDSInitializePackage - This function initializes everything in the DS package. It is called
    321:   from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to PetscDSCreate()
    322:   when using static libraries.

    324:   Level: developer

    326: .seealso: PetscInitialize()
    327: @*/
    328: PetscErrorCode PetscDSInitializePackage(void)
    329: {
    330:   char           logList[256];
    331:   PetscBool      opt,pkg;

    335:   if (PetscDSPackageInitialized) return(0);
    336:   PetscDSPackageInitialized = PETSC_TRUE;

    338:   /* Register Classes */
    339:   PetscClassIdRegister("Discrete System", &PETSCDS_CLASSID);
    340:   PetscClassIdRegister("Weak Form",       &PETSCWEAKFORM_CLASSID);
    341:   /* Register Constructors */
    342:   PetscDSRegisterAll();
    343:   /* Register Events */
    344:   /* Process Info */
    345:   {
    346:     PetscClassId  classids[1];

    348:     classids[0] = PETSCDS_CLASSID;
    349:     PetscInfoProcessClass("ds", 1, classids);
    350:   }
    351:   /* Process summary exclusions */
    352:   PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
    353:   if (opt) {
    354:     PetscStrInList("ds",logList,',',&pkg);
    355:     if (pkg) {PetscLogEventExcludeClass(PETSCDS_CLASSID);}
    356:   }
    357:   /* Register package finalizer */
    358:   PetscRegisterFinalize(PetscDSFinalizePackage);
    359:   return(0);
    360: }

    362: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
    363: /*
    364:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

    366:   This one registers all the mesh generators and partitioners that are in
    367:   the basic DM library.

    369: */
    370: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscdm(void)
    371: {

    375:   AOInitializePackage();
    376:   PetscPartitionerInitializePackage();
    377:   DMInitializePackage();
    378:   PetscFEInitializePackage();
    379:   PetscFVInitializePackage();
    380:   DMFieldInitializePackage();
    381:   return(0);
    382: }

    384: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */