~chaffra/+junk/trilinos

« back to all changes in this revision

Viewing changes to packages/WebTrilinos/python/ex_IFPACK.py

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Prud'homme, Christophe Prud'homme, Johannes Ring
  • Date: 2009-12-13 12:53:22 UTC
  • mfrom: (5.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20091213125322-in0nrdjc55deqsw9
Tags: 10.0.3.dfsg-1
[Christophe Prud'homme]
* New upstream release

[Johannes Ring]
* debian/patches/libname.patch: Add prefix 'libtrilinos_' to all
  libraries. 
* debian/patches/soname.patch: Add soversion to libraries.
* debian/watch: Update download URL.
* debian/control:
  - Remove python-numeric from Build-Depends (virtual package).
  - Remove automake and autotools from Build-Depends and add cmake to
    reflect switch to CMake.
  - Add python-support to Build-Depends.
* debian/rules: 
  - Cleanup and updates for switch to CMake.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/env python
2
 
# @HEADER
3
 
# ************************************************************************
4
 
#
5
 
#                WebTrilinos: A Web Interface to Trilinos
6
 
#                 Copyright (2006) Sandia Corporation
7
 
#
8
 
# Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
9
 
# license for use of this work by or on behalf of the U.S. Government.
10
 
#
11
 
# This library is free software; you can redistribute it and/or modify
12
 
# it under the terms of the GNU Lesser General Public License as
13
 
# published by the Free Software Foundation; either version 2.1 of the
14
 
# License, or (at your option) any later version.
15
 
#
16
 
# This library is distributed in the hope that it will be useful, but
17
 
# WITHOUT ANY WARRANTY; without even the implied warranty of
18
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19
 
# Lesser General Public License for more details.
20
 
#
21
 
# You should have received a copy of the GNU Lesser General Public
22
 
# License along with this library; if not, write to the Free Software
23
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24
 
# USA
25
 
# Questions? Contact Marzio Sala (marzio.sala _AT_ gmail.com)
26
 
#
27
 
# ************************************************************************
28
 
# @HEADER
29
 
 
30
 
try:
31
 
  import setpath
32
 
  import Epetra, IFPACK, AztecOO
33
 
except:
34
 
  from PyTrilinos import Epetra, AztecOO, IFPACK
35
 
 
36
 
Comm = Epetra.PyComm()
37
 
 
38
 
NumGlobalElements = 10
39
 
Map = Epetra.Map(NumGlobalElements, 0, Comm)
40
 
MyGlobalElements = Map.MyGlobalElements()
41
 
 
42
 
Matrix = Epetra.CrsMatrix(Epetra.Copy, Map, 0)
43
 
 
44
 
for i in MyGlobalElements:
45
 
  Matrix[i, i] = 1.0
46
 
 
47
 
Matrix.FillComplete()
48
 
 
49
 
 
50
 
Factory = IFPACK.Factory()
51
 
Prec = Factory.Create("ILU", Matrix)
52
 
IFPACKList = {
53
 
  "fact: level-of-fill": 1
54
 
}
55
 
 
56
 
Prec.SetParameters(IFPACKList)
57
 
Prec.Initialize()
58
 
Prec.Compute()
59
 
 
60
 
 
61
 
LHS = Epetra.Vector(Map); LHS.PutScalar(0.0)
62
 
RHS = Epetra.Vector(Map); RHS.Random()
63
 
 
64
 
Solver = AztecOO.AztecOO(Matrix, LHS, RHS)
65
 
 
66
 
Solver.SetPrecOperator(Prec)
67
 
Solver.SetAztecOption(AztecOO.AZ_output, 16)
68
 
Solver.Iterate(1550, 1e-5)
69
 
 
70
 
print Solver.NumIters(), Solver.TrueResidual()