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