xref: /petsc/src/ksp/pc/impls/python/pythonpc.c (revision 759190395b54fdd00f8c2c9057722ad57da9afab)
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 {
21   PetscFunctionBegin;
22   PetscValidHeaderSpecific(pc,PC_CLASSID,1);
23   PetscValidCharPointer(pyname,2);
24   PetscTryMethod(pc,"PCPythonSetType_C",(PC, const char[]),(pc,pyname));
25   PetscFunctionReturn(0);
26 }
27 
28 /*@C
29    PCPythonGetType - Get the type of a PC object implemented in Python.
30 
31    Not collective
32 
33    Input Parameter:
34 .  pc - the preconditioner (PC) context.
35 
36    Output Parameter:
37 .  pyname - full dotted Python name [package].module[.{class|function}]
38 
39    Level: intermediate
40 
41 .seealso: `PCCreate()`, `PCSetType()`, `PCPYTHON`, `PetscPythonInitialize()`, `PCPythonSetType()`
42 @*/
43 PetscErrorCode  PCPythonGetType(PC pc,const char *pyname[])
44 {
45   PetscFunctionBegin;
46   PetscValidHeaderSpecific(pc,PC_CLASSID,1);
47   PetscValidPointer(pyname,2);
48   PetscUseMethod(pc,"PCPythonGetType_C",(PC, const char*[]),(pc,pyname));
49   PetscFunctionReturn(0);
50 }
51