Actual source code: dlregisdmdm.c

petsc-3.13.6 2020-09-29
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:   /* Process Info */
202:   {
203:     PetscClassId  classids[3];

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

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

229:   Level: developer

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

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

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

251:   Level: developer

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

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

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

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

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

299:   Level: developer

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

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

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

319:   Level: developer

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

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

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

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

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

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

363: */
364: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscdm(void)
365: {

369:   AOInitializePackage();
370:   DMInitializePackage();
371:   PetscFEInitializePackage();
372:   PetscFVInitializePackage();
373:   DMFieldInitializePackage();
374:   return(0);
375: }

377: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */