xref: /petsc/src/ksp/pc/impls/python/pythonpc.c (revision a69119a591a03a9d906b29c0a4e9802e4d7c9795)
1 #include <petsc/private/pcimpl.h> /*I "petscpc.h" I*/
2 
3 /*@C
4    PCPythonSetType - Initialize a PC object implemented in Python.
5 
6    Collective on PC
7 
8    Input Parameters:
9 +  pc - the preconditioner (PC) context.
10 -  pyname - full dotted Python name [package].module[.{class|function}]
11 
12    Options Database Key:
13 .  -pc_python_type <pyname> - python class
14 
15    Level: intermediate
16 
17 .seealso: `PCCreate()`, `PCSetType()`, `PCPYTHON`, `PetscPythonInitialize()`
18 @*/
19 PetscErrorCode PCPythonSetType(PC pc, const char pyname[]) {
20   PetscFunctionBegin;
21   PetscValidHeaderSpecific(pc, PC_CLASSID, 1);
22   PetscValidCharPointer(pyname, 2);
23   PetscTryMethod(pc, "PCPythonSetType_C", (PC, const char[]), (pc, pyname));
24   PetscFunctionReturn(0);
25 }
26 
27 /*@C
28    PCPythonGetType - Get the type of a PC object implemented in Python.
29 
30    Not collective
31 
32    Input Parameter:
33 .  pc - the preconditioner (PC) context.
34 
35    Output Parameter:
36 .  pyname - full dotted Python name [package].module[.{class|function}]
37 
38    Level: intermediate
39 
40 .seealso: `PCCreate()`, `PCSetType()`, `PCPYTHON`, `PetscPythonInitialize()`, `PCPythonSetType()`
41 @*/
42 PetscErrorCode PCPythonGetType(PC pc, const char *pyname[]) {
43   PetscFunctionBegin;
44   PetscValidHeaderSpecific(pc, PC_CLASSID, 1);
45   PetscValidPointer(pyname, 2);
46   PetscUseMethod(pc, "PCPythonGetType_C", (PC, const char *[]), (pc, pyname));
47   PetscFunctionReturn(0);
48 }
49