Actual source code: dlregisdmdm.c

petsc-master 2020-01-22
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);

128:   /* Process info exclusions */
129:   PetscOptionsGetString(NULL,NULL,"-info_exclude",logList,sizeof(logList),&opt);
130:   if (opt) {
131:     PetscStrInList("dm",logList,',',&pkg);
132:     if (pkg) {PetscInfoDeactivateClass(DM_CLASSID);}
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 exclusions */
202:   PetscOptionsGetString(NULL,NULL,"-info_exclude",logList,sizeof(logList),&opt);
203:   if (opt) {
204:     PetscStrInList("fe",logList,',',&pkg);
205:     if (pkg) {PetscInfoDeactivateClass(PETSCFE_CLASSID);}
206:   }
207:   /* Process summary exclusions */
208:   PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
209:   if (opt) {
210:     PetscStrInList("fe",logList,',',&pkg);
211:     if (pkg) {PetscLogEventExcludeClass(PETSCFE_CLASSID);}
212:   }
213:   /* Register package finalizer */
214:   PetscRegisterFinalize(PetscFEFinalizePackage);
215:   return(0);
216: }
217:  #include <petscfv.h>

219: static PetscBool PetscFVPackageInitialized = PETSC_FALSE;
220: /*@C
221:   PetscFVFinalizePackage - This function finalizes everything in the PetscFV package. It is called
222:   from PetscFinalize().

224:   Level: developer

226: .seealso: PetscInitialize()
227: @*/
228: PetscErrorCode PetscFVFinalizePackage(void)
229: {

233:   PetscFunctionListDestroy(&PetscLimiterList);
234:   PetscFunctionListDestroy(&PetscFVList);
235:   PetscFVPackageInitialized     = PETSC_FALSE;
236:   PetscFVRegisterAllCalled      = PETSC_FALSE;
237:   PetscLimiterRegisterAllCalled = PETSC_FALSE;
238:   return(0);
239: }

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

246:   Level: developer

248: .seealso: PetscInitialize()
249: @*/
250: PetscErrorCode PetscFVInitializePackage(void)
251: {
252:   char           logList[256];
253:   PetscBool      opt,pkg;

257:   if (PetscFVPackageInitialized) return(0);
258:   PetscFVPackageInitialized = PETSC_TRUE;

260:   /* Register Classes */
261:   PetscClassIdRegister("FV Space", &PETSCFV_CLASSID);
262:   PetscClassIdRegister("Limiter",  &PETSCLIMITER_CLASSID);
263:   /* Register Constructors */
264:   PetscFVRegisterAll();
265:   /* Register Events */
266:   /* Process info exclusions */
267:   PetscOptionsGetString(NULL,NULL,"-info_exclude",logList,sizeof(logList),&opt);
268:   if (opt) {
269:     PetscStrInList("fv",logList,',',&pkg);
270:     if (pkg) {PetscInfoDeactivateClass(PETSCFV_CLASSID);}
271:     PetscStrInList("limiter",logList,',',&pkg);
272:     if (pkg) {PetscInfoDeactivateClass(PETSCLIMITER_CLASSID);}
273:   }
274:   /* Process summary exclusions */
275:   PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
276:   if (opt) {
277:     PetscStrInList("fv",logList,',',&pkg);
278:     if (pkg) {PetscLogEventExcludeClass(PETSCFV_CLASSID);}
279:     PetscStrInList("limiter",logList,',',&pkg);
280:     if (pkg) {PetscLogEventExcludeClass(PETSCLIMITER_CLASSID);}
281:   }
282:   /* Register package finalizer */
283:   PetscRegisterFinalize(PetscFVFinalizePackage);
284:   return(0);
285: }
286:  #include <petscds.h>

288: static PetscBool PetscDSPackageInitialized = PETSC_FALSE;
289: /*@C
290:   PetscDSFinalizePackage - This function finalizes everything in the PetscDS package. It is called
291:   from PetscFinalize().

293:   Level: developer

295: .seealso: PetscInitialize()
296: @*/
297: PetscErrorCode PetscDSFinalizePackage(void)
298: {

302:   PetscFunctionListDestroy(&PetscDSList);
303:   PetscDSPackageInitialized = PETSC_FALSE;
304:   PetscDSRegisterAllCalled  = PETSC_FALSE;
305:   return(0);
306: }

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

313:   Level: developer

315: .seealso: PetscInitialize()
316: @*/
317: PetscErrorCode PetscDSInitializePackage(void)
318: {
319:   char           logList[256];
320:   PetscBool      opt,pkg;

324:   if (PetscDSPackageInitialized) return(0);
325:   PetscDSPackageInitialized = PETSC_TRUE;

327:   /* Register Classes */
328:   PetscClassIdRegister("Discrete System", &PETSCDS_CLASSID);
329:   /* Register Constructors */
330:   PetscDSRegisterAll();
331:   /* Register Events */
332:   /* Process info exclusions */
333:   PetscOptionsGetString(NULL,NULL,"-info_exclude",logList,sizeof(logList),&opt);
334:   if (opt) {
335:     PetscStrInList("ds",logList,',',&pkg);
336:     if (pkg) {PetscInfoDeactivateClass(PETSCDS_CLASSID);}
337:   }
338:   /* Process summary exclusions */
339:   PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
340:   if (opt) {
341:     PetscStrInList("ds",logList,',',&pkg);
342:     if (pkg) {PetscLogEventExcludeClass(PETSCDS_CLASSID);}
343:   }
344:   /* Register package finalizer */
345:   PetscRegisterFinalize(PetscDSFinalizePackage);
346:   return(0);
347: }

349: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
350: /*
351:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

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

356: */
357: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscdm(void)
358: {

362:   AOInitializePackage();
363:   DMInitializePackage();
364:   PetscFEInitializePackage();
365:   PetscFVInitializePackage();
366:   DMFieldInitializePackage();
367:   return(0);
368: }

370: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */