130a76a96SBarry Smith /* 230a76a96SBarry Smith Defines the interface functions for the method of characteristics solvers 330a76a96SBarry Smith */ 430a76a96SBarry Smith #ifndef __PETSCCHARACTERISTICS_H 530a76a96SBarry Smith #define __PETSCCHARACTERISTICS_H 630a76a96SBarry Smith 730a76a96SBarry Smith #include "petscvec.h" 830a76a96SBarry Smith #include "petscdmda.h" 930a76a96SBarry Smith 1030a76a96SBarry Smith extern PetscErrorCode CharacteristicInitializePackage(const char[]); 1130a76a96SBarry Smith 1230a76a96SBarry Smith /*S 1330a76a96SBarry Smith Characteristic - Abstract PETSc object that manages method of characteristics solves 1430a76a96SBarry Smith 1530a76a96SBarry Smith Level: beginner 1630a76a96SBarry Smith 1730a76a96SBarry Smith Concepts: Method of characteristics 1830a76a96SBarry Smith 1930a76a96SBarry Smith .seealso: CharacteristicCreate(), CharacteristicSetType(), CharacteristicType, SNES, TS, PC, KSP 2030a76a96SBarry Smith S*/ 2130a76a96SBarry Smith typedef struct _p_Characteristic *Characteristic; 2230a76a96SBarry Smith 23*76bdecfbSBarry Smith /*J 2430a76a96SBarry Smith CharacteristicType - String with the name of a characteristics method or the creation function 2530a76a96SBarry Smith with an optional dynamic library name, for example 2630a76a96SBarry Smith http://www.mcs.anl.gov/petsc/lib.a:mymoccreate() 2730a76a96SBarry Smith 2830a76a96SBarry Smith Level: beginner 2930a76a96SBarry Smith 3030a76a96SBarry Smith .seealso: CharacteristicSetType(), Characteristic 31*76bdecfbSBarry Smith J*/ 3230a76a96SBarry Smith #define CHARACTERISTICDA "da" 3330a76a96SBarry Smith #define CharacteristicType char* 3430a76a96SBarry Smith 3530a76a96SBarry Smith extern PetscErrorCode CharacteristicCreate(MPI_Comm, Characteristic *); 3630a76a96SBarry Smith extern PetscErrorCode CharacteristicSetType(Characteristic, const CharacteristicType); 3730a76a96SBarry Smith extern PetscErrorCode CharacteristicSetUp(Characteristic); 3830a76a96SBarry Smith extern PetscErrorCode CharacteristicSetVelocityInterpolation(Characteristic, DM, Vec, Vec, PetscInt, PetscInt[], PetscErrorCode (*)(Vec, PetscReal[], PetscInt, PetscInt[], PetscScalar[], void *), void *); 3930a76a96SBarry Smith extern PetscErrorCode CharacteristicSetVelocityInterpolationLocal(Characteristic, DM, Vec, Vec, PetscInt, PetscInt[], PetscErrorCode (*)(void *, PetscReal[], PetscInt, PetscInt[], PetscScalar[], void *), void *); 4030a76a96SBarry Smith extern PetscErrorCode CharacteristicSetFieldInterpolation(Characteristic, DM, Vec, PetscInt, PetscInt[], PetscErrorCode (*)(Vec, PetscReal[], PetscInt, PetscInt[], PetscScalar[], void *), void *); 4130a76a96SBarry Smith extern PetscErrorCode CharacteristicSetFieldInterpolationLocal(Characteristic, DM, Vec, PetscInt, PetscInt[], PetscErrorCode (*)(void *, PetscReal[], PetscInt, PetscInt[], PetscScalar[], void *), void *); 4230a76a96SBarry Smith extern PetscErrorCode CharacteristicSolve(Characteristic, PetscReal, Vec); 4330a76a96SBarry Smith extern PetscErrorCode CharacteristicDestroy(Characteristic*); 4430a76a96SBarry Smith 4530a76a96SBarry Smith extern PetscFList CharacteristicList; 4630a76a96SBarry Smith extern PetscErrorCode CharacteristicRegisterAll(const char[]); 4730a76a96SBarry Smith extern PetscErrorCode CharacteristicRegisterDestroy(void); 4830a76a96SBarry Smith 4930a76a96SBarry Smith extern PetscErrorCode CharacteristicRegister(const char[],const char[],const char[],PetscErrorCode (*)(Characteristic)); 5030a76a96SBarry Smith 5130a76a96SBarry Smith /*MC 5230a76a96SBarry Smith CharacteristicRegisterDynamic - Adds a solver to the method of characteristics package. 5330a76a96SBarry Smith 5430a76a96SBarry Smith Synopsis: 5530a76a96SBarry Smith PetscErrorCode CharacteristicRegisterDynamic(const char *name_solver,const char *path,const char *name_create,PetscErrorCode (*routine_create)(Characteristic)) 5630a76a96SBarry Smith 5730a76a96SBarry Smith Not Collective 5830a76a96SBarry Smith 5930a76a96SBarry Smith Input Parameters: 6030a76a96SBarry Smith + name_solver - name of a new user-defined solver 6130a76a96SBarry Smith . path - path (either absolute or relative) the library containing this solver 6230a76a96SBarry Smith . name_create - name of routine to create method context 6330a76a96SBarry Smith - routine_create - routine to create method context 6430a76a96SBarry Smith 6530a76a96SBarry Smith Notes: 6630a76a96SBarry Smith CharacteristicRegisterDynamic() may be called multiple times to add several user-defined solvers. 6730a76a96SBarry Smith 6830a76a96SBarry Smith If dynamic libraries are used, then the fourth input argument (routine_create) 6930a76a96SBarry Smith is ignored. 7030a76a96SBarry Smith 7130a76a96SBarry Smith Sample usage: 7230a76a96SBarry Smith .vb 7330a76a96SBarry Smith CharacteristicRegisterDynamic("my_solver",/home/username/my_lib/lib/libO/solaris/mylib.a, 7430a76a96SBarry Smith "MySolverCreate",MySolverCreate); 7530a76a96SBarry Smith .ve 7630a76a96SBarry Smith 7730a76a96SBarry Smith Then, your solver can be chosen with the procedural interface via 7830a76a96SBarry Smith $ CharacteristicSetType(ksp,"my_solver") 7930a76a96SBarry Smith or at runtime via the option 8030a76a96SBarry Smith $ -characteristic_type my_solver 8130a76a96SBarry Smith 8230a76a96SBarry Smith Level: advanced 8330a76a96SBarry Smith 8430a76a96SBarry Smith Notes: Environmental variables such as ${PETSC_ARCH}, ${PETSC_DIR}, ${PETSC_LIB_DIR}, 8530a76a96SBarry Smith and others of the form ${any_environmental_variable} occuring in pathname will be 8630a76a96SBarry Smith replaced with appropriate values. 8730a76a96SBarry Smith If your function is not being put into a shared library then use CharacteristicRegister() instead 8830a76a96SBarry Smith 8930a76a96SBarry Smith .keywords: Characteristic, register 9030a76a96SBarry Smith 9130a76a96SBarry Smith .seealso: CharacteristicRegisterAll(), CharacteristicRegisterDestroy() 9230a76a96SBarry Smith 9330a76a96SBarry Smith M*/ 9430a76a96SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 9530a76a96SBarry Smith #define CharacteristicRegisterDynamic(a,b,c,d) CharacteristicRegister(a,b,c,0) 9630a76a96SBarry Smith #else 9730a76a96SBarry Smith #define CharacteristicRegisterDynamic(a,b,c,d) CharacteristicRegister(a,b,c,d) 9830a76a96SBarry Smith #endif 9930a76a96SBarry Smith 10030a76a96SBarry Smith #endif /*__PETSCCHARACTERISTICS_H*/ 101