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