Actual source code: characteristic.h

  1: /*
  2:    Defines the interface functions for the method of characteristics solvers
  3: */
  4: #ifndef __PETSCCHARACTERISTICS_H

  7: #include <petscvec.h>
  8: #include <petscda.h>

 10: EXTERN PetscErrorCode CharacteristicInitializePackage(const char[]);

 12: /*S
 13:      Characteristic - Abstract PETSc object that manages method of characteristics solves

 15:    Level: beginner

 17:   Concepts: Method of characteristics

 19: .seealso:  CharacteristicCreate(), CharacteristicSetType(), CharacteristicType, SNES, TS, PC, KSP
 20: S*/
 21: typedef struct _p_Characteristic *Characteristic;

 23: /*E
 24:     CharacteristicType - String with the name of a characteristics method or the creation function
 25:        with an optional dynamic library name, for example
 26:        http://www.mcs.anl.gov/petsc/lib.a:mymoccreate()

 28:    Level: beginner

 30: .seealso: CharacteristicSetType(), Characteristic
 31: E*/
 32: #define CHARACTERISTICDA "da"
 33: #define CharacteristicType char*

 35: /* Logging support */

 41: /* function to wrap coordinates around boundary */
 42: EXTERN PetscErrorCode DAMapCoordsToPeriodicDomain(DA, PetscScalar*, PetscScalar*);

 44: EXTERN PetscErrorCode CharacteristicCreate(MPI_Comm, Characteristic *);
 45: EXTERN PetscErrorCode CharacteristicSetType(Characteristic, const CharacteristicType);
 46: EXTERN PetscErrorCode CharacteristicSetUp(Characteristic);
 47: EXTERN PetscErrorCode CharacteristicSetVelocityInterpolation(Characteristic, DA, Vec, Vec, PetscInt, PetscInt[], PetscErrorCode (*)(Vec, PetscReal[], PetscInt, PetscInt[], PetscScalar[], void *), void *);
 48: EXTERN PetscErrorCode CharacteristicSetVelocityInterpolationLocal(Characteristic, DA, Vec, Vec, PetscInt, PetscInt[], PetscErrorCode (*)(void *, PetscReal[], PetscInt, PetscInt[], PetscScalar[], void *), void *);
 49: EXTERN PetscErrorCode CharacteristicSetFieldInterpolation(Characteristic, DA, Vec, PetscInt, PetscInt[], PetscErrorCode (*)(Vec, PetscReal[], PetscInt, PetscInt[], PetscScalar[], void *), void *);
 50: EXTERN PetscErrorCode CharacteristicSetFieldInterpolationLocal(Characteristic, DA, Vec, PetscInt, PetscInt[], PetscErrorCode (*)(void *, PetscReal[], PetscInt, PetscInt[], PetscScalar[], void *), void *);
 51: EXTERN PetscErrorCode CharacteristicSolve(Characteristic, PetscReal, Vec);
 52: EXTERN PetscErrorCode CharacteristicDestroy(Characteristic);

 55: EXTERN PetscErrorCode CharacteristicRegisterAll(const char[]);
 56: EXTERN PetscErrorCode CharacteristicRegisterDestroy(void);

 58: EXTERN PetscErrorCode CharacteristicRegister(const char[],const char[],const char[],PetscErrorCode (*)(Characteristic));

 60: /*MC
 61:    CharacteristicRegisterDynamic - Adds a solver to the method of characteristics package.

 63:    Synopsis:
 64:    PetscErrorCode CharacteristicRegisterDynamic(const char *name_solver,const char *path,const char *name_create,PetscErrorCode (*routine_create)(Characteristic))

 66:    Not Collective

 68:    Input Parameters:
 69: +  name_solver - name of a new user-defined solver
 70: .  path - path (either absolute or relative) the library containing this solver
 71: .  name_create - name of routine to create method context
 72: -  routine_create - routine to create method context

 74:    Notes:
 75:    CharacteristicRegisterDynamic() may be called multiple times to add several user-defined solvers.

 77:    If dynamic libraries are used, then the fourth input argument (routine_create)
 78:    is ignored.

 80:    Sample usage:
 81: .vb
 82:    CharacteristicRegisterDynamic("my_solver",/home/username/my_lib/lib/libO/solaris/mylib.a,
 83:                "MySolverCreate",MySolverCreate);
 84: .ve

 86:    Then, your solver can be chosen with the procedural interface via
 87: $     CharacteristicSetType(ksp,"my_solver")
 88:    or at runtime via the option
 89: $     -characteristic_type my_solver

 91:    Level: advanced

 93:    Notes: Environmental variables such as ${PETSC_ARCH}, ${PETSC_DIR}, ${PETSC_LIB_DIR},
 94:           and others of the form ${any_environmental_variable} occuring in pathname will be 
 95:           replaced with appropriate values.
 96:          If your function is not being put into a shared library then use CharacteristicRegister() instead

 98: .keywords: Characteristic, register

100: .seealso: CharacteristicRegisterAll(), CharacteristicRegisterDestroy()

102: M*/
103: #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
104: #define CharacteristicRegisterDynamic(a,b,c,d) CharacteristicRegister(a,b,c,0)
105: #else
106: #define CharacteristicRegisterDynamic(a,b,c,d) CharacteristicRegister(a,b,c,d)
107: #endif

109: #endif /*__PETSCCHARACTERISTICS_H*/