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

  8: #undef __FUNCT__  
 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(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 Constructors and Serializers */
 38:   AOSerializeRegisterAll(path);
 39:   /* Register Events */
 40:   PetscLogEventRegister(&AOEvents[AO_PetscToApplication], "AOPetscToApplication", AO_COOKIE);
 41:   PetscLogEventRegister(&AOEvents[AO_ApplicationToPetsc], "AOApplicationToPetsc", AO_COOKIE);
 42:   PetscLogEventRegister(&DAEvents[DA_GlobalToLocal],      "DAGlobalToLocal",      DA_COOKIE);
 43:   PetscLogEventRegister(&DAEvents[DA_LocalToGlobal],      "DALocalToGlobal",      DA_COOKIE);
 44:   /* Process info exclusions */
 45:   PetscOptionsGetString(PETSC_NULL, "-log_info_exclude", logList, 256, &opt);
 46:   if (opt == PETSC_TRUE) {
 47:     PetscStrstr(logList, "ao", &className);
 48:     if (className) {
 49:       PetscLogInfoDeactivateClass(AO_COOKIE);
 50:     }
 51:     PetscStrstr(logList, "da", &className);
 52:     if (className) {
 53:       PetscLogInfoDeactivateClass(DA_COOKIE);
 54:     }
 55:   }
 56:   /* Process summary exclusions */
 57:   PetscOptionsGetString(PETSC_NULL, "-log_summary_exclude", logList, 256, &opt);
 58:   if (opt == PETSC_TRUE) {
 59:     PetscStrstr(logList, "ao", &className);
 60:     if (className) {
 61:       PetscLogEventDeactivateClass(AO_COOKIE);
 62:     }
 63:     PetscStrstr(logList, "da", &className);
 64:     if (className) {
 65:       PetscLogEventDeactivateClass(DA_COOKIE);
 66:     }
 67:   }
 68:   return(0);
 69: }

 71: #ifdef PETSC_USE_DYNAMIC_LIBRARIES
 72: EXTERN_C_BEGIN
 73: #undef __FUNCT__  
 75: /*
 76:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

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

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

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

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

 99: /* --------------------------------------------------------------------------*/
100: static char *contents = "PETSc Distributed Structures library, includesn
101: Application Orderings, Application Data, and Distributed Arrays";
102: static char *authors  = PETSC_AUTHOR_INFO;

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

106: /* --------------------------------------------------------------------------*/

108: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */