Actual source code: dlregisdmdm.c

petsc-3.4.4 2014-03-13
  2: #include <petsc-private/dmdaimpl.h>
  3: #include <petsc-private/dmpleximpl.h>
  4: #if defined(PETSC_HAVE_SIEVE)
  5: #include <petsc-private/meshimpl.h>
  6: #endif

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

 15:   Level: developer

 17: .keywords: AO, initialize, package
 18: .seealso: PetscInitialize()
 19: @*/
 20: PetscErrorCode  DMFinalizePackage(void)
 21: {

 25:   PetscFunctionListDestroy(&DMList);
 26:   DMPackageInitialized = PETSC_FALSE;
 27:   DMRegisterAllCalled  = PETSC_FALSE;
 28: #if defined(PETSC_HAVE_SIEVE)
 29:   DMMeshFinalize();
 30: #endif
 31:   return(0);
 32: }

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

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

 45:   Level: developer

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

 58:   if (DMPackageInitialized) return(0);
 59:   DMPackageInitialized = PETSC_TRUE;

 61:   /* Register Classes */
 62:   PetscClassIdRegister("Distributed Mesh",&DM_CLASSID);
 63: #if defined(PETSC_HAVE_SIEVE)
 64:   PetscClassIdRegister("SectionReal",&SECTIONREAL_CLASSID);
 65:   PetscClassIdRegister("SectionInt",&SECTIONINT_CLASSID);
 66: #endif

 68: #if defined(PETSC_HAVE_HYPRE)
 69:   MatRegister(MATHYPRESTRUCT, MatCreate_HYPREStruct);
 70: #endif

 72:   /* Register Constructors */
 73:   DMRegisterAll();
 74:   /* Register Events */
 75:   PetscLogEventRegister("DMConvert",              DM_CLASSID,&DM_Convert);
 76:   PetscLogEventRegister("DMGlobalToLocal",        DM_CLASSID,&DM_GlobalToLocal);
 77:   PetscLogEventRegister("DMLocalToGlobal",        DM_CLASSID,&DM_LocalToGlobal);

 79:   PetscLogEventRegister("DMDALocalADFunc",        DM_CLASSID,&DMDA_LocalADFunction);

 81:   PetscLogEventRegister("DMPlexDistribute",    DM_CLASSID,&DMPLEX_Distribute);
 82:   PetscLogEventRegister("DMPlexStratify",      DM_CLASSID,&DMPLEX_Stratify);
 83: #if defined(PETSC_HAVE_SIEVE)
 84:   PetscLogEventRegister("DMMeshView",             DM_CLASSID,&DMMesh_View);
 85:   PetscLogEventRegister("DMMeshGetGlobalScatter", DM_CLASSID,&DMMesh_GetGlobalScatter);
 86:   PetscLogEventRegister("DMMeshRestrictVector",   DM_CLASSID,&DMMesh_restrictVector);
 87:   PetscLogEventRegister("DMMeshAssembleVector",   DM_CLASSID,&DMMesh_assembleVector);
 88:   PetscLogEventRegister("DMMeshAssemVecComplete", DM_CLASSID,&DMMesh_assembleVectorComplete);
 89:   PetscLogEventRegister("DMMeshAssembleMatrix",   DM_CLASSID,&DMMesh_assembleMatrix);
 90:   PetscLogEventRegister("DMMeshUpdateOperator",   DM_CLASSID,&DMMesh_updateOperator);
 91:   PetscLogEventRegister("SectionRealView",        SECTIONREAL_CLASSID,&SectionReal_View);
 92:   PetscLogEventRegister("SectionIntView",         SECTIONINT_CLASSID,&SectionInt_View);
 93: #endif
 94:   /* Process info exclusions */
 95:   PetscOptionsGetString(NULL, "-info_exclude", logList, 256, &opt);
 96:   if (opt) {
 97:     PetscStrstr(logList, "da", &className);
 98:     if (className) {
 99:       PetscInfoDeactivateClass(DM_CLASSID);
100:     }
101: #if defined(PETSC_HAVE_SIEVE)
102:     PetscStrstr(logList, "sectionreal", &className);
103:     if (className) {
104:       PetscInfoDeactivateClass(SECTIONREAL_CLASSID);
105:     }
106:     PetscStrstr(logList, "sectionint", &className);
107:     if (className) {
108:       PetscInfoDeactivateClass(SECTIONINT_CLASSID);
109:     }
110: #endif
111:   }
112:   /* Process summary exclusions */
113:   PetscOptionsGetString(NULL, "-log_summary_exclude", logList, 256, &opt);
114:   if (opt) {
115:     PetscStrstr(logList, "da", &className);
116:     if (className) {
117:       PetscLogEventDeactivateClass(DM_CLASSID);
118:     }
119: #if defined(PETSC_HAVE_SIEVE)
120:     PetscStrstr(logList, "sectionreal", &className);
121:     if (className) {
122:       PetscLogEventDeactivateClass(SECTIONREAL_CLASSID);
123:     }
124:     PetscStrstr(logList, "sectionint", &className);
125:     if (className) {
126:       PetscLogEventDeactivateClass(SECTIONINT_CLASSID);
127:     }
128: #endif
129:   }
130:   PetscRegisterFinalize(DMFinalizePackage);
131:   return(0);
132: }



136: #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
139: /*
140:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

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

145: */
146: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscdm(void)
147: {

151:   AOInitializePackage();
152:   DMInitializePackage();
153:   return(0);
154: }

156: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */