/[escript]/trunk/escriptcore/test/python/test_linearPDEs.py
ViewVC logotype

Diff of /trunk/escriptcore/test/python/test_linearPDEs.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2470 by gross, Thu Jun 11 08:32:32 2009 UTC revision 4154 by jfenwick, Tue Jan 22 09:30:23 2013 UTC
# Line 1  Line 1 
1    # -*- coding: utf-8 -*-
2    
3  ########################################################  ##############################################################################
4  #  #
5  # Copyright (c) 2003-2008 by University of Queensland  # Copyright (c) 2003-2013 by University of Queensland
6  # Earth Systems Science Computational Center (ESSCC)  # http://www.uq.edu.au
 # http://www.uq.edu.au/esscc  
7  #  #
8  # Primary Business: Queensland, Australia  # Primary Business: Queensland, Australia
9  # Licensed under the Open Software License version 3.0  # Licensed under the Open Software License version 3.0
10  # http://www.opensource.org/licenses/osl-3.0.php  # http://www.opensource.org/licenses/osl-3.0.php
11  #  #
12  ########################################################  # Development until 2012 by Earth Systems Science Computational Center (ESSCC)
13    # Development since 2012 by School of Earth Sciences
14    #
15    ##############################################################################
16    
17  __copyright__="""Copyright (c) 2003-2008 by University of Queensland  __copyright__="""Copyright (c) 2003-2013 by University of Queensland
18  Earth Systems Science Computational Center (ESSCC)  http://www.uq.edu.au
 http://www.uq.edu.au/esscc  
19  Primary Business: Queensland, Australia"""  Primary Business: Queensland, Australia"""
20  __license__="""Licensed under the Open Software License version 3.0  __license__="""Licensed under the Open Software License version 3.0
21  http://www.opensource.org/licenses/osl-3.0.php"""  http://www.opensource.org/licenses/osl-3.0.php"""
# Line 22  __url__="https://launchpad.net/escript-f Line 24  __url__="https://launchpad.net/escript-f
24  """  """
25  Test suite for linearPDEs class  Test suite for linearPDEs class
26    
 The tests must be linked with a Domain class object in the setUp method:  
   
    from esys.finley import Rectangle  
    class Test_LinearPDEOnFinley(Test_LinearPDE):  
        def setUp(self):  
            self.domain = Rectangle(10,10,2)  
        def tearDown(self):  
            del self.domain  
    suite = unittest.TestSuite()  
    suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinley))  
    unittest.TextTestRunner(verbosity=2).run(suite)  
   
 @var __author__: name of author  
 @var __copyright__: copyrights  
 @var __license__: licence agreement  
 @var __url__: url entry point on documentation  
 @var __version__: version  
 @var __date__: date of the version  
