Galeri Development
The Python interface

Galeri can be used within PyTrilinos. You need to configure Trilinos with the --enable-python flag. PyTrilinos requires SWIG and Numeric; check the PyTrilinos web page for more details.

Once compiled, the Python module of Galeri (PyGaleri) can be imported as

>>> from PyTrilinos import Galeri

The only difference with respect to the C++ code is that Teuchos ParameterList's are replaced by Python's dictionaries. An example of usage is as follows.

>>> from PyTrilinos import Galeri, Epetra, AztecOO
>>> Comm = Epetra.PyComm()
>>> List = {"n": 10}
>>> Map = Galeri.CreateMap("Linear", Comm, List)
>>> Matrix = Galeri.CreateCrsMatrix("Laplace1D", Map, List);
>>> LHS = Epetra.Vector(Map); LHS.PutScalar(0.0)
>>> RHS = Epetra.Vector(Map); RHS.Random()
>>> Solver AztecOO.AztecOO(Matrix, LHS, RHS);
>>> Solver.Iterate(1550, 1e-9);

The above example creates a linear map, with n elements, then a tridiagonal matrix, and solves the linear system using AztecOO.

 All Classes Files Functions Variables