Actual source code: dlregisdm.c

  1: #define PETSCDM_DLL

 3:  #include ../src/dm/ao/aoimpl.h
 4:  #include ../src/dm/da/daimpl.h
  5: #ifdef PETSC_HAVE_SIEVE
 6:  #include private/meshimpl.h
  7: #endif

 11: /*@C
 12:   DMFinalizePackage - This function finalizes everything in the DM package. It is called
 13:   from PetscFinalize().

 15:   Level: developer

 17: .keywords: AO, DA, initialize, package
 18: .seealso: PetscInitialize()
 19: @*/
 20: PetscErrorCode  DMFinalizePackage(void) {
 21: #ifdef PETSC_HAVE_SIEVE
 23: #endif

 26: #ifdef PETSC_HAVE_SIEVE
 27:   MeshFinalize();
 28: #endif
 29:   return(0);
 30: }

 34: /*@C
 35:   DMInitializePackage - This function initializes everything in the DM package. It is called
 36:   from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to AOCreate()
 37:   or DACreate() when using static libraries.

 39:   Input Parameter:
 40:   path - The dynamic library path, or PETSC_NULL

 42:   Level: developer

 44: .keywords: AO, DA, initialize, package
 45: .seealso: PetscInitialize()
 46: @*/
 47: PetscErrorCode  DMInitializePackage(const char path[])
 48: {
 49:   static PetscTruth initialized = PETSC_FALSE;
 50:   char              logList[256];
 51:   char             *className;
 52:   PetscTruth        opt;

 56:   if (initialized) return(0);
 57:   initialized = PETSC_TRUE;
 58:   /* Register Classes */
 59:   PetscCookieRegister("Application Order",&AO_COOKIE);
 60:   PetscCookieRegister("Distributed array",&DM_COOKIE);
 61:   PetscCookieRegister("Arbitrary Dimension Distributed array",&ADDA_COOKIE);
 62: #ifdef PETSC_HAVE_SIEVE
 63:   PetscCookieRegister("Mesh",&MESH_COOKIE);
 64:   PetscCookieRegister("SectionReal",&SECTIONREAL_COOKIE);
 65:   PetscCookieRegister("SectionInt",&SECTIONINT_COOKIE);
 66: #endif
 67:   /* Register Constructors */
 68: #ifdef PETSC_HAVE_SIEVE
 69:   MeshRegisterAll(path);
 70: #endif
 71:   /* Register Events */
 72:   PetscLogEventRegister("AOPetscToApplication", AO_COOKIE,&AO_PetscToApplication);
 73:   PetscLogEventRegister("AOApplicationToPetsc", AO_COOKIE,&AO_ApplicationToPetsc);
 74:   PetscLogEventRegister("DAGlobalToLocal",      DM_COOKIE,&DA_GlobalToLocal);
 75:   PetscLogEventRegister("DALocalToGlobal",      DM_COOKIE,&DA_LocalToGlobal);
 76:   PetscLogEventRegister("DALocalADFunc",        DM_COOKIE,&DA_LocalADFunction);
 77: #ifdef PETSC_HAVE_SIEVE
 78:   PetscLogEventRegister("MeshView",             MESH_COOKIE,&Mesh_View);
 79:   PetscLogEventRegister("MeshGetGlobalScatter", MESH_COOKIE,&Mesh_GetGlobalScatter);
 80:   PetscLogEventRegister("MeshRestrictVector",   MESH_COOKIE,&Mesh_restrictVector);
 81:   PetscLogEventRegister("MeshAssembleVector",   MESH_COOKIE,&Mesh_assembleVector);
 82:   PetscLogEventRegister("MeshAssemVecComplete", MESH_COOKIE,&Mesh_assembleVectorComplete);
 83:   PetscLogEventRegister("MeshAssembleMatrix",   MESH_COOKIE,&Mesh_assembleMatrix);
 84:   PetscLogEventRegister("MeshUpdateOperator",   MESH_COOKIE,&Mesh_updateOperator);
 85:   PetscLogEventRegister("SectionRealView",      SECTIONREAL_COOKIE,&SectionReal_View);
 86:   PetscLogEventRegister("SectionIntView",       SECTIONINT_COOKIE,&SectionInt_View);
 87: #endif
 88:   /* Process info exclusions */
 89:   PetscOptionsGetString(PETSC_NULL, "-info_exclude", logList, 256, &opt);
 90:   if (opt) {
 91:     PetscStrstr(logList, "ao", &className);
 92:     if (className) {
 93:       PetscInfoDeactivateClass(AO_COOKIE);
 94:     }
 95:     PetscStrstr(logList, "da", &className);
 96:     if (className) {
 97:       PetscInfoDeactivateClass(DM_COOKIE);
 98:     }
 99: #ifdef PETSC_HAVE_SIEVE
100:     PetscStrstr(logList, "mesh", &className);
101:     if (className) {
102:       PetscInfoDeactivateClass(MESH_COOKIE);
103:     }
104:     PetscStrstr(logList, "sectionreal", &className);
105:     if (className) {
106:       PetscInfoDeactivateClass(SECTIONREAL_COOKIE);
107:     }
108:     PetscStrstr(logList, "sectionint", &className);
109:     if (className) {
110:       PetscInfoDeactivateClass(SECTIONINT_COOKIE);
111:     }
112: #endif
113:   }
114:   /* Process summary exclusions */
115:   PetscOptionsGetString(PETSC_NULL, "-log_summary_exclude", logList, 256, &opt);
116:   if (opt) {
117:     PetscStrstr(logList, "ao", &className);
118:     if (className) {
119:       PetscLogEventDeactivateClass(AO_COOKIE);
120:     }
121:     PetscStrstr(logList, "da", &className);
122:     if (className) {
123:       PetscLogEventDeactivateClass(DM_COOKIE);
124:     }
125: #ifdef PETSC_HAVE_SIEVE
126:     PetscStrstr(logList, "mesh", &className);
127:     if (className) {
128:       PetscLogEventDeactivateClass(MESH_COOKIE);
129:     }
130:     PetscStrstr(logList, "sectionreal", &className);
131:     if (className) {
132:       PetscLogEventDeactivateClass(SECTIONREAL_COOKIE);
133:     }
134:     PetscStrstr(logList, "sectionint", &className);
135:     if (className) {
136:       PetscLogEventDeactivateClass(SECTIONINT_COOKIE);
137:     }
138: #endif
139:   }
140:   PetscRegisterFinalize(DMFinalizePackage);
141:   return(0);
142: }



146: #ifdef PETSC_USE_DYNAMIC_LIBRARIES
150: /*
151:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

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

156:   Input Parameter:
157:   path - library path
158: */
159: PetscErrorCode  PetscDLLibraryRegister_petscdm(const char path[])
160: {

163:   PetscInitializeNoArguments();
164:   if (ierr) return(1);

166:   /*
167:       If we got here then PETSc was properly loaded
168:   */
169:   DMInitializePackage(path);
170:   return(0);
171: }

174: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */