xref: /petsc/src/tao/python/pythontao.c (revision 9371c9d470a9602b6d10a8bf50c9b2280a79e45a)
1 #include <petsc/private/taoimpl.h> /*I "petsctao.h" I*/
2 
3 /*@C
4    TaoPythonSetType - Initialize a Tao object implemented in Python.
5 
6    Collective on tao
7 
8    Input Parameters:
9 +  tao - the optimation solver (Tao) context.
10 -  pyname - full dotted Python name [package].module[.{class|function}]
11 
12    Options Database Key:
13 .  -tao_python_type <pyname> - python class
14 
15    Level: intermediate
16 
17 .seealso: `TaoCreate()`, `TaoSetType()`, `TAOPYTHON`, `PetscPythonInitialize()`
18 @*/
19 PetscErrorCode TaoPythonSetType(Tao tao, const char pyname[]) {
20   PetscFunctionBegin;
21   PetscValidHeaderSpecific(tao, TAO_CLASSID, 1);
22   PetscValidCharPointer(pyname, 2);
23   PetscTryMethod(tao, "TaoPythonSetType_C", (Tao, const char[]), (tao, pyname));
24   PetscFunctionReturn(0);
25 }
26 
27 /*@C
28    TaoPythonGetType - Get the type of a Tao object implemented in Python.
29 
30    Not collective
31 
32    Input Parameter:
33 .  tao - the optimation solver (Tao) context.
34 
35    Output Parameter:
36 .  pyname - full dotted Python name [package].module[.{class|function}]
37 
38    Level: intermediate
39 
40 .seealso: `TaoCreate()`, `TaoSetType()`, `TaoPYTHON`, `PetscPythonInitialize()`, `TaoPythonSetType()`
41 @*/
42 PetscErrorCode TaoPythonGetType(Tao tao, const char *pyname[]) {
43   PetscFunctionBegin;
44   PetscValidHeaderSpecific(tao, TAO_CLASSID, 1);
45   PetscValidPointer(pyname, 2);
46   PetscUseMethod(tao, "TaoPythonGetType_C", (Tao, const char *[]), (tao, pyname));
47   PetscFunctionReturn(0);
48 }
49