Actual source code: pythonsnes.c

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

  3: /*@C
  4:    SNESPythonSetType - Initialize a `SNES` object implemented in Python.

  6:    Collective

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

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

 15:    Level: intermediate

 17: .seealso: `SNESCreate()`, `SNESSetType()`, `SNESPYTHON`, `PetscPythonInitialize()`, `SNESPythonGetType()`
 18: @*/
 19: PetscErrorCode SNESPythonSetType(SNES snes, const char pyname[])
 20: {
 23:   PetscTryMethod(snes, "SNESPythonSetType_C", (SNES, const char[]), (snes, pyname));
 24:   return 0;
 25: }

 27: /*@C
 28:    SNESPythonGetType - Get the type of a `SNES` object implemented in Python.

 30:    Not collective

 32:    Input Parameter:
 33: .  snes - the nonlinear solver (`SNES`) context.

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

 38:    Level: intermediate

 40: .seealso: `SNESCreate()`, `SNESSetType()`, `SNESPYTHON`, `PetscPythonInitialize()`, `SNESPythonSetType()`
 41: @*/
 42: PetscErrorCode SNESPythonGetType(SNES snes, const char *pyname[])
 43: {
 46:   PetscUseMethod(snes, "SNESPythonGetType_C", (SNES, const char *[]), (snes, pyname));
 47:   return 0;
 48: }