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

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

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

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