Actual source code: pythonksp.c
1: #include <petsc/private/kspimpl.h>
3: /*@C
4: KSPPythonSetType - Initialize a `KSP` object to a type implemented in Python.
6: Collective
8: Input Parameters:
9: + ksp - the linear solver `KSP` context.
10: - pyname - full dotted Python name [package].module[.{class|function}]
12: Options Database Key:
13: . -ksp_python_type <pyname> - python class
15: Level: intermediate
17: .seealso: [](ch_ksp), `KSPCreate()`, `KSPSetType()`, `KSPPYTHON`, `PetscPythonInitialize()`
18: @*/
19: PetscErrorCode KSPPythonSetType(KSP ksp, const char pyname[])
20: {
21: PetscFunctionBegin;
23: PetscAssertPointer(pyname, 2);
24: PetscTryMethod(ksp, "KSPPythonSetType_C", (KSP, const char[]), (ksp, pyname));
25: PetscFunctionReturn(PETSC_SUCCESS);
26: }
28: /*@C
29: KSPPythonGetType - Get the type of a `KSP` object implemented in Python.
31: Not Collective
33: Input Parameter:
34: . ksp - the linear solver `KSP` context.
36: Output Parameter:
37: . pyname - full dotted Python name [package].module[.{class|function}]
39: Level: intermediate
41: .seealso: [](ch_ksp), `KSPCreate()`, `KSPSetType()`, `KSPPYTHON`, `PetscPythonInitialize()`, `KSPPythonSetType()`
42: @*/
43: PetscErrorCode KSPPythonGetType(KSP ksp, const char *pyname[])
44: {
45: PetscFunctionBegin;
47: PetscAssertPointer(pyname, 2);
48: PetscUseMethod(ksp, "KSPPythonGetType_C", (KSP, const char *[]), (ksp, pyname));
49: PetscFunctionReturn(PETSC_SUCCESS);
50: }