xref: /petsc/src/ksp/ksp/impls/python/pythonksp.c (revision c7e2be787d2516ba220992c3998880cc5ca7778f)
1 #include <petsc/private/kspimpl.h>          /*I "petscksp.h" I*/
2 
3 /*@C
4    KSPPythonSetType - Initialize a KSP object implemented in Python.
5 
6    Collective on ksp
7 
8    Input Parameters:
9 +  ksp - the linear solver (KSP) context.
10 -  pyname - full dotted Python name [package].module[.{class|function}]
11 
12    Options Database Key:
13 .  -ksp_python_type <pyname> - python class
14 
15    Level: intermediate
16 
17 .seealso: `KSPCreate()`, `KSPSetType()`, `KSPPYTHON`, `PetscPythonInitialize()`
18 @*/
19 PetscErrorCode  KSPPythonSetType(KSP ksp,const char pyname[])
20 {
21   PetscFunctionBegin;
22   PetscValidHeaderSpecific(ksp,KSP_CLASSID,1);
23   PetscValidCharPointer(pyname,2);
24   PetscTryMethod(ksp,"KSPPythonSetType_C",(KSP, const char[]),(ksp,pyname));
25   PetscFunctionReturn(0);
26 }
27 
28 /*@C
29    KSPPythonGetType - Get the type of a KSP object implemented in Python.
30 
31    Not collective
32 
33    Input Parameter:
34 .  ksp - the linear solver (KSP) context.
35 
36    Output Parameter:
37 .  pyname - full dotted Python name [package].module[.{class|function}]
38 
39    Level: intermediate
40 
41 .seealso: `KSPCreate()`, `KSPSetType()`, `KSPPYTHON`, `PetscPythonInitialize()`, `KSPPythonSetType()`
42 @*/
43 PetscErrorCode  KSPPythonGetType(KSP ksp,const char *pyname[])
44 {
45   PetscFunctionBegin;
46   PetscValidHeaderSpecific(ksp,KSP_CLASSID,1);
47   PetscValidPointer(pyname,2);
48   PetscUseMethod(ksp,"KSPPythonGetType_C",(KSP, const char*[]),(ksp,pyname));
49   PetscFunctionReturn(0);
50 }
51