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