xref: /petsc/src/ksp/ksp/impls/python/pythonksp.c (revision a69119a591a03a9d906b29c0a4e9802e4d7c9795)
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   PetscFunctionBegin;
21   PetscValidHeaderSpecific(ksp, KSP_CLASSID, 1);
22   PetscValidCharPointer(pyname, 2);
23   PetscTryMethod(ksp, "KSPPythonSetType_C", (KSP, const char[]), (ksp, pyname));
24   PetscFunctionReturn(0);
25 }
26 
27 /*@C
28    KSPPythonGetType - Get the type of a KSP object implemented in Python.
29 
30    Not collective
31 
32    Input Parameter:
33 .  ksp - the linear solver (KSP) context.
34 
35    Output Parameter:
36 .  pyname - full dotted Python name [package].module[.{class|function}]
37 
38    Level: intermediate
39 
40 .seealso: `KSPCreate()`, `KSPSetType()`, `KSPPYTHON`, `PetscPythonInitialize()`, `KSPPythonSetType()`
41 @*/
42 PetscErrorCode KSPPythonGetType(KSP ksp, const char *pyname[]) {
43   PetscFunctionBegin;
44   PetscValidHeaderSpecific(ksp, KSP_CLASSID, 1);
45   PetscValidPointer(pyname, 2);
46   PetscUseMethod(ksp, "KSPPythonGetType_C", (KSP, const char *[]), (ksp, pyname));
47   PetscFunctionReturn(0);
48 }
49