Actual source code: pythonpc.c

  1: #include <petsc/private/pcimpl.h>

  3: /*@
  4:    PCPythonSetType - Initialize a `PC` object implemented in Python, a `PCPYTHON`.

  6:    Collective

  8:    Input Parameters:
  9: +  pc - the preconditioner (`PC`) context.
 10: -  pyname - full dotted Python name [package].module[.{class|function}]

 12:    Options Database Key:
 13: .  -pc_python_type <pyname> - python class

 15:    Level: intermediate

 17: .seealso: [](ch_ksp), `PC`, `PCSHELL`, `PCCreate()`, `PCSetType()`, `PCPYTHON`, `PetscPythonInitialize()`
 18: @*/
 19: PetscErrorCode PCPythonSetType(PC pc, const char pyname[])
 20: {
 21:   PetscFunctionBegin;
 23:   PetscAssertPointer(pyname, 2);
 24:   PetscTryMethod(pc, "PCPythonSetType_C", (PC, const char[]), (pc, pyname));
 25:   PetscFunctionReturn(PETSC_SUCCESS);
 26: }

 28: /*@
 29:    PCPythonGetType - Get the type of a `PC` object implemented in Python, a `PCPYTHON`.

 31:    Not Collective

 33:    Input Parameter:
 34: .  pc - the preconditioner (`PC`) context.

 36:    Output Parameter:
 37: .  pyname - full dotted Python name [package].module[.{class|function}]

 39:    Level: intermediate

 41: .seealso: [](ch_ksp), `PC`, `PCSHELL`, `PCCreate()`, `PCSetType()`, `PCPYTHON`, `PetscPythonInitialize()`, `PCPythonSetType()`
 42: @*/
 43: PetscErrorCode PCPythonGetType(PC pc, const char *pyname[])
 44: {
 45:   PetscFunctionBegin;
 47:   PetscAssertPointer(pyname, 2);
 48:   PetscUseMethod(pc, "PCPythonGetType_C", (PC, const char *[]), (pc, pyname));
 49:   PetscFunctionReturn(PETSC_SUCCESS);
 50: }