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(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:   PetscLogEventRegister(&DAEvents[DA_LocalADFunction],    "DALocalADFunc",        DA_COOKIE);
 45:   /* Process info exclusions */
 46:   PetscOptionsGetString(PETSC_NULL, "-log_info_exclude", logList, 256, &opt);
 47:   if (opt == PETSC_TRUE) {
 48:     PetscStrstr(logList, "ao", &className);
 49:     if (className) {
 50:       PetscLogInfoDeactivateClass(AO_COOKIE);
 51:     }
 52:     PetscStrstr(logList, "da", &className);
 53:     if (className) {
 54:       PetscLogInfoDeactivateClass(DA_COOKIE);
 55:     }
 56:   }
 57:   /* Process summary exclusions */
 58:   PetscOptionsGetString(PETSC_NULL, "-log_summary_exclude", logList, 256, &opt);
 59:   if (opt == PETSC_TRUE) {
 60:     PetscStrstr(logList, "ao", &className);
 61:     if (className) {
 62:       PetscLogEventDeactivateClass(AO_COOKIE);
 63:     }
 64:     PetscStrstr(logList, "da", &className);
 65:     if (className) {
 66:       PetscLogEventDeactivateClass(DA_COOKIE);
 67:     }
 68:   }
 69:   return(0);
 70: }

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

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

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

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

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

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

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

107: /* --------------------------------------------------------------------------*/

109: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */