Actual source code: dlregisdmdm.c

petsc-master 2020-07-05
Report Typos and Errors

  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(&PetscPartitionerList);
 26:   PetscFunctionListDestroy(&DMList);
 27:   DMPackageInitialized = PETSC_FALSE;
 28:   DMRegisterAllCalled  = PETSC_FALSE;
 29:   PetscPartitionerRegisterAllCalled = PETSC_FALSE;
 30:   return(0);
 31: }

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

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

 43:   Level: developer

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

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

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

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

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

 83:   PetscLogEventRegister("DMPlexCrFrCeLi",         DM_CLASSID,&DMPLEX_CreateFromCellList);
 84:   PetscLogEventRegister("DMPlexCrFrCeLiCo",       DM_CLASSID,&DMPLEX_CreateFromCellList_Coordinates);
 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);

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

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

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

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

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

154:   Level: developer

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

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

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

178:   Level: developer

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

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

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

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

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

231:   Level: developer

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

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

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

253:   Level: developer

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

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

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

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

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

301:   Level: developer

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

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

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

321:   Level: developer

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

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

335:   /* Register Classes */
336:   PetscClassIdRegister("Discrete System", &PETSCDS_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:   DMInitializePackage();
373:   PetscFEInitializePackage();
374:   PetscFVInitializePackage();
375:   DMFieldInitializePackage();
376:   return(0);
377: }

379: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */