Actual source code: dlregis.c

  1: #ifdef PETSC_RCS_HEADER
  2: static char vcid[] = "$Id: dlregis.c,v 1.1 2000/01/10 06:34:46 knepley Exp $";
  3: #endif

 5:  #include petscao.h
 6:  #include petscda.h

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

 15:   Input Parameter:
 16:   path - The dynamic library path, or PETSC_NULL

 18:   Level: developer

 20: .keywords: AO, DA, initialize, package
 21: .seealso: PetscInitialize()
 22: @*/
 23: int DMInitializePackage(const char path[]) {
 24:   static PetscTruth initialized = PETSC_FALSE;
 25:   char              logList[256];
 26:   char             *className;
 27:   PetscTruth        opt;
 28:   int               ierr;

 31:   if (initialized == PETSC_TRUE) return(0);
 32:   initialized = PETSC_TRUE;
 33:   /* Register Classes */
 34:   PetscLogClassRegister(&AO_COOKIE,     "Application Order");
 35:   PetscLogClassRegister(&AODATA_COOKIE, "Application Data");
 36:   PetscLogClassRegister(&DA_COOKIE,     "Distributed array");
 37:   /* Register Events */
 38:   PetscLogEventRegister(&AOEvents[AO_PetscToApplication], "AOPetscToApplication", AO_COOKIE);
 39:   PetscLogEventRegister(&AOEvents[AO_ApplicationToPetsc], "AOApplicationToPetsc", AO_COOKIE);
 40:   PetscLogEventRegister(&DAEvents[DA_GlobalToLocal],      "DAGlobalToLocal",      DA_COOKIE);
 41:   PetscLogEventRegister(&DAEvents[DA_LocalToGlobal],      "DALocalToGlobal",      DA_COOKIE);
 42:   PetscLogEventRegister(&DAEvents[DA_LocalADFunction],    "DALocalADFunc",        DA_COOKIE);
 43:   /* Process info exclusions */
 44:   PetscOptionsGetString(PETSC_NULL, "-log_info_exclude", logList, 256, &opt);
 45:   if (opt == PETSC_TRUE) {
 46:     PetscStrstr(logList, "ao", &className);
 47:     if (className) {
 48:       PetscLogInfoDeactivateClass(AO_COOKIE);
 49:     }
 50:     PetscStrstr(logList, "da", &className);
 51:     if (className) {
 52:       PetscLogInfoDeactivateClass(DA_COOKIE);
 53:     }
 54:   }
 55:   /* Process summary exclusions */
 56:   PetscOptionsGetString(PETSC_NULL, "-log_summary_exclude", logList, 256, &opt);
 57:   if (opt == PETSC_TRUE) {
 58:     PetscStrstr(logList, "ao", &className);
 59:     if (className) {
 60:       PetscLogEventDeactivateClass(AO_COOKIE);
 61:     }
 62:     PetscStrstr(logList, "da", &className);
 63:     if (className) {
 64:       PetscLogEventDeactivateClass(DA_COOKIE);
 65:     }
 66:   }
 67:   return(0);
 68: }

 70: #ifdef PETSC_USE_DYNAMIC_LIBRARIES
 71: EXTERN_C_BEGIN
 74: /*
 75:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

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

 80:   Input Parameter:
 81:   path - library path
 82: */
 83: int PetscDLLibraryRegister(char *path)
 84: {

 87:   PetscInitializeNoArguments();
 88:   if (ierr) return(1);

 90:   /*
 91:       If we got here then PETSc was properly loaded
 92:   */
 93:   DMInitializePackage(path);
 94:   return(0);
 95: }
 96: EXTERN_C_END

 98: /* --------------------------------------------------------------------------*/
 99: static const char *contents = "PETSc Distributed Structures library, includes\n\
100: Application Orderings, Application Data, and Distributed Arrays";
101: static const char *authors  = PETSC_AUTHOR_INFO;

103:  #include src/sys/src/utils/dlregis.h

105: /* --------------------------------------------------------------------------*/

107: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */