Actual source code: slregis.c

  1: #include "../src/semiLagrange/characteristicimpl.h"

  3: static PetscTruth CharacteristicPackageInitialized = PETSC_FALSE;
  6: /*@C
  7:   CharacteristicFinalizePackage - This function destroys everything in the Petsc interface to the charactoristics package. It is
  8:   called from PetscFinalize().

 10:   Level: developer

 12: .keywords: Petsc, destroy, package, mathematica
 13: .seealso: PetscFinalize()
 14: @*/
 15: PetscErrorCode  CharacteristicFinalizePackage(void)
 16: {
 18:   CharacteristicPackageInitialized = PETSC_FALSE;
 19:   CharacteristicRegisterAllCalled = PETSC_FALSE;
 20:   CharacteristicList              = PETSC_NULL;
 21:   return(0);
 22: }

 26: /*@C
 27:   CharacteristicInitializePackage - This function initializes everything in the Characteristic package. It is called
 28:   from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to CharacteristicCreate()
 29:   when using static libraries.

 31:   Input Parameter:
 32:   path - The dynamic library path, or PETSC_NULL

 34:   Level: developer

 36: .keywords: Characteristic, initialize, package
 37: .seealso: PetscInitialize()
 38: @*/
 39: PetscErrorCode CharacteristicInitializePackage(const char path[])
 40: {
 41:   char              logList[256];
 42:   char             *className;
 43:   PetscTruth        opt;
 44:   PetscErrorCode    ierr;

 47:   if (CharacteristicPackageInitialized) return(0);
 48:   CharacteristicPackageInitialized = PETSC_TRUE;
 49:   /* Register Classes */
 50:   PetscCookieRegister("Method of Characteristics",&CHARACTERISTIC_COOKIE);
 51:   /* Register Constructors */
 52:   CharacteristicRegisterAll(path);
 53:   /* Register Events */
 54:   PetscLogEventRegister("MOCSetUp",         CHARACTERISTIC_COOKIE,&CHARACTERISTIC_SetUp);
 55:   PetscLogEventRegister("MOCSolve",         CHARACTERISTIC_COOKIE,&CHARACTERISTIC_Solve);
 56:   PetscLogEventRegister("MOCQueueSetup",    CHARACTERISTIC_COOKIE,&CHARACTERISTIC_QueueSetup);
 57:   PetscLogEventRegister("MOCDAUpdate",      CHARACTERISTIC_COOKIE,&CHARACTERISTIC_DAUpdate);
 58:   PetscLogEventRegister("MOCHalfTimeLocal", CHARACTERISTIC_COOKIE,&CHARACTERISTIC_HalfTimeLocal);
 59:   PetscLogEventRegister("MOCHalfTimeRemot", CHARACTERISTIC_COOKIE,&CHARACTERISTIC_HalfTimeRemote);
 60:   PetscLogEventRegister("MOCHalfTimeExchg", CHARACTERISTIC_COOKIE,&CHARACTERISTIC_HalfTimeExchange);
 61:   PetscLogEventRegister("MOCFullTimeLocal", CHARACTERISTIC_COOKIE,&CHARACTERISTIC_FullTimeLocal);
 62:   PetscLogEventRegister("MOCFullTimeRemot", CHARACTERISTIC_COOKIE,&CHARACTERISTIC_FullTimeRemote);
 63:   PetscLogEventRegister("MOCFullTimeExchg", CHARACTERISTIC_COOKIE,&CHARACTERISTIC_FullTimeExchange);
 64:   /* Process info exclusions */
 65:   PetscOptionsGetString(PETSC_NULL, "-log_info_exclude", logList, 256, &opt);
 66:   if (opt) {
 67:     PetscStrstr(logList, "characteristic", &className);
 68:     if (className) {
 69:       PetscInfoDeactivateClass(CHARACTERISTIC_COOKIE);
 70:     }
 71:   }
 72:   /* Process summary exclusions */
 73:   PetscOptionsGetString(PETSC_NULL, "-log_summary_exclude", logList, 256, &opt);
 74:   if (opt) {
 75:     PetscStrstr(logList, "characteristic", &className);
 76:     if (className) {
 77:       PetscLogEventDeactivateClass(CHARACTERISTIC_COOKIE);
 78:     }
 79:   }
 80:   PetscRegisterFinalize(CharacteristicFinalizePackage);
 81:   return(0);
 82: }

 84: #ifdef PETSC_USE_DYNAMIC_LIBRARIES
 88: /*
 89:   PetscDLLibraryRegister - This function is called when the dynamic library it is in is opened.

 91:   This one registers all the KSP and PC methods that are in the basic PETSc libpetscksp
 92:   library.

 94:   Input Parameter:
 95:   path - library path
 96:  */
 97: PetscErrorCode PetscDLLibraryRegister_petsccontrib(const char path[])
 98: {

101:   PetscInitializeNoArguments(); if (ierr) return 1;

104:   /*
105:       If we got here then PETSc was properly loaded
106:   */
107:   CharacteristicInitializePackage(path);
108:   return(0);
109: }

112: /* --------------------------------------------------------------------------*/
113: static const char *contents = "PETSc Method of Characteristics library.\n";
114: static const char *authors  = "Richard Katz and Matthew G. Knepley\n";

116: /* $Id: dlregis.h,v 1.8 2001/03/23 23:20:45 balay Exp $ */
117: /*
118:    This file is included by all the dlregis.c files to provide common information
119:    on the PETSC team.
120: */

122: static const char *version = "???";

125: /* --------------------------------------------------------------------------*/
128: int PetscDLLibraryInfo(const char *path,const char *type,const char **mess)
129: {
130:   PetscTruth iscon,isaut,isver;
131:   int        ierr;


135:   PetscStrcmp(type,"Contents",&iscon);
136:   PetscStrcmp(type,"Authors",&isaut);
137:   PetscStrcmp(type,"Version",&isver);
138:   if (iscon)      *mess = contents;
139:   else if (isaut) *mess = authors;
140:   else if (isver) *mess = version;
141:   else            *mess = 0;

143:   return(0);
144: }

147: #endif /* PETSC_USE_DYNAMIC_LIBRARIES */