Actual source code: dlregisdmdm.c

petsc-master 2018-10-16
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: .keywords: AO, initialize, package
 19: .seealso: PetscInitialize()
 20: @*/
 21: PetscErrorCode  DMFinalizePackage(void)
 22: {

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

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

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

 44:   Level: developer

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

 56:   if (DMPackageInitialized) return(0);
 57:   DMPackageInitialized = PETSC_TRUE;

 59:   /* Register Classes */
 60:   PetscClassIdRegister("Distributed Mesh",&DM_CLASSID);
 61:   PetscClassIdRegister("GraphPartitioner",&PETSCPARTITIONER_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);

 80:   PetscLogEventRegister("Mesh Partition",         DM_CLASSID,&DMPLEX_Partition);
 81:   PetscLogEventRegister("Mesh Migration",         DM_CLASSID,&DMPLEX_Migrate);
 82:   PetscLogEventRegister("DMPlexInterp",           DM_CLASSID,&DMPLEX_Interpolate);
 83:   PetscLogEventRegister("DMPlexDistribute",       DM_CLASSID,&DMPLEX_Distribute);
 84:   PetscLogEventRegister("DMPlexDistCones",        DM_CLASSID,&DMPLEX_DistributeCones);
 85:   PetscLogEventRegister("DMPlexDistLabels",       DM_CLASSID,&DMPLEX_DistributeLabels);
 86:   PetscLogEventRegister("DMPlexDistSF",           DM_CLASSID,&DMPLEX_DistributeSF);
 87:   PetscLogEventRegister("DMPlexDistOvrlp",        DM_CLASSID,&DMPLEX_DistributeOverlap);
 88:   PetscLogEventRegister("DMPlexDistField",        DM_CLASSID,&DMPLEX_DistributeField);
 89:   PetscLogEventRegister("DMPlexDistData",         DM_CLASSID,&DMPLEX_DistributeData);
 90:   PetscLogEventRegister("DMPlexInterpSF",         DM_CLASSID,&DMPLEX_InterpolateSF);
 91:   PetscLogEventRegister("DMPlexGToNBegin",        DM_CLASSID,&DMPLEX_GlobalToNaturalBegin);
 92:   PetscLogEventRegister("DMPlexGToNEnd",          DM_CLASSID,&DMPLEX_GlobalToNaturalEnd);
 93:   PetscLogEventRegister("DMPlexNToGBegin",        DM_CLASSID,&DMPLEX_NaturalToGlobalBegin);
 94:   PetscLogEventRegister("DMPlexNToGEnd",          DM_CLASSID,&DMPLEX_NaturalToGlobalEnd);
 95:   PetscLogEventRegister("DMPlexStratify",         DM_CLASSID,&DMPLEX_Stratify);
 96:   PetscLogEventRegister("DMPlexPrealloc",         DM_CLASSID,&DMPLEX_Preallocate);
 97:   PetscLogEventRegister("DMPlexResidualFE",       DM_CLASSID,&DMPLEX_ResidualFEM);
 98:   PetscLogEventRegister("DMPlexJacobianFE",       DM_CLASSID,&DMPLEX_JacobianFEM);
 99:   PetscLogEventRegister("DMPlexInterpFE",         DM_CLASSID,&DMPLEX_InterpolatorFEM);
100:   PetscLogEventRegister("DMPlexInjectorFE",       DM_CLASSID,&DMPLEX_InjectorFEM);
101:   PetscLogEventRegister("DMPlexIntegralFEM",      DM_CLASSID,&DMPLEX_IntegralFEM);
102:   PetscLogEventRegister("DMPlexCreateGmsh",       DM_CLASSID,&DMPLEX_CreateGmsh);

104:   PetscLogEventRegister("DMSwarmMigrate",         DM_CLASSID,&DMSWARM_Migrate);
105:   PetscLogEventRegister("DMSwarmDETSetup",        DM_CLASSID,&DMSWARM_DataExchangerTopologySetup);
106:   PetscLogEventRegister("DMSwarmDExBegin",        DM_CLASSID,&DMSWARM_DataExchangerBegin);
107:   PetscLogEventRegister("DMSwarmDExEnd",          DM_CLASSID,&DMSWARM_DataExchangerEnd);
108:   PetscLogEventRegister("DMSwarmDESendCnt",       DM_CLASSID,&DMSWARM_DataExchangerSendCount);
109:   PetscLogEventRegister("DMSwarmDEPack",          DM_CLASSID,&DMSWARM_DataExchangerPack);
110:   PetscLogEventRegister("DMSwarmAddPnts",         DM_CLASSID,&DMSWARM_AddPoints);
111:   PetscLogEventRegister("DMSwarmRmvPnts",         DM_CLASSID,&DMSWARM_RemovePoints);
112:   PetscLogEventRegister("DMSwarmSort",            DM_CLASSID,&DMSWARM_Sort);
113:   PetscLogEventRegister("DMSwarmSetSizes",        DM_CLASSID,&DMSWARM_SetSizes);
114: 
115:   /* Process info exclusions */
116:   PetscOptionsGetString(NULL,NULL,"-info_exclude",logList,sizeof(logList),&opt);
117:   if (opt) {
118:     PetscStrInList("dm",logList,',',&pkg);
119:     if (pkg) {PetscInfoDeactivateClass(DM_CLASSID);}
120:   }

122:   /* Process summary exclusions */
123:   PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
124:   if (opt) {
125:     PetscStrInList("dm",logList,',',&pkg);
126:     if (pkg) {PetscLogEventExcludeClass(DM_CLASSID);}
127:   }

129:   DMPlexGenerateRegisterAll();
130:   PetscRegisterFinalize(DMPlexGenerateRegisterDestroy);
131:   PetscRegisterFinalize(DMFinalizePackage);
132:   return(0);
133: }
134:  #include <petscfe.h>

136: static PetscBool PetscFEPackageInitialized = PETSC_FALSE;
137: /*@C
138:   PetscFEFinalizePackage - This function finalizes everything in the PetscFE package. It is called
139:   from PetscFinalize().

141:   Level: developer

143: .keywords: PetscFE, initialize, package
144: .seealso: PetscInitialize()
145: @*/
146: PetscErrorCode PetscFEFinalizePackage(void)
147: {

151:   PetscFunctionListDestroy(&PetscSpaceList);
152:   PetscFunctionListDestroy(&PetscDualSpaceList);
153:   PetscFunctionListDestroy(&PetscFEList);
154:   PetscFEPackageInitialized       = PETSC_FALSE;
155:   PetscSpaceRegisterAllCalled     = PETSC_FALSE;
156:   PetscDualSpaceRegisterAllCalled = PETSC_FALSE;
157:   PetscFERegisterAllCalled        = PETSC_FALSE;
158:   return(0);
159: }

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

166:   Level: developer

168: .keywords: PetscFE, initialize, package
169: .seealso: PetscInitialize()
170: @*/
171: PetscErrorCode PetscFEInitializePackage(void)
172: {
173:   char           logList[256];
174:   PetscBool      opt,pkg;

178:   if (PetscFEPackageInitialized) return(0);
179:   PetscFEPackageInitialized = PETSC_TRUE;

181:   /* Register Classes */
182:   PetscClassIdRegister("Linear Space", &PETSCSPACE_CLASSID);
183:   PetscClassIdRegister("Dual Space",   &PETSCDUALSPACE_CLASSID);
184:   PetscClassIdRegister("FE Space",     &PETSCFE_CLASSID);
185:   /* Register Constructors */
186:   PetscSpaceRegisterAll();
187:   PetscDualSpaceRegisterAll();
188:   PetscFERegisterAll();
189:   /* Register Events */
190:   /* Process info exclusions */
191:   PetscOptionsGetString(NULL,NULL,"-info_exclude",logList,sizeof(logList),&opt);
192:   if (opt) {
193:     PetscStrInList("fe",logList,',',&pkg);
194:     if (pkg) {PetscInfoDeactivateClass(PETSCFE_CLASSID);}
195:   }
196:   /* Process summary exclusions */
197:   PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
198:   if (opt) {
199:     PetscStrInList("fe",logList,',',&pkg);
200:     if (pkg) {PetscLogEventExcludeClass(PETSCFE_CLASSID);}
201:   }
202:   /* Register package finalizer */
203:   PetscRegisterFinalize(PetscFEFinalizePackage);
204:   return(0);
205: }
206:  #include <petscfv.h>

208: static PetscBool PetscFVPackageInitialized = PETSC_FALSE;
209: /*@C
210:   PetscFVFinalizePackage - This function finalizes everything in the PetscFV package. It is called
211:   from PetscFinalize().

213:   Level: developer

215: .keywords: PetscFV, initialize, package
216: .seealso: PetscInitialize()
217: @*/
218: PetscErrorCode PetscFVFinalizePackage(void)
219: {

223:   PetscFunctionListDestroy(&PetscLimiterList);
224:   PetscFunctionListDestroy(&PetscFVList);
225:   PetscFVPackageInitialized     = PETSC_FALSE;
226:   PetscFVRegisterAllCalled      = PETSC_FALSE;
227:   PetscLimiterRegisterAllCalled = PETSC_FALSE;
228:   return(0);
229: }

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

236:   Level: developer

238: .keywords: PetscFV, initialize, package
239: .seealso: PetscInitialize()
240: @*/
241: PetscErrorCode PetscFVInitializePackage(void)
242: {
243:   char           logList[256];
244:   PetscBool      opt,pkg;

248:   if (PetscFVPackageInitialized) return(0);
249:   PetscFVPackageInitialized = PETSC_TRUE;

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

279: static PetscBool PetscDSPackageInitialized = PETSC_FALSE;
280: /*@C
281:   PetscDSFinalizePackage - This function finalizes everything in the PetscDS package. It is called
282:   from PetscFinalize().

284:   Level: developer

286: .keywords: PetscDS, initialize, package
287: .seealso: PetscInitialize()
288: @*/
289: PetscErrorCode PetscDSFinalizePackage(void)
290: {

294:   PetscFunctionListDestroy(&PetscDSList);
295:   PetscDSPackageInitialized = PETSC_FALSE;
296:   PetscDSRegisterAllCalled  = PETSC_FALSE;
297:   return(0);
298: }

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

305:   Level: developer

307: .keywords: PetscDS, initialize, package
308: .seealso: PetscInitialize()
309: @*/
310: PetscErrorCode PetscDSInitializePackage(void)
311: {
312:   char           logList[256];
313:   PetscBool      opt,pkg;

317:   if (PetscDSPackageInitialized) return(0);
318:   PetscDSPackageInitialized = PETSC_TRUE;

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

342: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
343: /*
344:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

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

349: */
350: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscdm(void)
351: {

355:   AOInitializePackage();
356:   DMInitializePackage();
357:   PetscFEInitializePackage();
358:   PetscFVInitializePackage();
359:   DMFieldInitializePackage();
360:   return(0);
361: }

363: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */