xref: /petsc/src/ts/impls/python/pythonts.c (revision da93591f59bc1e95f467c6fc21a755040df0b8f3)
1 #include "private/tsimpl.h"          /*I "petscts.h" I*/
2 
3 #undef __FUNCT__
4 #define __FUNCT__ "TSPythonSetType"
5 /*@C
6    TSPythonSetType - Initalize a TS object implemented in Python.
7 
8    Collective on TS
9 
10    Input Parameter:
11 +  ts - the nonlinear solver (TS) context.
12 -  pyname - full dotted Python name [package].module[.{class|function}]
13 
14    Options Database Key:
15 .  -ts_python_type <pyname>
16 
17    Level: intermediate
18 
19 .keywords: TS, Python
20 
21 .seealso: TSCreate(), TSSetType(), TSPYTHON, PetscPythonInitialize()
22 @*/
23 PetscErrorCode PETSCTS_DLLEXPORT TSPythonSetType(TS ts,const char pyname[])
24 {
25   PetscErrorCode (*f)(TS, const char[]) = 0;
26   PetscErrorCode ierr;
27   PetscFunctionBegin;
28   PetscValidHeaderSpecific(ts,TS_COOKIE,1);
29   PetscValidCharPointer(pyname,2);
30   ierr = PetscObjectQueryFunction((PetscObject)ts,"TSPythonSetType_C",
31 				  (PetscVoidFunction*)&f);CHKERRQ(ierr);
32   if (f) {ierr = (*f)(ts,pyname);CHKERRQ(ierr);}
33   PetscFunctionReturn(0);
34 }
35