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

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

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

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