27  """  """
28    
29  __author__="Lutz Gross, l.gross@uq.edu.au"  __author__="Lutz Gross, l.gross@uq.edu.au"
30    
31  from esys.escript.util import Lsup,kronecker,interpolate,whereZero, outer, swap_axes  from esys.escript.util import Lsup,kronecker,interpolate,whereZero, outer, swap_axes
32  from esys.escript import Function,FunctionOnBoundary,FunctionOnContactZero,Solution,ReducedSolution,Vector,ContinuousFunction,Scalar, ReducedFunction,ReducedFunctionOnBoundary,ReducedFunctionOnContactZero,Data, Tensor4, Tensor  from esys.escript import Function,FunctionOnBoundary,FunctionOnContactZero,Solution,ReducedSolution,Vector,ContinuousFunction,Scalar, ReducedFunction,ReducedFunctionOnBoundary,ReducedFunctionOnContactZero,Data, Tensor4, Tensor, getEscriptParamInt
33  from esys.escript.linearPDEs import LinearPDE,IllegalCoefficientValue,Poisson, IllegalCoefficientFunctionSpace, TransportPDE, IllegalCoefficient, Helmholtz, LameEquation, SolverOptions  from esys.escript.linearPDEs import LinearPDE,IllegalCoefficientValue,Poisson, IllegalCoefficientFunctionSpace, TransportPDE, IllegalCoefficient, Helmholtz, LameEquation, SolverOptions
34  import numpy  import numpy
35  import unittest  import unittest
# Line 57  class Test_linearPDEs(unittest.TestCase) Line 41  class Test_linearPDEs(unittest.TestCase)
41      VERBOSE=False      VERBOSE=False
42      def check(self,arg,ref_arg,tol=None):      def check(self,arg,ref_arg,tol=None):
43          """          """
44          checks if arg and ref_arg are nearly identical using the L{Lsup<esys.escript.util.Lsup>}          checks if arg and ref_arg are nearly identical using the `Lsup`
45          """          """
46          if tol==None: tol=self.TOL          if tol==None: tol=self.TOL
47          return Lsup(arg-ref_arg)<=tol*Lsup(ref_arg)          return Lsup(arg-ref_arg)<=tol*Lsup(ref_arg)
# Line 67  class Test_LameEquation(Test_linearPDEs) Line 51  class Test_LameEquation(Test_linearPDEs)
51      def test_config(self):      def test_config(self):
52          mypde=LameEquation(self.domain,debug=self.DEBUG)          mypde=LameEquation(self.domain,debug=self.DEBUG)
53          d=self.domain.getDim()          d=self.domain.getDim()
54          self.failUnlessEqual((mypde.getNumEquations(),mypde.getNumSolutions(),mypde.isSymmetric()),(d,d,True),"set up incorrect")          self.assertEqual((mypde.getNumEquations(), mypde.getNumSolutions(), mypde.getSolverOptions().isSymmetric()),(d,d,True),"set up incorrect")
55    
56      def test_setCoefficient_q(self):      def test_setCoefficient_q(self):
57          mypde=LameEquation(self.domain,debug=self.DEBUG)          mypde=LameEquation(self.domain,debug=self.DEBUG)
# Line 75  class Test_LameEquation(Test_linearPDEs) Line 59  class Test_LameEquation(Test_linearPDEs)
59          mypde.setValue(q=x)          mypde.setValue(q=x)
60    
61          q_ref=interpolate(x,Solution(self.domain))          q_ref=interpolate(x,Solution(self.domain))
62          self.failUnless(self.check(mypde.getCoefficient("A"),0),"A is not 0")          self.assertTrue(self.check(mypde.getCoefficient("A"),0),"A is not 0")
63          self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")          self.assertTrue(mypde.getCoefficient("B").isEmpty(),"B is not empty")
64          self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")          self.assertTrue(mypde.getCoefficient("C").isEmpty(),"C is not empty")
65          self.failUnless(mypde.getCoefficient("D").isEmpty(),"D is not empty")          self.assertTrue(mypde.getCoefficient("D").isEmpty(),"D is not empty")
66          self.failUnless(mypde.getCoefficient("X").isEmpty(),"X is not empty")          self.assertTrue(mypde.getCoefficient("X").isEmpty(),"X is not empty")
67          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")          self.assertTrue(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
68          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")          self.assertTrue(mypde.getCoefficient("y").isEmpty(),"y is not empty")
69          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")          self.assertTrue(mypde.getCoefficient("d").isEmpty(),"d is not empty")
70          self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")          self.assertTrue(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
71          self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")          self.assertTrue(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
72          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.assertTrue(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
73          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.assertTrue(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
74          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.assertTrue(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
75          self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")          self.assertTrue(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
76          self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")          self.assertTrue(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
77          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")          self.assertTrue(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
78          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          if self.domain.supportsContactElements():
79          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
80          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")
81          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
82          self.failUnless(self.check(mypde.getCoefficient("q"),q_ref),"q is not empty")              self.assertTrue(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
83          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")          self.assertTrue(self.check(mypde.getCoefficient("q"),q_ref),"q is not empty")
84            self.assertTrue(mypde.getCoefficient("r").isEmpty(),"r is not empty")
85    
86    
87      def test_setCoefficient_r(self):      def test_setCoefficient_r(self):
88          mypde=LameEquation(self.domain,debug=self.DEBUG)          mypde=LameEquation(self.domain,debug=self.DEBUG)
# Line 104  class Test_LameEquation(Test_linearPDEs) Line 90  class Test_LameEquation(Test_linearPDEs)
90          mypde.setValue(r=x)          mypde.setValue(r=x)
91    
92          r_ref=interpolate(x,Solution(self.domain))          r_ref=interpolate(x,Solution(self.domain))
93          self.failUnless(self.check(mypde.getCoefficient("A"),0),"A is not 0")          self.assertTrue(self.check(mypde.getCoefficient("A"),0),"A is not 0")
94          self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")          self.assertTrue(mypde.getCoefficient("B").isEmpty(),"B is not empty")
95          self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")          self.assertTrue(mypde.getCoefficient("C").isEmpty(),"C is not empty")
96          self.failUnless(mypde.getCoefficient("D").isEmpty(),"D is not empty")          self.assertTrue(mypde.getCoefficient("D").isEmpty(),"D is not empty")
97          self.failUnless(mypde.getCoefficient("X").isEmpty(),"X is not empty")          self.assertTrue(mypde.getCoefficient("X").isEmpty(),"X is not empty")
98          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")          self.assertTrue(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
99          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")          self.assertTrue(mypde.getCoefficient("y").isEmpty(),"y is not empty")
100          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")          self.assertTrue(mypde.getCoefficient("d").isEmpty(),"d is not empty")
101          self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")          self.assertTrue(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
102          self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")          self.assertTrue(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
103          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.assertTrue(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
104          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.assertTrue(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
105          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.assertTrue(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
106          self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")          self.assertTrue(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
107          self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")          self.assertTrue(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
108          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")          self.assertTrue(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
109          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          if self.domain.supportsContactElements():
110          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
111          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")
112          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
113          self.failUnless(self.check(mypde.getCoefficient("r"),r_ref),"r is nor x")              self.assertTrue(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
114          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")          self.assertTrue(self.check(mypde.getCoefficient("r"),r_ref),"r is nor x")
115            self.assertTrue(mypde.getCoefficient("q").isEmpty(),"q is not empty")
116    
117    
118      def test_setCoefficient_F(self):      def test_setCoefficient_F(self):
# Line 134  class Test_LameEquation(Test_linearPDEs) Line 121  class Test_LameEquation(Test_linearPDEs)
121          mypde.setValue(F=x)          mypde.setValue(F=x)
122    
123          Y_ref=interpolate(x,Function(self.domain))          Y_ref=interpolate(x,Function(self.domain))
124          self.failUnless(self.check(mypde.getCoefficient("A"),0),"A is not 0")          self.assertTrue(self.check(mypde.getCoefficient("A"),0),"A is not 0")
125          self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")          self.assertTrue(mypde.getCoefficient("B").isEmpty(),"B is not empty")
126          self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")          self.assertTrue(mypde.getCoefficient("C").isEmpty(),"C is not empty")
127          self.failUnless(mypde.getCoefficient("D").isEmpty(),"D is not empty")          self.assertTrue(mypde.getCoefficient("D").isEmpty(),"D is not empty")
128          self.failUnless(mypde.getCoefficient("X").isEmpty(),"X is not empty")          self.assertTrue(mypde.getCoefficient("X").isEmpty(),"X is not empty")
129          self.failUnless(self.check(mypde.getCoefficient("Y"),Y_ref),"Y is not x")          self.assertTrue(self.check(mypde.getCoefficient("Y"),Y_ref),"Y is not x")
130          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")          self.assertTrue(mypde.getCoefficient("y").isEmpty(),"y is not empty")
131          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")          self.assertTrue(mypde.getCoefficient("d").isEmpty(),"d is not empty")
132          self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")          self.assertTrue(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
133          self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")          self.assertTrue(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
134          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.assertTrue(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
135          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.assertTrue(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
136          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.assertTrue(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
137          self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")          self.assertTrue(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
138          self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")          self.assertTrue(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
139          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")          self.assertTrue(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
140          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          if self.domain.supportsContactElements():
141          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
142          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
143          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
144          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")              self.assertTrue(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")
145          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")          self.assertTrue(mypde.getCoefficient("q").isEmpty(),"q is not empty")
146            self.assertTrue(mypde.getCoefficient("r").isEmpty(),"r is not empty")
147    
148      def test_setCoefficient_f(self):      def test_setCoefficient_f(self):
149          mypde=LameEquation(self.domain,debug=self.DEBUG)          mypde=LameEquation(self.domain,debug=self.DEBUG)
# Line 163  class Test_LameEquation(Test_linearPDEs) Line 151  class Test_LameEquation(Test_linearPDEs)
151          mypde.setValue(f=x)          mypde.setValue(f=x)
152    
153          y_ref=interpolate(x,FunctionOnBoundary(self.domain))          y_ref=interpolate(x,FunctionOnBoundary(self.domain))
154          self.failUnless(self.check(mypde.getCoefficient("A"),0),"A is not 0")          self.assertTrue(self.check(mypde.getCoefficient("A"),0),"A is not 0")
155          self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")          self.assertTrue(mypde.getCoefficient("B").isEmpty(),"B is not empty")
156          self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")          self.assertTrue(mypde.getCoefficient("C").isEmpty(),"C is not empty")
157          self.failUnless(mypde.getCoefficient("D").isEmpty(),"D is not empty")          self.assertTrue(mypde.getCoefficient("D").isEmpty(),"D is not empty")
158          self.failUnless(mypde.getCoefficient("X").isEmpty(),"X is not empty")          self.assertTrue(mypde.getCoefficient("X").isEmpty(),"X is not empty")
159          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")          self.assertTrue(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
160          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")          self.assertTrue(mypde.getCoefficient("d").isEmpty(),"d is not empty")
161          self.failUnless(self.check(mypde.getCoefficient("y"),y_ref),"d is not x[0]")          self.assertTrue(self.check(mypde.getCoefficient("y"),y_ref),"d is not x[0]")
162          self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")          self.assertTrue(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
163          self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")          self.assertTrue(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
164          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.assertTrue(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
165          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.assertTrue(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
166          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.assertTrue(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
167          self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")          self.assertTrue(mypde.getCoefficient("Y_reduced").isEmpty(),"X_reduced is not empty")
168          self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")          self.assertTrue(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
169          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"X_reduced is not empty")          self.assertTrue(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
170          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          if self.domain.supportsContactElements():
171          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
172          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
173          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
174          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")              self.assertTrue(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")      
175          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")          self.assertTrue(mypde.getCoefficient("q").isEmpty(),"q is not empty")
176            self.assertTrue(mypde.getCoefficient("r").isEmpty(),"r is not empty")
177    
178      def test_setCoefficient_sigma(self):      def test_setCoefficient_sigma(self):
179          mypde=LameEquation(self.domain,debug=self.DEBUG)          mypde=LameEquation(self.domain,debug=self.DEBUG)
# Line 192  class Test_LameEquation(Test_linearPDEs) Line 181  class Test_LameEquation(Test_linearPDEs)
181          mypde.setValue(sigma=outer(x,x))          mypde.setValue(sigma=outer(x,x))
182    
183          X_ref=interpolate(outer(x,x),Function(self.domain))          X_ref=interpolate(outer(x,x),Function(self.domain))
184          self.failUnless(self.check(mypde.getCoefficient("A"),0),"A is not 0")          self.assertTrue(self.check(mypde.getCoefficient("A"),0),"A is not 0")
185          self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")          self.assertTrue(mypde.getCoefficient("B").isEmpty(),"B is not empty")
186          self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")          self.assertTrue(mypde.getCoefficient("C").isEmpty(),"C is not empty")
187          self.failUnless(mypde.getCoefficient("D").isEmpty(),"D is not empty")          self.assertTrue(mypde.getCoefficient("D").isEmpty(),"D is not empty")
188          self.failUnless(self.check(mypde.getCoefficient("X"),X_ref),"X is not x X x")          self.assertTrue(self.check(mypde.getCoefficient("X"),X_ref),"X is not x X x")
189          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")          self.assertTrue(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
190          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")          self.assertTrue(mypde.getCoefficient("d").isEmpty(),"d is not empty")
191          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")          self.assertTrue(mypde.getCoefficient("y").isEmpty(),"y is not empty")
192          self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")          self.assertTrue(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
193          self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")          self.assertTrue(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
194          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.assertTrue(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
195          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.assertTrue(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
196          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.assertTrue(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
197          self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")          self.assertTrue(mypde.getCoefficient("Y_reduced").isEmpty(),"X_reduced is not empty")
198          self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")          self.assertTrue(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
199          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"X_reduced is not empty")          self.assertTrue(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
200          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          if self.domain.supportsContactElements():
201          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
202          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")
203          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
204          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")              self.assertTrue(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
205          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")          self.assertTrue(mypde.getCoefficient("q").isEmpty(),"q is not empty")
206            self.assertTrue(mypde.getCoefficient("r").isEmpty(),"r is not empty")
207    
208      def test_setCoefficient_lambda(self):      def test_setCoefficient_lambda(self):
209          mypde=LameEquation(self.domain,debug=self.DEBUG)          mypde=LameEquation(self.domain,debug=self.DEBUG)
# Line 225  class Test_LameEquation(Test_linearPDEs) Line 215  class Test_LameEquation(Test_linearPDEs)
215          k3Xk3=outer(k3,k3)          k3Xk3=outer(k3,k3)
216          A_ref=x[0]*k3Xk3          A_ref=x[0]*k3Xk3
217    
218          self.failUnless(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")          self.assertTrue(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")
219          self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")          self.assertTrue(mypde.getCoefficient("B").isEmpty(),"B is not empty")
220          self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")          self.assertTrue(mypde.getCoefficient("C").isEmpty(),"C is not empty")
221          self.failUnless(mypde.getCoefficient("D").isEmpty(),"D is not empty")          self.assertTrue(mypde.getCoefficient("D").isEmpty(),"D is not empty")
222          self.failUnless(mypde.getCoefficient("X").isEmpty(),"X is not empty")          self.assertTrue(mypde.getCoefficient("X").isEmpty(),"X is not empty")
223          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")          self.assertTrue(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
224          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")          self.assertTrue(mypde.getCoefficient("d").isEmpty(),"d is not empty")
225          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")          self.assertTrue(mypde.getCoefficient("y").isEmpty(),"y is not empty")
226          self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")          self.assertTrue(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
227          self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")          self.assertTrue(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
228          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.assertTrue(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
229          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.assertTrue(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
230          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.assertTrue(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
231          self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")          self.assertTrue(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
232          self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")          self.assertTrue(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
233          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")          self.assertTrue(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
234          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          if self.domain.supportsContactElements():
235          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
236          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
237          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
238          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")              self.assertTrue(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")      
239          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")          self.assertTrue(mypde.getCoefficient("q").isEmpty(),"q is not empty")
240            self.assertTrue(mypde.getCoefficient("r").isEmpty(),"r is not empty")
241    
242      def test_setCoefficient_mu(self):      def test_setCoefficient_mu(self):
243          mypde=LameEquation(self.domain,debug=self.DEBUG)          mypde=LameEquation(self.domain,debug=self.DEBUG)
# Line 258  class Test_LameEquation(Test_linearPDEs) Line 249  class Test_LameEquation(Test_linearPDEs)
249          k3Xk3=outer(k3,k3)          k3Xk3=outer(k3,k3)
250          A_ref=x[0]*(swap_axes(k3Xk3,0,3)+swap_axes(k3Xk3,1,3))          A_ref=x[0]*(swap_axes(k3Xk3,0,3)+swap_axes(k3Xk3,1,3))
251    
252          self.failUnless(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")          self.assertTrue(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")
253          self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")          self.assertTrue(mypde.getCoefficient("B").isEmpty(),"B is not empty")
254          self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")          self.assertTrue(mypde.getCoefficient("C").isEmpty(),"C is not empty")
255          self.failUnless(mypde.getCoefficient("D").isEmpty(),"D is not empty")          self.assertTrue(mypde.getCoefficient("D").isEmpty(),"D is not empty")
256          self.failUnless(mypde.getCoefficient("X").isEmpty(),"X is not empty")          self.assertTrue(mypde.getCoefficient("X").isEmpty(),"X is not empty")
257          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")          self.assertTrue(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
258          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")          self.assertTrue(mypde.getCoefficient("d").isEmpty(),"d is not empty")
259          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")          self.assertTrue(mypde.getCoefficient("y").isEmpty(),"y is not empty")
260          self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")          self.assertTrue(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
261          self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")          self.assertTrue(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
262          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.assertTrue(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
263          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.assertTrue(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
264          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.assertTrue(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
265          self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")          self.assertTrue(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
266          self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")          self.assertTrue(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
267          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")          self.assertTrue(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
268          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          if self.domain.supportsContactElements():
269          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
270          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
271          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
272          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")              self.assertTrue(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")        
273          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")          self.assertTrue(mypde.getCoefficient("q").isEmpty(),"q is not empty")
274            self.assertTrue(mypde.getCoefficient("r").isEmpty(),"r is not empty")
275    
276      def test_setCoefficient_lambdamu(self):      def test_setCoefficient_lambdamu(self):
277          mypde=LameEquation(self.domain,debug=self.DEBUG)          mypde=LameEquation(self.domain,debug=self.DEBUG)
# Line 290  class Test_LameEquation(Test_linearPDEs) Line 282  class Test_LameEquation(Test_linearPDEs)
282          k3Xk3=outer(k3,k3)          k3Xk3=outer(k3,k3)
283          A_ref=x[0]*k3Xk3+x[1]*(swap_axes(k3Xk3,0,3)+swap_axes(k3Xk3,1,3))          A_ref=x[0]*k3Xk3+x[1]*(swap_axes(k3Xk3,0,3)+swap_axes(k3Xk3,1,3))
284    
285          self.failUnless(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")          self.assertTrue(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")
286          self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")          self.assertTrue(mypde.getCoefficient("B").isEmpty(),"B is not empty")
287          self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")          self.assertTrue(mypde.getCoefficient("C").isEmpty(),"C is not empty")
288          self.failUnless(mypde.getCoefficient("D").isEmpty(),"D is not empty")          self.assertTrue(mypde.getCoefficient("D").isEmpty(),"D is not empty")
289          self.failUnless(mypde.getCoefficient("X").isEmpty(),"X is not empty")          self.assertTrue(mypde.getCoefficient("X").isEmpty(),"X is not empty")
290          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")          self.assertTrue(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
291          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")          self.assertTrue(mypde.getCoefficient("d").isEmpty(),"d is not empty")
292          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")          self.assertTrue(mypde.getCoefficient("y").isEmpty(),"y is not empty")
293          self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")          self.assertTrue(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
294          self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")          self.assertTrue(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
295          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.assertTrue(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
296          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.assertTrue(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
297          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.assertTrue(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
298          self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")          self.assertTrue(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
299          self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")          self.assertTrue(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
300          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")          self.assertTrue(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
301          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          if self.domain.supportsContactElements():
302          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
303          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
304          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
305          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")              self.assertTrue(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")
306          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")          self.assertTrue(mypde.getCoefficient("q").isEmpty(),"q is not empty")
307            self.assertTrue(mypde.getCoefficient("r").isEmpty(),"r is not empty")
308    
309      def test_solve(self):      def test_solve(self):
310         d=self.domain.getDim()         d=self.domain.getDim()
# Line 324  class Test_LameEquation(Test_linearPDEs) Line 317  class Test_LameEquation(Test_linearPDEs)
317         mypde.setValue(q=msk,r=u_ex,lame_mu=3,lame_lambda=50,f=(2*3+50*d)*FunctionOnBoundary(self.domain).getNormal())         mypde.setValue(q=msk,r=u_ex,lame_mu=3,lame_lambda=50,f=(2*3+50*d)*FunctionOnBoundary(self.domain).getNormal())
318    
319         u=mypde.getSolution()         u=mypde.getSolution()
320         self.failUnless(self.check(u,u_ex,10*self.TOL),"incorrect solution")         self.assertTrue(self.check(u,u_ex,10*self.TOL),"incorrect solution")
321    
322  class Test_Helmholtz(Test_linearPDEs):  class Test_Helmholtz(Test_linearPDEs):
323    
324      def test_config(self):      def test_config(self):
325          mypde=Helmholtz(self.domain,debug=self.DEBUG)          mypde=Helmholtz(self.domain,debug=self.DEBUG)
326          self.failUnlessEqual((mypde.getNumEquations(),mypde.getNumSolutions(),mypde.isSymmetric()),(1,1,True),"set up incorrect")          self.assertEqual((mypde.getNumEquations(), mypde.getNumSolutions(), mypde.getSolverOptions().isSymmetric()),(1,1,True),"set up incorrect")
327      def test_setCoefficient_q(self):      def test_setCoefficient_q(self):
328          mypde=Helmholtz(self.domain,debug=self.DEBUG)          mypde=Helmholtz(self.domain,debug=self.DEBUG)
329          x=self.domain.getX()          x=self.domain.getX()
# Line 339  class Test_Helmholtz(Test_linearPDEs): Line 332  class Test_Helmholtz(Test_linearPDEs):
332          q_ref=interpolate(whereZero(x[0]),Solution(self.domain))          q_ref=interpolate(whereZero(x[0]),Solution(self.domain))
333          A_ref=kronecker(self.domain)          A_ref=kronecker(self.domain)
334    
335          self.failUnless(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")          self.assertTrue(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")
336          self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")          self.assertTrue(mypde.getCoefficient("B").isEmpty(),"B is not empty")
337          self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")          self.assertTrue(mypde.getCoefficient("C").isEmpty(),"C is not empty")
338          self.failUnless(mypde.getCoefficient("D").isEmpty(),"D is not empty")          self.assertTrue(mypde.getCoefficient("D").isEmpty(),"D is not empty")
339          self.failUnless(mypde.getCoefficient("X").isEmpty(),"X is not empty")          self.assertTrue(mypde.getCoefficient("X").isEmpty(),"X is not empty")
340          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")          self.assertTrue(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
341          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")          self.assertTrue(mypde.getCoefficient("y").isEmpty(),"y is not empty")
342          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")          self.assertTrue(mypde.getCoefficient("d").isEmpty(),"d is not empty")
343          self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")          self.assertTrue(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
344          self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")          self.assertTrue(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
345          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.assertTrue(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
346          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.assertTrue(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
347          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.assertTrue(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
348          self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")          self.assertTrue(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
349          self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")          self.assertTrue(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
350          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")          self.assertTrue(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
351          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          if self.domain.supportsContactElements():
352          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
353          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
354          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
355          self.failUnless(self.check(mypde.getCoefficient("q"),q_ref),"q is not empty")              self.assertTrue(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")      
356          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")          self.assertTrue(self.check(mypde.getCoefficient("q"),q_ref),"q is not empty")
357            self.assertTrue(mypde.getCoefficient("r").isEmpty(),"r is not empty")
358    
359      def test_setCoefficient_r(self):      def test_setCoefficient_r(self):
360          mypde=Helmholtz(self.domain,debug=self.DEBUG)          mypde=Helmholtz(self.domain,debug=self.DEBUG)
# Line 369  class Test_Helmholtz(Test_linearPDEs): Line 363  class Test_Helmholtz(Test_linearPDEs):
363    
364          r_ref=interpolate(x[0],Solution(self.domain))          r_ref=interpolate(x[0],Solution(self.domain))
365          A_ref=kronecker(self.domain)          A_ref=kronecker(self.domain)
366          self.failUnless(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")          self.assertTrue(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")
367          self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")          self.assertTrue(mypde.getCoefficient("B").isEmpty(),"B is not empty")
368          self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")          self.assertTrue(mypde.getCoefficient("C").isEmpty(),"C is not empty")
369          self.failUnless(mypde.getCoefficient("D").isEmpty(),"D is not empty")          self.assertTrue(mypde.getCoefficient("D").isEmpty(),"D is not empty")
370          self.failUnless(mypde.getCoefficient("X").isEmpty(),"X is not empty")          self.assertTrue(mypde.getCoefficient("X").isEmpty(),"X is not empty")
371          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")          self.assertTrue(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
372          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")          self.assertTrue(mypde.getCoefficient("y").isEmpty(),"y is not empty")
373          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")          self.assertTrue(mypde.getCoefficient("d").isEmpty(),"d is not empty")
374          self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")          self.assertTrue(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
375          self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")          self.assertTrue(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
376          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.assertTrue(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
377          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.assertTrue(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
378          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.assertTrue(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
379          self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")          self.assertTrue(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
380          self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")          self.assertTrue(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
381          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")          self.assertTrue(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
382          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          if self.domain.supportsContactElements():
383          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
384          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
385          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
386          self.failUnless(self.check(mypde.getCoefficient("r"),r_ref),"r is nor x[0]")              self.assertTrue(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")
387          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")          self.assertTrue(self.check(mypde.getCoefficient("r"),r_ref),"r is nor x[0]")
388            self.assertTrue(mypde.getCoefficient("q").isEmpty(),"q is not empty")
389    
390    
391      def test_setCoefficient_f(self):      def test_setCoefficient_f(self):
# Line 400  class Test_Helmholtz(Test_linearPDEs): Line 395  class Test_Helmholtz(Test_linearPDEs):
395    
396          Y_ref=interpolate(x[0],Function(self.domain))          Y_ref=interpolate(x[0],Function(self.domain))
397          A_ref=kronecker(self.domain)          A_ref=kronecker(self.domain)
398          self.failUnless(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")          self.assertTrue(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")
399          self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")          self.assertTrue(mypde.getCoefficient("B").isEmpty(),"B is not empty")
400          self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")          self.assertTrue(mypde.getCoefficient("C").isEmpty(),"C is not empty")
401          self.failUnless(mypde.getCoefficient("D").isEmpty(),"D is not empty")          self.assertTrue(mypde.getCoefficient("D").isEmpty(),"D is not empty")
402          self.failUnless(mypde.getCoefficient("X").isEmpty(),"X is not empty")          self.assertTrue(mypde.getCoefficient("X").isEmpty(),"X is not empty")
403          self.failUnless(self.check(mypde.getCoefficient("Y"),Y_ref),"Y is not x[0]")          self.assertTrue(self.check(mypde.getCoefficient("Y"),Y_ref),"Y is not x[0]")
404          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")          self.assertTrue(mypde.getCoefficient("y").isEmpty(),"y is not empty")
405          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")          self.assertTrue(mypde.getCoefficient("d").isEmpty(),"d is not empty")
406          self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")          self.assertTrue(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
407          self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")          self.assertTrue(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
408          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.assertTrue(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
409          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.assertTrue(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
410          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.assertTrue(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
411          self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")          self.assertTrue(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
412          self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")          self.assertTrue(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
413          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")          self.assertTrue(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
414          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          if self.domain.supportsContactElements():
415          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
416          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
417          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
418          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")              self.assertTrue(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")      
419          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")          self.assertTrue(mypde.getCoefficient("q").isEmpty(),"q is not empty")
420            self.assertTrue(mypde.getCoefficient("r").isEmpty(),"r is not empty")
421    
422      def test_setCoefficient_alpha(self):      def test_setCoefficient_alpha(self):
423          mypde=Helmholtz(self.domain,debug=self.DEBUG)          mypde=Helmholtz(self.domain,debug=self.DEBUG)
# Line 430  class Test_Helmholtz(Test_linearPDEs): Line 426  class Test_Helmholtz(Test_linearPDEs):
426    
427          d_ref=interpolate(x[0],FunctionOnBoundary(self.domain))          d_ref=interpolate(x[0],FunctionOnBoundary(self.domain))
428          A_ref=kronecker(self.domain)          A_ref=kronecker(self.domain)
429          self.failUnless(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")          self.assertTrue(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")
430          self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")          self.assertTrue(mypde.getCoefficient("B").isEmpty(),"B is not empty")
431          self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")          self.assertTrue(mypde.getCoefficient("C").isEmpty(),"C is not empty")
432          self.failUnless(mypde.getCoefficient("D").isEmpty(),"D is not empty")          self.assertTrue(mypde.getCoefficient("D").isEmpty(),"D is not empty")
433          self.failUnless(mypde.getCoefficient("X").isEmpty(),"X is not empty")          self.assertTrue(mypde.getCoefficient("X").isEmpty(),"X is not empty")
434          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")          self.assertTrue(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
435          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")          self.assertTrue(mypde.getCoefficient("y").isEmpty(),"y is not empty")
436          self.failUnless(self.check(mypde.getCoefficient("d"),d_ref),"d is not x[0]")          self.assertTrue(self.check(mypde.getCoefficient("d"),d_ref),"d is not x[0]")
437          self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")          self.assertTrue(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
438          self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")          self.assertTrue(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
439          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.assertTrue(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
440          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.assertTrue(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
441          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.assertTrue(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
442          self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")          self.assertTrue(mypde.getCoefficient("Y_reduced").isEmpty(),"X_reduced is not empty")
443          self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")          self.assertTrue(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
444          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"X_reduced is not empty")          self.assertTrue(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
445          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          if self.domain.supportsContactElements():
446          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
447          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
448          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
449          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")              self.assertTrue(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")      
450          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")          self.assertTrue(mypde.getCoefficient("q").isEmpty(),"q is not empty")
451            self.assertTrue(mypde.getCoefficient("r").isEmpty(),"r is not empty")
452    
453      def test_setCoefficient_g(self):      def test_setCoefficient_g(self):
454          mypde=Helmholtz(self.domain,debug=self.DEBUG)          mypde=Helmholtz(self.domain,debug=self.DEBUG)
# Line 460  class Test_Helmholtz(Test_linearPDEs): Line 457  class Test_Helmholtz(Test_linearPDEs):
457    
458          y_ref=interpolate(x[0],FunctionOnBoundary(self.domain))          y_ref=interpolate(x[0],FunctionOnBoundary(self.domain))
459          A_ref=kronecker(self.domain)          A_ref=kronecker(self.domain)
460          self.failUnless(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")          self.assertTrue(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")
461          self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")          self.assertTrue(mypde.getCoefficient("B").isEmpty(),"B is not empty")
462          self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")          self.assertTrue(mypde.getCoefficient("C").isEmpty(),"C is not empty")
463          self.failUnless(mypde.getCoefficient("D").isEmpty(),"D is not empty")          self.assertTrue(mypde.getCoefficient("D").isEmpty(),"D is not empty")
464          self.failUnless(mypde.getCoefficient("X").isEmpty(),"X is not empty")          self.assertTrue(mypde.getCoefficient("X").isEmpty(),"X is not empty")
465          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")          self.assertTrue(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
466          self.failUnless(self.check(mypde.getCoefficient("y"),y_ref),"y is not x[0]")          self.assertTrue(self.check(mypde.getCoefficient("y"),y_ref),"y is not x[0]")
467          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")          self.assertTrue(mypde.getCoefficient("d").isEmpty(),"d is not empty")
468          self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")          self.assertTrue(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
469          self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")          self.assertTrue(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
470          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.assertTrue(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
471          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.assertTrue(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
472          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.assertTrue(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
473          self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")          self.assertTrue(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
474          self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")          self.assertTrue(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
475          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")          self.assertTrue(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
476          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          if self.domain.supportsContactElements():
477          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
478          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
479          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
480          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")              self.assertTrue(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")      
481          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")          self.assertTrue(mypde.getCoefficient("q").isEmpty(),"q is not empty")
482            self.assertTrue(mypde.getCoefficient("r").isEmpty(),"r is not empty")
483    
484      def test_setCoefficient_omega(self):      def test_setCoefficient_omega(self):
485          mypde=Helmholtz(self.domain,debug=self.DEBUG)          mypde=Helmholtz(self.domain,debug=self.DEBUG)
# Line 490  class Test_Helmholtz(Test_linearPDEs): Line 488  class Test_Helmholtz(Test_linearPDEs):
488    
489          D_ref=interpolate(x[0],Function(self.domain))          D_ref=interpolate(x[0],Function(self.domain))
490          A_ref=kronecker(self.domain)          A_ref=kronecker(self.domain)
491          self.failUnless(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")          self.assertTrue(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")
492          self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")          self.assertTrue(mypde.getCoefficient("B").isEmpty(),"B is not empty")
493          self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")          self.assertTrue(mypde.getCoefficient("C").isEmpty(),"C is not empty")
494          self.failUnless(self.check(mypde.getCoefficient("D"),D_ref),"D is not x[0]")          self.assertTrue(self.check(mypde.getCoefficient("D"),D_ref),"D is not x[0]")
495          self.failUnless(mypde.getCoefficient("X").isEmpty(),"X is not empty")          self.assertTrue(mypde.getCoefficient("X").isEmpty(),"X is not empty")
496          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")          self.assertTrue(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
497          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")          self.assertTrue(mypde.getCoefficient("y").isEmpty(),"y is not empty")
498          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")          self.assertTrue(mypde.getCoefficient("d").isEmpty(),"d is not empty")
499          self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")          self.assertTrue(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
500          self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")          self.assertTrue(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
501          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.assertTrue(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
502          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.assertTrue(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
503          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.assertTrue(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
504          self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")          self.assertTrue(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
505          self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")          self.assertTrue(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
506          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")          self.assertTrue(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
507          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          if self.domain.supportsContactElements():
508          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
509          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
510          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
511          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")              self.assertTrue(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")        
512          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")          self.assertTrue(mypde.getCoefficient("q").isEmpty(),"q is not empty")
513            self.assertTrue(mypde.getCoefficient("r").isEmpty(),"r is not empty")
514    
515      def test_solve(self):      def test_solve(self):
516         d=self.domain.getDim()         d=self.domain.getDim()
# Line 520  class Test_Helmholtz(Test_linearPDEs): Line 519  class Test_Helmholtz(Test_linearPDEs):
519         mypde=Helmholtz(self.domain)         mypde=Helmholtz(self.domain)
520         mypde.setValue(f=3,omega=3,alpha=2,g=2)         mypde.setValue(f=3,omega=3,alpha=2,g=2)
521         u=mypde.getSolution()         u=mypde.getSolution()
522         self.failUnless(self.check(u,u_ex,10*self.TOL),"incorrect solution")         self.assertTrue(self.check(u,u_ex,10*self.TOL),"incorrect solution")
523    
524  class Test_Poisson(Test_linearPDEs):  class Test_Poisson(Test_linearPDEs):
525    
526      def test_config(self):      def test_config(self):
527          mypde=Poisson(self.domain,debug=self.DEBUG)          mypde=Poisson(self.domain,debug=self.DEBUG)
528          self.failUnlessEqual((mypde.getNumEquations(),mypde.getNumSolutions(),mypde.isSymmetric()),(1,1,True),"set up incorrect")          self.assertEqual((mypde.getNumEquations(), mypde.getNumSolutions(), mypde.getSolverOptions().isSymmetric()),(1,1,True),"set up incorrect")
529      def test_setCoefficient_q(self):      def test_setCoefficient_q(self):
530          mypde=Poisson(self.domain,debug=self.DEBUG)          mypde=Poisson(self.domain,debug=self.DEBUG)
531          x=self.domain.getX()          x=self.domain.getX()
532          q_ref=interpolate(whereZero(x[0]),Solution(self.domain))          q_ref=interpolate(whereZero(x[0]),Solution(self.domain))
533          A_ref=kronecker(self.domain)          A_ref=kronecker(self.domain)
534          mypde.setValue(q=whereZero(x[0]))          mypde.setValue(q=whereZero(x[0]))
535          self.failUnless(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")          self.assertTrue(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")
536          self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")          self.assertTrue(mypde.getCoefficient("B").isEmpty(),"B is not empty")
537          self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")          self.assertTrue(mypde.getCoefficient("C").isEmpty(),"C is not empty")
538          self.failUnless(mypde.getCoefficient("D").isEmpty(),"D is not empty")          self.assertTrue(mypde.getCoefficient("D").isEmpty(),"D is not empty")
539          self.failUnless(mypde.getCoefficient("X").isEmpty(),"X is not empty")          self.assertTrue(mypde.getCoefficient("X").isEmpty(),"X is not empty")
540          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")          self.assertTrue(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
541          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")          self.assertTrue(mypde.getCoefficient("y").isEmpty(),"y is not empty")
542          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")          self.assertTrue(mypde.getCoefficient("d").isEmpty(),"d is not empty")
543          self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")          self.assertTrue(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
544          self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")          self.assertTrue(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
545          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.assertTrue(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
546          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.assertTrue(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
547          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.assertTrue(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
548          self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")          self.assertTrue(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
549          self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")          self.assertTrue(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
550          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")          self.assertTrue(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
551          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          if self.domain.supportsContactElements():
552          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
553          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
554          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
555          self.failUnless(self.check(mypde.getCoefficient("q"),q_ref),"q is not empty")              self.assertTrue(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")
556          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")          self.assertTrue(self.check(mypde.getCoefficient("q"),q_ref),"q is not empty")
557            self.assertTrue(mypde.getCoefficient("r").isEmpty(),"r is not empty")
558      def test_setCoefficient_f(self):      def test_setCoefficient_f(self):
559          mypde=Poisson(self.domain,debug=self.DEBUG)          mypde=Poisson(self.domain,debug=self.DEBUG)
560          x=self.domain.getX()          x=self.domain.getX()
561          Y_ref=interpolate(x[0],Function(self.domain))          Y_ref=interpolate(x[0],Function(self.domain))
562          A_ref=kronecker(self.domain)          A_ref=kronecker(self.domain)
563          mypde.setValue(f=x[0])          mypde.setValue(f=x[0])
564          self.failUnless(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")          self.assertTrue(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")
565          self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")          self.assertTrue(mypde.getCoefficient("B").isEmpty(),"B is not empty")
566          self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")          self.assertTrue(mypde.getCoefficient("C").isEmpty(),"C is not empty")
567          self.failUnless(mypde.getCoefficient("D").isEmpty(),"D is not empty")          self.assertTrue(mypde.getCoefficient("D").isEmpty(),"D is not empty")
568          self.failUnless(mypde.getCoefficient("X").isEmpty(),"X is not empty")          self.assertTrue(mypde.getCoefficient("X").isEmpty(),"X is not empty")
569          self.failUnless(self.check(mypde.getCoefficient("Y"),Y_ref),"Y is not x[0]")          self.assertTrue(self.check(mypde.getCoefficient("Y"),Y_ref),"Y is not x[0]")
570          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")          self.assertTrue(mypde.getCoefficient("y").isEmpty(),"y is not empty")
571          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")          self.assertTrue(mypde.getCoefficient("d").isEmpty(),"d is not empty")
572          self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")          self.assertTrue(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
573          self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")          self.assertTrue(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
574          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.assertTrue(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
575          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.assertTrue(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
576          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.assertTrue(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
577          self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")          self.assertTrue(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
578          self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")          self.assertTrue(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
579          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")          self.assertTrue(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
580          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          if self.domain.supportsContactElements():
581          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
582          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
583          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
584          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")              self.assertTrue(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")
585          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")          self.assertTrue(mypde.getCoefficient("q").isEmpty(),"q is not empty")
586            self.assertTrue(mypde.getCoefficient("r").isEmpty(),"r is not empty")
587      def test_setCoefficient_f_reduced(self):      def test_setCoefficient_f_reduced(self):
588          mypde=Poisson(self.domain,debug=self.DEBUG)          mypde=Poisson(self.domain,debug=self.DEBUG)
589          x=self.domain.getX()          x=self.domain.getX()
590          Y_ref=interpolate(x[0],ReducedFunction(self.domain))          Y_ref=interpolate(x[0],ReducedFunction(self.domain))
591          A_ref=kronecker(self.domain)          A_ref=kronecker(self.domain)
592          mypde.setValue(f_reduced=x[0])          mypde.setValue(f_reduced=x[0])
593          self.failUnless(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")          self.assertTrue(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")
594          self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")          self.assertTrue(mypde.getCoefficient("B").isEmpty(),"B is not empty")
595          self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")          self.assertTrue(mypde.getCoefficient("C").isEmpty(),"C is not empty")
596          self.failUnless(mypde.getCoefficient("D").isEmpty(),"D is not empty")          self.assertTrue(mypde.getCoefficient("D").isEmpty(),"D is not empty")
597          self.failUnless(mypde.getCoefficient("X").isEmpty(),"X is not empty")          self.assertTrue(mypde.getCoefficient("X").isEmpty(),"X is not empty")
598          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")          self.assertTrue(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
599          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")          self.assertTrue(mypde.getCoefficient("y").isEmpty(),"y is not empty")
600          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")          self.assertTrue(mypde.getCoefficient("d").isEmpty(),"d is not empty")
601          self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")          self.assertTrue(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
602          self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")          self.assertTrue(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
603          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.assertTrue(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
604          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.assertTrue(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
605          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.assertTrue(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
606          self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")          self.assertTrue(self.check(mypde.getCoefficient("Y_reduced"),Y_ref),"Y_reduced is not x[0]")
607          self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")          self.assertTrue(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
608          self.failUnless(self.check(mypde.getCoefficient("Y_reduced"),Y_ref),"Y_reduced is not x[0]")          self.assertTrue(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
609          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          if self.domain.supportsContactElements():
610          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
611          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
612          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")              self.assertTrue(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
613          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")              self.assertTrue(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")        
614          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")          self.assertTrue(mypde.getCoefficient("q").isEmpty(),"q is not empty")
615            self.assertTrue(mypde.getCoefficient("r").isEmpty(),"r is not empty")
616      def test_solve(self):      def test_solve(self):
617         d=self.domain.getDim()         d=self.domain.getDim()
618         cf=ContinuousFunction(self.domain)         cf=ContinuousFunction(self.domain)
# Line 636  class Test_Poisson(Test_linearPDEs): Line 638  class Test_Poisson(Test_linearPDEs):
638         mypde=Poisson(self.domain)         mypde=Poisson(self.domain)
639         mypde.setValue(f=f,q=msk)         mypde.setValue(f=f,q=msk)
640         u=mypde.getSolution()         u=mypde.getSolution()
641         self.failUnless(self.check(u,u_ex,10*self.TOL),"incorrect solution")         self.assertTrue(self.check(u,u_ex,10*self.TOL),"incorrect solution")
642    
643  class Test_LinearPDE_noLumping(Test_linearPDEs):  class Test_LinearPDE_noLumping(Test_linearPDEs):
644      N=4      N=4
645      def test_SolverOptions(self):      def test_SolverOptions(self):
646          so=SolverOptions()          so=SolverOptions()
647            
648            self.assertTrue(so.getSmoother() == 28, "initial Smoother is wrong.")
649            self.assertRaises(ValueError,so.setSmoother,-1)
650            so.setSmoother(so.GAUSS_SEIDEL)
651            self.assertTrue(so.getSmoother() == 28, "Gauss-Seidel smoother is not set.")
652            so.setSmoother(so.JACOBI)
653            self.assertTrue(so.getSmoother() == 10, "Jacobi smoother is not set.")
654    
655            self.assertTrue(so.getLevelMax() == 100, "initial  LevelMax is wrong.")
656            self.assertRaises(ValueError,so.setLevelMax,-1)
657            so.setLevelMax(20)
658            self.assertTrue(so.getLevelMax() == 20, "LevelMax is wrong.")
659    
660          self.failUnless(so.getLevelMax() == 10, "initial  LevelMax is wrong.")          self.assertTrue(so.getCoarseningThreshold() == 0.25, "initial  CoarseningThreshold is wrong.")
661          self.failUnlessRaises(ValueError,so.setLevelMax,-1)          self.assertRaises(ValueError,so.setCoarseningThreshold,-1)
         so.setLevelMax(3)  
         self.failUnless(so.getLevelMax() == 3, "LevelMax is wrong.")  
   
         self.failUnless(so.getCoarseningThreshold() == 0.05, "initial  CoarseningThreshold is wrong.")  
         self.failUnlessRaises(ValueError,so.setCoarseningThreshold,-1)  
662          so.setCoarseningThreshold(0.1)          so.setCoarseningThreshold(0.1)
663          self.failUnless(so.getCoarseningThreshold() == 0.1, "CoarseningThreshold is wrong.")          self.assertTrue(so.getCoarseningThreshold() == 0.1, "CoarseningThreshold is wrong.")
664            
665            self.assertTrue(so.getMinCoarseMatrixSize() == 500, "initial  Minimum Coarse Matrix Size is wrong.")
666            self.assertRaises(ValueError,so.setMinCoarseMatrixSize,-1)
667            so.setMinCoarseMatrixSize(1000)
668            self.assertTrue(so.getMinCoarseMatrixSize() == 1000, "Minimum Coarse Matrix Size is wrong.")
669    
670          self.failUnless(so.getNumSweeps() == 2, "initial  Sweeps is wrong.")          self.assertTrue(so.getNumSweeps() == 1, "initial  Sweeps is wrong.")
671          self.failUnlessRaises(ValueError,so.setNumSweeps,-1)          self.assertRaises(ValueError,so.setNumSweeps,-1)
672          so.setNumSweeps(3)          so.setNumSweeps(3)
673          self.failUnless(so.getNumSweeps() == 3, "Sweeps is wrong.")          self.assertTrue(so.getNumSweeps() == 3, "Sweeps is wrong.")
674    
675          self.failUnless(so.getNumPreSweeps() == 2, "initial  PreSweeps is wrong.")          self.assertTrue(so.getNumPreSweeps() == 1, "initial  PreSweeps is wrong.")
676          self.failUnlessRaises(ValueError,so.setNumPreSweeps,-1)          self.assertRaises(ValueError,so.setNumPreSweeps,-1)
677          so.setNumPreSweeps(4)          so.setNumPreSweeps(4)
678          self.failUnless(so.getNumPreSweeps() == 4, "PreSweeps is wrong.")          self.assertTrue(so.getNumPreSweeps() == 4, "PreSweeps is wrong.")
679    
680          self.failUnless(so.getNumPostSweeps() == 2, "initial  PreSweeps is wrong.")          self.assertTrue(so.getNumPostSweeps() == 1, "initial  PostSweeps is wrong.")
681          self.failUnlessRaises(ValueError,so.setNumPostSweeps,-1)          self.assertRaises(ValueError,so.setNumPostSweeps,-1)
682          so.setNumPostSweeps(5)          so.setNumPostSweeps(5)
683          self.failUnless(so.getNumPostSweeps() == 5, "PreSweeps is wrong.")          self.assertTrue(so.getNumPostSweeps() == 5, "PostSweeps is wrong.")
684    
685          self.failUnless(so.getTolerance() == 1.e-8, "initial Tolerance is wrong.")          self.assertTrue(so.getTolerance() == 1.e-8, "initial Tolerance is wrong.")
686          self.failUnlessRaises(ValueError,so.setTolerance,-1)          self.assertRaises(ValueError,so.setTolerance,-1)
687          so.setTolerance(0.2)          so.setTolerance(0.2)
688          self.failUnless(so.getTolerance() == 0.2, "Tolerance is wrong.")          self.assertTrue(so.getTolerance() == 0.2, "Tolerance is wrong.")
689    
690          self.failUnless(so.getAbsoluteTolerance() == 0., "initial  AbsoluteTolerance is wrong.")          self.assertTrue(so.getAbsoluteTolerance() == 0., "initial  AbsoluteTolerance is wrong.")
691          self.failUnlessRaises(ValueError,so.setAbsoluteTolerance,-1)          self.assertRaises(ValueError,so.setAbsoluteTolerance,-1)
692          so.setAbsoluteTolerance(0.3)          so.setAbsoluteTolerance(0.3)
693          self.failUnless(so.getAbsoluteTolerance() == 0.3, "AbsoluteTolerance is wrong.")          self.assertTrue(so.getAbsoluteTolerance() == 0.3, "AbsoluteTolerance is wrong.")
694    
695          self.failUnless(so.getInnerTolerance() == 0.9, "initial InnerTolerance is wrong.")          self.assertTrue(so.getInnerTolerance() == 0.9, "initial InnerTolerance is wrong.")
696          self.failUnlessRaises(ValueError,so.setInnerTolerance,-1)          self.assertRaises(ValueError,so.setInnerTolerance,-1)
697          so.setInnerTolerance(0.4)          so.setInnerTolerance(0.4)
698          self.failUnless(so.getInnerTolerance() == 0.4, "InnerTolerance is wrong.")          self.assertTrue(so.getInnerTolerance() == 0.4, "InnerTolerance is wrong.")
699    
700          self.failUnless(so.getDropTolerance() == 0.01, "initial DropTolerance is wrong.")          self.assertTrue(so.getDropTolerance() == 0.01, "initial DropTolerance is wrong.")
701          self.failUnlessRaises(ValueError,so.setDropTolerance,-1)          self.assertRaises(ValueError,so.setDropTolerance,-1)
702          so.setDropTolerance(0.5)          so.setDropTolerance(0.5)
703          self.failUnless(so.getDropTolerance() == 0.5, "DropDropTolerance is wrong.")          self.assertTrue(so.getDropTolerance() == 0.5, "DropDropTolerance is wrong.")
704    
705          self.failUnless(so.getDropStorage() == 2., "initial DropStorage is wrong.")          self.assertTrue(so.getDropStorage() == 2., "initial DropStorage is wrong.")
706          self.failUnlessRaises(ValueError,so.setDropStorage,-1)          self.assertRaises(ValueError,so.setDropStorage,-1)
707          so.setDropStorage(10)          so.setDropStorage(10)
708          self.failUnless(so.getDropStorage() == 10, "DropStorage is wrong.")          self.assertTrue(so.getDropStorage() == 10, "DropStorage is wrong.")
709                    
710          self.failUnless(so.getRelaxationFactor() == 0.3, "initial RelaxationFactor is wrong.")          self.assertTrue(so.getRelaxationFactor() == 0.3, "initial RelaxationFactor is wrong.")
711          self.failUnlessRaises(ValueError,so.setRelaxationFactor,-1)          self.assertRaises(ValueError,so.setRelaxationFactor,-1)
712          so.setRelaxationFactor(0.1)          so.setRelaxationFactor(0.1)
713          self.failUnless(so.getRelaxationFactor() == 0.1, "Relaxation is wrong.")          self.assertTrue(so.getRelaxationFactor() == 0.1, "Relaxation is wrong.")
714    
715    
716          self.failUnless(so.getIterMax() == 10000, "initial IterMax is wrong.")          self.assertTrue(so.getIterMax() == 100000, "initial IterMax is wrong.")
717          self.failUnlessRaises(ValueError,so.setIterMax,0)          self.assertRaises(ValueError,so.setIterMax,0)
718          so.setIterMax(11)          so.setIterMax(11)
719          self.failUnless(so.getIterMax() == 11, "IterMax is wrong.")          self.assertTrue(so.getIterMax() == 11, "IterMax is wrong.")
720    
721          self.failUnless(so.getInnerIterMax() == 10, "initial InnerIterMax is wrong.")          self.assertTrue(so.getInnerIterMax() == 10, "initial InnerIterMax is wrong.")
722          self.failUnlessRaises(ValueError,so.setInnerIterMax,0)          self.assertRaises(ValueError,so.setInnerIterMax,0)
723          so.setInnerIterMax(12)          so.setInnerIterMax(12)
724          self.failUnless(so.getInnerIterMax() == 12, "InnerIterMax is wrong.")          self.assertTrue(so.getInnerIterMax() == 12, "InnerIterMax is wrong.")
725    
726          self.failUnless(so.getTruncation() == 20, "initial Truncation is wrong.")          self.assertTrue(so.getTruncation() == 20, "initial Truncation is wrong.")
727          self.failUnlessRaises(ValueError,so.setTruncation,0)          self.assertRaises(ValueError,so.setTruncation,0)
728          so.setTruncation(13)          so.setTruncation(13)
729          self.failUnless(so.getTruncation() == 13, "Truncation is wrong.")          self.assertTrue(so.getTruncation() == 13, "Truncation is wrong.")
730    
731          self.failUnless(so.getRestart() == None, "initial Truncation is wrong.")          self.assertTrue(so.getRestart() == None, "initial Truncation is wrong.")
732          self.failUnlessRaises(ValueError,so.setTruncation,0)          self.assertRaises(ValueError,so.setTruncation,0)
733          so.setRestart(14)          so.setRestart(14)
734          self.failUnless(so.getRestart() == 14, "Truncation is wrong.")          self.assertTrue(so.getRestart() == 14, "Truncation is wrong.")
735          so.setRestart(None)          so.setRestart(None)
736          self.failUnless(so.getRestart() == None, "Truncation is wrong.")          self.assertTrue(so.getRestart() == None, "Truncation is wrong.")
737                
738          self.failUnless(not so.isSymmetric(), "initial symmetry flag is wrong.")          self.assertTrue(not so.isVerbose(), "initial verbosity flag is wrong.")
739            so.setVerbosityOn()
740            self.assertTrue(so.isVerbose(), "verbosity (1) flag is wrong.")
741            so.setVerbosityOff()
742            self.assertTrue(not so.isVerbose(), "verbosity (2) flag is wrong.")
743            so.setVerbosity(verbose=True)
744            self.assertTrue(so.isVerbose(), "verbosity (3) flag is wrong.")
745            so.setVerbosity(verbose=False)
746            self.assertTrue(not so.isVerbose(), "verbosity (4) flag is wrong.")
747    
748            self.assertTrue(not so.isSymmetric(), "initial symmetry flag is wrong.")
749          so.setSymmetryOn()          so.setSymmetryOn()
750          self.failUnless(so.isSymmetric(), "symmetry (1) flag is wrong.")          self.assertTrue(so.isSymmetric(), "symmetry (1) flag is wrong.")
751          so.setSymmetryOff()          so.setSymmetryOff()
752          self.failUnless(not so.isSymmetric(), "symmetry (2) flag is wrong.")          self.assertTrue(not so.isSymmetric(), "symmetry (2) flag is wrong.")
753          so.setSymmetry(flag=True)          so.setSymmetry(flag=True)
754          self.failUnless(so.isSymmetric(), "symmetry (3) flag is wrong.")          self.assertTrue(so.isSymmetric(), "symmetry (3) flag is wrong.")
755          so.setSymmetry(flag=False)          so.setSymmetry(flag=False)
756          self.failUnless(not so.isSymmetric(), "symmetry (4) flag is wrong.")          self.assertTrue(not so.isSymmetric(), "symmetry (4) flag is wrong.")
757    
758          self.failUnless(so.adaptInnerTolerance(), "initial InnerToleranceAdaption flag is wrong.")          self.assertTrue(so.adaptInnerTolerance(), "initial InnerToleranceAdaption flag is wrong.")
759          so.setInnerToleranceAdaptionOn()          so.setInnerToleranceAdaptionOn()
760          self.failUnless(so.adaptInnerTolerance(), "InnerToleranceAdaption (1) flag is wrong.")          self.assertTrue(so.adaptInnerTolerance(), "InnerToleranceAdaption (1) flag is wrong.")
761          so.setInnerToleranceAdaptionOff()          so.setInnerToleranceAdaptionOff()
762          self.failUnless(not so.adaptInnerTolerance(), "InnerToleranceAdaption (2) flag is wrong.")          self.assertTrue(not so.adaptInnerTolerance(), "InnerToleranceAdaption (2) flag is wrong.")
763          so.setInnerToleranceAdaption(adapt=True)          so.setInnerToleranceAdaption(adapt=True)
764          self.failUnless(so.adaptInnerTolerance(), "InnerToleranceAdaption (3) flag is wrong.")          self.assertTrue(so.adaptInnerTolerance(), "InnerToleranceAdaption (3) flag is wrong.")
765          so.setInnerToleranceAdaption(adapt=False)          so.setInnerToleranceAdaption(adapt=False)
766          self.failUnless(not so.adaptInnerTolerance(), "InnerToleranceAdaption (4) flag is wrong.")          self.assertTrue(not so.adaptInnerTolerance(), "InnerToleranceAdaption (4) flag is wrong.")
767            
768          self.failUnless(not so.acceptConvergenceFailure(), "initial acceptConvergenceFailure flag is wrong.")          self.assertTrue(not so.acceptConvergenceFailure(), "initial acceptConvergenceFailure flag is wrong.")
769          so.setAcceptanceConvergenceFailureOn()          so.setAcceptanceConvergenceFailureOn()
770          self.failUnless(so.acceptConvergenceFailure(), "acceptConvergenceFailure (1) flag is wrong.")          self.assertTrue(so.acceptConvergenceFailure(), "acceptConvergenceFailure (1) flag is wrong.")
771          so.setAcceptanceConvergenceFailureOff()          so.setAcceptanceConvergenceFailureOff()
772          self.failUnless(not so.acceptConvergenceFailure(), "acceptConvergenceFailure (2) flag is wrong.")          self.assertTrue(not so.acceptConvergenceFailure(), "acceptConvergenceFailure (2) flag is wrong.")
773          so.setAcceptanceConvergenceFailure(accept=True)          so.setAcceptanceConvergenceFailure(accept=True)
774          self.failUnless(so.acceptConvergenceFailure(), "acceptConvergenceFailure (3) flag is wrong.")          self.assertTrue(so.acceptConvergenceFailure(), "acceptConvergenceFailure (3) flag is wrong.")
775          so.setAcceptanceConvergenceFailure(accept=False)          so.setAcceptanceConvergenceFailure(accept=False)
776          self.failUnless(not so.acceptConvergenceFailure(), "acceptConvergenceFailure (4) flag is wrong.")            self.assertTrue(not so.acceptConvergenceFailure(), "acceptConvergenceFailure (4) flag is wrong.")  
777                    
778          self.failUnless(so.getReordering() == 30, "initial Reordering is wrong.")          self.assertTrue(so.getReordering() == 30, "initial Reordering is wrong.")
779          self.failUnlessRaises(ValueError,so.setReordering,-1)          self.assertRaises(ValueError,so.setReordering,-1)
780          so.setReordering(so.NO_REORDERING)          so.setReordering(so.NO_REORDERING)
781          self.failUnless(so.getReordering() == 17, "NO_REORDERING is not set.")          self.assertTrue(so.getReordering() == 17, "NO_REORDERING is not set.")
782          so.setReordering(so.MINIMUM_FILL_IN)          so.setReordering(so.MINIMUM_FILL_IN)
783          self.failUnless(so.getReordering() == 18, "MINIMUM_FILL_IN is not set.")          self.assertTrue(so.getReordering() == 18, "MINIMUM_FILL_IN is not set.")
784          so.setReordering(so.NESTED_DISSECTION)          so.setReordering(so.NESTED_DISSECTION)
785          self.failUnless(so.getReordering() == 19, "NESTED_DISSECTION is not set.")          self.assertTrue(so.getReordering() == 19, "NESTED_DISSECTION is not set.")
786          so.setReordering(so.DEFAULT_REORDERING)          so.setReordering(so.DEFAULT_REORDERING)
787          self.failUnless(so.getReordering() == 30, "DEFAULT_REORDERING is not set.")          self.assertTrue(so.getReordering() == 30, "DEFAULT_REORDERING is not set.")
788                    
789          self.failUnless(so.getPackage() == 0, "initial solver package is wrong.")          self.assertTrue(so.getPackage() == 0, "initial solver package is wrong.")
790          self.failUnlessRaises(ValueError,so.setPackage,-1)          self.assertRaises(ValueError,so.setPackage,-1)
791          so.setPackage(so.PASO)          so.setPackage(so.PASO)
792          self.failUnless(so.getPackage() == 21, "PASO is not set.")          self.assertTrue(so.getPackage() == 21, "PASO is not set.")
793          so.setPackage(so.SUPER_LU)          so.setPackage(so.SUPER_LU)
794          self.failUnless(so.getPackage() == 31, "SUPER_LU is not set.")          self.assertTrue(so.getPackage() == 31, "SUPER_LU is not set.")
795          so.setPackage(so.PASTIX)          so.setPackage(so.PASTIX)
796          self.failUnless(so.getPackage() == 32, "PASTIX is not set.")          self.assertTrue(so.getPackage() == 32, "PASTIX is not set.")
797          so.setPackage(so.MKL)          so.setPackage(so.MKL)
798          self.failUnless(so.getPackage() == 15, "MKL is not set.")          self.assertTrue(so.getPackage() == 15, "MKL is not set.")
799          so.setPackage(so.UMFPACK)          so.setPackage(so.UMFPACK)
800          self.failUnless(so.getPackage() == 16, "UMFPACK is not set.")          self.assertTrue(so.getPackage() == 16, "UMFPACK is not set.")
801          so.setPackage(so.TRILINOS)          so.setPackage(so.TRILINOS)
802          self.failUnless(so.getPackage() == 24, "TRILINOS is not set.")          self.assertTrue(so.getPackage() == 24, "TRILINOS is not set.")
803    
804          self.failUnless(so.getSolverMethod() == 0, "initial SolverMethod is wrong.")          self.assertTrue(so.getSolverMethod() == 0, "initial SolverMethod is wrong.")
805          self.failUnlessRaises(ValueError,so.setSolverMethod,-1)          self.assertRaises(ValueError,so.setSolverMethod,-1)
806          so.setSolverMethod(so.DIRECT)          so.setSolverMethod(so.DIRECT)
807          self.failUnless(so.getSolverMethod() == 1, "DIRECT is not set.")          self.assertTrue(so.getSolverMethod() == 1, "DIRECT is not set.")
808          so.setSolverMethod(so.CHOLEVSKY)          so.setSolverMethod(so.CHOLEVSKY)
809          self.failUnless(so.getSolverMethod() == 2, "CHOLEVSKY is not set.")          self.assertTrue(so.getSolverMethod() == 2, "CHOLEVSKY is not set.")
810          so.setSolverMethod(so.PCG)          so.setSolverMethod(so.PCG)
811          self.failUnless(so.getSolverMethod() == 3, "PCG is not set.")          self.assertTrue(so.getSolverMethod() == 3, "PCG is not set.")
812          so.setSolverMethod(so.CR)          so.setSolverMethod(so.CR)
813          self.failUnless(so.getSolverMethod() == 4, "CR is not set.")          self.assertTrue(so.getSolverMethod() == 4, "CR is not set.")
814          so.setSolverMethod(so.CGS)          so.setSolverMethod(so.CGS)
815          self.failUnless(so.getSolverMethod() == 5, "CGS is not set.")          self.assertTrue(so.getSolverMethod() == 5, "CGS is not set.")
816          so.setSolverMethod(so.BICGSTAB)          so.setSolverMethod(so.BICGSTAB)
817          self.failUnless(so.getSolverMethod() == 6, "BICGSTAB is not set.")          self.assertTrue(so.getSolverMethod() == 6, "BICGSTAB is not set.")
         so.setSolverMethod(so.SSOR)  
         self.failUnless(so.getSolverMethod() == 7, "SSOR is not set.")  
818          so.setSolverMethod(so.GMRES)          so.setSolverMethod(so.GMRES)
819          self.failUnless(so.getSolverMethod() == 11, "GMRES is not set.")          self.assertTrue(so.getSolverMethod() == 11, "GMRES is not set.")
820          so.setSolverMethod(so.PRES20)          so.setSolverMethod(so.PRES20)
821          self.failUnless(so.getSolverMethod() == 12, "PRES20 is not set.")          self.assertTrue(so.getSolverMethod() == 12, "PRES20 is not set.")
822          so.setSolverMethod(so.LUMPING)          so.setSolverMethod(so.LUMPING)
823          self.failUnless(so.getSolverMethod() == 13, "LUMPING is not set.")          self.assertTrue(so.getSolverMethod() == 13, "LUMPING is not set.")
824          so.setSolverMethod(so.ITERATIVE)          so.setSolverMethod(so.ITERATIVE)
825          self.failUnless(so.getSolverMethod() == 20, "ITERATIVE is not set.")          self.assertTrue(so.getSolverMethod() == 20, "ITERATIVE is not set.")
         so.setSolverMethod(so.AMG)  
         self.failUnless(so.getSolverMethod() == 22, "AMG is not set.")  
826          so.setSolverMethod(so.NONLINEAR_GMRES)          so.setSolverMethod(so.NONLINEAR_GMRES)
827          self.failUnless(so.getSolverMethod() == 25, "NONLINEAR_GMRES is not set.")          self.assertTrue(so.getSolverMethod() == 25, "NONLINEAR_GMRES is not set.")
828          so.setSolverMethod(so.TFQMR)          so.setSolverMethod(so.TFQMR)
829          self.failUnless(so.getSolverMethod() == 26, "TFQMR is not set.")          self.assertTrue(so.getSolverMethod() == 26, "TFQMR is not set.")
830          so.setSolverMethod(so.MINRES)          so.setSolverMethod(so.MINRES)
831          self.failUnless(so.getSolverMethod() == 27, "MINRES is not set.")          self.assertTrue(so.getSolverMethod() == 27, "MINRES is not set.")
         so.setSolverMethod(so.GAUSS_SEIDEL)  
         self.failUnless(so.getSolverMethod() == 28, "GAUSS_SEIDEL is not set.")  
832          so.setSolverMethod(so.DEFAULT)          so.setSolverMethod(so.DEFAULT)
833          self.failUnless(so.getSolverMethod() == 0, "DEFAULT is not set.")          self.assertTrue(so.getSolverMethod() == 0, "DEFAULT is not set.")
834    
835          self.failUnless(so.getPreconditioner() == 10, "initial Preconditioner is wrong.")          self.assertTrue(so.getPreconditioner() == 10, "initial Preconditioner is wrong.")
836          self.failUnlessRaises(ValueError,so.setPreconditioner,-1)          self.assertRaises(ValueError,so.setPreconditioner,-1)
837          so.setPreconditioner(so.ILU0)          so.setPreconditioner(so.ILU0)
838          self.failUnless(so.getPreconditioner() == 8, "ILU0 is not set.")          self.assertTrue(so.getPreconditioner() == 8, "ILU0 is not set.")
         so.setPreconditioner(so.SSOR)  
         self.failUnless(so.getPreconditioner() == 7, "SSOR is not set.")  
839          so.setPreconditioner(so.ILUT)          so.setPreconditioner(so.ILUT)
840          self.failUnless(so.getPreconditioner() == 9, "ILUT is not set.")          self.assertTrue(so.getPreconditioner() == 9, "ILUT is not set.")
841          so.setPreconditioner(so.JACOBI)          so.setPreconditioner(so.JACOBI)
842          self.failUnless(so.getPreconditioner() == 10, "JACOBI is not set.")          self.assertTrue(so.getPreconditioner() == 10, "JACOBI is not set.")
843          so.setPreconditioner(so.AMG)          if getEscriptParamInt('DISABLE_AMG', 0):
844          self.failUnless(so.getPreconditioner() == 22, "AMG is not set.")              print("AMG test disabled on MPI build")
845            else:
846                so.setPreconditioner(so.AMG)
847                self.assertTrue(so.getPreconditioner() == 22, "AMG is not set.")
848          so.setPreconditioner(so.REC_ILU)          so.setPreconditioner(so.REC_ILU)
849          self.failUnless(so.getPreconditioner() == 23, "REC_ILU is not set.")          self.assertTrue(so.getPreconditioner() == 23, "REC_ILU is not set.")
850          so.setPreconditioner(so.GAUSS_SEIDEL)          so.setPreconditioner(so.GAUSS_SEIDEL)
851          self.failUnless(so.getPreconditioner() == 28, "GAUSS_SEIDEL is not set.")          self.assertTrue(so.getPreconditioner() == 28, "GAUSS_SEIDEL is not set.")
852          so.setPreconditioner(so.RILU)          so.setPreconditioner(so.RILU)
853          self.failUnless(so.getPreconditioner() == 29, "RILU is not set.")          self.assertTrue(so.getPreconditioner() == 29, "RILU is not set.")
854            so.setPreconditioner(so.AMLI)
855            self.assertTrue(so.getPreconditioner() == 38, "AMLI is not set.")
856          so.setPreconditioner(so.NO_PRECONDITIONER)          so.setPreconditioner(so.NO_PRECONDITIONER)
857          self.failUnless(so.getPreconditioner() == 36, "NO_PRECONDITIONER is not set.")                  self.assertTrue(so.getPreconditioner() == 36, "NO_PRECONDITIONER is not set.")        
858    
859          self.failUnless(so.getCoarsening() == 0, "initial Coarseningr is wrong.")          self.assertTrue(so.getCoarsening() == 0, "initial Coarseningr is wrong.")
860          self.failUnlessRaises(ValueError,so.setCoarsening,-1)          self.assertRaises(ValueError,so.setCoarsening,-1)
861          so.setCoarsening(so.YAIR_SHAPIRA_COARSENING)          so.setCoarsening(so.YAIR_SHAPIRA_COARSENING)
862          self.failUnless(so.getCoarsening() == 33, "YAIR_SHAPIRA_COARSENING is not set.")          self.assertTrue(so.getCoarsening() == 33, "YAIR_SHAPIRA_COARSENING is not set.")
863          so.setCoarsening(so.RUGE_STUEBEN_COARSENING)          so.setCoarsening(so.RUGE_STUEBEN_COARSENING)
864          self.failUnless(so.getCoarsening() == 34, "RUGE_STUEBEN_COARSENING is not set.")          self.assertTrue(so.getCoarsening() == 34, "RUGE_STUEBEN_COARSENING is not set.")
865          so.setCoarsening(so.AGGREGATION_COARSENING)          so.setCoarsening(so.AGGREGATION_COARSENING)
866          self.failUnless(so.getCoarsening() == 35, "AGREGATION_COARSENING is not set.")          self.assertTrue(so.getCoarsening() == 35, "AGREGATION_COARSENING is not set.")
867            so.setCoarsening(so.STANDARD_COARSENING)
868            self.assertTrue(so.getCoarsening() == 39, "STANDARD_COARSENING is not set.")
869          so.setCoarsening(so.DEFAULT)          so.setCoarsening(so.DEFAULT)
870          self.failUnless(so.getCoarsening() == 0, "DEFAULT is not set.")          self.assertTrue(so.getCoarsening() == 0, "DEFAULT is not set.")
871    
872          self.failUnless(so.getDiagnostics("num_iter") == None, "initial num_iter is wrong.")          self.assertTrue(so.getDiagnostics("num_iter") == None, "initial num_iter is wrong.")
873          self.failUnless(so.getDiagnostics("num_inner_iter") == None, "initial num_inner_iter is wrong.")          self.assertTrue(so.getDiagnostics("num_inner_iter") == None, "initial num_inner_iter is wrong.")
874          self.failUnless(so.getDiagnostics("time") == None, "initial time is wrong.")          self.assertTrue(so.getDiagnostics("time") == None, "initial time is wrong.")
875          self.failUnless(so.getDiagnostics("set_up_time") == None, "initial set_up_time is wrong.")          self.assertTrue(so.getDiagnostics("set_up_time") == None, "initial set_up_time is wrong.")
876          self.failUnless(so.getDiagnostics("residual_norm") == None, "initial residual_norm is wrong.")          self.assertTrue(so.getDiagnostics("residual_norm") == None, "initial residual_norm is wrong.")
877          self.failUnless(so.getDiagnostics("converged") == None, "initial converged is wrong.")          self.assertTrue(so.getDiagnostics("converged") == None, "initial converged is wrong.")
878          self.failUnless(so.hasConverged() == None, "initial convergence flag is wrong.")          self.assertTrue(so.hasConverged() == None, "initial convergence flag is wrong.")
879          self.failUnless(so.getDiagnostics("cum_num_inner_iter") == 0, "initial cum_num_inner_iter is wrong.")          self.assertTrue(so.getDiagnostics("cum_num_inner_iter") == 0, "initial cum_num_inner_iter is wrong.")
880          self.failUnless(so.getDiagnostics("cum_num_iter") == 0, "initial cum_num_iter is wrong.")          self.assertTrue(so.getDiagnostics("cum_num_iter") == 0, "initial cum_num_iter is wrong.")
881          self.failUnless(so.getDiagnostics("cum_time") ==0, "initial cum_time is wrong.")          self.assertTrue(so.getDiagnostics("cum_time") ==0, "initial cum_time is wrong.")
882          self.failUnless(so.getDiagnostics("cum_set_up_time") == 0, "initial cum_set_up_time is wrong.")          self.assertTrue(so.getDiagnostics("cum_set_up_time") == 0, "initial cum_set_up_time is wrong.")
883    
884          so._updateDiagnostics("num_iter",1)          so._updateDiagnostics("num_iter",1)
885          so._updateDiagnostics("num_inner_iter",2)          so._updateDiagnostics("num_inner_iter",2)
# Line 865  class Test_LinearPDE_noLumping(Test_line Line 888  class Test_LinearPDE_noLumping(Test_line
888          so._updateDiagnostics("residual_norm",5)          so._updateDiagnostics("residual_norm",5)
889          so._updateDiagnostics("converged",True)          so._updateDiagnostics("converged",True)
890    
891          self.failUnless(so.getDiagnostics("num_iter") == 1, "num_iter is wrong.")          self.assertTrue(so.getDiagnostics("num_iter") == 1, "num_iter is wrong.")
892          self.failUnless(so.getDiagnostics("num_inner_iter") == 2, "num_inner_iter is wrong.")          self.assertTrue(so.getDiagnostics("num_inner_iter") == 2, "num_inner_iter is wrong.")
893          self.failUnless(so.getDiagnostics("time") == 3, "time is wrong.")          self.assertTrue(so.getDiagnostics("time") == 3, "time is wrong.")
894          self.failUnless(so.getDiagnostics("set_up_time") == 4, "set_up_time is wrong.")          self.assertTrue(so.getDiagnostics("set_up_time") == 4, "set_up_time is wrong.")
895          self.failUnless(so.getDiagnostics("residual_norm") == 5, "residual_norm is wrong.")          self.assertTrue(so.getDiagnostics("residual_norm") == 5, "residual_norm is wrong.")
896          self.failUnless(so.getDiagnostics("converged"), "converged is wrong.")          self.assertTrue(so.getDiagnostics("converged"), "converged is wrong.")
897          self.failUnless(so.hasConverged(), "convergence flag is wrong.")          self.assertTrue(so.hasConverged(), "convergence flag is wrong.")
898          self.failUnless(so.getDiagnostics("cum_num_inner_iter") == 2, "cum_num_inner_iter is wrong.")          self.assertTrue(so.getDiagnostics("cum_num_inner_iter") == 2, "cum_num_inner_iter is wrong.")
899          self.failUnless(so.getDiagnostics("cum_num_iter") == 1, "cum_num_iter is wrong.")          self.assertTrue(so.getDiagnostics("cum_num_iter") == 1, "cum_num_iter is wrong.")
900          self.failUnless(so.getDiagnostics("cum_time") ==3, "cum_time is wrong.")          self.assertTrue(so.getDiagnostics("cum_time") ==3, "cum_time is wrong.")
901          self.failUnless(so.getDiagnostics("cum_set_up_time") == 4, "cum_set_up_time is wrong.")            self.assertTrue(so.getDiagnostics("cum_set_up_time") == 4, "cum_set_up_time is wrong.")  
902                    
903          so.resetDiagnostics()          so.resetDiagnostics()
904          self.failUnless(so.getDiagnostics("num_iter") == None, "initial num_iter is wrong.")          self.assertTrue(so.getDiagnostics("num_iter") == None, "initial num_iter is wrong.")
905          self.failUnless(so.getDiagnostics("num_inner_iter") == None, "initial num_inner_iter is wrong.")          self.assertTrue(so.getDiagnostics("num_inner_iter") == None, "initial num_inner_iter is wrong.")
906          self.failUnless(so.getDiagnostics("time") == None, "initial time is wrong.")          self.assertTrue(so.getDiagnostics("time") == None, "initial time is wrong.")
907          self.failUnless(so.getDiagnostics("set_up_time") == None, "initial set_up_time is wrong.")          self.assertTrue(so.getDiagnostics("set_up_time") == None, "initial set_up_time is wrong.")
908          self.failUnless(so.getDiagnostics("residual_norm") == None, "initial residual_norm is wrong.")          self.assertTrue(so.getDiagnostics("residual_norm") == None, "initial residual_norm is wrong.")
909          self.failUnless(so.getDiagnostics("converged") == None, "initial converged is wrong.")          self.assertTrue(so.getDiagnostics("converged") == None, "initial converged is wrong.")
910          self.failUnless(so.hasConverged() == None, "initial convergence flag is wrong")                self.assertTrue(so.hasConverged() == None, "initial convergence flag is wrong")      
911          self.failUnless(so.getDiagnostics("cum_num_inner_iter") == 2, "cum_num_inner_iter is wrong.")          self.assertTrue(so.getDiagnostics("cum_num_inner_iter") == 2, "cum_num_inner_iter is wrong.")
912          self.failUnless(so.getDiagnostics("cum_num_iter") == 1, "cum_num_iter is wrong.")          self.assertTrue(so.getDiagnostics("cum_num_iter") == 1, "cum_num_iter is wrong.")
913          self.failUnless(so.getDiagnostics("cum_time") ==3, "cum_time is wrong.")          self.assertTrue(so.getDiagnostics("cum_time") ==3, "cum_time is wrong.")
914          self.failUnless(so.getDiagnostics("cum_set_up_time") == 4, "cum_set_up_time is wrong.")          self.assertTrue(so.getDiagnostics("cum_set_up_time") == 4, "cum_set_up_time is wrong.")
915    
916          so._updateDiagnostics("num_iter",10)          so._updateDiagnostics("num_iter",10)
917          so._updateDiagnostics("num_inner_iter",20)          so._updateDiagnostics("num_inner_iter",20)
# Line 897  class Test_LinearPDE_noLumping(Test_line Line 920  class Test_LinearPDE_noLumping(Test_line
920          so._updateDiagnostics("residual_norm",50)          so._updateDiagnostics("residual_norm",50)
921          so._updateDiagnostics("converged",False)          so._updateDiagnostics("converged",False)
922    
923          self.failUnless(so.getDiagnostics("num_iter") == 10, "num_iter is wrong.")          self.assertTrue(so.getDiagnostics("num_iter") == 10, "num_iter is wrong.")
924          self.failUnless(so.getDiagnostics("num_inner_iter") == 20, "num_inner_iter is wrong.")          self.assertTrue(so.getDiagnostics("num_inner_iter") == 20, "num_inner_iter is wrong.")
925          self.failUnless(so.getDiagnostics("time") == 30, "time is wrong.")          self.assertTrue(so.getDiagnostics("time") == 30, "time is wrong.")
926          self.failUnless(so.getDiagnostics("set_up_time") == 40, "set_up_time is wrong.")          self.assertTrue(so.getDiagnostics("set_up_time") == 40, "set_up_time is wrong.")
927          self.failUnless(so.getDiagnostics("residual_norm") == 50, "residual_norm is wrong.")          self.assertTrue(so.getDiagnostics("residual_norm") == 50, "residual_norm is wrong.")
928          self.failUnless(not so.getDiagnostics("converged"), "converged is wrong.")          self.assertTrue(not so.getDiagnostics("converged"), "converged is wrong.")
929          self.failUnless(not so.hasConverged(), "convergence flag is wrong.")          self.assertTrue(not so.hasConverged(), "convergence flag is wrong.")
930          self.failUnless(so.getDiagnostics("cum_num_inner_iter") == 22, "cum_num_inner_iter is wrong.")          self.assertTrue(so.getDiagnostics("cum_num_inner_iter") == 22, "cum_num_inner_iter is wrong.")
931          self.failUnless(so.getDiagnostics("cum_num_iter") == 11, "cum_num_iter is wrong.")          self.assertTrue(so.getDiagnostics("cum_num_iter") == 11, "cum_num_iter is wrong.")
932          self.failUnless(so.getDiagnostics("cum_time") ==33, "cum_time is wrong.")          self.assertTrue(so.getDiagnostics("cum_time") ==33, "cum_time is wrong.")
933          self.failUnless(so.getDiagnostics("cum_set_up_time") == 44, "cum_set_up_time is wrong.")            self.assertTrue(so.getDiagnostics("cum_set_up_time") == 44, "cum_set_up_time is wrong.")  
934    
935          so.resetDiagnostics(all=True)          so.resetDiagnostics(all=True)
936          self.failUnless(so.getDiagnostics("num_iter") == None, "initial num_iter is wrong.")          self.assertTrue(so.getDiagnostics("num_iter") == None, "initial num_iter is wrong.")
937          self.failUnless(so.getDiagnostics("num_inner_iter") == None, "initial num_inner_iter is wrong.")          self.assertTrue(so.getDiagnostics("num_inner_iter") == None, "initial num_inner_iter is wrong.")
938          self.failUnless(so.getDiagnostics("time") == None, "initial time is wrong.")          self.assertTrue(so.getDiagnostics("time") == None, "initial time is wrong.")
939          self.failUnless(so.getDiagnostics("set_up_time") == None, "initial set_up_time is wrong.")          self.assertTrue(so.getDiagnostics("set_up_time") == None, "initial set_up_time is wrong.")
940          self.failUnless(so.getDiagnostics("residual_norm") == None, "initial residual_norm is wrong.")          self.assertTrue(so.getDiagnostics("residual_norm") == None, "initial residual_norm is wrong.")
941          self.failUnless(so.getDiagnostics("converged") == None, "initial converged is wrong.")          self.assertTrue(so.getDiagnostics("converged") == None, "initial converged is wrong.")
942          self.failUnless(so.hasConverged() == None, "initial convergence flag is wrong.")          self.assertTrue(so.hasConverged() == None, "initial convergence flag is wrong.")
943          self.failUnless(so.getDiagnostics("cum_num_inner_iter") == 0, "initial cum_num_inner_iter is wrong.")          self.assertTrue(so.getDiagnostics("cum_num_inner_iter") == 0, "initial cum_num_inner_iter is wrong.")
944          self.failUnless(so.getDiagnostics("cum_num_iter") == 0, "initial cum_num_iter is wrong.")          self.assertTrue(so.getDiagnostics("cum_num_iter") == 0, "initial cum_num_iter is wrong.")
945          self.failUnless(so.getDiagnostics("cum_time") ==0, "initial cum_time is wrong.")          self.assertTrue(so.getDiagnostics("cum_time") ==0, "initial cum_time is wrong.")
946          self.failUnless(so.getDiagnostics("cum_set_up_time") == 0, "initial cum_set_up_time is wrong.")          self.assertTrue(so.getDiagnostics("cum_set_up_time") == 0, "initial cum_set_up_time is wrong.")
947                    
948      def test_setCoefficient_WithIllegalFunctionSpace(self):      def test_setCoefficient_WithIllegalFunctionSpace(self):
949          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
950          self.failUnlessRaises(IllegalCoefficientFunctionSpace,mypde.setValue, C=Vector(0.,FunctionOnBoundary(self.domain)))          self.assertRaises(IllegalCoefficientFunctionSpace, mypde.setValue, C=Vector(0.,FunctionOnBoundary(self.domain)))
951    
952      def test_setCoefficient_WithWrongName(self):      def test_setCoefficient_WithWrongName(self):
953          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
954          self.failUnlessRaises(IllegalCoefficient, mypde.setValue, ROMA=0.)          self.assertRaises(IllegalCoefficient, mypde.setValue, ROMA=0.)
955    
956      def test_resetCoefficient_WithWrongShape(self):      def test_resetCoefficient_WithWrongShape(self):
957          mypde=LinearPDE(self.domain,numEquations=2,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=2,debug=self.DEBUG)
958          self.failUnlessRaises(IllegalCoefficientValue, mypde.setValue, C=0.)          self.assertRaises(IllegalCoefficientValue, mypde.setValue, C=0.)
959    
960      def test_reducedOn(self):      def test_reducedOn(self):
961          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 940  class Test_LinearPDE_noLumping(Test_line Line 963  class Test_LinearPDE_noLumping(Test_line
963          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
964          mypde.setValue(A=kronecker(self.domain),D=x[0],Y=x[0])          mypde.setValue(A=kronecker(self.domain),D=x[0],Y=x[0])
965          u=mypde.getSolution()          u=mypde.getSolution()
966          self.failUnless(self.check(u,1.),'solution is wrong.')          self.assertTrue(self.check(u,1.),'solution is wrong.')
967    
968      def test_attemptToChangeOrderAfterDefinedCoefficient(self):      def test_attemptToChangeOrderAfterDefinedCoefficient(self):
969          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
970          mypde.setValue(D=1.)          mypde.setValue(D=1.)
971          self.failUnlessRaises(RuntimeError,mypde.setReducedOrderOn)          self.assertRaises(RuntimeError, mypde.setReducedOrderOn)
972    
973      def test_reducedOnConfig(self):      def test_reducedOnConfig(self):
974          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
975          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
976          self.failUnlessEqual((mypde.getFunctionSpaceForSolution(),mypde.getFunctionSpaceForEquation()),(ReducedSolution(self.domain),ReducedSolution(self.domain)),"reduced function spaces expected.")          self.assertEqual((mypde.getFunctionSpaceForSolution(), mypde.getFunctionSpaceForEquation()),(ReducedSolution(self.domain),ReducedSolution(self.domain)),"reduced function spaces expected.")
977      #      #
978      #  set coefficients for scalars:      #  set coefficients for scalars:
979      #      #
# Line 959  class Test_LinearPDE_noLumping(Test_line Line 982  class Test_LinearPDE_noLumping(Test_line
982          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
983          mypde.setValue(A=numpy.ones((d,d)))          mypde.setValue(A=numpy.ones((d,d)))
984          coeff=mypde.getCoefficient("A")          coeff=mypde.getCoefficient("A")
985          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,d),Function(self.domain),1,1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,d),Function(self.domain),1,1))
986    
987            mypde.resetRightHandSideCoefficients()
988            self.assertFalse(mypde.getCoefficient("A").isEmpty(),"A is empty after reset of right hand side coefficients")
989    
990      def test_setCoefficient_B_Scalar(self):      def test_setCoefficient_B_Scalar(self):
991          d=self.domain.getDim()          d=self.domain.getDim()
992          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
993          mypde.setValue(B=numpy.ones((d,)))          mypde.setValue(B=numpy.ones((d,)))
994          coeff=mypde.getCoefficient("B")          coeff=mypde.getCoefficient("B")
995          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),Function(self.domain),1,1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,),Function(self.domain),1,1))
996    
997            mypde.resetRightHandSideCoefficients()
998            self.assertFalse(mypde.getCoefficient("B").isEmpty(),"B is empty after reset of right hand side coefficients")
999    
1000      def test_setCoefficient_C_Scalar(self):      def test_setCoefficient_C_Scalar(self):
1001          d=self.domain.getDim()          d=self.domain.getDim()
1002          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1003          mypde.setValue(C=numpy.ones((d,)))          mypde.setValue(C=numpy.ones((d,)))
1004          coeff=mypde.getCoefficient("C")          coeff=mypde.getCoefficient("C")
1005          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),Function(self.domain),1,1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,),Function(self.domain),1,1))
1006    
1007            mypde.resetRightHandSideCoefficients()
1008            self.assertFalse(mypde.getCoefficient("C").isEmpty(),"C is empty after reset of right hand side coefficients")
1009    
1010      def test_setCoefficient_D_Scalar(self):      def test_setCoefficient_D_Scalar(self):
1011          d=self.domain.getDim()          d=self.domain.getDim()
1012          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1013          mypde.setValue(D=1.)          mypde.setValue(D=1.)
1014          coeff=mypde.getCoefficient("D")          coeff=mypde.getCoefficient("D")
1015          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),Function(self.domain),1,1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),Function(self.domain),1,1))
1016    
1017            mypde.resetRightHandSideCoefficients()
1018            self.assertFalse(mypde.getCoefficient("D").isEmpty(),"D is empty after reset of right hand side coefficients")
1019    
1020      def test_setCoefficient_X_Scalar(self):      def test_setCoefficient_X_Scalar(self):
1021          d=self.domain.getDim()          d=self.domain.getDim()
1022          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1023          mypde.setValue(X=numpy.ones((d,)))          mypde.setValue(X=numpy.ones((d,)))
1024          coeff=mypde.getCoefficient("X")          coeff=mypde.getCoefficient("X")
1025          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((d,),Function(self.domain),1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((d,),Function(self.domain),1))
1026    
1027            mypde.resetRightHandSideCoefficients()
1028            self.assertTrue(mypde.getCoefficient("X").isEmpty(),"X is not empty after reset of right hand side coefficients")
1029    
1030      def test_setCoefficient_Y_Scalar(self):      def test_setCoefficient_Y_Scalar(self):
1031          d=self.domain.getDim()          d=self.domain.getDim()
1032          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1033          mypde.setValue(Y=1.)          mypde.setValue(Y=1.)
1034          coeff=mypde.getCoefficient("Y")          coeff=mypde.getCoefficient("Y")
1035          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),Function(self.domain),1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),Function(self.domain),1))
1036    
1037            mypde.resetRightHandSideCoefficients()
1038            self.assertTrue(mypde.getCoefficient("Y").isEmpty(),"Y is not empty after reset of right hand side coefficients")
1039    
1040      def test_setCoefficient_y_Scalar(self):      def test_setCoefficient_y_Scalar(self):
1041          d=self.domain.getDim()          d=self.domain.getDim()
1042          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1043          mypde.setValue(y=1.)          mypde.setValue(y=1.)
1044          coeff=mypde.getCoefficient("y")          coeff=mypde.getCoefficient("y")
1045          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1))
1046    
1047            mypde.resetRightHandSideCoefficients()
1048            self.assertTrue(mypde.getCoefficient("y").isEmpty(),"y is not empty after reset of right hand side coefficients")
1049    
1050      def test_setCoefficient_d_Scalar(self):      def test_setCoefficient_d_Scalar(self):
1051          d=self.domain.getDim()          d=self.domain.getDim()
1052          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1053          mypde.setValue(d=1.)          mypde.setValue(d=1.)
1054          coeff=mypde.getCoefficient("d")          coeff=mypde.getCoefficient("d")
1055          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1,1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1,1))
1056    
1057            mypde.resetRightHandSideCoefficients()
1058            self.assertFalse(mypde.getCoefficient("d").isEmpty(),"d is empty after reset of right hand side coefficients")
1059    
1060      def test_setCoefficient_d_contact_Scalar(self):      def test_setCoefficient_d_contact_Scalar(self):
1061          d=self.domain.getDim()          if self.domain.supportsContactElements():
1062          mypde=LinearPDE(self.domain,debug=self.DEBUG)              d=self.domain.getDim()
1063          mypde.setValue(d_contact=1.)              mypde=LinearPDE(self.domain,debug=self.DEBUG)
1064          coeff=mypde.getCoefficient("d_contact")              mypde.setValue(d_contact=1.)
1065          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),FunctionOnContactZero(self.domain),1,1))              coeff=mypde.getCoefficient("d_contact")
1066                self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),FunctionOnContactZero(self.domain),1,1))
1067    
1068                mypde.resetRightHandSideCoefficients()
1069                self.assertFalse(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is empty after reset of right hand side coefficients")
1070    
1071      def test_setCoefficient_y_contact_Scalar(self):      def test_setCoefficient_y_contact_Scalar(self):
1072          d=self.domain.getDim()          d=self.domain.getDim()
1073          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          if self.domain.supportsContactElements():
1074          mypde.setValue(y_contact=1.)              mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1075          coeff=mypde.getCoefficient("y_contact")              mypde.setValue(y_contact=1.)
1076          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),FunctionOnContactZero(self.domain),1))              coeff=mypde.getCoefficient("y_contact")
1077                self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),FunctionOnContactZero(self.domain),1))
1078    
1079                mypde.resetRightHandSideCoefficients()
1080                self.assertTrue(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty after reset of right hand side coefficients")
1081    
1082      def test_setCoefficient_A_reduced_Scalar(self):      def test_setCoefficient_A_reduced_Scalar(self):
1083          d=self.domain.getDim()          d=self.domain.getDim()
1084          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1085          mypde.setValue(A_reduced=numpy.ones((d,d)))          mypde.setValue(A_reduced=numpy.ones((d,d)))
1086          coeff=mypde.getCoefficient("A_reduced")          coeff=mypde.getCoefficient("A_reduced")
1087          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,d),ReducedFunction(self.domain),1,1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,d),ReducedFunction(self.domain),1,1))
1088    
1089            mypde.resetRightHandSideCoefficients()
1090            self.assertFalse(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is empty after reset of right hand side coefficients")
1091    
1092      def test_setCoefficient_B_reduced_Scalar(self):      def test_setCoefficient_B_reduced_Scalar(self):
1093          d=self.domain.getDim()          d=self.domain.getDim()
1094          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1095          mypde.setValue(B_reduced=numpy.ones((d,)))          mypde.setValue(B_reduced=numpy.ones((d,)))
1096          coeff=mypde.getCoefficient("B_reduced")          coeff=mypde.getCoefficient("B_reduced")
1097          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))
1098    
1099            mypde.resetRightHandSideCoefficients()
1100            self.assertFalse(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is empty after reset of right hand side coefficients")
1101    
1102      def test_setCoefficient_C_reduced_Scalar(self):      def test_setCoefficient_C_reduced_Scalar(self):
1103          d=self.domain.getDim()          d=self.domain.getDim()
1104          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1105          mypde.setValue(C_reduced=numpy.ones((d,)))          mypde.setValue(C_reduced=numpy.ones((d,)))
1106          coeff=mypde.getCoefficient("C_reduced")          coeff=mypde.getCoefficient("C_reduced")
1107          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))
1108    
1109            mypde.resetRightHandSideCoefficients()
1110            self.assertFalse(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is empty after reset of right hand side coefficients")
1111    
1112      def test_setCoefficient_D_reduced_Scalar(self):      def test_setCoefficient_D_reduced_Scalar(self):
1113          d=self.domain.getDim()          d=self.domain.getDim()
1114          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1115          mypde.setValue(D_reduced=1.)          mypde.setValue(D_reduced=1.)
1116          coeff=mypde.getCoefficient("D_reduced")          coeff=mypde.getCoefficient("D_reduced")
1117          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1,1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunction(self.domain),1,1))
1118    
1119            mypde.resetRightHandSideCoefficients()
1120            self.assertFalse(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is empty after reset of right hand side coefficients")
1121    
1122      def test_setCoefficient_X_reduced_Scalar(self):      def test_setCoefficient_X_reduced_Scalar(self):
1123          d=self.domain.getDim()          d=self.domain.getDim()
1124          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1125          mypde.setValue(X_reduced=numpy.ones((d,)))          mypde.setValue(X_reduced=numpy.ones((d,)))
1126          coeff=mypde.getCoefficient("X_reduced")          coeff=mypde.getCoefficient("X_reduced")
1127          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1))
1128    
1129            mypde.resetRightHandSideCoefficients()
1130            self.assertTrue(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty after reset of right hand side coefficients")
1131    
1132      def test_setCoefficient_Y_reduced_Scalar(self):      def test_setCoefficient_Y_reduced_Scalar(self):
1133          d=self.domain.getDim()          d=self.domain.getDim()
1134          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1135          mypde.setValue(Y_reduced=1.)          mypde.setValue(Y_reduced=1.)
1136          coeff=mypde.getCoefficient("Y_reduced")          coeff=mypde.getCoefficient("Y_reduced")
1137          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunction(self.domain),1))
1138    
1139            mypde.resetRightHandSideCoefficients()
1140            self.assertTrue(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty after reset of right hand side coefficients")
1141    
1142      def test_setCoefficient_y_reduced_Scalar(self):      def test_setCoefficient_y_reduced_Scalar(self):
1143          d=self.domain.getDim()          d=self.domain.getDim()
1144          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1145          mypde.setValue(y_reduced=1.)          mypde.setValue(y_reduced=1.)
1146          coeff=mypde.getCoefficient("y_reduced")          coeff=mypde.getCoefficient("y_reduced")
1147          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))
1148    
1149            mypde.resetRightHandSideCoefficients()
1150            self.assertTrue(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty after reset of right hand side coefficients")
1151    
1152      def test_setCoefficient_d_reduced_Scalar(self):      def test_setCoefficient_d_reduced_Scalar(self):
1153          d=self.domain.getDim()          d=self.domain.getDim()
1154          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1155          mypde.setValue(d_reduced=1.)          mypde.setValue(d_reduced=1.)
1156          coeff=mypde.getCoefficient("d_reduced")          coeff=mypde.getCoefficient("d_reduced")
1157          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1,1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1,1))
1158    
1159            mypde.resetRightHandSideCoefficients()
1160            self.assertFalse(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty after reset of right hand side coefficients")
1161    
1162      def test_setCoefficient_d_contact_reduced_Scalar(self):      def test_setCoefficient_d_contact_reduced_Scalar(self):
1163          d=self.domain.getDim()          if self.domain.supportsContactElements():
1164          mypde=LinearPDE(self.domain,debug=self.DEBUG)              d=self.domain.getDim()
1165          mypde.setValue(d_contact_reduced=1.)              mypde=LinearPDE(self.domain,debug=self.DEBUG)
1166          coeff=mypde.getCoefficient("d_contact_reduced")              mypde.setValue(d_contact_reduced=1.)
1167          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1,1))              coeff=mypde.getCoefficient("d_contact_reduced")
1168                self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1,1))
1169    
1170                mypde.resetRightHandSideCoefficients()
1171                self.assertFalse(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty after reset of right hand side coefficients")
1172      def test_setCoefficient_y_contact_reduced_Scalar(self):      def test_setCoefficient_y_contact_reduced_Scalar(self):
1173          d=self.domain.getDim()          if self.domain.supportsContactElements():
1174          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)              d=self.domain.getDim()
1175          mypde.setValue(y_contact_reduced=1.)              mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1176          coeff=mypde.getCoefficient("y_contact_reduced")              mypde.setValue(y_contact_reduced=1.)
1177          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))              coeff=mypde.getCoefficient("y_contact_reduced")
1178                self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))
1179    
1180                mypde.resetRightHandSideCoefficients()
1181                self.assertTrue(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty after reset of right hand side coefficients")
1182    
1183      def test_setCoefficient_r_Scalar(self):      def test_setCoefficient_r_Scalar(self):
1184          d=self.domain.getDim()          d=self.domain.getDim()
1185          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1186          mypde.setValue(r=1.)          mypde.setValue(r=1.)
1187          coeff=mypde.getCoefficient("r")          coeff=mypde.getCoefficient("r")
1188          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),Solution(self.domain),1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((),Solution(self.domain),1))
1189    
1190            mypde.resetRightHandSideCoefficients()
1191            self.assertTrue(mypde.getCoefficient("r").isEmpty(),"r is not empty after reset of right hand side coefficients")
1192    
1193      def test_setCoefficient_q_Scalar(self):      def test_setCoefficient_q_Scalar(self):
1194          d=self.domain.getDim()          d=self.domain.getDim()
1195          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1196          mypde.setValue(q=1.)          mypde.setValue(q=1.)
1197          coeff=mypde.getCoefficient("q")          coeff=mypde.getCoefficient("q")
1198          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),Solution(self.domain),1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((),Solution(self.domain),1))
1199    
1200            mypde.resetRightHandSideCoefficients()
1201            self.assertFalse(mypde.getCoefficient("q").isEmpty(),"q is empty after reset of right hand side coefficients")
1202    
1203      def test_setCoefficient_r_Scalar_reducedOn(self):      def test_setCoefficient_r_Scalar_reducedOn(self):
1204          d=self.domain.getDim()          d=self.domain.getDim()
1205          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1206          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
1207          mypde.setValue(r=1.)          mypde.setValue(r=1.)
1208          coeff=mypde.getCoefficient("r")          coeff=mypde.getCoefficient("r")
1209          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))
1210    
1211            mypde.resetRightHandSideCoefficients()
1212            self.assertTrue(mypde.getCoefficient("r").isEmpty(),"r is not empty after reset of right hand side coefficients")
1213    
1214      def test_setCoefficient_q_Scalar_reducedOn(self):      def test_setCoefficient_q_Scalar_reducedOn(self):
1215          d=self.domain.getDim()          d=self.domain.getDim()
1216          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1217          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
1218          mypde.setValue(q=1.)          mypde.setValue(q=1.)
1219          coeff=mypde.getCoefficient("q")          coeff=mypde.getCoefficient("q")
1220          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))
1221    
1222            mypde.resetRightHandSideCoefficients()
1223            self.assertFalse(mypde.getCoefficient("q").isEmpty(),"q is empty after reset of right hand side coefficients")
1224    
1225      def test_setCoefficient_A_reduced_Scalar_usingA(self):      def test_setCoefficient_A_reduced_Scalar_usingA(self):
1226          d=self.domain.getDim()          d=self.domain.getDim()
1227          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1228          mypde.setValue(A=Data(numpy.ones((d,d)),ReducedFunction(self.domain)))          mypde.setValue(A=Data(numpy.ones((d,d)),ReducedFunction(self.domain)))
1229          coeff=mypde.getCoefficient("A_reduced")          coeff=mypde.getCoefficient("A_reduced")
1230          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,d),ReducedFunction(self.domain),1,1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,d),ReducedFunction(self.domain),1,1))
1231    
1232            mypde.resetRightHandSideCoefficients()
1233            self.assertFalse(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is empty after reset of right hand side coefficients")
1234    
1235      def test_setCoefficient_B_reduced_Scalar_usingB(self):      def test_setCoefficient_B_reduced_Scalar_usingB(self):
1236          d=self.domain.getDim()          d=self.domain.getDim()
1237          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1238          mypde.setValue(B=Data(numpy.ones((d,)),ReducedFunction(self.domain)))          mypde.setValue(B=Data(numpy.ones((d,)),ReducedFunction(self.domain)))
1239          coeff=mypde.getCoefficient("B_reduced")          coeff=mypde.getCoefficient("B_reduced")
1240          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))
1241    
1242            mypde.resetRightHandSideCoefficients()
1243            self.assertFalse(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is empty after reset of right hand side coefficients")
1244    
1245      def test_setCoefficient_C_reduced_Scalar_usingC(self):      def test_setCoefficient_C_reduced_Scalar_usingC(self):
1246          d=self.domain.getDim()          d=self.domain.getDim()
1247          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1248          mypde.setValue(C=Data(numpy.ones((d,)),ReducedFunction(self.domain)))          mypde.setValue(C=Data(numpy.ones((d,)),ReducedFunction(self.domain)))
1249          coeff=mypde.getCoefficient("C_reduced")          coeff=mypde.getCoefficient("C_reduced")
1250          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))
1251    
1252            mypde.resetRightHandSideCoefficients()
1253            self.assertFalse(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is empty after reset of right hand side coefficients")
1254    
1255      def test_setCoefficient_D_reduced_Scalar_usingD(self):      def test_setCoefficient_D_reduced_Scalar_usingD(self):
1256          d=self.domain.getDim()          d=self.domain.getDim()
1257          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1258          mypde.setValue(D=Scalar(1.,ReducedFunction(self.domain)))          mypde.setValue(D=Scalar(1.,ReducedFunction(self.domain)))
1259          coeff=mypde.getCoefficient("D_reduced")          coeff=mypde.getCoefficient("D_reduced")
1260          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1,1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunction(self.domain),1,1))
1261    
1262            mypde.resetRightHandSideCoefficients()
1263            self.assertFalse(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is empty after reset of right hand side coefficients")
1264    
1265      def test_setCoefficient_X_reduced_Scalar_usingX(self):      def test_setCoefficient_X_reduced_Scalar_usingX(self):
1266          d=self.domain.getDim()          d=self.domain.getDim()
1267          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1268          mypde.setValue(X_reduced=Data(numpy.ones((d,)),ReducedFunction(self.domain)))          mypde.setValue(X_reduced=Data(numpy.ones((d,)),ReducedFunction(self.domain)))
1269          coeff=mypde.getCoefficient("X_reduced")          coeff=mypde.getCoefficient("X_reduced")
1270          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1))
1271    
1272            mypde.resetRightHandSideCoefficients()
1273            self.assertTrue(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced not is empty after reset of right hand side coefficients")
1274    
1275      def test_setCoefficient_Y_reduced_Scalar_usingY(self):      def test_setCoefficient_Y_reduced_Scalar_usingY(self):
1276          d=self.domain.getDim()          d=self.domain.getDim()
1277          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1278          mypde.setValue(Y=Scalar(1.,ReducedFunction(self.domain)))          mypde.setValue(Y=Scalar(1.,ReducedFunction(self.domain)))
1279          coeff=mypde.getCoefficient("Y_reduced")          coeff=mypde.getCoefficient("Y_reduced")
1280          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunction(self.domain),1))
1281    
1282            mypde.resetRightHandSideCoefficients()
1283            self.assertTrue(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced not is empty after reset of right hand side coefficients")
1284    
1285      def test_setCoefficient_y_reduced_Scalar_using_y(self):      def test_setCoefficient_y_reduced_Scalar_using_y(self):
1286          d=self.domain.getDim()          d=self.domain.getDim()
1287          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1288          mypde.setValue(y=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(y=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))
1289          coeff=mypde.getCoefficient("y_reduced")          coeff=mypde.getCoefficient("y_reduced")
1290          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))
1291    
1292            mypde.resetRightHandSideCoefficients()
1293            self.assertTrue(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced not is empty after reset of right hand side coefficients")
1294    
1295      def test_setCoefficient_d_reduced_Scalar_using_d(self):      def test_setCoefficient_d_reduced_Scalar_using_d(self):
1296          d=self.domain.getDim()          d=self.domain.getDim()
1297          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1298          mypde.setValue(d=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(d=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))
1299          coeff=mypde.getCoefficient("d_reduced")          coeff=mypde.getCoefficient("d_reduced")
1300          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1,1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1,1))
1301    
1302            mypde.resetRightHandSideCoefficients()
1303            self.assertFalse(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced not is empty after reset of right hand side coefficients")
1304    
1305      def test_setCoefficient_d_contact_reduced_Scalar_using_d_contact(self):      def test_setCoefficient_d_contact_reduced_Scalar_using_d_contact(self):
1306          d=self.domain.getDim()          if self.domain.supportsContactElements():
1307          mypde=LinearPDE(self.domain,debug=self.DEBUG)              d=self.domain.getDim()
1308          mypde.setValue(d_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))              mypde=LinearPDE(self.domain,debug=self.DEBUG)
1309          coeff=mypde.getCoefficient("d_contact_reduced")              mypde.setValue(d_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))
1310          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1,1))              coeff=mypde.getCoefficient("d_contact_reduced")
1311                self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1,1))
1312                mypde.resetRightHandSideCoefficients()
1313                self.assertFalse(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced not is empty after reset of right hand side coefficients")
1314      def test_setCoefficient_y_contact_reduced_Scalar_using_y_contact(self):      def test_setCoefficient_y_contact_reduced_Scalar_using_y_contact(self):
1315          d=self.domain.getDim()          if self.domain.supportsContactElements():
1316          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)              d=self.domain.getDim()
1317          mypde.setValue(y_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))              mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1318          coeff=mypde.getCoefficient("y_contact_reduced")              mypde.setValue(y_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))
1319          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))              coeff=mypde.getCoefficient("y_contact_reduced")
1320                self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))
1321                mypde.resetRightHandSideCoefficients()
1322                self.assertTrue(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced not is empty after reset of right hand side coefficients")
1323      #      #
1324      #  set coefficients for systems:      #  set coefficients for systems:
1325      #      #
# Line 1169  class Test_LinearPDE_noLumping(Test_line Line 1328  class Test_LinearPDE_noLumping(Test_line
1328          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1329          mypde.setValue(A=numpy.ones((self.N,d,self.N,d)))          mypde.setValue(A=numpy.ones((self.N,d,self.N,d)))
1330          coeff=mypde.getCoefficient("A")          coeff=mypde.getCoefficient("A")
1331          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N,d),Function(self.domain),self.N,self.N))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,d,self.N,d),Function(self.domain),self.N,self.N))
1332            mypde.resetRightHandSideCoefficients()
1333            self.assertFalse(mypde.getCoefficient("A").isEmpty(),"A is empty after reset of right hand side coefficients")
1334            
1335      def test_setCoefficient_B_System(self):      def test_setCoefficient_B_System(self):
1336          d=self.domain.getDim()          d=self.domain.getDim()
1337          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1338          mypde.setValue(B=numpy.ones((self.N,d,self.N)))          mypde.setValue(B=numpy.ones((self.N,d,self.N)))
1339          coeff=mypde.getCoefficient("B")          coeff=mypde.getCoefficient("B")
1340          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N),Function(self.domain),self.N,self.N))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,d,self.N),Function(self.domain),self.N,self.N))
1341            mypde.resetRightHandSideCoefficients()
1342            self.assertFalse(mypde.getCoefficient("B").isEmpty(),"B is empty after reset of right hand side coefficients")
1343      def test_setCoefficient_C_System(self):      def test_setCoefficient_C_System(self):
1344          d=self.domain.getDim()          d=self.domain.getDim()
1345          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1346          mypde.setValue(C=numpy.ones((self.N,self.N,d)))          mypde.setValue(C=numpy.ones((self.N,self.N,d)))
1347          coeff=mypde.getCoefficient("C")          coeff=mypde.getCoefficient("C")
1348          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N,d),Function(self.domain),self.N,self.N))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N,d),Function(self.domain),self.N,self.N))
1349            mypde.resetRightHandSideCoefficients()
1350            self.assertFalse(mypde.getCoefficient("C").isEmpty(),"C is empty after reset of right hand side coefficients")
1351      def test_setCoefficient_D_System(self):      def test_setCoefficient_D_System(self):
1352          d=self.domain.getDim()          d=self.domain.getDim()
1353          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1354          mypde.setValue(D=numpy.ones((self.N,self.N)))          mypde.setValue(D=numpy.ones((self.N,self.N)))
1355          coeff=mypde.getCoefficient("D")          coeff=mypde.getCoefficient("D")
1356          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),Function(self.domain),self.N,self.N))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),Function(self.domain),self.N,self.N))
1357            mypde.resetRightHandSideCoefficients()
1358            self.assertFalse(mypde.getCoefficient("D").isEmpty(),"D is empty after reset of right hand side coefficients")
1359      def test_setCoefficient_X_System(self):      def test_setCoefficient_X_System(self):
1360          d=self.domain.getDim()          d=self.domain.getDim()
1361          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1362          mypde.setValue(X=numpy.ones((self.N,d)))          mypde.setValue(X=numpy.ones((self.N,d)))
1363          coeff=mypde.getCoefficient("X")          coeff=mypde.getCoefficient("X")
1364          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,d),Function(self.domain),self.N))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,d),Function(self.domain),self.N))
1365            mypde.resetRightHandSideCoefficients()
1366            self.assertTrue(mypde.getCoefficient("X").isEmpty(),"X is not empty after reset of right hand side coefficients")
1367      def test_setCoefficient_Y_System(self):      def test_setCoefficient_Y_System(self):
1368          d=self.domain.getDim()          d=self.domain.getDim()
1369          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1370          mypde.setValue(Y=numpy.ones((self.N,)))          mypde.setValue(Y=numpy.ones((self.N,)))
1371          coeff=mypde.getCoefficient("Y")          coeff=mypde.getCoefficient("Y")
1372          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),Function(self.domain),self.N))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),Function(self.domain),self.N))
1373            mypde.resetRightHandSideCoefficients()
1374            self.assertTrue(mypde.getCoefficient("Y").isEmpty(),"Y is not empty after reset of right hand side coefficients")
1375      def test_setCoefficient_y_System(self):      def test_setCoefficient_y_System(self):
1376          d=self.domain.getDim()          d=self.domain.getDim()
1377          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1378          mypde.setValue(y=numpy.ones((self.N,)))          mypde.setValue(y=numpy.ones((self.N,)))
1379          coeff=mypde.getCoefficient("y")          coeff=mypde.getCoefficient("y")
1380          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),FunctionOnBoundary(self.domain),self.N))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),FunctionOnBoundary(self.domain),self.N))
1381            mypde.resetRightHandSideCoefficients()
1382            self.assertTrue(mypde.getCoefficient("y").isEmpty(),"y is not empty after reset of right hand side coefficients")
1383      def test_setCoefficient_d_System(self):      def test_setCoefficient_d_System(self):
1384          d=self.domain.getDim()          d=self.domain.getDim()
1385          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1386          mypde.setValue(d=numpy.ones((self.N,self.N)))          mypde.setValue(d=numpy.ones((self.N,self.N)))
1387          coeff=mypde.getCoefficient("d")          coeff=mypde.getCoefficient("d")
1388          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),FunctionOnBoundary(self.domain),self.N,self.N))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),FunctionOnBoundary(self.domain),self.N,self.N))
1389            mypde.resetRightHandSideCoefficients()
1390            self.assertFalse(mypde.getCoefficient("d").isEmpty(),"d is empty after reset of right hand side coefficients")
1391      def test_setCoefficient_d_contact_System(self):      def test_setCoefficient_d_contact_System(self):
1392          d=self.domain.getDim()          if self.domain.supportsContactElements():
1393          mypde=LinearPDE(self.domain,debug=self.DEBUG)              d=self.domain.getDim()
1394          mypde.setValue(d_contact=numpy.ones((self.N,self.N)))              mypde=LinearPDE(self.domain,debug=self.DEBUG)
1395          coeff=mypde.getCoefficient("d_contact")              mypde.setValue(d_contact=numpy.ones((self.N,self.N)))
1396          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),FunctionOnContactZero(self.domain),self.N,self.N))              coeff=mypde.getCoefficient("d_contact")
1397                self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),FunctionOnContactZero(self.domain),self.N,self.N))
1398                mypde.resetRightHandSideCoefficients()
1399                self.assertFalse(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is empty after reset of right hand side coefficients")
1400      def test_setCoefficient_y_contact_System(self):      def test_setCoefficient_y_contact_System(self):
1401          d=self.domain.getDim()          if self.domain.supportsContactElements():
1402          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)              d=self.domain.getDim()
1403          mypde.setValue(y_contact=numpy.ones((self.N,)))              mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1404          coeff=mypde.getCoefficient("y_contact")              mypde.setValue(y_contact=numpy.ones((self.N,)))
1405          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),FunctionOnContactZero(self.domain),self.N))              coeff=mypde.getCoefficient("y_contact")
1406                self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),FunctionOnContactZero(self.domain),self.N))
1407                mypde.resetRightHandSideCoefficients()
1408                self.assertTrue(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty after reset of right hand side coefficients")
1409      def test_setCoefficient_A_reduced_System(self):      def test_setCoefficient_A_reduced_System(self):
1410          d=self.domain.getDim()          d=self.domain.getDim()
1411          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1412          mypde.setValue(A_reduced=numpy.ones((self.N,d,self.N,d)))          mypde.setValue(A_reduced=numpy.ones((self.N,d,self.N,d)))
1413          coeff=mypde.getCoefficient("A_reduced")          coeff=mypde.getCoefficient("A_reduced")
1414          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N,d),ReducedFunction(self.domain),self.N,self.N))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,d,self.N,d),ReducedFunction(self.domain),self.N,self.N))
1415            mypde.resetRightHandSideCoefficients()
1416            self.assertFalse(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is empty after reset of right hand side coefficients")
1417      def test_setCoefficient_B_reduced_System(self):      def test_setCoefficient_B_reduced_System(self):
1418          d=self.domain.getDim()          d=self.domain.getDim()
1419          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1420          mypde.setValue(B_reduced=numpy.ones((self.N,d,self.N)))          mypde.setValue(B_reduced=numpy.ones((self.N,d,self.N)))
1421          coeff=mypde.getCoefficient("B_reduced")          coeff=mypde.getCoefficient("B_reduced")
1422          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N),ReducedFunction(self.domain),self.N,self.N))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,d,self.N),ReducedFunction(self.domain),self.N,self.N))
1423            mypde.resetRightHandSideCoefficients()
1424            self.assertFalse(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is empty after reset of right hand side coefficients")
1425      def test_setCoefficient_C_reduced_System(self):      def test_setCoefficient_C_reduced_System(self):
1426          d=self.domain.getDim()          d=self.domain.getDim()
1427          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1428          mypde.setValue(C_reduced=numpy.ones((self.N,self.N,d)))          mypde.setValue(C_reduced=numpy.ones((self.N,self.N,d)))
1429          coeff=mypde.getCoefficient("C_reduced")          coeff=mypde.getCoefficient("C_reduced")
1430          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N,d),ReducedFunction(self.domain),self.N,self.N))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N,d),ReducedFunction(self.domain),self.N,self.N))
1431            mypde.resetRightHandSideCoefficients()
1432            self.assertFalse(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is empty after reset of right hand side coefficients")
1433      def test_setCoefficient_D_System_reduced(self):      def test_setCoefficient_D_System_reduced(self):
1434          d=self.domain.getDim()          d=self.domain.getDim()
1435          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1436          mypde.setValue(D_reduced=numpy.ones((self.N,self.N)))          mypde.setValue(D_reduced=numpy.ones((self.N,self.N)))
1437          coeff=mypde.getCoefficient("D_reduced")          coeff=mypde.getCoefficient("D_reduced")
1438          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunction(self.domain),self.N,self.N))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),ReducedFunction(self.domain),self.N,self.N))
1439            mypde.resetRightHandSideCoefficients()
1440            self.assertFalse(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is empty after reset of right hand side coefficients")
1441      def test_setCoefficient_X_System_reduced(self):      def test_setCoefficient_X_System_reduced(self):
1442          d=self.domain.getDim()          d=self.domain.getDim()
1443          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1444          mypde.setValue(X_reduced=numpy.ones((self.N,d)))          mypde.setValue(X_reduced=numpy.ones((self.N,d)))
1445          coeff=mypde.getCoefficient("X_reduced")          coeff=mypde.getCoefficient("X_reduced")
1446          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,d),ReducedFunction(self.domain),self.N))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,d),ReducedFunction(self.domain),self.N))
1447            mypde.resetRightHandSideCoefficients()
1448            self.assertTrue(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty after reset of right hand side coefficients")
1449      def test_setCoefficient_Y_System_reduced(self):      def test_setCoefficient_Y_System_reduced(self):
1450          d=self.domain.getDim()          d=self.domain.getDim()
1451          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1452          mypde.setValue(Y_reduced=numpy.ones((self.N,)))          mypde.setValue(Y_reduced=numpy.ones((self.N,)))
1453          coeff=mypde.getCoefficient("Y_reduced")          coeff=mypde.getCoefficient("Y_reduced")
1454          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunction(self.domain),self.N))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),ReducedFunction(self.domain),self.N))
1455            mypde.resetRightHandSideCoefficients()
1456            self.assertTrue(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty after reset of right hand side coefficients")
1457      def test_setCoefficient_y_System_reduced(self):      def test_setCoefficient_y_System_reduced(self):
1458          d=self.domain.getDim()          d=self.domain.getDim()
1459          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1460          mypde.setValue(y_reduced=numpy.ones((self.N,)))          mypde.setValue(y_reduced=numpy.ones((self.N,)))
1461          coeff=mypde.getCoefficient("y_reduced")          coeff=mypde.getCoefficient("y_reduced")
1462          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunctionOnBoundary(self.domain),self.N))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),ReducedFunctionOnBoundary(self.domain),self.N))
1463            mypde.resetRightHandSideCoefficients()
1464            self.assertTrue(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty after reset of right hand side coefficients")
1465      def test_setCoefficient_d_reduced_System(self):      def test_setCoefficient_d_reduced_System(self):
1466          d=self.domain.getDim()          d=self.domain.getDim()
1467          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1468          mypde.setValue(d_reduced=numpy.ones((self.N,self.N)))          mypde.setValue(d_reduced=numpy.ones((self.N,self.N)))
1469          coeff=mypde.getCoefficient("d_reduced")          coeff=mypde.getCoefficient("d_reduced")
1470          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnBoundary(self.domain),self.N,self.N))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnBoundary(self.domain),self.N,self.N))
1471            mypde.resetRightHandSideCoefficients()
1472            self.assertFalse(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is empty after reset of right hand side coefficients")
1473      def test_setCoefficient_d_contact_reduced_System(self):      def test_setCoefficient_d_contact_reduced_System(self):
1474          d=self.domain.getDim()          if self.domain.supportsContactElements():
1475          mypde=LinearPDE(self.domain,debug=self.DEBUG)              d=self.domain.getDim()
1476          mypde.setValue(d_contact_reduced=numpy.ones((self.N,self.N)))              mypde=LinearPDE(self.domain,debug=self.DEBUG)
1477          coeff=mypde.getCoefficient("d_contact_reduced")              mypde.setValue(d_contact_reduced=numpy.ones((self.N,self.N)))
1478          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnContactZero(self.domain),self.N,self.N))              coeff=mypde.getCoefficient("d_contact_reduced")
1479                self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnContactZero(self.domain),self.N,self.N))
1480                mypde.resetRightHandSideCoefficients()
1481                self.assertFalse(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is empty after reset of right hand side coefficients")
1482      def test_setCoefficient_y_contact_reduced_System(self):      def test_setCoefficient_y_contact_reduced_System(self):
1483          d=self.domain.getDim()          if self.domain.supportsContactElements():
1484          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)              d=self.domain.getDim()
1485          mypde.setValue(y_contact_reduced=numpy.ones((self.N,)))              mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1486          coeff=mypde.getCoefficient("y_contact_reduced")              mypde.setValue(y_contact_reduced=numpy.ones((self.N,)))
1487          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunctionOnContactZero(self.domain),self.N))              coeff=mypde.getCoefficient("y_contact_reduced")
1488                self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),ReducedFunctionOnContactZero(self.domain),self.N))
1489                mypde.resetRightHandSideCoefficients()
1490                self.assertTrue(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty after reset of right hand side coefficients")
1491      def test_setCoefficient_r_System(self):      def test_setCoefficient_r_System(self):
1492          d=self.domain.getDim()          d=self.domain.getDim()
1493          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1494          mypde.setValue(r=numpy.ones((self.N,)))          mypde.setValue(r=numpy.ones((self.N,)))
1495          coeff=mypde.getCoefficient("r")          coeff=mypde.getCoefficient("r")
1496          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((self.N,),Solution(self.domain),self.N))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((self.N,),Solution(self.domain),self.N))
1497            mypde.resetRightHandSideCoefficients()
1498            self.assertTrue(mypde.getCoefficient("r").isEmpty(),"r is not empty after reset of right hand side coefficients")
1499      def test_setCoefficient_q_System(self):      def test_setCoefficient_q_System(self):
1500          d=self.domain.getDim()          d=self.domain.getDim()
1501          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1502          mypde.setValue(q=numpy.ones((self.N,)))          mypde.setValue(q=numpy.ones((self.N,)))
1503          coeff=mypde.getCoefficient("q")          coeff=mypde.getCoefficient("q")
1504          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((self.N,),Solution(self.domain),self.N))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((self.N,),Solution(self.domain),self.N))
1505            mypde.resetRightHandSideCoefficients()
1506            self.assertFalse(mypde.getCoefficient("q").isEmpty(),"q is empty after reset of right hand side coefficients")
1507      def test_setCoefficient_r_System_reducedOn(self):      def test_setCoefficient_r_System_reducedOn(self):
1508          d=self.domain.getDim()          d=self.domain.getDim()
1509          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1510          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
1511          mypde.setValue(r=numpy.ones((self.N,)))          mypde.setValue(r=numpy.ones((self.N,)))
1512          coeff=mypde.getCoefficient("r")          coeff=mypde.getCoefficient("r")
1513          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((self.N,),ReducedSolution(self.domain),self.N))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((self.N,),ReducedSolution(self.domain),self.N))
1514            mypde.resetRightHandSideCoefficients()
1515            self.assertTrue(mypde.getCoefficient("r").isEmpty(),"r is not empty after reset of right hand side coefficients")
1516      def test_setCoefficient_q_System_reducedOn(self):      def test_setCoefficient_q_System_reducedOn(self):
1517          d=self.domain.getDim()          d=self.domain.getDim()
1518          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1519          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
1520          mypde.setValue(q=numpy.ones((self.N,)))          mypde.setValue(q=numpy.ones((self.N,)))
1521          coeff=mypde.getCoefficient("q")          coeff=mypde.getCoefficient("q")
1522          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((self.N,),ReducedSolution(self.domain),self.N))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((self.N,),ReducedSolution(self.domain),self.N))
1523            mypde.resetRightHandSideCoefficients()
1524            self.assertFalse(mypde.getCoefficient("q").isEmpty(),"q is empty after reset of right hand side coefficients")
1525    
1526      def test_setCoefficient_A_reduced_System_using_A(self):      def test_setCoefficient_A_reduced_System_using_A(self):
1527          d=self.domain.getDim()          d=self.domain.getDim()
1528          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1529          mypde.setValue(A=Data(numpy.ones((self.N,d,self.N,d)),ReducedFunction(self.domain)))          mypde.setValue(A=Data(numpy.ones((self.N,d,self.N,d)),ReducedFunction(self.domain)))
1530          coeff=mypde.getCoefficient("A_reduced")          coeff=mypde.getCoefficient("A_reduced")
1531          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N,d),ReducedFunction(self.domain),self.N,self.N))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,d,self.N,d),ReducedFunction(self.domain),self.N,self.N))
1532            mypde.resetRightHandSideCoefficients()
1533            self.assertFalse(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is empty after reset of right hand side coefficients")
1534      def test_setCoefficient_B_reduced_System_using_B(self):      def test_setCoefficient_B_reduced_System_using_B(self):
1535          d=self.domain.getDim()          d=self.domain.getDim()
1536          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1537          mypde.setValue(B=Data(numpy.ones((self.N,d,self.N)),ReducedFunction(self.domain)))          mypde.setValue(B=Data(numpy.ones((self.N,d,self.N)),ReducedFunction(self.domain)))
1538          coeff=mypde.getCoefficient("B_reduced")          coeff=mypde.getCoefficient("B_reduced")
1539          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N),ReducedFunction(self.domain),self.N,self.N))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,d,self.N),ReducedFunction(self.domain),self.N,self.N))
1540            mypde.resetRightHandSideCoefficients()
1541            self.assertFalse(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is empty after reset of right hand side coefficients")
1542      def test_setCoefficient_C_reduced_System_using_C(self):      def test_setCoefficient_C_reduced_System_using_C(self):
1543          d=self.domain.getDim()          d=self.domain.getDim()
1544          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1545          mypde.setValue(C=Data(numpy.ones((self.N,self.N,d)),ReducedFunction(self.domain)))          mypde.setValue(C=Data(numpy.ones((self.N,self.N,d)),ReducedFunction(self.domain)))
1546          coeff=mypde.getCoefficient("C_reduced")          coeff=mypde.getCoefficient("C_reduced")
1547          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N,d),ReducedFunction(self.domain),self.N,self.N))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N,d),ReducedFunction(self.domain),self.N,self.N))
1548            mypde.resetRightHandSideCoefficients()
1549            self.assertFalse(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is empty after reset of right hand side coefficients")
1550      def test_setCoefficient_D_System_reduced_using_D(self):      def test_setCoefficient_D_System_reduced_using_D(self):
1551          d=self.domain.getDim()          d=self.domain.getDim()
1552          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1553          mypde.setValue(D=Data(numpy.ones((self.N,self.N)),ReducedFunction(self.domain)))          mypde.setValue(D=Data(numpy.ones((self.N,self.N)),ReducedFunction(self.domain)))
1554          coeff=mypde.getCoefficient("D_reduced")          coeff=mypde.getCoefficient("D_reduced")
1555          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunction(self.domain),self.N,self.N))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),ReducedFunction(self.domain),self.N,self.N))
1556            mypde.resetRightHandSideCoefficients()
1557            self.assertFalse(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is empty after reset of right hand side coefficients")
1558      def test_setCoefficient_X_System_reduced_using_X(self):      def test_setCoefficient_X_System_reduced_using_X(self):
1559          d=self.domain.getDim()          d=self.domain.getDim()
1560          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1561          mypde.setValue(X=Data(numpy.ones((self.N,d)),ReducedFunction(self.domain)))          mypde.setValue(X=Data(numpy.ones((self.N,d)),ReducedFunction(self.domain)))
1562          coeff=mypde.getCoefficient("X_reduced")          coeff=mypde.getCoefficient("X_reduced")
1563          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,d),ReducedFunction(self.domain),self.N))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,d),ReducedFunction(self.domain),self.N))
1564            mypde.resetRightHandSideCoefficients()
1565            self.assertTrue(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty after reset of right hand side coefficients")
1566      def test_setCoefficient_Y_System_reduced_using_Y(self):      def test_setCoefficient_Y_System_reduced_using_Y(self):
1567          d=self.domain.getDim()          d=self.domain.getDim()
1568          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1569          mypde.setValue(Y=Data(numpy.ones((self.N,)),ReducedFunction(self.domain)))          mypde.setValue(Y=Data(numpy.ones((self.N,)),ReducedFunction(self.domain)))
1570          coeff=mypde.getCoefficient("Y_reduced")          coeff=mypde.getCoefficient("Y_reduced")
1571          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunction(self.domain),self.N))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),ReducedFunction(self.domain),self.N))
1572            mypde.resetRightHandSideCoefficients()
1573            self.assertTrue(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty after reset of right hand side coefficients")
1574      def test_setCoefficient_y_reduced_System_using_y(self):      def test_setCoefficient_y_reduced_System_using_y(self):
1575          d=self.domain.getDim()          d=self.domain.getDim()
1576          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1577          mypde.setValue(y=Data(numpy.ones((self.N,)),ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(y=Data(numpy.ones((self.N,)),ReducedFunctionOnBoundary(self.domain)))
1578          coeff=mypde.getCoefficient("y_reduced")          coeff=mypde.getCoefficient("y_reduced")
1579          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunctionOnBoundary(self.domain),self.N))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),ReducedFunctionOnBoundary(self.domain),self.N))
1580            mypde.resetRightHandSideCoefficients()
1581            self.assertTrue(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty after reset of right hand side coefficients")
1582      def test_setCoefficient_d_reduced_System_using_d(self):      def test_setCoefficient_d_reduced_System_using_d(self):
1583          d=self.domain.getDim()          d=self.domain.getDim()
1584          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1585          mypde.setValue(d=Data(numpy.ones((self.N,self.N)),ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(d=Data(numpy.ones((self.N,self.N)),ReducedFunctionOnBoundary(self.domain)))
1586          coeff=mypde.getCoefficient("d_reduced")          coeff=mypde.getCoefficient("d_reduced")
1587          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnBoundary(self.domain),self.N,self.N))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnBoundary(self.domain),self.N,self.N))
1588            mypde.resetRightHandSideCoefficients()
1589            self.assertFalse(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is empty after reset of right hand side coefficients")
1590      def test_setCoefficient_d_contact_reduced_System_using_d_contact(self):      def test_setCoefficient_d_contact_reduced_System_using_d_contact(self):
1591          d=self.domain.getDim()          if self.domain.supportsContactElements():
1592          mypde=LinearPDE(self.domain,debug=self.DEBUG)              d=self.domain.getDim()
1593          mypde.setValue(d_contact=Data(numpy.ones((self.N,self.N)),ReducedFunctionOnContactZero(self.domain)))              mypde=LinearPDE(self.domain,debug=self.DEBUG)
1594          coeff=mypde.getCoefficient("d_contact_reduced")              mypde.setValue(d_contact=Data(numpy.ones((self.N,self.N)),ReducedFunctionOnContactZero(self.domain)))
1595          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnContactZero(self.domain),self.N,self.N))              coeff=mypde.getCoefficient("d_contact_reduced")
1596                self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnContactZero(self.domain),self.N,self.N))
1597                mypde.resetRightHandSideCoefficients()
1598                self.assertFalse(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is empty after reset of right hand side coefficients")
1599      def test_setCoefficient_y_contact_reduced_System_using_y_contact(self):      def test_setCoefficient_y_contact_reduced_System_using_y_contact(self):
1600          d=self.domain.getDim()          if self.domain.supportsContactElements():
1601          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)              d=self.domain.getDim()
1602          mypde.setValue(y_contact=Data(numpy.ones((self.N,)),ReducedFunctionOnContactZero(self.domain)))              mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1603          coeff=mypde.getCoefficient("y_contact_reduced")              mypde.setValue(y_contact=Data(numpy.ones((self.N,)),ReducedFunctionOnContactZero(self.domain)))
1604          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunctionOnContactZero(self.domain),self.N))              coeff=mypde.getCoefficient("y_contact_reduced")
1605                self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),ReducedFunctionOnContactZero(self.domain),self.N))
1606    
1607                mypde.resetRightHandSideCoefficients()
1608                self.assertTrue(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty after reset of right hand side coefficients")
1609    
1610      def test_resetCoefficient_HomogeneousConstraint(self):      def test_resetCoefficient_HomogeneousConstraint(self):
1611          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1612          x=self.domain.getX()          x=self.domain.getX()
# Line 1378  class Test_LinearPDE_noLumping(Test_line Line 1614  class Test_LinearPDE_noLumping(Test_line
1614          u1=mypde.getSolution()          u1=mypde.getSolution()
1615          mypde.setValue(Y=2.)          mypde.setValue(Y=2.)
1616          u2=mypde.getSolution()          u2=mypde.getSolution()
1617          self.failUnless(self.check(u2,2*u1),'solution is wrong.')          self.assertTrue(self.check(u2,2*u1),'solution is wrong.')
1618    
1619      def test_resetCoefficient_InHomogeneousConstraint(self):      def test_resetCoefficient_InHomogeneousConstraint(self):
1620          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1621          mypde.setSymmetryOn()          mypde.setSymmetryOn()
1622            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1623          x=self.domain.getX()          x=self.domain.getX()
1624          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.,r=1,q=whereZero(x[0]))          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.,r=1,q=whereZero(x[0]))
1625          u1=mypde.getSolution(verbose=self.VERBOSE)          u1=mypde.getSolution()
1626          mypde.setValue(Y=2.,D=2)          mypde.setValue(Y=2.,D=2)
1627          u2=mypde.getSolution(verbose=self.VERBOSE)          u2=mypde.getSolution()
1628          self.failUnless(self.check(u2,u1),'first solution is wrong.')          self.assertTrue(self.check(u2,u1),'first solution is wrong.')
1629          u2=mypde.getSolution(verbose=self.VERBOSE)          u2=mypde.getSolution()
1630          self.failUnless(self.check(u2,u1),'first solution is wrong.')          self.assertTrue(self.check(u2,u1),'first solution is wrong.')
1631          mypde.setValue(r=2,Y=4.)          mypde.setValue(r=2,Y=4.)
1632          u2=mypde.getSolution(verbose=self.VERBOSE)          u2=mypde.getSolution()
1633          self.failUnless(self.check(u2,2*u1),'second solution is wrong.')          self.assertTrue(self.check(u2,2*u1),'second solution is wrong.')
1634    
1635        def test_Status(self):
1636            DIM=self.domain.getDim()
1637            x=self.domain.getX()
1638            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1639            mypde.getSolverOptions().setSymmetryOn()
1640            mypde.getSolverOptions().setTolerance(self.RES_TOL)
1641            mypde.setValue(A=kronecker(self.domain), q=whereZero(x[0])+whereZero(x[0]-1.), Y=2.)
1642            x1=self.domain.getX()
1643            u1_ref=x1[0]*(1.-x1[0])
1644            u1=mypde.getSolution()
1645            error1=Lsup(u1-u1_ref)/Lsup(u1_ref)
1646            self.assertTrue(mypde.getDomainStatus() == mypde.getSystemStatus(), "status of first pde does not match domain status.")
1647            try:
1648                self.domain.setX(x*5)
1649            except:
1650                # setX not supported
1651                return
1652            self.assertTrue(mypde.getDomainStatus() != mypde.getSystemStatus(), "status of first pde matches updated domain status.")
1653            x2=self.domain.getX()
1654            u2_ref=x2[0]*(5.-x2[0])
1655            u2=mypde.getSolution()
1656            error2=Lsup(u2-u2_ref)/Lsup(u2_ref)
1657            self.assertTrue(error2 <= max(error1,self.RES_TOL)*10., "solution of second PDE wrong.")
1658            self.assertTrue(mypde.getDomainStatus() == mypde.getSystemStatus(), "status of second pde does not match domain status.")
1659    
1660      def test_symmetryCheckTrue_System(self):      def test_symmetryCheckTrue_System(self):
1661          d=self.domain.getDim()          d=self.domain.getDim()
# Line 1404  class Test_LinearPDE_noLumping(Test_line Line 1666  class Test_LinearPDE_noLumping(Test_line
1666          D=3*numpy.ones((self.N,self.N))          D=3*numpy.ones((self.N,self.N))
1667          d=4*numpy.ones((self.N,self.N))          d=4*numpy.ones((self.N,self.N))
1668          d_contact=5*numpy.ones((self.N,self.N))          d_contact=5*numpy.ones((self.N,self.N))
1669          mypde.setValue(A=A,B=B,C=C,D=D,d=d,d_contact=d_contact,A_reduced=-A,B_reduced=-B,C_reduced=-C,D_reduced=-D,d_reduced=-d,d_contact_reduced=-d_contact)          pars={"A":A, "B":B, "C":C, "D":D, "d":d, "A_reduced":-A, "B_reduced":-B, "C_reduced":-C, "D_reduced":-D, "d_reduced":-d}
1670          self.failUnless(mypde.checkSymmetry(verbose=False),"symmetry detected")          if self.domain.supportsContactElements():
1671                    pars["d_contact"]=d_contact
1672                    pars["d_contact_reduced"]=-d_contact
1673            mypde.setValue(**pars)
1674            self.assertTrue(mypde.checkSymmetry(verbose=False),"symmetry detected")
1675    
1676      def test_symmetryCheckFalse_A_System(self):      def test_symmetryCheckFalse_A_System(self):
1677          d=self.domain.getDim()          d=self.domain.getDim()
# Line 1413  class Test_LinearPDE_noLumping(Test_line Line 1679  class Test_LinearPDE_noLumping(Test_line
1679          A=numpy.ones((self.N,d,self.N,d))          A=numpy.ones((self.N,d,self.N,d))
1680          A[1,1,1,0]=0.          A[1,1,1,0]=0.
1681          mypde.setValue(A=A)          mypde.setValue(A=A)
1682          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")          self.assertTrue(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1683      def test_symmetryCheckFalse_BC_System(self):      def test_symmetryCheckFalse_BC_System(self):
1684          d=self.domain.getDim()          d=self.domain.getDim()
1685          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 1421  class Test_LinearPDE_noLumping(Test_line Line 1687  class Test_LinearPDE_noLumping(Test_line
1687          B=2*numpy.ones((self.N,d,self.N))          B=2*numpy.ones((self.N,d,self.N))
1688          B[0,0,1]=1.          B[0,0,1]=1.
1689          mypde.setValue(B=B,C=C)          mypde.setValue(B=B,C=C)
1690          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")          self.assertTrue(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1691    
1692      def test_symmetryCheckFalse_D_System(self):      def test_symmetryCheckFalse_D_System(self):
1693          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1694          D=3*numpy.ones((self.N,self.N))          D=3*numpy.ones((self.N,self.N))
1695          D[0,1]=0.          D[0,1]=0.
1696          mypde.setValue(D=D)          mypde.setValue(D=D)
1697          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")          self.assertTrue(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1698    
1699      def test_symmetryCheckFalse_d_System(self):      def test_symmetryCheckFalse_d_System(self):
1700          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1701          d=4*numpy.ones((self.N,self.N))          d=4*numpy.ones((self.N,self.N))
1702          d[0,1]=0.          d[0,1]=0.
1703          mypde.setValue(d=d)          mypde.setValue(d=d)
1704          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")          self.assertTrue(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1705    
1706      def test_symmetryCheckFalse_d_contact_System(self):      def test_symmetryCheckFalse_d_contact_System(self):
1707          mypde=LinearPDE(self.domain,debug=self.DEBUG)          if self.domain.supportsContactElements():
1708          d_contact=5*numpy.ones((self.N,self.N))              mypde=LinearPDE(self.domain,debug=self.DEBUG)
1709          d_contact[0,1]=0.              d_contact=5*numpy.ones((self.N,self.N))
1710          mypde.setValue(d_contact=d_contact)              d_contact[0,1]=0.
1711          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")              mypde.setValue(d_contact=d_contact)
1712                self.assertTrue(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1713    
1714      def test_symmetryCheckFalse_A_reduced_System(self):      def test_symmetryCheckFalse_A_reduced_System(self):
1715          d=self.domain.getDim()          d=self.domain.getDim()
# Line 1450  class Test_LinearPDE_noLumping(Test_line Line 1717  class Test_LinearPDE_noLumping(Test_line
1717          A=numpy.ones((self.N,d,self.N,d))          A=numpy.ones((self.N,d,self.N,d))
1718          A[1,1,1,0]=0.          A[1,1,1,0]=0.
1719          mypde.setValue(A_reduced=A)          mypde.setValue(A_reduced=A)
1720          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")          self.assertTrue(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1721      def test_symmetryCheckFalse_BC_reduced_System(self):      def test_symmetryCheckFalse_BC_reduced_System(self):
1722          d=self.domain.getDim()          d=self.domain.getDim()
1723          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 1458  class Test_LinearPDE_noLumping(Test_line Line 1725  class Test_LinearPDE_noLumping(Test_line
1725          B=2*numpy.ones((self.N,d,self.N))          B=2*numpy.ones((self.N,d,self.N))
1726          B[0,0,1]=1.          B[0,0,1]=1.
1727          mypde.setValue(B_reduced=B,C_reduced=C)          mypde.setValue(B_reduced=B,C_reduced=C)
1728          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")          self.assertTrue(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1729    
1730      def test_symmetryCheckFalse_D_reduced_System(self):      def test_symmetryCheckFalse_D_reduced_System(self):
1731          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1732          D=3*numpy.ones((self.N,self.N))          D=3*numpy.ones((self.N,self.N))
1733          D[0,1]=0.          D[0,1]=0.
1734          mypde.setValue(D_reduced=D)          mypde.setValue(D_reduced=D)
1735          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")          self.assertTrue(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1736    
1737      def test_symmetryCheckFalse_d_reduced_System(self):      def test_symmetryCheckFalse_d_reduced_System(self):
1738          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1739          d=4*numpy.ones((self.N,self.N))          d=4*numpy.ones((self.N,self.N))
1740          d[0,1]=0.          d[0,1]=0.
1741          mypde.setValue(d_reduced=d)          mypde.setValue(d_reduced=d)
1742          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")          self.assertTrue(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1743    
1744      def test_symmetryCheckFalse_d_contact_reduced_System(self):      def test_symmetryCheckFalse_d_contact_reduced_System(self):
1745          mypde=LinearPDE(self.domain,debug=self.DEBUG)          if self.domain.supportsContactElements():
1746          d_contact=5*numpy.ones((self.N,self.N))              mypde=LinearPDE(self.domain,debug=self.DEBUG)
1747          d_contact[0,1]=0.              d_contact=5*numpy.ones((self.N,self.N))
1748          mypde.setValue(d_contact_reduced=d_contact)              d_contact[0,1]=0.
1749          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")              mypde.setValue(d_contact_reduced=d_contact)
1750                self.assertTrue(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1751    
1752      def test_symmetryCheckTrue_Scalar(self):      def test_symmetryCheckTrue_Scalar(self):
1753          d=self.domain.getDim()          d=self.domain.getDim()
# Line 1490  class Test_LinearPDE_noLumping(Test_line Line 1758  class Test_LinearPDE_noLumping(Test_line
1758          D=3          D=3
1759          d=4          d=4
1760          d_contact=5          d_contact=5
1761          mypde.setValue(A=A,B=B,C=C,D=D,d=d,d_contact=d_contact,A_reduced=-A,B_reduced=-B,C_reduced=-C,D_reduced=-D,d_reduced=-d,d_contact_reduced=-d_contact)          pars={"A":A, "B":B, "C":C, "D":D, "d":d, "A_reduced":-A, "B_reduced":-B, "C_reduced":-C, "D_reduced":-D, "d_reduced":-d}
1762          self.failUnless(mypde.checkSymmetry(verbose=False),"symmetry detected")          if self.domain.supportsContactElements():
1763                    pars["d_contact"]=d_contact
1764                    pars["d_contact_reduced"]=-d_contact
1765            mypde.setValue(**pars)
1766            self.assertTrue(mypde.checkSymmetry(verbose=False),"symmetry detected")
1767    
1768      def test_symmetryCheckFalse_A_Scalar(self):      def test_symmetryCheckFalse_A_Scalar(self):
1769          d=self.domain.getDim()          d=self.domain.getDim()
# Line 1499  class Test_LinearPDE_noLumping(Test_line Line 1771  class Test_LinearPDE_noLumping(Test_line
1771          A=numpy.ones((d,d))          A=numpy.ones((d,d))
1772          A[1,0]=0.          A[1,0]=0.
1773          mypde.setValue(A=A)          mypde.setValue(A=A)
1774          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")          self.assertTrue(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1775      def test_symmetryCheckFalse_BC_Scalar(self):      def test_symmetryCheckFalse_BC_Scalar(self):
1776          d=self.domain.getDim()          d=self.domain.getDim()
1777          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 1507  class Test_LinearPDE_noLumping(Test_line Line 1779  class Test_LinearPDE_noLumping(Test_line
1779          B=2*numpy.ones((d,))          B=2*numpy.ones((d,))
1780          B[0]=1.          B[0]=1.
1781          mypde.setValue(B=B,C=C)          mypde.setValue(B=B,C=C)
1782          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")          self.assertTrue(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1783      def test_symmetryCheckFalse_A_reduced_Scalar(self):      def test_symmetryCheckFalse_A_reduced_Scalar(self):
1784          d=self.domain.getDim()          d=self.domain.getDim()
1785          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1786          A=numpy.ones((d,d))          A=numpy.ones((d,d))
1787          A[1,0]=0.          A[1,0]=0.
1788          mypde.setValue(A_reduced=A)          mypde.setValue(A_reduced=A)
1789          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")          self.assertTrue(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1790      def test_symmetryCheckFalse_BC_reduced_Scalar(self):      def test_symmetryCheckFalse_BC_reduced_Scalar(self):
1791          d=self.domain.getDim()          d=self.domain.getDim()
1792          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 1522  class Test_LinearPDE_noLumping(Test_line Line 1794  class Test_LinearPDE_noLumping(Test_line
1794          B=2*numpy.ones((d,))          B=2*numpy.ones((d,))
1795          B[0]=1.          B[0]=1.
1796          mypde.setValue(B_reduced=B,C_reduced=C)          mypde.setValue(B_reduced=B,C_reduced=C)
1797          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")          self.assertTrue(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1798      #      #
1799      #   solver checks (single PDE)      #   solver checks (single PDE)
1800      #      #
1801      def test_symmetryOnIterative(self):      def test_symmetryOnIterative(self):
1802          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1803          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1804          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1805          self.failUnless(self.check(u,1.),'solution is wrong.')          u=mypde.getSolution()
1806            self.assertTrue(self.check(u,1.),'solution is wrong.')
1807      def test_symmetryOnDirect(self):      def test_symmetryOnDirect(self):
1808          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1809          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1810          mypde.setSolverMethod(mypde.DIRECT)          mypde.getSolverOptions().setSolverMethod(SolverOptions.DIRECT)
1811          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1812          self.failUnless(self.check(u,1.),'solution is wrong.')          u=mypde.getSolution()
1813            self.assertTrue(self.check(u,1.),'solution is wrong.')
1814      def test_PCG_JACOBI(self):      def test_PCG_JACOBI(self):
1815          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1816          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1817          mypde.setSolverMethod(mypde.PCG,mypde.JACOBI)          mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1818          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1819          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1820            u=mypde.getSolution()
1821            self.assertTrue(self.check(u,1.),'solution is wrong.')
1822        def test_PCG_GAUSS_SEIDEL(self):
1823            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1824            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1825            mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1826            mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1827            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1828            u=mypde.getSolution()
1829            self.assertTrue(self.check(u,1.),'solution is wrong.')
1830        def test_PCG_AMG(self):
1831            if self.order!=2:
1832                if getEscriptParamInt('DISABLE_AMG', 0):
1833                    print("AMG test disabled on MPI build")
1834                    return
1835                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1836                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1837                mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1838                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1839                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1840                u=mypde.getSolution()
1841                self.assertTrue(self.check(u,1.),'solution is wrong.')
1842      def test_PCG_ILU0(self):      def test_PCG_ILU0(self):
1843          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1844          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1845          mypde.setSolverMethod(mypde.PCG,mypde.ILU0)          mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1846          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1847          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1848            u=mypde.getSolution()
1849            self.assertTrue(self.check(u,1.),'solution is wrong.')
1850      def test_PCG_RILU(self):      def test_PCG_RILU(self):
1851          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1852          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1853          mypde.setSolverMethod(mypde.PCG,mypde.RILU)          mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1854          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1855          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1856            u=mypde.getSolution()
1857            self.assertTrue(self.check(u,1.),'solution is wrong.')
1858        def test_PCG_REC_ILU(self):
1859            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1860            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1861            mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1862            mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
1863            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1864            u=mypde.getSolution()
1865            self.assertTrue(self.check(u,1.),'solution is wrong.')
1866      def test_DIRECT(self):      def test_DIRECT(self):
1867          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1868          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1869          mypde.setSolverMethod(mypde.DIRECT)          mypde.getSolverOptions().setSolverMethod(SolverOptions.DIRECT)
1870          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1871          self.failUnless(self.check(u,1.),'solution is wrong.')          u=mypde.getSolution()
1872            self.assertTrue(self.check(u,1.),'solution is wrong.')
1873      def test_BICGSTAB_JACOBI(self):      def test_BICGSTAB_JACOBI(self):
1874          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1875      mypde.setSolverMethod(mypde.BICGSTAB,mypde.JACOBI)          mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1876            mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1877            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1878            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1879            u=mypde.getSolution()
1880            self.assertTrue(self.check(u,1.),'solution is wrong.')
1881        def test_BICGSTAB_GAUSS_SEIDEL(self):
1882            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1883            mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1884            mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1885          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1886          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1887          self.failUnless(self.check(u,1.),'solution is wrong.')          u=mypde.getSolution()
1888            self.assertTrue(self.check(u,1.),'solution is wrong.')
1889        def test_BICGSTAB_AMG(self):
1890            if self.order!=2:
1891                if getEscriptParamInt('DISABLE_AMG', 0):
1892                    print("AMG test disabled on MPI build")
1893                    return    
1894                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1895                mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1896                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1897                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1898                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1899                u=mypde.getSolution()
1900                self.assertTrue(self.check(u,1.),'solution is wrong.')
1901      def test_BICGSTAB_ILU0(self):      def test_BICGSTAB_ILU0(self):
1902          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1903          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1904      mypde.setSolverMethod(mypde.BICGSTAB,mypde.ILU0)          mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1905          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1906          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1907            u=mypde.getSolution()
1908            self.assertTrue(self.check(u,1.),'solution is wrong.')
1909      def test_BICGSTAB_RILU(self):      def test_BICGSTAB_RILU(self):
1910          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1911          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1912      mypde.setSolverMethod(mypde.BICGSTAB,mypde.RILU)          mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1913          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1914          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1915            u=mypde.getSolution()
1916            self.assertTrue(self.check(u,1.),'solution is wrong.')
1917        def test_BICGSTAB_REC_ILU(self):
1918            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1919            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1920            mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1921            mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
1922            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1923            u=mypde.getSolution()
1924            self.assertTrue(self.check(u,1.),'solution is wrong.')
1925      def test_MINRES_JACOBI(self):      def test_MINRES_JACOBI(self):
1926          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1927      mypde.setSolverMethod(mypde.MINRES,mypde.JACOBI)          mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1928            mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1929            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1930            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1931            u=mypde.getSolution()
1932            self.assertTrue(self.check(u,1.),'solution is wrong.')
1933        def test_MINRES_GAUSS_SEIDEL(self):
1934            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1935            mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1936            mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1937          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1938          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1939          self.failUnless(self.check(u,1.),'solution is wrong.')          u=mypde.getSolution()
1940            self.assertTrue(self.check(u,1.),'solution is wrong.')
1941        def test_MINRES_AMG(self):
1942            if self.order!=2:
1943                if getEscriptParamInt('DISABLE_AMG',0):
1944                    print("AMG test disabled on MPI build")
1945                    return                
1946                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1947                mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1948                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1949                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1950                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1951                u=mypde.getSolution()
1952                self.assertTrue(self.check(u,1.),'solution is wrong.')
1953      def test_MINRES_ILU0(self):      def test_MINRES_ILU0(self):
1954          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1955          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1956      mypde.setSolverMethod(mypde.MINRES,mypde.ILU0)          mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1957          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1958          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1959            u=mypde.getSolution()
1960            self.assertTrue(self.check(u,1.),'solution is wrong.')
1961      def test_MINRES_RILU(self):      def test_MINRES_RILU(self):
1962          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1963          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1964      mypde.setSolverMethod(mypde.MINRES,mypde.RILU)          mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1965          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1966          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1967            u=mypde.getSolution()
1968            self.assertTrue(self.check(u,1.),'solution is wrong.')
1969        def test_MINRES_REC_ILU(self):
1970            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1971            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1972            mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1973            mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
1974            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1975            u=mypde.getSolution()
1976            self.assertTrue(self.check(u,1.),'solution is wrong.')
1977      def test_TFQMR_JACOBI(self):      def test_TFQMR_JACOBI(self):
1978          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1979      mypde.setSolverMethod(mypde.TFQMR,mypde.JACOBI)          mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
1980            mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1981            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1982            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1983            u=mypde.getSolution()
1984            self.assertTrue(self.check(u,1.),'solution is wrong.')
1985        def test_TFQMR_GAUSS_SEIDEL(self):
1986            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1987            mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
1988            mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1989          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1990          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1991          self.failUnless(self.check(u,1.),'solution is wrong.')          u=mypde.getSolution()
1992            self.assertTrue(self.check(u,1.),'solution is wrong.')
1993        def test_TFQMR_AMG(self):
1994            if self.order!=2:
1995                if getEscriptParamInt('DISABLE_AMG', 0):
1996                    print("AMG test disabled on MPI build")
1997                    return
1998                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1999                mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
2000                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2001                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2002                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2003                u=mypde.getSolution()
2004                self.assertTrue(self.check(u,1.),'solution is wrong.')
2005      def test_TFQMR_ILU0(self):      def test_TFQMR_ILU0(self):
2006          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2007          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2008      mypde.setSolverMethod(mypde.TFQMR,mypde.ILU0)          mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
2009          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2010          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2011            u=mypde.getSolution()
2012            self.assertTrue(self.check(u,1.),'solution is wrong.')
2013      def test_TFQMR_RILU(self):      def test_TFQMR_RILU(self):
2014          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2015          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2016      mypde.setSolverMethod(mypde.TFQMR,mypde.RILU)          mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
2017          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
2018          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2019            u=mypde.getSolution()
2020            self.assertTrue(self.check(u,1.),'solution is wrong.')
2021        def test_TFQMR_REC_ILU(self):
2022            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2023            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2024            mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
2025            mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
2026            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2027            u=mypde.getSolution()
2028            self.assertTrue(self.check(u,1.),'solution is wrong.')
2029      def test_PRES20_JACOBI(self):      def test_PRES20_JACOBI(self):
2030          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2031          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2032      mypde.setSolverMethod(mypde.PRES20,mypde.JACOBI)          mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
2033          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
2034          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2035            u=mypde.getSolution()
2036            self.assertTrue(self.check(u,1.),'solution is wrong.')
2037        def test_PRES20_GAUSS_SEIDEL(self):
2038            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2039            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2040            mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
2041            mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2042            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2043            u=mypde.getSolution()
2044            self.assertTrue(self.check(u,1.),'solution is wrong.')
2045        def test_PRES20_AMG(self):
2046            if self.order!=2:
2047                if getEscriptParamInt('DISABLE_AMG', 0):
2048                    print("AMG test disabled on MPI build")
2049                    return
2050                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2051                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2052                mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
2053                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2054                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2055                u=mypde.getSolution()
2056                self.assertTrue(self.check(u,1.),'solution is wrong.')
2057      def test_PRES20_ILU0(self):      def test_PRES20_ILU0(self):
2058          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2059          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2060      mypde.setSolverMethod(mypde.PRES20,mypde.ILU0)          mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
2061          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2062          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2063            u=mypde.getSolution()
2064            self.assertTrue(self.check(u,1.),'solution is wrong.')
2065      def test_PRES20_RILU(self):      def test_PRES20_RILU(self):
2066          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2067          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2068      mypde.setSolverMethod(mypde.PRES20,mypde.RILU)          mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
2069          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
2070          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2071            u=mypde.getSolution()
2072            self.assertTrue(self.check(u,1.),'solution is wrong.')
2073        def test_PRES20_REC_ILU(self):
2074            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2075            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2076            mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
2077            mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
2078            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2079            u=mypde.getSolution()
2080            self.assertTrue(self.check(u,1.),'solution is wrong.')
2081      def test_GMRESnoRestart_JACOBI(self):      def test_GMRESnoRestart_JACOBI(self):
2082          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2083          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2084      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)          mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2085          u=mypde.getSolution(verbose=self.VERBOSE,truncation=50)          mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
2086          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2087            mypde.getSolverOptions().setTruncation(50)
2088            u=mypde.getSolution()
2089            self.assertTrue(self.check(u,1.),'solution is wrong.')
2090        def test_GMRESnoRestart_GAUSS_SEIDEL(self):
2091            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2092            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2093            mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2094            mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2095            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2096            mypde.getSolverOptions().setTruncation(50)
2097            u=mypde.getSolution()
2098            self.assertTrue(self.check(u,1.),'solution is wrong.')
2099        def test_GMRESnoRestart_AMG(self):
2100            if self.order!=2:
2101                if getEscriptParamInt('DISABLE_AMG', 0):
2102                    print("AMG test disabled on MPI build")
2103                    return    
2104                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2105                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2106                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2107                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2108                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2109                mypde.getSolverOptions().setTruncation(50)
2110                u=mypde.getSolution()
2111                self.assertTrue(self.check(u,1.),'solution is wrong.')
2112      def test_GMRESnoRestart_ILU0(self):      def test_GMRESnoRestart_ILU0(self):
2113          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2114          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2115      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)          mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2116          u=mypde.getSolution(verbose=self.VERBOSE,truncation=50)          mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2117          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2118          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setTruncation(50)                        
2119            u=mypde.getSolution()
2120            self.assertTrue(self.check(u,1.),'solution is wrong.')
2121      def test_GMRESnoRestart_RILU(self):      def test_GMRESnoRestart_RILU(self):
2122          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2123          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2124      mypde.setSolverMethod(mypde.GMRES,mypde.RILU)          mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2125          u=mypde.getSolution(verbose=self.VERBOSE,truncation=50)          mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
2126          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2127          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setTruncation(50)
2128            u=mypde.getSolution()
2129            self.assertTrue(self.check(u,1.),'solution is wrong.')
2130        def test_GMRESnoRestart_REC_ILU(self):
2131            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2132            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2133            mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2134            mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
2135            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2136            mypde.getSolverOptions().setTruncation(50)
2137            u=mypde.getSolution()
2138            self.assertTrue(self.check(u,1.),'solution is wrong.')
2139      def test_GMRES_JACOBI(self):      def test_GMRES_JACOBI(self):
2140          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2141          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2142      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)          mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2143          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
2144          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2145            u=mypde.getSolution()
2146            self.assertTrue(self.check(u,1.),'solution is wrong.')
2147        def test_GMRES_GAUSS_SEIDEL(self):
2148            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2149            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2150            mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2151            mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2152            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2153            u=mypde.getSolution()
2154            self.assertTrue(self.check(u,1.),'solution is wrong.')
2155        def test_GMRES_AMG(self):
2156            if self.order!=2:
2157                if getEscriptParamInt('DISABLE_AMG', 0):
2158                    print("AMG test disabled on MPI build")
2159                    return    
2160                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2161                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2162                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2163                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2164                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2165                u=mypde.getSolution()
2166                self.assertTrue(self.check(u,1.),'solution is wrong.')        
2167      def test_GMRES_ILU0(self):      def test_GMRES_ILU0(self):
2168          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2169          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2170      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)          mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2171          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2172          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2173            u=mypde.getSolution()
2174            self.assertTrue(self.check(u,1.),'solution is wrong.')
2175      def test_GMRES_RILU(self):      def test_GMRES_RILU(self):
2176          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2177          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2178      mypde.setSolverMethod(mypde.GMRES,mypde.RILU)          mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2179          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
2180          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2181            u=mypde.getSolution()
2182            self.assertTrue(self.check(u,1.),'solution is wrong.')
2183        def test_GMRES_REC_ILU(self):
2184            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2185            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2186            mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2187            mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
2188            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2189            u=mypde.getSolution()
2190            self.assertTrue(self.check(u,1.),'solution is wrong.')
2191      def test_GMRES_truncation_restart_JACOBI(self):      def test_GMRES_truncation_restart_JACOBI(self):
2192          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2193          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2194      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)          mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2195          u=mypde.getSolution(verbose=self.VERBOSE,truncation=10,restart=20)          mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
2196          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2197            mypde.getSolverOptions().setTruncation(10)
2198            mypde.getSolverOptions().setRestart(20)
2199            u=mypde.getSolution()
2200            self.assertTrue(self.check(u,1.),'solution is wrong.')
2201        def test_GMRES_truncation_restart_GAUSS_SEIDEL(self):
2202            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2203            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2204            mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2205            mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2206            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2207            mypde.getSolverOptions().setTruncation(10)
2208            mypde.getSolverOptions().setRestart(20)
2209            u=mypde.getSolution()
2210            self.assertTrue(self.check(u,1.),'solution is wrong.')
2211        def test_GMRES_truncation_restart_AMG(self):
2212            if self.order!=2:
2213                if getEscriptParamInt('DISABLE_AMG', 0):
2214                    print("AMG test disabled on MPI build")
2215                    return    
2216                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2217                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2218                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2219                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2220                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2221                mypde.getSolverOptions().setTruncation(10)
2222                mypde.getSolverOptions().setRestart(20)
2223                u=mypde.getSolution()
2224                self.assertTrue(self.check(u,1.),'solution is wrong.')
2225      def test_GMRES_truncation_restart_ILU0(self):      def test_GMRES_truncation_restart_ILU0(self):
2226          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2227          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2228      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)          mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2229          u=mypde.getSolution(verbose=self.VERBOSE,truncation=10,restart=20)          mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2230          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2231            mypde.getSolverOptions().setTruncation(10)
2232            mypde.getSolverOptions().setRestart(20)
2233            u=mypde.getSolution()
2234            self.assertTrue(self.check(u,1.),'solution is wrong.')
2235      def test_GMRES_truncation_restart_RILU(self):      def test_GMRES_truncation_restart_RILU(self):
2236          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2237          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2238      mypde.setSolverMethod(mypde.GMRES,mypde.RILU)          mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2239          u=mypde.getSolution(verbose=self.VERBOSE,truncation=10,restart=20)          mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
2240          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2241            mypde.getSolverOptions().setTruncation(10)
2242            mypde.getSolverOptions().setRestart(20)
2243            u=mypde.getSolution()
2244            self.assertTrue(self.check(u,1.),'solution is wrong.')
2245        def test_GMRES_truncation_restart_REC_ILU(self):
2246            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2247            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2248            mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2249            mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
2250            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2251            mypde.getSolverOptions().setTruncation(10)
2252            mypde.getSolverOptions().setRestart(20)
2253            u=mypde.getSolution()
2254            self.assertTrue(self.check(u,1.),'solution is wrong.')
2255      #      #
2256      #   solver checks (PDE system)      #   solver checks (PDE system)
2257      #      #
# Line 1702  class Test_LinearPDE_noLumping(Test_line Line 2265  class Test_LinearPDE_noLumping(Test_line
2265              Y[i]+=i              Y[i]+=i
2266          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2267          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2268          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2269          self.failUnless(self.check(u,1.),'solution is wrong.')          u=mypde.getSolution()
2270            self.assertTrue(self.check(u,1.),'solution is wrong.')
2271      def test_symmetryOnDirect_System(self):      def test_symmetryOnDirect_System(self):
2272          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2273          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1714  class Test_LinearPDE_noLumping(Test_line Line 2278  class Test_LinearPDE_noLumping(Test_line
2278              Y[i]+=i              Y[i]+=i
2279          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2280          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2281          mypde.setSolverMethod(mypde.DIRECT)          mypde.getSolverOptions().setSolverMethod(SolverOptions.DIRECT)
2282          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2283          self.failUnless(self.check(u,1.),'solution is wrong.')          u=mypde.getSolution()
2284            self.assertTrue(self.check(u,1.),'solution is wrong.')
2285      def test_PCG_JACOBI_System(self):      def test_PCG_JACOBI_System(self):
2286          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2287          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1727  class Test_LinearPDE_noLumping(Test_line Line 2292  class Test_LinearPDE_noLumping(Test_line
2292              Y[i]+=i              Y[i]+=i
2293          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2294          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2295          mypde.setSolverMethod(mypde.PCG,mypde.JACOBI)          mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
2296          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
2297          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2298            u=mypde.getSolution()
2299            self.assertTrue(self.check(u,1.),'solution is wrong.')
2300        def test_PCG_GAUSS_SEIDEL_System(self):
2301            A=Tensor4(0.,Function(self.domain))
2302            D=Tensor(1.,Function(self.domain))
2303            Y=Vector(self.domain.getDim(),Function(self.domain))
2304            for i in range(self.domain.getDim()):
2305                A[i,:,i,:]=kronecker(self.domain)
2306                D[i,i]+=i
2307                Y[i]+=i
2308            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2309            mypde.setValue(A=A,D=D,Y=Y)
2310            mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
2311            mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2312            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2313            u=mypde.getSolution()
2314            self.assertTrue(self.check(u,1.),'solution is wrong.')
2315        def test_PCG_AMG_System(self):
2316            if self.order!=2:
2317                if getEscriptParamInt('DISABLE_AMG', 0):
2318                    print("AMG test disabled on MPI build")
2319                    return
2320                A=Tensor4(0.,Function(self.domain))
2321                D=Tensor(1.,Function(self.domain))
2322                Y=Vector(self.domain.getDim(),Function(self.domain))
2323                for i in range(self.domain.getDim()):
2324                    A[i,:,i,:]=kronecker(self.domain)
2325                    D[i,i]+=i
2326                    Y[i]+=i
2327                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2328                mypde.setValue(A=A,D=D,Y=Y)
2329                mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
2330                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2331                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2332                u=mypde.getSolution()
2333                self.assertTrue(self.check(u,1.),'solution is wrong.')
2334      def test_PCG_ILU0_System(self):      def test_PCG_ILU0_System(self):
2335          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2336          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1740  class Test_LinearPDE_noLumping(Test_line Line 2341  class Test_LinearPDE_noLumping(Test_line
2341              Y[i]+=i              Y[i]+=i
2342          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2343          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2344          mypde.setSolverMethod(mypde.PCG,mypde.ILU0)          mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
2345          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2346          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2347            u=mypde.getSolution()
2348            self.assertTrue(self.check(u,1.),'solution is wrong.')
2349      def test_DIRECT_System(self):      def test_DIRECT_System(self):
2350          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2351          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1753  class Test_LinearPDE_noLumping(Test_line Line 2356  class Test_LinearPDE_noLumping(Test_line
2356              Y[i]+=i              Y[i]+=i
2357          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2358          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2359          mypde.setSolverMethod(mypde.DIRECT)          mypde.getSolverOptions().setSolverMethod(SolverOptions.DIRECT)
2360          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2361          self.failUnless(self.check(u,1.),'solution is wrong.')          u=mypde.getSolution()
2362            self.assertTrue(self.check(u,1.),'solution is wrong.')
2363      def test_BICGSTAB_JACOBI_System(self):      def test_BICGSTAB_JACOBI_System(self):
2364          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2365          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1766  class Test_LinearPDE_noLumping(Test_line Line 2370  class Test_LinearPDE_noLumping(Test_line
2370              Y[i]+=i              Y[i]+=i
2371          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2372          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2373      mypde.setSolverMethod(mypde.BICGSTAB,mypde.JACOBI)          mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
2374          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
2375          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2376            u=mypde.getSolution()
2377            self.assertTrue(self.check(u,1.),'solution is wrong.')
2378        def test_BICGSTAB_GAUSS_SEIDEL_System(self):
2379            A=Tensor4(0.,Function(self.domain))
2380            D=Tensor(1.,Function(self.domain))
2381            Y=Vector(self.domain.getDim(),Function(self.domain))
2382            for i in range(self.domain.getDim()):
2383                A[i,:,i,:]=kronecker(self.domain)
2384                D[i,i]+=i
2385                Y[i]+=i
2386            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2387            mypde.setValue(A=A,D=D,Y=Y)
2388            mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
2389            mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2390            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2391            u=mypde.getSolution()
2392            self.assertTrue(self.check(u,1.),'solution is wrong.')
2393        def test_BICGSTAB_AMG_System(self):
2394            if self.order!=2:
2395                if getEscriptParamInt('DISABLE_AMG', 0):
2396                    print("AMG test disabled on MPI build")
2397                    return    
2398                A=Tensor4(0.,Function(self.domain))
2399                D=Tensor(1.,Function(self.domain))
2400                Y=Vector(self.domain.getDim(),Function(self.domain))
2401                for i in range(self.domain.getDim()):
2402                    A[i,:,i,:]=kronecker(self.domain)
2403                    D[i,i]+=i
2404                    Y[i]+=i
2405                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2406                mypde.setValue(A=A,D=D,Y=Y)
2407                mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
2408                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2409                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2410                u=mypde.getSolution()
2411                self.assertTrue(self.check(u,1.),'solution is wrong.')
2412      def test_BICGSTAB_ILU0_System(self):      def test_BICGSTAB_ILU0_System(self):
2413          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2414          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1779  class Test_LinearPDE_noLumping(Test_line Line 2419  class Test_LinearPDE_noLumping(Test_line
2419              Y[i]+=i              Y[i]+=i
2420          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2421          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2422      mypde.setSolverMethod(mypde.BICGSTAB,mypde.ILU0)          mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
2423          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2424          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2425            u=mypde.getSolution()
2426            self.assertTrue(self.check(u,1.),'solution is wrong.')
2427      def test_PRES20_JACOBI_System(self):      def test_PRES20_JACOBI_System(self):
2428          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2429          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1792  class Test_LinearPDE_noLumping(Test_line Line 2434  class Test_LinearPDE_noLumping(Test_line
2434              Y[i]+=i              Y[i]+=i
2435          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2436          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2437      mypde.setSolverMethod(mypde.PRES20,mypde.JACOBI)          mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
2438          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
2439          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2440            u=mypde.getSolution()
2441            self.assertTrue(self.check(u,1.),'solution is wrong.')
2442        def test_PRES20_GAUSS_SEIDEL_System(self):
2443            A=Tensor4(0.,Function(self.domain))
2444            D=Tensor(1.,Function(self.domain))
2445            Y=Vector(self.domain.getDim(),Function(self.domain))
2446            for i in range(self.domain.getDim()):
2447                A[i,:,i,:]=kronecker(self.domain)
2448                D[i,i]+=i
2449                Y[i]+=i
2450            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2451            mypde.setValue(A=A,D=D,Y=Y)
2452            mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
2453            mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2454            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2455            u=mypde.getSolution()
2456            self.assertTrue(self.check(u,1.),'solution is wrong.')
2457        def test_PRES20_AMG_System(self):
2458            if self.order!=2:
2459                if getEscriptParamInt('DISABLE_AMG', 0):
2460                    print("AMG test disabled on MPI build")
2461                    return
2462                A=Tensor4(0.,Function(self.domain))
2463                D=Tensor(1.,Function(self.domain))
2464                Y=Vector(self.domain.getDim(),Function(self.domain))
2465                for i in range(self.domain.getDim()):
2466                    A[i,:,i,:]=kronecker(self.domain)
2467                    D[i,i]+=i
2468                    Y[i]+=i
2469                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2470                mypde.setValue(A=A,D=D,Y=Y)
2471                mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
2472                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2473                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2474                u=mypde.getSolution()
2475                self.assertTrue(self.check(u,1.),'solution is wrong.')
2476      def test_PRES20_ILU0_System(self):      def test_PRES20_ILU0_System(self):
2477          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2478          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1805  class Test_LinearPDE_noLumping(Test_line Line 2483  class Test_LinearPDE_noLumping(Test_line
2483              Y[i]+=i              Y[i]+=i
2484          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2485          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2486      mypde.setSolverMethod(mypde.PRES20,mypde.ILU0)          mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
2487          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2488          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2489            u=mypde.getSolution()
2490            self.assertTrue(self.check(u,1.),'solution is wrong.')
2491      def test_GMRESnoRestart_JACOBI_System(self):      def test_GMRESnoRestart_JACOBI_System(self):
2492          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2493          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1818  class Test_LinearPDE_noLumping(Test_line Line 2498  class Test_LinearPDE_noLumping(Test_line
2498              Y[i]+=i              Y[i]+=i
2499          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2500          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2501      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)          mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2502            mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
2503            # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)
2504            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2505            u=mypde.getSolution()
2506            self.assertTrue(self.check(u,1.),'solution is wrong.')
2507        def test_GMRESnoRestart_GAUSS_SEIDEL_System(self):
2508            A=Tensor4(0.,Function(self.domain))
2509            D=Tensor(1.,Function(self.domain))
2510            Y=Vector(self.domain.getDim(),Function(self.domain))
2511            for i in range(self.domain.getDim()):
2512                A[i,:,i,:]=kronecker(self.domain)
2513                D[i,i]+=i
2514                Y[i]+=i
2515            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2516            mypde.setValue(A=A,D=D,Y=Y)
2517            mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2518            mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2519          # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)          # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)
2520          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2521          self.failUnless(self.check(u,1.),'solution is wrong.')          u=mypde.getSolution()
2522            self.assertTrue(self.check(u,1.),'solution is wrong.')
2523        def test_GMRESnoRestart_AMG_System(self):
2524            if self.order!=2:
2525                if getEscriptParamInt('DISABLE_AMG',0):
2526                    print("AMG test disabled on MPI build")
2527                    return        
2528                A=Tensor4(0.,Function(self.domain))
2529                D=Tensor(1.,Function(self.domain))
2530                Y=Vector(self.domain.getDim(),Function(self.domain))
2531                for i in range(self.domain.getDim()):
2532                    A[i,:,i,:]=kronecker(self.domain)
2533                    D[i,i]+=i
2534                    Y[i]+=i
2535                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2536                mypde.setValue(A=A,D=D,Y=Y)
2537                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2538                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2539                # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)
2540                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2541                u=mypde.getSolution()
2542                self.assertTrue(self.check(u,1.),'solution is wrong.')
2543      def test_GMRESnoRestart_ILU0_System(self):      def test_GMRESnoRestart_ILU0_System(self):
2544          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2545          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1832  class Test_LinearPDE_noLumping(Test_line Line 2550  class Test_LinearPDE_noLumping(Test_line
2550              Y[i]+=i              Y[i]+=i
2551          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2552          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2553      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)          mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2554            mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2555          # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)          # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)
2556          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2557          self.failUnless(self.check(u,1.),'solution is wrong.')          u=mypde.getSolution()
2558            self.assertTrue(self.check(u,1.),'solution is wrong.')
2559      def test_GMRES_JACOBI_System(self):      def test_GMRES_JACOBI_System(self):
2560          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2561          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1846  class Test_LinearPDE_noLumping(Test_line Line 2566  class Test_LinearPDE_noLumping(Test_line
2566              Y[i]+=i              Y[i]+=i
2567          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2568          mypde.setValue(A=A,D=D,Y=Y)