xref: /petsc/src/tao/python/pythontao.c (revision 27f49a208b01d2e827ab9db411a2d16003fe9262)
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
7 
8    Input Parameters:
9 +  tao - the optimization 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 {
21   PetscFunctionBegin;
22   PetscValidHeaderSpecific(tao, TAO_CLASSID, 1);
23   PetscValidCharPointer(pyname, 2);
24   PetscTryMethod(tao, "TaoPythonSetType_C", (Tao, const char[]), (tao, pyname));
25   PetscFunctionReturn(PETSC_SUCCESS);
26 }
27 
28 /*@C
29    TaoPythonGetType - Get the type of a `Tao` object implemented in Python.
30 
31    Not Collective
32 
33    Input Parameter:
34 .  tao - the optimization solver (`Tao`) context.
35 
36    Output Parameter:
37 .  pyname - full dotted Python name [package].module[.{class|function}]
38 
39    Level: intermediate
40 
41 .seealso: `TaoCreate()`, `TaoSetType()`, `TaoPYTHON`, `PetscPythonInitialize()`, `TaoPythonSetType()`
42 @*/
43 PetscErrorCode TaoPythonGetType(Tao tao, const char *pyname[])
44 {
45   PetscFunctionBegin;
46   PetscValidHeaderSpecific(tao, TAO_CLASSID, 1);
47   PetscValidPointer(pyname, 2);
48   PetscUseMethod(tao, "TaoPythonGetType_C", (Tao, const char *[]), (tao, pyname));
49   PetscFunctionReturn(PETSC_SUCCESS);
50 }
51