/[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

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