Date: 2025-03-29T05:58:49+00:00

Actual source code: pythonts.c

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

      3: /*@
      4:    TSPythonSetType - Initialize a `TS` object implemented in Python.

      6:    Collective

      8:    Input Parameters:
      9: +  ts - the `TS` context
     10: -  pyname - full dotted Python name [package].module[.{class|function}]

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

     15:    Level: intermediate

     17: .seealso: [](ch_ts), `TSCreate()`, `TSSetType()`, `TSPYTHON`, `PetscPythonInitialize()`
     18: @*/
     19: PetscErrorCode TSPythonSetType(TS ts, const char pyname[])
     20: {
     21:   PetscFunctionBegin;
     23:   PetscAssertPointer(pyname, 2);
     24:   PetscTryMethod(ts, "TSPythonSetType_C", (TS, const char[]), (ts, pyname));
     25:   PetscFunctionReturn(PETSC_SUCCESS);
     26: }

     28: /*@
     29:    TSPythonGetType - Get the type of a `TS` object implemented in Python.

     31:    Not Collective

     33:    Input Parameter:
     34: .  ts - the `TS` context

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

     39:    Level: intermediate

     41: .seealso: [](ch_ts), `TSCreate()`, `TSSetType()`, `TSPYTHON`, `PetscPythonInitialize()`, `TSPythonSetType()`
     42: @*/
     43: PetscErrorCode TSPythonGetType(TS ts, const char *pyname[])
     44: {
     45:   PetscFunctionBegin;
     47:   PetscAssertPointer(pyname, 2);
     48:   PetscUseMethod(ts, "TSPythonGetType_C", (TS, const char *[]), (ts, pyname));
     49:   PetscFunctionReturn(PETSC_SUCCESS);
     50: }