1 /* 2 Defines the interface functions for the method of characteristics solvers 3 */ 4 #ifndef __PETSCCHARACTERISTICS_H 5 #define __PETSCCHARACTERISTICS_H 6 7 #include "petscvec.h" 8 #include "petscdmda.h" 9 10 extern PetscErrorCode CharacteristicInitializePackage(const char[]); 11 12 /*S 13 Characteristic - Abstract PETSc object that manages method of characteristics solves 14 15 Level: beginner 16 17 Concepts: Method of characteristics 18 19 .seealso: CharacteristicCreate(), CharacteristicSetType(), CharacteristicType, SNES, TS, PC, KSP 20 S*/ 21 typedef struct _p_Characteristic *Characteristic; 22 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() 27 28 Level: beginner 29 30 .seealso: CharacteristicSetType(), Characteristic 31 E*/ 32 #define CHARACTERISTICDA "da" 33 #define CharacteristicType char* 34 35 extern PetscErrorCode CharacteristicCreate(MPI_Comm, Characteristic *); 36 extern PetscErrorCode CharacteristicSetType(Characteristic, const CharacteristicType); 37 extern PetscErrorCode CharacteristicSetUp(Characteristic); 38 extern PetscErrorCode CharacteristicSetVelocityInterpolation(Characteristic, DM, Vec, Vec, PetscInt, PetscInt[], PetscErrorCode (*)(Vec, PetscReal[], PetscInt, PetscInt[], PetscScalar[], void *), void *); 39 extern PetscErrorCode CharacteristicSetVelocityInterpolationLocal(Characteristic, DM, Vec, Vec, PetscInt, PetscInt[], PetscErrorCode (*)(void *, PetscReal[], PetscInt, PetscInt[], PetscScalar[], void *), void *); 40 extern PetscErrorCode CharacteristicSetFieldInterpolation(Characteristic, DM, Vec, PetscInt, PetscInt[], PetscErrorCode (*)(Vec, PetscReal[], PetscInt, PetscInt[], PetscScalar[], void *), void *); 41 extern PetscErrorCode CharacteristicSetFieldInterpolationLocal(Characteristic, DM, Vec, PetscInt, PetscInt[], PetscErrorCode (*)(void *, PetscReal[], PetscInt, PetscInt[], PetscScalar[], void *), void *); 42 extern PetscErrorCode CharacteristicSolve(Characteristic, PetscReal, Vec); 43 extern PetscErrorCode CharacteristicDestroy(Characteristic*); 44 45 extern PetscFList CharacteristicList; 46 extern PetscErrorCode CharacteristicRegisterAll(const char[]); 47 extern PetscErrorCode CharacteristicRegisterDestroy(void); 48 49 extern PetscErrorCode CharacteristicRegister(const char[],const char[],const char[],PetscErrorCode (*)(Characteristic)); 50 51 /*MC 52 CharacteristicRegisterDynamic - Adds a solver to the method of characteristics package. 53 54 Synopsis: 55 PetscErrorCode CharacteristicRegisterDynamic(const char *name_solver,const char *path,const char *name_create,PetscErrorCode (*routine_create)(Characteristic)) 56 57 Not Collective 58 59 Input Parameters: 60 + name_solver - name of a new user-defined solver 61 . path - path (either absolute or relative) the library containing this solver 62 . name_create - name of routine to create method context 63 - routine_create - routine to create method context 64 65 Notes: 66 CharacteristicRegisterDynamic() may be called multiple times to add several user-defined solvers. 67 68 If dynamic libraries are used, then the fourth input argument (routine_create) 69 is ignored. 70 71 Sample usage: 72 .vb 73 CharacteristicRegisterDynamic("my_solver",/home/username/my_lib/lib/libO/solaris/mylib.a, 74 "MySolverCreate",MySolverCreate); 75 .ve 76 77 Then, your solver can be chosen with the procedural interface via 78 $ CharacteristicSetType(ksp,"my_solver") 79 or at runtime via the option 80 $ -characteristic_type my_solver 81 82 Level: advanced 83 84 Notes: Environmental variables such as ${PETSC_ARCH}, ${PETSC_DIR}, ${PETSC_LIB_DIR}, 85 and others of the form ${any_environmental_variable} occuring in pathname will be 86 replaced with appropriate values. 87 If your function is not being put into a shared library then use CharacteristicRegister() instead 88 89 .keywords: Characteristic, register 90 91 .seealso: CharacteristicRegisterAll(), CharacteristicRegisterDestroy() 92 93 M*/ 94 #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 95 #define CharacteristicRegisterDynamic(a,b,c,d) CharacteristicRegister(a,b,c,0) 96 #else 97 #define CharacteristicRegisterDynamic(a,b,c,d) CharacteristicRegister(a,b,c,d) 98 #endif 99 100 #endif /*__PETSCCHARACTERISTICS_H*/ 101