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/petscdsimpl.h>
      7: #include <petsc/private/petscfeimpl.h>
      8: #include <petsc/private/petscfvimpl.h>
      9: #include <petsc/private/dmswarmimpl.h>

     11: static PetscBool DMPackageInitialized = PETSC_FALSE;
     12: /*@C
     13:   DMFinalizePackage - This function finalizes everything in the DM package. It is called
     14:   from PetscFinalize().

     16:   Level: developer

     18: .seealso: PetscInitialize()
     19: @*/
     20: PetscErrorCode  DMFinalizePackage(void)
     21: {

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

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

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

     41:   Level: developer

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

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

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

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

     66:   /* Register Constructors */
     67:   DMRegisterAll();
     68:   /* Register Events */
     69:   PetscLogEventRegister("DMConvert",              DM_CLASSID,&DM_Convert);
     70:   PetscLogEventRegister("DMGlobalToLocal",        DM_CLASSID,&DM_GlobalToLocal);
     71:   PetscLogEventRegister("DMLocalToGlobal",        DM_CLASSID,&DM_LocalToGlobal);
     72:   PetscLogEventRegister("DMLocatePoints",         DM_CLASSID,&DM_LocatePoints);
     73:   PetscLogEventRegister("DMCoarsen",              DM_CLASSID,&DM_Coarsen);
     74:   PetscLogEventRegister("DMCreateInterp",         DM_CLASSID,&DM_CreateInterpolation);
     75:   PetscLogEventRegister("DMCreateRestrict",       DM_CLASSID,&DM_CreateRestriction);
     76:   PetscLogEventRegister("DMCreateInject",         DM_CLASSID,&DM_CreateInjection);
     77:   PetscLogEventRegister("DMCreateMat",            DM_CLASSID,&DM_CreateMatrix);
     78:   PetscLogEventRegister("DMLoad",                 DM_CLASSID,&DM_Load);
     79:   PetscLogEventRegister("DMAdaptInterp",          DM_CLASSID,&DM_AdaptInterpolator);

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

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

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

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

    141:   DMPlexGenerateRegisterAll();
    142:   PetscRegisterFinalize(DMPlexGenerateRegisterDestroy);
    143:   PetscRegisterFinalize(DMFinalizePackage);
    144:   return(0);
    145: }
    146: #include <petscfe.h>

    148: static PetscBool PetscFEPackageInitialized = PETSC_FALSE;
    149: /*@C
    150:   PetscFEFinalizePackage - This function finalizes everything in the PetscFE package. It is called
    151:   from PetscFinalize().

    153:   Level: developer

    155: .seealso: PetscInitialize()
    156: @*/
    157: PetscErrorCode PetscFEFinalizePackage(void)
    158: {

    162:   PetscFunctionListDestroy(&PetscSpaceList);
    163:   PetscFunctionListDestroy(&PetscDualSpaceList);
    164:   PetscFunctionListDestroy(&PetscFEList);
    165:   PetscFEPackageInitialized       = PETSC_FALSE;
    166:   PetscSpaceRegisterAllCalled     = PETSC_FALSE;
    167:   PetscDualSpaceRegisterAllCalled = PETSC_FALSE;
    168:   PetscFERegisterAllCalled        = PETSC_FALSE;
    169:   return(0);
    170: }

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

    177:   Level: developer

    179: .seealso: PetscInitialize()
    180: @*/
    181: PetscErrorCode PetscFEInitializePackage(void)
    182: {
    183:   char           logList[256];
    184:   PetscBool      opt,pkg;

    188:   if (PetscFEPackageInitialized) return(0);
    189:   PetscFEPackageInitialized = PETSC_TRUE;

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

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

    225: static PetscBool PetscFVPackageInitialized = PETSC_FALSE;
    226: /*@C
    227:   PetscFVFinalizePackage - This function finalizes everything in the PetscFV package. It is called
    228:   from PetscFinalize().

    230:   Level: developer

    232: .seealso: PetscInitialize()
    233: @*/
    234: PetscErrorCode PetscFVFinalizePackage(void)
    235: {

    239:   PetscFunctionListDestroy(&PetscLimiterList);
    240:   PetscFunctionListDestroy(&PetscFVList);
    241:   PetscFVPackageInitialized     = PETSC_FALSE;
    242:   PetscFVRegisterAllCalled      = PETSC_FALSE;
    243:   PetscLimiterRegisterAllCalled = PETSC_FALSE;
    244:   return(0);
    245: }

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

    252:   Level: developer

    254: .seealso: PetscInitialize()
    255: @*/
    256: PetscErrorCode PetscFVInitializePackage(void)
    257: {
    258:   char           logList[256];
    259:   PetscBool      opt,pkg;

    263:   if (PetscFVPackageInitialized) return(0);
    264:   PetscFVPackageInitialized = PETSC_TRUE;

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

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

    295: static PetscBool PetscDSPackageInitialized = PETSC_FALSE;
    296: /*@C
    297:   PetscDSFinalizePackage - This function finalizes everything in the PetscDS package. It is called
    298:   from PetscFinalize().

    300:   Level: developer

    302: .seealso: PetscInitialize()
    303: @*/
    304: PetscErrorCode PetscDSFinalizePackage(void)
    305: {

    309:   PetscFunctionListDestroy(&PetscDSList);
    310:   PetscDSPackageInitialized = PETSC_FALSE;
    311:   PetscDSRegisterAllCalled  = PETSC_FALSE;
    312:   return(0);
    313: }

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

    320:   Level: developer

    322: .seealso: PetscInitialize()
    323: @*/
    324: PetscErrorCode PetscDSInitializePackage(void)
    325: {
    326:   char           logList[256];
    327:   PetscBool      opt,pkg;

    331:   if (PetscDSPackageInitialized) return(0);
    332:   PetscDSPackageInitialized = PETSC_TRUE;

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

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

    358: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
    359: /*
    360:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

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

    365: */
    366: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscdm(void)
    367: {

    371:   AOInitializePackage();
    372:   PetscPartitionerInitializePackage();
    373:   DMInitializePackage();
    374:   PetscFEInitializePackage();
    375:   PetscFVInitializePackage();
    376:   DMFieldInitializePackage();
    377:   return(0);
    378: }

    380: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */