/[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 3892 by jfenwick, Tue Apr 10 08:57:23 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-2010 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-2010 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"
# 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)          so.setPreconditioner(so.AMG)
842          self.failUnless(so.getPreconditioner() == 22, "AMG is not set.")          self.assertTrue(so.getPreconditioner() == 22, "AMG is not set.")
843          so.setPreconditioner(so.REC_ILU)          so.setPreconditioner(so.REC_ILU)
844          self.failUnless(so.getPreconditioner() == 23, "REC_ILU is not set.")          self.assertTrue(so.getPreconditioner() == 23, "REC_ILU is not set.")
845          so.setPreconditioner(so.GAUSS_SEIDEL)          so.setPreconditioner(so.GAUSS_SEIDEL)
846          self.failUnless(so.getPreconditioner() == 28, "GAUSS_SEIDEL is not set.")          self.assertTrue(so.getPreconditioner() == 28, "GAUSS_SEIDEL is not set.")
847          so.setPreconditioner(so.RILU)          so.setPreconditioner(so.RILU)
848          self.failUnless(so.getPreconditioner() == 29, "RILU is not set.")          self.assertTrue(so.getPreconditioner() == 29, "RILU is not set.")
849            so.setPreconditioner(so.AMLI)
850            self.assertTrue(so.getPreconditioner() == 38, "AMLI is not set.")
851          so.setPreconditioner(so.NO_PRECONDITIONER)          so.setPreconditioner(so.NO_PRECONDITIONER)
852          self.failUnless(so.getPreconditioner() == 36, "NO_PRECONDITIONER is not set.")                  self.assertTrue(so.getPreconditioner() == 36, "NO_PRECONDITIONER is not set.")        
853    
854          self.failUnless(so.getCoarsening() == 0, "initial Coarseningr is wrong.")          self.assertTrue(so.getCoarsening() == 0, "initial Coarseningr is wrong.")
855          self.failUnlessRaises(ValueError,so.setCoarsening,-1)          self.assertRaises(ValueError,so.setCoarsening,-1)
856          so.setCoarsening(so.YAIR_SHAPIRA_COARSENING)          so.setCoarsening(so.YAIR_SHAPIRA_COARSENING)
857          self.failUnless(so.getCoarsening() == 33, "YAIR_SHAPIRA_COARSENING is not set.")          self.assertTrue(so.getCoarsening() == 33, "YAIR_SHAPIRA_COARSENING is not set.")
858          so.setCoarsening(so.RUGE_STUEBEN_COARSENING)          so.setCoarsening(so.RUGE_STUEBEN_COARSENING)
859          self.failUnless(so.getCoarsening() == 34, "RUGE_STUEBEN_COARSENING is not set.")          self.assertTrue(so.getCoarsening() == 34, "RUGE_STUEBEN_COARSENING is not set.")
860          so.setCoarsening(so.AGGREGATION_COARSENING)          so.setCoarsening(so.AGGREGATION_COARSENING)
861          self.failUnless(so.getCoarsening() == 35, "AGREGATION_COARSENING is not set.")          self.assertTrue(so.getCoarsening() == 35, "AGREGATION_COARSENING is not set.")
862            so.setCoarsening(so.STANDARD_COARSENING)
863            self.assertTrue(so.getCoarsening() == 39, "STANDARD_COARSENING is not set.")
864          so.setCoarsening(so.DEFAULT)          so.setCoarsening(so.DEFAULT)
865          self.failUnless(so.getCoarsening() == 0, "DEFAULT is not set.")          self.assertTrue(so.getCoarsening() == 0, "DEFAULT is not set.")
866    
867          self.failUnless(so.getDiagnostics("num_iter") == None, "initial num_iter is wrong.")          self.assertTrue(so.getDiagnostics("num_iter") == None, "initial num_iter is wrong.")
868          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.")
869          self.failUnless(so.getDiagnostics("time") == None, "initial time is wrong.")          self.assertTrue(so.getDiagnostics("time") == None, "initial time is wrong.")
870          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.")
871          self.failUnless(so.getDiagnostics("residual_norm") == None, "initial residual_norm is wrong.")          self.assertTrue(so.getDiagnostics("residual_norm") == None, "initial residual_norm is wrong.")
872          self.failUnless(so.getDiagnostics("converged") == None, "initial converged is wrong.")          self.assertTrue(so.getDiagnostics("converged") == None, "initial converged is wrong.")
873          self.failUnless(so.hasConverged() == None, "initial convergence flag is wrong.")          self.assertTrue(so.hasConverged() == None, "initial convergence flag is wrong.")
874          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.")
875          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.")
876          self.failUnless(so.getDiagnostics("cum_time") ==0, "initial cum_time is wrong.")          self.assertTrue(so.getDiagnostics("cum_time") ==0, "initial cum_time is wrong.")
877          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.")
878    
879          so._updateDiagnostics("num_iter",1)          so._updateDiagnostics("num_iter",1)
880          so._updateDiagnostics("num_inner_iter",2)          so._updateDiagnostics("num_inner_iter",2)
# Line 865  class Test_LinearPDE_noLumping(Test_line Line 883  class Test_LinearPDE_noLumping(Test_line
883          so._updateDiagnostics("residual_norm",5)          so._updateDiagnostics("residual_norm",5)
884          so._updateDiagnostics("converged",True)          so._updateDiagnostics("converged",True)
885    
886          self.failUnless(so.getDiagnostics("num_iter") == 1, "num_iter is wrong.")          self.assertTrue(so.getDiagnostics("num_iter") == 1, "num_iter is wrong.")
887          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.")
888          self.failUnless(so.getDiagnostics("time") == 3, "time is wrong.")          self.assertTrue(so.getDiagnostics("time") == 3, "time is wrong.")
889          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.")
890          self.failUnless(so.getDiagnostics("residual_norm") == 5, "residual_norm is wrong.")          self.assertTrue(so.getDiagnostics("residual_norm") == 5, "residual_norm is wrong.")
891          self.failUnless(so.getDiagnostics("converged"), "converged is wrong.")          self.assertTrue(so.getDiagnostics("converged"), "converged is wrong.")
892          self.failUnless(so.hasConverged(), "convergence flag is wrong.")          self.assertTrue(so.hasConverged(), "convergence flag is wrong.")
893          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.")
894          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.")
895          self.failUnless(so.getDiagnostics("cum_time") ==3, "cum_time is wrong.")          self.assertTrue(so.getDiagnostics("cum_time") ==3, "cum_time is wrong.")
896          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.")  
897                    
898          so.resetDiagnostics()          so.resetDiagnostics()
899          self.failUnless(so.getDiagnostics("num_iter") == None, "initial num_iter is wrong.")          self.assertTrue(so.getDiagnostics("num_iter") == None, "initial num_iter is wrong.")
900          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.")
901          self.failUnless(so.getDiagnostics("time") == None, "initial time is wrong.")          self.assertTrue(so.getDiagnostics("time") == None, "initial time is wrong.")
902          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.")
903          self.failUnless(so.getDiagnostics("residual_norm") == None, "initial residual_norm is wrong.")          self.assertTrue(so.getDiagnostics("residual_norm") == None, "initial residual_norm is wrong.")
904          self.failUnless(so.getDiagnostics("converged") == None, "initial converged is wrong.")          self.assertTrue(so.getDiagnostics("converged") == None, "initial converged is wrong.")
905          self.failUnless(so.hasConverged() == None, "initial convergence flag is wrong")                self.assertTrue(so.hasConverged() == None, "initial convergence flag is wrong")      
906          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.")
907          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.")
908          self.failUnless(so.getDiagnostics("cum_time") ==3, "cum_time is wrong.")          self.assertTrue(so.getDiagnostics("cum_time") ==3, "cum_time is wrong.")
909          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.")
910    
911          so._updateDiagnostics("num_iter",10)          so._updateDiagnostics("num_iter",10)
912          so._updateDiagnostics("num_inner_iter",20)          so._updateDiagnostics("num_inner_iter",20)
# Line 897  class Test_LinearPDE_noLumping(Test_line Line 915  class Test_LinearPDE_noLumping(Test_line
915          so._updateDiagnostics("residual_norm",50)          so._updateDiagnostics("residual_norm",50)
916          so._updateDiagnostics("converged",False)          so._updateDiagnostics("converged",False)
917    
918          self.failUnless(so.getDiagnostics("num_iter") == 10, "num_iter is wrong.")          self.assertTrue(so.getDiagnostics("num_iter") == 10, "num_iter is wrong.")
919          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.")
920          self.failUnless(so.getDiagnostics("time") == 30, "time is wrong.")          self.assertTrue(so.getDiagnostics("time") == 30, "time is wrong.")
921          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.")
922          self.failUnless(so.getDiagnostics("residual_norm") == 50, "residual_norm is wrong.")          self.assertTrue(so.getDiagnostics("residual_norm") == 50, "residual_norm is wrong.")
923          self.failUnless(not so.getDiagnostics("converged"), "converged is wrong.")          self.assertTrue(not so.getDiagnostics("converged"), "converged is wrong.")
924          self.failUnless(not so.hasConverged(), "convergence flag is wrong.")          self.assertTrue(not so.hasConverged(), "convergence flag is wrong.")
925          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.")
926          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.")
927          self.failUnless(so.getDiagnostics("cum_time") ==33, "cum_time is wrong.")          self.assertTrue(so.getDiagnostics("cum_time") ==33, "cum_time is wrong.")
928          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.")  
929    
930          so.resetDiagnostics(all=True)          so.resetDiagnostics(all=True)
931          self.failUnless(so.getDiagnostics("num_iter") == None, "initial num_iter is wrong.")          self.assertTrue(so.getDiagnostics("num_iter") == None, "initial num_iter is wrong.")
932          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.")
933          self.failUnless(so.getDiagnostics("time") == None, "initial time is wrong.")          self.assertTrue(so.getDiagnostics("time") == None, "initial time is wrong.")
934          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.")
935          self.failUnless(so.getDiagnostics("residual_norm") == None, "initial residual_norm is wrong.")          self.assertTrue(so.getDiagnostics("residual_norm") == None, "initial residual_norm is wrong.")
936          self.failUnless(so.getDiagnostics("converged") == None, "initial converged is wrong.")          self.assertTrue(so.getDiagnostics("converged") == None, "initial converged is wrong.")
937          self.failUnless(so.hasConverged() == None, "initial convergence flag is wrong.")          self.assertTrue(so.hasConverged() == None, "initial convergence flag is wrong.")
938          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.")
939          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.")
940          self.failUnless(so.getDiagnostics("cum_time") ==0, "initial cum_time is wrong.")          self.assertTrue(so.getDiagnostics("cum_time") ==0, "initial cum_time is wrong.")
941          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.")
942                    
943      def test_setCoefficient_WithIllegalFunctionSpace(self):      def test_setCoefficient_WithIllegalFunctionSpace(self):
944          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
945          self.failUnlessRaises(IllegalCoefficientFunctionSpace,mypde.setValue, C=Vector(0.,FunctionOnBoundary(self.domain)))          self.assertRaises(IllegalCoefficientFunctionSpace, mypde.setValue, C=Vector(0.,FunctionOnBoundary(self.domain)))
946    
947      def test_setCoefficient_WithWrongName(self):      def test_setCoefficient_WithWrongName(self):
948          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
949          self.failUnlessRaises(IllegalCoefficient, mypde.setValue, ROMA=0.)          self.assertRaises(IllegalCoefficient, mypde.setValue, ROMA=0.)
950    
951      def test_resetCoefficient_WithWrongShape(self):      def test_resetCoefficient_WithWrongShape(self):
952          mypde=LinearPDE(self.domain,numEquations=2,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=2,debug=self.DEBUG)
953          self.failUnlessRaises(IllegalCoefficientValue, mypde.setValue, C=0.)          self.assertRaises(IllegalCoefficientValue, mypde.setValue, C=0.)
954    
955      def test_reducedOn(self):      def test_reducedOn(self):
956          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 940  class Test_LinearPDE_noLumping(Test_line Line 958  class Test_LinearPDE_noLumping(Test_line
958          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
959          mypde.setValue(A=kronecker(self.domain),D=x[0],Y=x[0])          mypde.setValue(A=kronecker(self.domain),D=x[0],Y=x[0])
960          u=mypde.getSolution()          u=mypde.getSolution()
961          self.failUnless(self.check(u,1.),'solution is wrong.')          self.assertTrue(self.check(u,1.),'solution is wrong.')
962    
963      def test_attemptToChangeOrderAfterDefinedCoefficient(self):      def test_attemptToChangeOrderAfterDefinedCoefficient(self):
964          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
965          mypde.setValue(D=1.)          mypde.setValue(D=1.)
966          self.failUnlessRaises(RuntimeError,mypde.setReducedOrderOn)          self.assertRaises(RuntimeError, mypde.setReducedOrderOn)
967    
968      def test_reducedOnConfig(self):      def test_reducedOnConfig(self):
969          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
970          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
971          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.")
972      #      #
973      #  set coefficients for scalars:      #  set coefficients for scalars:
974      #      #
# Line 959  class Test_LinearPDE_noLumping(Test_line Line 977  class Test_LinearPDE_noLumping(Test_line
977          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
978          mypde.setValue(A=numpy.ones((d,d)))          mypde.setValue(A=numpy.ones((d,d)))
979          coeff=mypde.getCoefficient("A")          coeff=mypde.getCoefficient("A")
980          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))
981      def test_setCoefficient_B_Scalar(self):      def test_setCoefficient_B_Scalar(self):
982          d=self.domain.getDim()          d=self.domain.getDim()
983          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
984          mypde.setValue(B=numpy.ones((d,)))          mypde.setValue(B=numpy.ones((d,)))
985          coeff=mypde.getCoefficient("B")          coeff=mypde.getCoefficient("B")
986          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))
987      def test_setCoefficient_C_Scalar(self):      def test_setCoefficient_C_Scalar(self):
988          d=self.domain.getDim()          d=self.domain.getDim()
989          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
990          mypde.setValue(C=numpy.ones((d,)))          mypde.setValue(C=numpy.ones((d,)))
991          coeff=mypde.getCoefficient("C")          coeff=mypde.getCoefficient("C")
992          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))
993      def test_setCoefficient_D_Scalar(self):      def test_setCoefficient_D_Scalar(self):
994          d=self.domain.getDim()          d=self.domain.getDim()
995          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
996          mypde.setValue(D=1.)          mypde.setValue(D=1.)
997          coeff=mypde.getCoefficient("D")          coeff=mypde.getCoefficient("D")
998          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))
999      def test_setCoefficient_X_Scalar(self):      def test_setCoefficient_X_Scalar(self):
1000          d=self.domain.getDim()          d=self.domain.getDim()
1001          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1002          mypde.setValue(X=numpy.ones((d,)))          mypde.setValue(X=numpy.ones((d,)))
1003          coeff=mypde.getCoefficient("X")          coeff=mypde.getCoefficient("X")
1004          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))
1005      def test_setCoefficient_Y_Scalar(self):      def test_setCoefficient_Y_Scalar(self):
1006          d=self.domain.getDim()          d=self.domain.getDim()
1007          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1008          mypde.setValue(Y=1.)          mypde.setValue(Y=1.)
1009          coeff=mypde.getCoefficient("Y")          coeff=mypde.getCoefficient("Y")
1010          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),Function(self.domain),1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),Function(self.domain),1))
1011      def test_setCoefficient_y_Scalar(self):      def test_setCoefficient_y_Scalar(self):
1012          d=self.domain.getDim()          d=self.domain.getDim()
1013          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1014          mypde.setValue(y=1.)          mypde.setValue(y=1.)
1015          coeff=mypde.getCoefficient("y")          coeff=mypde.getCoefficient("y")
1016          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1))
1017      def test_setCoefficient_d_Scalar(self):      def test_setCoefficient_d_Scalar(self):
1018          d=self.domain.getDim()          d=self.domain.getDim()
1019          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1020          mypde.setValue(d=1.)          mypde.setValue(d=1.)
1021          coeff=mypde.getCoefficient("d")          coeff=mypde.getCoefficient("d")
1022          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))
1023      def test_setCoefficient_d_contact_Scalar(self):      def test_setCoefficient_d_contact_Scalar(self):
1024          d=self.domain.getDim()          if self.domain.supportsContactElements():
1025          mypde=LinearPDE(self.domain,debug=self.DEBUG)              d=self.domain.getDim()
1026          mypde.setValue(d_contact=1.)              mypde=LinearPDE(self.domain,debug=self.DEBUG)
1027          coeff=mypde.getCoefficient("d_contact")              mypde.setValue(d_contact=1.)
1028          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),FunctionOnContactZero(self.domain),1,1))              coeff=mypde.getCoefficient("d_contact")
1029                self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),FunctionOnContactZero(self.domain),1,1))
1030      def test_setCoefficient_y_contact_Scalar(self):      def test_setCoefficient_y_contact_Scalar(self):
1031          d=self.domain.getDim()          d=self.domain.getDim()
1032          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          if self.domain.supportsContactElements():
1033          mypde.setValue(y_contact=1.)              mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1034          coeff=mypde.getCoefficient("y_contact")              mypde.setValue(y_contact=1.)
1035          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),FunctionOnContactZero(self.domain),1))              coeff=mypde.getCoefficient("y_contact")
1036                self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),FunctionOnContactZero(self.domain),1))
1037      def test_setCoefficient_A_reduced_Scalar(self):      def test_setCoefficient_A_reduced_Scalar(self):
1038          d=self.domain.getDim()          d=self.domain.getDim()
1039          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1040          mypde.setValue(A_reduced=numpy.ones((d,d)))          mypde.setValue(A_reduced=numpy.ones((d,d)))
1041          coeff=mypde.getCoefficient("A_reduced")          coeff=mypde.getCoefficient("A_reduced")
1042          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))
1043      def test_setCoefficient_B_reduced_Scalar(self):      def test_setCoefficient_B_reduced_Scalar(self):
1044          d=self.domain.getDim()          d=self.domain.getDim()
1045          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1046          mypde.setValue(B_reduced=numpy.ones((d,)))          mypde.setValue(B_reduced=numpy.ones((d,)))
1047          coeff=mypde.getCoefficient("B_reduced")          coeff=mypde.getCoefficient("B_reduced")
1048          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))
1049      def test_setCoefficient_C_reduced_Scalar(self):      def test_setCoefficient_C_reduced_Scalar(self):
1050          d=self.domain.getDim()          d=self.domain.getDim()
1051          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1052          mypde.setValue(C_reduced=numpy.ones((d,)))          mypde.setValue(C_reduced=numpy.ones((d,)))
1053          coeff=mypde.getCoefficient("C_reduced")          coeff=mypde.getCoefficient("C_reduced")
1054          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))
1055      def test_setCoefficient_D_reduced_Scalar(self):      def test_setCoefficient_D_reduced_Scalar(self):
1056          d=self.domain.getDim()          d=self.domain.getDim()
1057          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1058          mypde.setValue(D_reduced=1.)          mypde.setValue(D_reduced=1.)
1059          coeff=mypde.getCoefficient("D_reduced")          coeff=mypde.getCoefficient("D_reduced")
1060          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))
1061      def test_setCoefficient_X_reduced_Scalar(self):      def test_setCoefficient_X_reduced_Scalar(self):
1062          d=self.domain.getDim()          d=self.domain.getDim()
1063          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1064          mypde.setValue(X_reduced=numpy.ones((d,)))          mypde.setValue(X_reduced=numpy.ones((d,)))
1065          coeff=mypde.getCoefficient("X_reduced")          coeff=mypde.getCoefficient("X_reduced")
1066          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))
1067      def test_setCoefficient_Y_reduced_Scalar(self):      def test_setCoefficient_Y_reduced_Scalar(self):
1068          d=self.domain.getDim()          d=self.domain.getDim()
1069          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1070          mypde.setValue(Y_reduced=1.)          mypde.setValue(Y_reduced=1.)
1071          coeff=mypde.getCoefficient("Y_reduced")          coeff=mypde.getCoefficient("Y_reduced")
1072          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunction(self.domain),1))
1073      def test_setCoefficient_y_reduced_Scalar(self):      def test_setCoefficient_y_reduced_Scalar(self):
1074          d=self.domain.getDim()          d=self.domain.getDim()
1075          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1076          mypde.setValue(y_reduced=1.)          mypde.setValue(y_reduced=1.)
1077          coeff=mypde.getCoefficient("y_reduced")          coeff=mypde.getCoefficient("y_reduced")
1078          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))
1079      def test_setCoefficient_d_reduced_Scalar(self):      def test_setCoefficient_d_reduced_Scalar(self):
1080          d=self.domain.getDim()          d=self.domain.getDim()
1081          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1082          mypde.setValue(d_reduced=1.)          mypde.setValue(d_reduced=1.)
1083          coeff=mypde.getCoefficient("d_reduced")          coeff=mypde.getCoefficient("d_reduced")
1084          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))
1085      def test_setCoefficient_d_contact_reduced_Scalar(self):      def test_setCoefficient_d_contact_reduced_Scalar(self):
1086          d=self.domain.getDim()          if self.domain.supportsContactElements():
1087          mypde=LinearPDE(self.domain,debug=self.DEBUG)              d=self.domain.getDim()
1088          mypde.setValue(d_contact_reduced=1.)              mypde=LinearPDE(self.domain,debug=self.DEBUG)
1089          coeff=mypde.getCoefficient("d_contact_reduced")              mypde.setValue(d_contact_reduced=1.)
1090          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1,1))              coeff=mypde.getCoefficient("d_contact_reduced")
1091                self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1,1))
1092      def test_setCoefficient_y_contact_reduced_Scalar(self):      def test_setCoefficient_y_contact_reduced_Scalar(self):
1093          d=self.domain.getDim()          if self.domain.supportsContactElements():
1094          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)              d=self.domain.getDim()
1095          mypde.setValue(y_contact_reduced=1.)              mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1096          coeff=mypde.getCoefficient("y_contact_reduced")              mypde.setValue(y_contact_reduced=1.)
1097          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))              coeff=mypde.getCoefficient("y_contact_reduced")
1098                self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))
1099      def test_setCoefficient_r_Scalar(self):      def test_setCoefficient_r_Scalar(self):
1100          d=self.domain.getDim()          d=self.domain.getDim()
1101          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1102          mypde.setValue(r=1.)          mypde.setValue(r=1.)
1103          coeff=mypde.getCoefficient("r")          coeff=mypde.getCoefficient("r")
1104          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),Solution(self.domain),1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((),Solution(self.domain),1))
1105      def test_setCoefficient_q_Scalar(self):      def test_setCoefficient_q_Scalar(self):
1106          d=self.domain.getDim()          d=self.domain.getDim()
1107          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1108          mypde.setValue(q=1.)          mypde.setValue(q=1.)
1109          coeff=mypde.getCoefficient("q")          coeff=mypde.getCoefficient("q")
1110          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),Solution(self.domain),1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((),Solution(self.domain),1))
1111      def test_setCoefficient_r_Scalar_reducedOn(self):      def test_setCoefficient_r_Scalar_reducedOn(self):
1112          d=self.domain.getDim()          d=self.domain.getDim()
1113          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1114          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
1115          mypde.setValue(r=1.)          mypde.setValue(r=1.)
1116          coeff=mypde.getCoefficient("r")          coeff=mypde.getCoefficient("r")
1117          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))
1118      def test_setCoefficient_q_Scalar_reducedOn(self):      def test_setCoefficient_q_Scalar_reducedOn(self):
1119          d=self.domain.getDim()          d=self.domain.getDim()
1120          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1121          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
1122          mypde.setValue(q=1.)          mypde.setValue(q=1.)
1123          coeff=mypde.getCoefficient("q")          coeff=mypde.getCoefficient("q")
1124          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))
1125    
1126      def test_setCoefficient_A_reduced_Scalar_usingA(self):      def test_setCoefficient_A_reduced_Scalar_usingA(self):
1127          d=self.domain.getDim()          d=self.domain.getDim()
1128          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1129          mypde.setValue(A=Data(numpy.ones((d,d)),ReducedFunction(self.domain)))          mypde.setValue(A=Data(numpy.ones((d,d)),ReducedFunction(self.domain)))
1130          coeff=mypde.getCoefficient("A_reduced")          coeff=mypde.getCoefficient("A_reduced")
1131          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))
1132      def test_setCoefficient_B_reduced_Scalar_usingB(self):      def test_setCoefficient_B_reduced_Scalar_usingB(self):
1133          d=self.domain.getDim()          d=self.domain.getDim()
1134          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1135          mypde.setValue(B=Data(numpy.ones((d,)),ReducedFunction(self.domain)))          mypde.setValue(B=Data(numpy.ones((d,)),ReducedFunction(self.domain)))
1136          coeff=mypde.getCoefficient("B_reduced")          coeff=mypde.getCoefficient("B_reduced")
1137          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))
1138      def test_setCoefficient_C_reduced_Scalar_usingC(self):      def test_setCoefficient_C_reduced_Scalar_usingC(self):
1139          d=self.domain.getDim()          d=self.domain.getDim()
1140          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1141          mypde.setValue(C=Data(numpy.ones((d,)),ReducedFunction(self.domain)))          mypde.setValue(C=Data(numpy.ones((d,)),ReducedFunction(self.domain)))
1142          coeff=mypde.getCoefficient("C_reduced")          coeff=mypde.getCoefficient("C_reduced")
1143          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))
1144      def test_setCoefficient_D_reduced_Scalar_usingD(self):      def test_setCoefficient_D_reduced_Scalar_usingD(self):
1145          d=self.domain.getDim()          d=self.domain.getDim()
1146          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1147          mypde.setValue(D=Scalar(1.,ReducedFunction(self.domain)))          mypde.setValue(D=Scalar(1.,ReducedFunction(self.domain)))
1148          coeff=mypde.getCoefficient("D_reduced")          coeff=mypde.getCoefficient("D_reduced")
1149          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))
1150      def test_setCoefficient_X_reduced_Scalar_usingX(self):      def test_setCoefficient_X_reduced_Scalar_usingX(self):
1151          d=self.domain.getDim()          d=self.domain.getDim()
1152          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1153          mypde.setValue(X_reduced=Data(numpy.ones((d,)),ReducedFunction(self.domain)))          mypde.setValue(X_reduced=Data(numpy.ones((d,)),ReducedFunction(self.domain)))
1154          coeff=mypde.getCoefficient("X_reduced")          coeff=mypde.getCoefficient("X_reduced")
1155          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))
1156      def test_setCoefficient_Y_reduced_Scalar_usingY(self):      def test_setCoefficient_Y_reduced_Scalar_usingY(self):
1157          d=self.domain.getDim()          d=self.domain.getDim()
1158          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1159          mypde.setValue(Y=Scalar(1.,ReducedFunction(self.domain)))          mypde.setValue(Y=Scalar(1.,ReducedFunction(self.domain)))
1160          coeff=mypde.getCoefficient("Y_reduced")          coeff=mypde.getCoefficient("Y_reduced")
1161          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunction(self.domain),1))
1162      def test_setCoefficient_y_reduced_Scalar_using_y(self):      def test_setCoefficient_y_reduced_Scalar_using_y(self):
1163          d=self.domain.getDim()          d=self.domain.getDim()
1164          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1165          mypde.setValue(y=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(y=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))
1166          coeff=mypde.getCoefficient("y_reduced")          coeff=mypde.getCoefficient("y_reduced")
1167          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))          self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))
1168      def test_setCoefficient_d_reduced_Scalar_using_d(self):      def test_setCoefficient_d_reduced_Scalar_using_d(self):
1169          d=self.domain.getDim()          d=self.domain.getDim()
1170          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1171          mypde.setValue(d=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(d=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))
1172          coeff=mypde.getCoefficient("d_reduced")          coeff=mypde.getCoefficient("d_reduced")
1173          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))
1174      def test_setCoefficient_d_contact_reduced_Scalar_using_d_contact(self):      def test_setCoefficient_d_contact_reduced_Scalar_using_d_contact(self):
1175          d=self.domain.getDim()          if self.domain.supportsContactElements():
1176          mypde=LinearPDE(self.domain,debug=self.DEBUG)              d=self.domain.getDim()
1177          mypde.setValue(d_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))              mypde=LinearPDE(self.domain,debug=self.DEBUG)
1178          coeff=mypde.getCoefficient("d_contact_reduced")              mypde.setValue(d_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))
1179          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1,1))              coeff=mypde.getCoefficient("d_contact_reduced")
1180                self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1,1))
1181      def test_setCoefficient_y_contact_reduced_Scalar_using_y_contact(self):      def test_setCoefficient_y_contact_reduced_Scalar_using_y_contact(self):
1182          d=self.domain.getDim()          if self.domain.supportsContactElements():
1183          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)              d=self.domain.getDim()
1184          mypde.setValue(y_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))              mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1185          coeff=mypde.getCoefficient("y_contact_reduced")              mypde.setValue(y_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))
1186          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))              coeff=mypde.getCoefficient("y_contact_reduced")
1187                self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))
1188      #      #
1189      #  set coefficients for systems:      #  set coefficients for systems:
1190      #      #
# Line 1169  class Test_LinearPDE_noLumping(Test_line Line 1193  class Test_LinearPDE_noLumping(Test_line
1193          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1194          mypde.setValue(A=numpy.ones((self.N,d,self.N,d)))          mypde.setValue(A=numpy.ones((self.N,d,self.N,d)))
1195          coeff=mypde.getCoefficient("A")          coeff=mypde.getCoefficient("A")
1196          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))
1197      def test_setCoefficient_B_System(self):      def test_setCoefficient_B_System(self):
1198          d=self.domain.getDim()          d=self.domain.getDim()
1199          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1200          mypde.setValue(B=numpy.ones((self.N,d,self.N)))          mypde.setValue(B=numpy.ones((self.N,d,self.N)))
1201          coeff=mypde.getCoefficient("B")          coeff=mypde.getCoefficient("B")
1202          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))
1203      def test_setCoefficient_C_System(self):      def test_setCoefficient_C_System(self):
1204          d=self.domain.getDim()          d=self.domain.getDim()
1205          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1206          mypde.setValue(C=numpy.ones((self.N,self.N,d)))          mypde.setValue(C=numpy.ones((self.N,self.N,d)))
1207          coeff=mypde.getCoefficient("C")          coeff=mypde.getCoefficient("C")
1208          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))
1209      def test_setCoefficient_D_System(self):      def test_setCoefficient_D_System(self):
1210          d=self.domain.getDim()          d=self.domain.getDim()
1211          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1212          mypde.setValue(D=numpy.ones((self.N,self.N)))          mypde.setValue(D=numpy.ones((self.N,self.N)))
1213          coeff=mypde.getCoefficient("D")          coeff=mypde.getCoefficient("D")
1214          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))
1215      def test_setCoefficient_X_System(self):      def test_setCoefficient_X_System(self):
1216          d=self.domain.getDim()          d=self.domain.getDim()
1217          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1218          mypde.setValue(X=numpy.ones((self.N,d)))          mypde.setValue(X=numpy.ones((self.N,d)))
1219          coeff=mypde.getCoefficient("X")          coeff=mypde.getCoefficient("X")
1220          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))
1221      def test_setCoefficient_Y_System(self):      def test_setCoefficient_Y_System(self):
1222          d=self.domain.getDim()          d=self.domain.getDim()
1223          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1224          mypde.setValue(Y=numpy.ones((self.N,)))          mypde.setValue(Y=numpy.ones((self.N,)))
1225          coeff=mypde.getCoefficient("Y")          coeff=mypde.getCoefficient("Y")
1226          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))
1227      def test_setCoefficient_y_System(self):      def test_setCoefficient_y_System(self):
1228          d=self.domain.getDim()          d=self.domain.getDim()
1229          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1230          mypde.setValue(y=numpy.ones((self.N,)))          mypde.setValue(y=numpy.ones((self.N,)))
1231          coeff=mypde.getCoefficient("y")          coeff=mypde.getCoefficient("y")
1232          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))
1233      def test_setCoefficient_d_System(self):      def test_setCoefficient_d_System(self):
1234          d=self.domain.getDim()          d=self.domain.getDim()
1235          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1236          mypde.setValue(d=numpy.ones((self.N,self.N)))          mypde.setValue(d=numpy.ones((self.N,self.N)))
1237          coeff=mypde.getCoefficient("d")          coeff=mypde.getCoefficient("d")
1238          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))
1239      def test_setCoefficient_d_contact_System(self):      def test_setCoefficient_d_contact_System(self):
1240          d=self.domain.getDim()          if self.domain.supportsContactElements():
1241          mypde=LinearPDE(self.domain,debug=self.DEBUG)              d=self.domain.getDim()
1242          mypde.setValue(d_contact=numpy.ones((self.N,self.N)))              mypde=LinearPDE(self.domain,debug=self.DEBUG)
1243          coeff=mypde.getCoefficient("d_contact")              mypde.setValue(d_contact=numpy.ones((self.N,self.N)))
1244          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")
1245                self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),FunctionOnContactZero(self.domain),self.N,self.N))
1246      def test_setCoefficient_y_contact_System(self):      def test_setCoefficient_y_contact_System(self):
1247          d=self.domain.getDim()          if self.domain.supportsContactElements():
1248          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)              d=self.domain.getDim()
1249          mypde.setValue(y_contact=numpy.ones((self.N,)))              mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1250          coeff=mypde.getCoefficient("y_contact")              mypde.setValue(y_contact=numpy.ones((self.N,)))
1251          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),FunctionOnContactZero(self.domain),self.N))              coeff=mypde.getCoefficient("y_contact")
1252                self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),FunctionOnContactZero(self.domain),self.N))
1253      def test_setCoefficient_A_reduced_System(self):      def test_setCoefficient_A_reduced_System(self):
1254          d=self.domain.getDim()          d=self.domain.getDim()
1255          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1256          mypde.setValue(A_reduced=numpy.ones((self.N,d,self.N,d)))          mypde.setValue(A_reduced=numpy.ones((self.N,d,self.N,d)))
1257          coeff=mypde.getCoefficient("A_reduced")          coeff=mypde.getCoefficient("A_reduced")
1258          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))
1259      def test_setCoefficient_B_reduced_System(self):      def test_setCoefficient_B_reduced_System(self):
1260          d=self.domain.getDim()          d=self.domain.getDim()
1261          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1262          mypde.setValue(B_reduced=numpy.ones((self.N,d,self.N)))          mypde.setValue(B_reduced=numpy.ones((self.N,d,self.N)))
1263          coeff=mypde.getCoefficient("B_reduced")          coeff=mypde.getCoefficient("B_reduced")
1264          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))
1265      def test_setCoefficient_C_reduced_System(self):      def test_setCoefficient_C_reduced_System(self):
1266          d=self.domain.getDim()          d=self.domain.getDim()
1267          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1268          mypde.setValue(C_reduced=numpy.ones((self.N,self.N,d)))          mypde.setValue(C_reduced=numpy.ones((self.N,self.N,d)))
1269          coeff=mypde.getCoefficient("C_reduced")          coeff=mypde.getCoefficient("C_reduced")
1270          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))
1271      def test_setCoefficient_D_System_reduced(self):      def test_setCoefficient_D_System_reduced(self):
1272          d=self.domain.getDim()          d=self.domain.getDim()
1273          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1274          mypde.setValue(D_reduced=numpy.ones((self.N,self.N)))          mypde.setValue(D_reduced=numpy.ones((self.N,self.N)))
1275          coeff=mypde.getCoefficient("D_reduced")          coeff=mypde.getCoefficient("D_reduced")
1276          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))
1277      def test_setCoefficient_X_System_reduced(self):      def test_setCoefficient_X_System_reduced(self):
1278          d=self.domain.getDim()          d=self.domain.getDim()
1279          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1280          mypde.setValue(X_reduced=numpy.ones((self.N,d)))          mypde.setValue(X_reduced=numpy.ones((self.N,d)))
1281          coeff=mypde.getCoefficient("X_reduced")          coeff=mypde.getCoefficient("X_reduced")
1282          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))
1283      def test_setCoefficient_Y_System_reduced(self):      def test_setCoefficient_Y_System_reduced(self):
1284          d=self.domain.getDim()          d=self.domain.getDim()
1285          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1286          mypde.setValue(Y_reduced=numpy.ones((self.N,)))          mypde.setValue(Y_reduced=numpy.ones((self.N,)))
1287          coeff=mypde.getCoefficient("Y_reduced")          coeff=mypde.getCoefficient("Y_reduced")
1288          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))
1289      def test_setCoefficient_y_System_reduced(self):      def test_setCoefficient_y_System_reduced(self):
1290          d=self.domain.getDim()          d=self.domain.getDim()
1291          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1292          mypde.setValue(y_reduced=numpy.ones((self.N,)))          mypde.setValue(y_reduced=numpy.ones((self.N,)))
1293          coeff=mypde.getCoefficient("y_reduced")          coeff=mypde.getCoefficient("y_reduced")
1294          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))
1295      def test_setCoefficient_d_reduced_System(self):      def test_setCoefficient_d_reduced_System(self):
1296          d=self.domain.getDim()          d=self.domain.getDim()
1297          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1298          mypde.setValue(d_reduced=numpy.ones((self.N,self.N)))          mypde.setValue(d_reduced=numpy.ones((self.N,self.N)))
1299          coeff=mypde.getCoefficient("d_reduced")          coeff=mypde.getCoefficient("d_reduced")
1300          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))
1301      def test_setCoefficient_d_contact_reduced_System(self):      def test_setCoefficient_d_contact_reduced_System(self):
1302          d=self.domain.getDim()          if self.domain.supportsContactElements():
1303          mypde=LinearPDE(self.domain,debug=self.DEBUG)              d=self.domain.getDim()
1304          mypde.setValue(d_contact_reduced=numpy.ones((self.N,self.N)))              mypde=LinearPDE(self.domain,debug=self.DEBUG)
1305          coeff=mypde.getCoefficient("d_contact_reduced")              mypde.setValue(d_contact_reduced=numpy.ones((self.N,self.N)))
1306          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")
1307                self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnContactZero(self.domain),self.N,self.N))
1308      def test_setCoefficient_y_contact_reduced_System(self):      def test_setCoefficient_y_contact_reduced_System(self):
1309          d=self.domain.getDim()          if self.domain.supportsContactElements():
1310          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)              d=self.domain.getDim()
1311          mypde.setValue(y_contact_reduced=numpy.ones((self.N,)))              mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1312          coeff=mypde.getCoefficient("y_contact_reduced")              mypde.setValue(y_contact_reduced=numpy.ones((self.N,)))
1313          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunctionOnContactZero(self.domain),self.N))              coeff=mypde.getCoefficient("y_contact_reduced")
1314                self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),ReducedFunctionOnContactZero(self.domain),self.N))
1315      def test_setCoefficient_r_System(self):      def test_setCoefficient_r_System(self):
1316          d=self.domain.getDim()          d=self.domain.getDim()
1317          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1318          mypde.setValue(r=numpy.ones((self.N,)))          mypde.setValue(r=numpy.ones((self.N,)))
1319          coeff=mypde.getCoefficient("r")          coeff=mypde.getCoefficient("r")
1320          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))
1321      def test_setCoefficient_q_System(self):      def test_setCoefficient_q_System(self):
1322          d=self.domain.getDim()          d=self.domain.getDim()
1323          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1324          mypde.setValue(q=numpy.ones((self.N,)))          mypde.setValue(q=numpy.ones((self.N,)))
1325          coeff=mypde.getCoefficient("q")          coeff=mypde.getCoefficient("q")
1326          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))
1327      def test_setCoefficient_r_System_reducedOn(self):      def test_setCoefficient_r_System_reducedOn(self):
1328          d=self.domain.getDim()          d=self.domain.getDim()
1329          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1330          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
1331          mypde.setValue(r=numpy.ones((self.N,)))          mypde.setValue(r=numpy.ones((self.N,)))
1332          coeff=mypde.getCoefficient("r")          coeff=mypde.getCoefficient("r")
1333          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))
1334      def test_setCoefficient_q_System_reducedOn(self):      def test_setCoefficient_q_System_reducedOn(self):
1335          d=self.domain.getDim()          d=self.domain.getDim()
1336          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1337          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
1338          mypde.setValue(q=numpy.ones((self.N,)))          mypde.setValue(q=numpy.ones((self.N,)))
1339          coeff=mypde.getCoefficient("q")          coeff=mypde.getCoefficient("q")
1340          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))
1341    
1342      def test_setCoefficient_A_reduced_System_using_A(self):      def test_setCoefficient_A_reduced_System_using_A(self):
1343          d=self.domain.getDim()          d=self.domain.getDim()
1344          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1345          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)))
1346          coeff=mypde.getCoefficient("A_reduced")          coeff=mypde.getCoefficient("A_reduced")
1347          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))
1348      def test_setCoefficient_B_reduced_System_using_B(self):      def test_setCoefficient_B_reduced_System_using_B(self):
1349          d=self.domain.getDim()          d=self.domain.getDim()
1350          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1351          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)))
1352          coeff=mypde.getCoefficient("B_reduced")          coeff=mypde.getCoefficient("B_reduced")
1353          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))
1354      def test_setCoefficient_C_reduced_System_using_C(self):      def test_setCoefficient_C_reduced_System_using_C(self):
1355          d=self.domain.getDim()          d=self.domain.getDim()
1356          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1357          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)))
1358          coeff=mypde.getCoefficient("C_reduced")          coeff=mypde.getCoefficient("C_reduced")
1359          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))
1360      def test_setCoefficient_D_System_reduced_using_D(self):      def test_setCoefficient_D_System_reduced_using_D(self):
1361          d=self.domain.getDim()          d=self.domain.getDim()
1362          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1363          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)))
1364          coeff=mypde.getCoefficient("D_reduced")          coeff=mypde.getCoefficient("D_reduced")
1365          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))
1366      def test_setCoefficient_X_System_reduced_using_X(self):      def test_setCoefficient_X_System_reduced_using_X(self):
1367          d=self.domain.getDim()          d=self.domain.getDim()
1368          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1369          mypde.setValue(X=Data(numpy.ones((self.N,d)),ReducedFunction(self.domain)))          mypde.setValue(X=Data(numpy.ones((self.N,d)),ReducedFunction(self.domain)))
1370          coeff=mypde.getCoefficient("X_reduced")          coeff=mypde.getCoefficient("X_reduced")
1371          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))
1372      def test_setCoefficient_Y_System_reduced_using_Y(self):      def test_setCoefficient_Y_System_reduced_using_Y(self):
1373          d=self.domain.getDim()          d=self.domain.getDim()
1374          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1375          mypde.setValue(Y=Data(numpy.ones((self.N,)),ReducedFunction(self.domain)))          mypde.setValue(Y=Data(numpy.ones((self.N,)),ReducedFunction(self.domain)))
1376          coeff=mypde.getCoefficient("Y_reduced")          coeff=mypde.getCoefficient("Y_reduced")
1377          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))
1378      def test_setCoefficient_y_reduced_System_using_y(self):      def test_setCoefficient_y_reduced_System_using_y(self):
1379          d=self.domain.getDim()          d=self.domain.getDim()
1380          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1381          mypde.setValue(y=Data(numpy.ones((self.N,)),ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(y=Data(numpy.ones((self.N,)),ReducedFunctionOnBoundary(self.domain)))
1382          coeff=mypde.getCoefficient("y_reduced")          coeff=mypde.getCoefficient("y_reduced")
1383          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))
1384      def test_setCoefficient_d_reduced_System_using_d(self):      def test_setCoefficient_d_reduced_System_using_d(self):
1385          d=self.domain.getDim()          d=self.domain.getDim()
1386          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1387          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)))
1388          coeff=mypde.getCoefficient("d_reduced")          coeff=mypde.getCoefficient("d_reduced")
1389          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))
1390      def test_setCoefficient_d_contact_reduced_System_using_d_contact(self):      def test_setCoefficient_d_contact_reduced_System_using_d_contact(self):
1391          d=self.domain.getDim()          if self.domain.supportsContactElements():
1392          mypde=LinearPDE(self.domain,debug=self.DEBUG)              d=self.domain.getDim()
1393          mypde.setValue(d_contact=Data(numpy.ones((self.N,self.N)),ReducedFunctionOnContactZero(self.domain)))              mypde=LinearPDE(self.domain,debug=self.DEBUG)
1394          coeff=mypde.getCoefficient("d_contact_reduced")              mypde.setValue(d_contact=Data(numpy.ones((self.N,self.N)),ReducedFunctionOnContactZero(self.domain)))
1395          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")
1396                self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnContactZero(self.domain),self.N,self.N))
1397      def test_setCoefficient_y_contact_reduced_System_using_y_contact(self):      def test_setCoefficient_y_contact_reduced_System_using_y_contact(self):
1398          d=self.domain.getDim()          if self.domain.supportsContactElements():
1399          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)              d=self.domain.getDim()
1400          mypde.setValue(y_contact=Data(numpy.ones((self.N,)),ReducedFunctionOnContactZero(self.domain)))              mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1401          coeff=mypde.getCoefficient("y_contact_reduced")              mypde.setValue(y_contact=Data(numpy.ones((self.N,)),ReducedFunctionOnContactZero(self.domain)))
1402          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunctionOnContactZero(self.domain),self.N))              coeff=mypde.getCoefficient("y_contact_reduced")
1403                self.assertEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),ReducedFunctionOnContactZero(self.domain),self.N))
1404      def test_resetCoefficient_HomogeneousConstraint(self):      def test_resetCoefficient_HomogeneousConstraint(self):
1405          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1406          x=self.domain.getX()          x=self.domain.getX()
# Line 1378  class Test_LinearPDE_noLumping(Test_line Line 1408  class Test_LinearPDE_noLumping(Test_line
1408          u1=mypde.getSolution()          u1=mypde.getSolution()
1409          mypde.setValue(Y=2.)          mypde.setValue(Y=2.)
1410          u2=mypde.getSolution()          u2=mypde.getSolution()
1411          self.failUnless(self.check(u2,2*u1),'solution is wrong.')          self.assertTrue(self.check(u2,2*u1),'solution is wrong.')
1412    
1413      def test_resetCoefficient_InHomogeneousConstraint(self):      def test_resetCoefficient_InHomogeneousConstraint(self):
1414          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1415          mypde.setSymmetryOn()          mypde.setSymmetryOn()
1416            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1417          x=self.domain.getX()          x=self.domain.getX()
1418          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]))
1419          u1=mypde.getSolution(verbose=self.VERBOSE)          u1=mypde.getSolution()
1420          mypde.setValue(Y=2.,D=2)          mypde.setValue(Y=2.,D=2)
1421          u2=mypde.getSolution(verbose=self.VERBOSE)          u2=mypde.getSolution()
1422          self.failUnless(self.check(u2,u1),'first solution is wrong.')          self.assertTrue(self.check(u2,u1),'first solution is wrong.')
1423          u2=mypde.getSolution(verbose=self.VERBOSE)          u2=mypde.getSolution()
1424          self.failUnless(self.check(u2,u1),'first solution is wrong.')          self.assertTrue(self.check(u2,u1),'first solution is wrong.')
1425          mypde.setValue(r=2,Y=4.)          mypde.setValue(r=2,Y=4.)
1426          u2=mypde.getSolution(verbose=self.VERBOSE)          u2=mypde.getSolution()
1427          self.failUnless(self.check(u2,2*u1),'second solution is wrong.')          self.assertTrue(self.check(u2,2*u1),'second solution is wrong.')
1428    
1429        def test_Status(self):
1430            DIM=self.domain.getDim()
1431            x=self.domain.getX()
1432            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1433            mypde.getSolverOptions().setSymmetryOn()
1434            mypde.getSolverOptions().setTolerance(self.RES_TOL)
1435            mypde.setValue(A=kronecker(self.domain), q=whereZero(x[0])+whereZero(x[0]-1.), Y=2.)
1436            x1=self.domain.getX()
1437            u1_ref=x1[0]*(1.-x1[0])
1438            u1=mypde.getSolution()
1439            error1=Lsup(u1-u1_ref)/Lsup(u1_ref)
1440            self.assertTrue(mypde.getDomainStatus() == mypde.getSystemStatus(), "status of first pde does not match domain status.")
1441            try:
1442                self.domain.setX(x*5)
1443            except:
1444                # setX not supported
1445                return
1446            self.assertTrue(mypde.getDomainStatus() != mypde.getSystemStatus(), "status of first pde matches updated domain status.")
1447            x2=self.domain.getX()
1448            u2_ref=x2[0]*(5.-x2[0])
1449            u2=mypde.getSolution()
1450            error2=Lsup(u2-u2_ref)/Lsup(u2_ref)
1451            self.assertTrue(error2 <= max(error1,self.RES_TOL)*10., "solution of second PDE wrong.")
1452            self.assertTrue(mypde.getDomainStatus() == mypde.getSystemStatus(), "status of second pde does not match domain status.")
1453    
1454      def test_symmetryCheckTrue_System(self):      def test_symmetryCheckTrue_System(self):
1455          d=self.domain.getDim()          d=self.domain.getDim()
# Line 1404  class Test_LinearPDE_noLumping(Test_line Line 1460  class Test_LinearPDE_noLumping(Test_line
1460          D=3*numpy.ones((self.N,self.N))          D=3*numpy.ones((self.N,self.N))
1461          d=4*numpy.ones((self.N,self.N))          d=4*numpy.ones((self.N,self.N))
1462          d_contact=5*numpy.ones((self.N,self.N))          d_contact=5*numpy.ones((self.N,self.N))
1463          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}
1464          self.failUnless(mypde.checkSymmetry(verbose=False),"symmetry detected")          if self.domain.supportsContactElements():
1465                    pars["d_contact"]=d_contact
1466                    pars["d_contact_reduced"]=-d_contact
1467            mypde.setValue(**pars)
1468            self.assertTrue(mypde.checkSymmetry(verbose=False),"symmetry detected")
1469    
1470      def test_symmetryCheckFalse_A_System(self):      def test_symmetryCheckFalse_A_System(self):
1471          d=self.domain.getDim()          d=self.domain.getDim()
# Line 1413  class Test_LinearPDE_noLumping(Test_line Line 1473  class Test_LinearPDE_noLumping(Test_line
1473          A=numpy.ones((self.N,d,self.N,d))          A=numpy.ones((self.N,d,self.N,d))
1474          A[1,1,1,0]=0.          A[1,1,1,0]=0.
1475          mypde.setValue(A=A)          mypde.setValue(A=A)
1476          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")          self.assertTrue(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1477      def test_symmetryCheckFalse_BC_System(self):      def test_symmetryCheckFalse_BC_System(self):
1478          d=self.domain.getDim()          d=self.domain.getDim()
1479          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 1421  class Test_LinearPDE_noLumping(Test_line Line 1481  class Test_LinearPDE_noLumping(Test_line
1481          B=2*numpy.ones((self.N,d,self.N))          B=2*numpy.ones((self.N,d,self.N))
1482          B[0,0,1]=1.          B[0,0,1]=1.
1483          mypde.setValue(B=B,C=C)          mypde.setValue(B=B,C=C)
1484          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")          self.assertTrue(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1485    
1486      def test_symmetryCheckFalse_D_System(self):      def test_symmetryCheckFalse_D_System(self):
1487          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1488          D=3*numpy.ones((self.N,self.N))          D=3*numpy.ones((self.N,self.N))
1489          D[0,1]=0.          D[0,1]=0.
1490          mypde.setValue(D=D)          mypde.setValue(D=D)
1491          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")          self.assertTrue(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1492    
1493      def test_symmetryCheckFalse_d_System(self):      def test_symmetryCheckFalse_d_System(self):
1494          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1495          d=4*numpy.ones((self.N,self.N))          d=4*numpy.ones((self.N,self.N))
1496          d[0,1]=0.          d[0,1]=0.
1497          mypde.setValue(d=d)          mypde.setValue(d=d)
1498          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")          self.assertTrue(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1499    
1500      def test_symmetryCheckFalse_d_contact_System(self):      def test_symmetryCheckFalse_d_contact_System(self):
1501          mypde=LinearPDE(self.domain,debug=self.DEBUG)          if self.domain.supportsContactElements():
1502          d_contact=5*numpy.ones((self.N,self.N))              mypde=LinearPDE(self.domain,debug=self.DEBUG)
1503          d_contact[0,1]=0.              d_contact=5*numpy.ones((self.N,self.N))
1504          mypde.setValue(d_contact=d_contact)              d_contact[0,1]=0.
1505          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")              mypde.setValue(d_contact=d_contact)
1506                self.assertTrue(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1507    
1508      def test_symmetryCheckFalse_A_reduced_System(self):      def test_symmetryCheckFalse_A_reduced_System(self):
1509          d=self.domain.getDim()          d=self.domain.getDim()
# Line 1450  class Test_LinearPDE_noLumping(Test_line Line 1511  class Test_LinearPDE_noLumping(Test_line
1511          A=numpy.ones((self.N,d,self.N,d))          A=numpy.ones((self.N,d,self.N,d))
1512          A[1,1,1,0]=0.          A[1,1,1,0]=0.
1513          mypde.setValue(A_reduced=A)          mypde.setValue(A_reduced=A)
1514          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")          self.assertTrue(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1515      def test_symmetryCheckFalse_BC_reduced_System(self):      def test_symmetryCheckFalse_BC_reduced_System(self):
1516          d=self.domain.getDim()          d=self.domain.getDim()
1517          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 1458  class Test_LinearPDE_noLumping(Test_line Line 1519  class Test_LinearPDE_noLumping(Test_line
1519          B=2*numpy.ones((self.N,d,self.N))          B=2*numpy.ones((self.N,d,self.N))
1520          B[0,0,1]=1.          B[0,0,1]=1.
1521          mypde.setValue(B_reduced=B,C_reduced=C)          mypde.setValue(B_reduced=B,C_reduced=C)
1522          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")          self.assertTrue(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1523    
1524      def test_symmetryCheckFalse_D_reduced_System(self):      def test_symmetryCheckFalse_D_reduced_System(self):
1525          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1526          D=3*numpy.ones((self.N,self.N))          D=3*numpy.ones((self.N,self.N))
1527          D[0,1]=0.          D[0,1]=0.
1528          mypde.setValue(D_reduced=D)          mypde.setValue(D_reduced=D)
1529          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")          self.assertTrue(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1530    
1531      def test_symmetryCheckFalse_d_reduced_System(self):      def test_symmetryCheckFalse_d_reduced_System(self):
1532          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1533          d=4*numpy.ones((self.N,self.N))          d=4*numpy.ones((self.N,self.N))
1534          d[0,1]=0.          d[0,1]=0.
1535          mypde.setValue(d_reduced=d)          mypde.setValue(d_reduced=d)
1536          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")          self.assertTrue(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1537    
1538      def test_symmetryCheckFalse_d_contact_reduced_System(self):      def test_symmetryCheckFalse_d_contact_reduced_System(self):
1539          mypde=LinearPDE(self.domain,debug=self.DEBUG)          if self.domain.supportsContactElements():
1540          d_contact=5*numpy.ones((self.N,self.N))              mypde=LinearPDE(self.domain,debug=self.DEBUG)
1541          d_contact[0,1]=0.              d_contact=5*numpy.ones((self.N,self.N))
1542          mypde.setValue(d_contact_reduced=d_contact)              d_contact[0,1]=0.
1543          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")              mypde.setValue(d_contact_reduced=d_contact)
1544                self.assertTrue(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1545    
1546      def test_symmetryCheckTrue_Scalar(self):      def test_symmetryCheckTrue_Scalar(self):
1547          d=self.domain.getDim()          d=self.domain.getDim()
# Line 1490  class Test_LinearPDE_noLumping(Test_line Line 1552  class Test_LinearPDE_noLumping(Test_line
1552          D=3          D=3
1553          d=4          d=4
1554          d_contact=5          d_contact=5
1555          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}
1556          self.failUnless(mypde.checkSymmetry(verbose=False),"symmetry detected")          if self.domain.supportsContactElements():
1557                    pars["d_contact"]=d_contact
1558                    pars["d_contact_reduced"]=-d_contact
1559            mypde.setValue(**pars)
1560            self.assertTrue(mypde.checkSymmetry(verbose=False),"symmetry detected")
1561    
1562      def test_symmetryCheckFalse_A_Scalar(self):      def test_symmetryCheckFalse_A_Scalar(self):
1563          d=self.domain.getDim()          d=self.domain.getDim()
# Line 1499  class Test_LinearPDE_noLumping(Test_line Line 1565  class Test_LinearPDE_noLumping(Test_line
1565          A=numpy.ones((d,d))          A=numpy.ones((d,d))
1566          A[1,0]=0.          A[1,0]=0.
1567          mypde.setValue(A=A)          mypde.setValue(A=A)
1568          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")          self.assertTrue(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1569      def test_symmetryCheckFalse_BC_Scalar(self):      def test_symmetryCheckFalse_BC_Scalar(self):
1570          d=self.domain.getDim()          d=self.domain.getDim()
1571          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 1507  class Test_LinearPDE_noLumping(Test_line Line 1573  class Test_LinearPDE_noLumping(Test_line
1573          B=2*numpy.ones((d,))          B=2*numpy.ones((d,))
1574          B[0]=1.          B[0]=1.
1575          mypde.setValue(B=B,C=C)          mypde.setValue(B=B,C=C)
1576          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")          self.assertTrue(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1577      def test_symmetryCheckFalse_A_reduced_Scalar(self):      def test_symmetryCheckFalse_A_reduced_Scalar(self):
1578          d=self.domain.getDim()          d=self.domain.getDim()
1579          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1580          A=numpy.ones((d,d))          A=numpy.ones((d,d))
1581          A[1,0]=0.          A[1,0]=0.
1582          mypde.setValue(A_reduced=A)          mypde.setValue(A_reduced=A)
1583          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")          self.assertTrue(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1584      def test_symmetryCheckFalse_BC_reduced_Scalar(self):      def test_symmetryCheckFalse_BC_reduced_Scalar(self):
1585          d=self.domain.getDim()          d=self.domain.getDim()
1586          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 1522  class Test_LinearPDE_noLumping(Test_line Line 1588  class Test_LinearPDE_noLumping(Test_line
1588          B=2*numpy.ones((d,))          B=2*numpy.ones((d,))
1589          B[0]=1.          B[0]=1.
1590          mypde.setValue(B_reduced=B,C_reduced=C)          mypde.setValue(B_reduced=B,C_reduced=C)
1591          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")          self.assertTrue(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1592      #      #
1593      #   solver checks (single PDE)      #   solver checks (single PDE)
1594      #      #
1595      def test_symmetryOnIterative(self):      def test_symmetryOnIterative(self):
1596          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1597          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1598          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1599          self.failUnless(self.check(u,1.),'solution is wrong.')          u=mypde.getSolution()
1600            self.assertTrue(self.check(u,1.),'solution is wrong.')
1601      def test_symmetryOnDirect(self):      def test_symmetryOnDirect(self):
1602          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1603          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1604          mypde.setSolverMethod(mypde.DIRECT)          mypde.getSolverOptions().setSolverMethod(SolverOptions.DIRECT)
1605          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1606          self.failUnless(self.check(u,1.),'solution is wrong.')          u=mypde.getSolution()
1607            self.assertTrue(self.check(u,1.),'solution is wrong.')
1608      def test_PCG_JACOBI(self):      def test_PCG_JACOBI(self):
1609          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1610          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1611          mypde.setSolverMethod(mypde.PCG,mypde.JACOBI)          mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1612          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1613          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1614            u=mypde.getSolution()
1615            self.assertTrue(self.check(u,1.),'solution is wrong.')
1616        def test_PCG_GAUSS_SEIDEL(self):
1617            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1618            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1619            mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1620            mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1621            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1622            u=mypde.getSolution()
1623            self.assertTrue(self.check(u,1.),'solution is wrong.')
1624        def test_PCG_AMG(self):
1625            if self.order!=2:
1626                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1627                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1628                mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1629                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1630                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1631                u=mypde.getSolution()
1632                self.assertTrue(self.check(u,1.),'solution is wrong.')
1633      def test_PCG_ILU0(self):      def test_PCG_ILU0(self):
1634          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1635          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1636          mypde.setSolverMethod(mypde.PCG,mypde.ILU0)          mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1637          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1638          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1639            u=mypde.getSolution()
1640            self.assertTrue(self.check(u,1.),'solution is wrong.')
1641      def test_PCG_RILU(self):      def test_PCG_RILU(self):
1642          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1643          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1644          mypde.setSolverMethod(mypde.PCG,mypde.RILU)          mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1645          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1646          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1647            u=mypde.getSolution()
1648            self.assertTrue(self.check(u,1.),'solution is wrong.')
1649        def test_PCG_REC_ILU(self):
1650            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1651            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1652            mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1653            mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
1654            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1655            u=mypde.getSolution()
1656            self.assertTrue(self.check(u,1.),'solution is wrong.')
1657      def test_DIRECT(self):      def test_DIRECT(self):
1658          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1659          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1660          mypde.setSolverMethod(mypde.DIRECT)          mypde.getSolverOptions().setSolverMethod(SolverOptions.DIRECT)
1661          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1662          self.failUnless(self.check(u,1.),'solution is wrong.')          u=mypde.getSolution()
1663            self.assertTrue(self.check(u,1.),'solution is wrong.')
1664      def test_BICGSTAB_JACOBI(self):      def test_BICGSTAB_JACOBI(self):
1665          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1666      mypde.setSolverMethod(mypde.BICGSTAB,mypde.JACOBI)          mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1667            mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1668            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1669            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1670            u=mypde.getSolution()
1671            self.assertTrue(self.check(u,1.),'solution is wrong.')
1672        def test_BICGSTAB_GAUSS_SEIDEL(self):
1673            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1674            mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1675            mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1676          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1677          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1678          self.failUnless(self.check(u,1.),'solution is wrong.')          u=mypde.getSolution()
1679            self.assertTrue(self.check(u,1.),'solution is wrong.')
1680        def test_BICGSTAB_AMG(self):
1681            if self.order!=2:
1682                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1683                mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1684                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1685                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1686                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1687                u=mypde.getSolution()
1688                self.assertTrue(self.check(u,1.),'solution is wrong.')
1689      def test_BICGSTAB_ILU0(self):      def test_BICGSTAB_ILU0(self):
1690          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1691          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1692      mypde.setSolverMethod(mypde.BICGSTAB,mypde.ILU0)          mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1693          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1694          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1695            u=mypde.getSolution()
1696            self.assertTrue(self.check(u,1.),'solution is wrong.')
1697      def test_BICGSTAB_RILU(self):      def test_BICGSTAB_RILU(self):
1698          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1699          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1700      mypde.setSolverMethod(mypde.BICGSTAB,mypde.RILU)          mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1701          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1702          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1703            u=mypde.getSolution()
1704            self.assertTrue(self.check(u,1.),'solution is wrong.')
1705        def test_BICGSTAB_REC_ILU(self):
1706            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1707            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1708            mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1709            mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
1710            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1711            u=mypde.getSolution()
1712            self.assertTrue(self.check(u,1.),'solution is wrong.')
1713      def test_MINRES_JACOBI(self):      def test_MINRES_JACOBI(self):
1714          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1715      mypde.setSolverMethod(mypde.MINRES,mypde.JACOBI)          mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1716            mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1717          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1718          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1719          self.failUnless(self.check(u,1.),'solution is wrong.')          u=mypde.getSolution()
1720            self.assertTrue(self.check(u,1.),'solution is wrong.')
1721        def test_MINRES_GAUSS_SEIDEL(self):
1722            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1723            mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1724            mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1725            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1726            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1727            u=mypde.getSolution()
1728            self.assertTrue(self.check(u,1.),'solution is wrong.')
1729        def test_MINRES_AMG(self):
1730            if self.order!=2:
1731                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1732                mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1733                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
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_ILU0(self):      def test_MINRES_ILU0(self):
1739          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1740          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1741      mypde.setSolverMethod(mypde.MINRES,mypde.ILU0)          mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1742          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1743          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1744            u=mypde.getSolution()
1745            self.assertTrue(self.check(u,1.),'solution is wrong.')
1746      def test_MINRES_RILU(self):      def test_MINRES_RILU(self):
1747          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1748          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1749      mypde.setSolverMethod(mypde.MINRES,mypde.RILU)          mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1750          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1751          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1752            u=mypde.getSolution()
1753            self.assertTrue(self.check(u,1.),'solution is wrong.')
1754        def test_MINRES_REC_ILU(self):
1755            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1756            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1757            mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1758            mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
1759            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1760            u=mypde.getSolution()
1761            self.assertTrue(self.check(u,1.),'solution is wrong.')
1762      def test_TFQMR_JACOBI(self):      def test_TFQMR_JACOBI(self):
1763          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1764      mypde.setSolverMethod(mypde.TFQMR,mypde.JACOBI)          mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
1765            mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1766          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1767          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1768          self.failUnless(self.check(u,1.),'solution is wrong.')          u=mypde.getSolution()
1769            self.assertTrue(self.check(u,1.),'solution is wrong.')
1770        def test_TFQMR_GAUSS_SEIDEL(self):
1771            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1772            mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
1773            mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1774            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1775            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1776            u=mypde.getSolution()
1777            self.assertTrue(self.check(u,1.),'solution is wrong.')
1778        def test_TFQMR_AMG(self):
1779            if self.order!=2:
1780                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1781                mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
1782                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1783                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1784                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1785                u=mypde.getSolution()
1786                self.assertTrue(self.check(u,1.),'solution is wrong.')
1787      def test_TFQMR_ILU0(self):      def test_TFQMR_ILU0(self):
1788          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1789          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1790      mypde.setSolverMethod(mypde.TFQMR,mypde.ILU0)          mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
1791          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1792          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1793            u=mypde.getSolution()
1794            self.assertTrue(self.check(u,1.),'solution is wrong.')
1795      def test_TFQMR_RILU(self):      def test_TFQMR_RILU(self):
1796          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1797          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1798      mypde.setSolverMethod(mypde.TFQMR,mypde.RILU)          mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
1799          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1800          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1801            u=mypde.getSolution()
1802            self.assertTrue(self.check(u,1.),'solution is wrong.')
1803        def test_TFQMR_REC_ILU(self):
1804            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1805            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1806            mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
1807            mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
1808            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1809            u=mypde.getSolution()
1810            self.assertTrue(self.check(u,1.),'solution is wrong.')
1811      def test_PRES20_JACOBI(self):      def test_PRES20_JACOBI(self):
1812          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1813          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1814      mypde.setSolverMethod(mypde.PRES20,mypde.JACOBI)          mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
1815          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1816          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1817            u=mypde.getSolution()
1818            self.assertTrue(self.check(u,1.),'solution is wrong.')
1819        def test_PRES20_GAUSS_SEIDEL(self):
1820            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1821            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1822            mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
1823            mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1824            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1825            u=mypde.getSolution()
1826            self.assertTrue(self.check(u,1.),'solution is wrong.')
1827        def test_PRES20_AMG(self):
1828            if self.order!=2:
1829                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1830                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1831                mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
1832                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1833                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1834                u=mypde.getSolution()
1835                self.assertTrue(self.check(u,1.),'solution is wrong.')
1836      def test_PRES20_ILU0(self):      def test_PRES20_ILU0(self):
1837          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1838          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1839      mypde.setSolverMethod(mypde.PRES20,mypde.ILU0)          mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
1840          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1841          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1842            u=mypde.getSolution()
1843            self.assertTrue(self.check(u,1.),'solution is wrong.')
1844      def test_PRES20_RILU(self):      def test_PRES20_RILU(self):
1845          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1846          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1847      mypde.setSolverMethod(mypde.PRES20,mypde.RILU)          mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
1848          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1849          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1850            u=mypde.getSolution()
1851            self.assertTrue(self.check(u,1.),'solution is wrong.')
1852        def test_PRES20_REC_ILU(self):
1853            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1854            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1855            mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
1856            mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
1857            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1858            u=mypde.getSolution()
1859            self.assertTrue(self.check(u,1.),'solution is wrong.')
1860      def test_GMRESnoRestart_JACOBI(self):      def test_GMRESnoRestart_JACOBI(self):
1861          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1862          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1863      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)          mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1864          u=mypde.getSolution(verbose=self.VERBOSE,truncation=50)          mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1865          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1866            mypde.getSolverOptions().setTruncation(50)
1867            u=mypde.getSolution()
1868            self.assertTrue(self.check(u,1.),'solution is wrong.')
1869        def test_GMRESnoRestart_GAUSS_SEIDEL(self):
1870            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1871            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1872            mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1873            mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1874            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1875            mypde.getSolverOptions().setTruncation(50)
1876            u=mypde.getSolution()
1877            self.assertTrue(self.check(u,1.),'solution is wrong.')
1878        def test_GMRESnoRestart_AMG(self):
1879            if self.order!=2:
1880                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1881                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1882                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1883                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1884                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1885                mypde.getSolverOptions().setTruncation(50)
1886                u=mypde.getSolution()
1887                self.assertTrue(self.check(u,1.),'solution is wrong.')
1888      def test_GMRESnoRestart_ILU0(self):      def test_GMRESnoRestart_ILU0(self):
1889          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1890          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1891      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)          mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1892          u=mypde.getSolution(verbose=self.VERBOSE,truncation=50)          mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1893          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1894          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setTruncation(50)                        
1895            u=mypde.getSolution()
1896            self.assertTrue(self.check(u,1.),'solution is wrong.')
1897      def test_GMRESnoRestart_RILU(self):      def test_GMRESnoRestart_RILU(self):
1898          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1899          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1900      mypde.setSolverMethod(mypde.GMRES,mypde.RILU)          mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1901          u=mypde.getSolution(verbose=self.VERBOSE,truncation=50)          mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1902          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1903          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setTruncation(50)
1904            u=mypde.getSolution()
1905            self.assertTrue(self.check(u,1.),'solution is wrong.')
1906        def test_GMRESnoRestart_REC_ILU(self):
1907            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1908            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1909            mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1910            mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
1911            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1912            mypde.getSolverOptions().setTruncation(50)
1913            u=mypde.getSolution()
1914            self.assertTrue(self.check(u,1.),'solution is wrong.')
1915      def test_GMRES_JACOBI(self):      def test_GMRES_JACOBI(self):
1916          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1917          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1918      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)          mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1919          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1920          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1921            u=mypde.getSolution()
1922            self.assertTrue(self.check(u,1.),'solution is wrong.')
1923        def test_GMRES_GAUSS_SEIDEL(self):
1924            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1925            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1926            mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1927            mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1928            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1929            u=mypde.getSolution()
1930            self.assertTrue(self.check(u,1.),'solution is wrong.')
1931        def test_GMRES_AMG(self):
1932            if self.order!=2:
1933                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1934                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1935                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1936                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1937                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1938                u=mypde.getSolution()
1939                self.assertTrue(self.check(u,1.),'solution is wrong.')        
1940      def test_GMRES_ILU0(self):      def test_GMRES_ILU0(self):
1941          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1942          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1943      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)          mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1944          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1945          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1946            u=mypde.getSolution()
1947            self.assertTrue(self.check(u,1.),'solution is wrong.')
1948      def test_GMRES_RILU(self):      def test_GMRES_RILU(self):
1949          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1950          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1951      mypde.setSolverMethod(mypde.GMRES,mypde.RILU)          mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1952          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1953          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1954            u=mypde.getSolution()
1955            self.assertTrue(self.check(u,1.),'solution is wrong.')
1956        def test_GMRES_REC_ILU(self):
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.REC_ILU)
1961            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1962            u=mypde.getSolution()
1963            self.assertTrue(self.check(u,1.),'solution is wrong.')
1964      def test_GMRES_truncation_restart_JACOBI(self):      def test_GMRES_truncation_restart_JACOBI(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.JACOBI)          mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1968          u=mypde.getSolution(verbose=self.VERBOSE,truncation=10,restart=20)          mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1969          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1970            mypde.getSolverOptions().setTruncation(10)
1971            mypde.getSolverOptions().setRestart(20)
1972            u=mypde.getSolution()
1973            self.assertTrue(self.check(u,1.),'solution is wrong.')
1974        def test_GMRES_truncation_restart_GAUSS_SEIDEL(self):
1975            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1976            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1977            mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1978            mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1979            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1980            mypde.getSolverOptions().setTruncation(10)
1981            mypde.getSolverOptions().setRestart(20)
1982            u=mypde.getSolution()
1983            self.assertTrue(self.check(u,1.),'solution is wrong.')
1984        def test_GMRES_truncation_restart_AMG(self):
1985            if self.order!=2:
1986                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1987                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1988                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1989                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1990                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1991                mypde.getSolverOptions().setTruncation(10)
1992                mypde.getSolverOptions().setRestart(20)
1993                u=mypde.getSolution()
1994                self.assertTrue(self.check(u,1.),'solution is wrong.')
1995      def test_GMRES_truncation_restart_ILU0(self):      def test_GMRES_truncation_restart_ILU0(self):
1996          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1997          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1998      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)          mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1999          u=mypde.getSolution(verbose=self.VERBOSE,truncation=10,restart=20)          mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2000          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2001            mypde.getSolverOptions().setTruncation(10)
2002            mypde.getSolverOptions().setRestart(20)
2003            u=mypde.getSolution()
2004            self.assertTrue(self.check(u,1.),'solution is wrong.')
2005      def test_GMRES_truncation_restart_RILU(self):      def test_GMRES_truncation_restart_RILU(self):
2006          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2007          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2008      mypde.setSolverMethod(mypde.GMRES,mypde.RILU)          mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2009          u=mypde.getSolution(verbose=self.VERBOSE,truncation=10,restart=20)          mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
2010          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2011            mypde.getSolverOptions().setTruncation(10)
2012            mypde.getSolverOptions().setRestart(20)
2013            u=mypde.getSolution()
2014            self.assertTrue(self.check(u,1.),'solution is wrong.')
2015        def test_GMRES_truncation_restart_REC_ILU(self):
2016            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2017            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2018            mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2019            mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
2020            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2021            mypde.getSolverOptions().setTruncation(10)
2022            mypde.getSolverOptions().setRestart(20)
2023            u=mypde.getSolution()
2024            self.assertTrue(self.check(u,1.),'solution is wrong.')
2025      #      #
2026      #   solver checks (PDE system)      #   solver checks (PDE system)
2027      #      #
# Line 1702  class Test_LinearPDE_noLumping(Test_line Line 2035  class Test_LinearPDE_noLumping(Test_line
2035              Y[i]+=i              Y[i]+=i
2036          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2037          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2038          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2039          self.failUnless(self.check(u,1.),'solution is wrong.')          u=mypde.getSolution()
2040            self.assertTrue(self.check(u,1.),'solution is wrong.')
2041      def test_symmetryOnDirect_System(self):      def test_symmetryOnDirect_System(self):
2042          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2043          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1714  class Test_LinearPDE_noLumping(Test_line Line 2048  class Test_LinearPDE_noLumping(Test_line
2048              Y[i]+=i              Y[i]+=i
2049          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2050          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2051          mypde.setSolverMethod(mypde.DIRECT)          mypde.getSolverOptions().setSolverMethod(SolverOptions.DIRECT)
2052          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2053          self.failUnless(self.check(u,1.),'solution is wrong.')          u=mypde.getSolution()
2054            self.assertTrue(self.check(u,1.),'solution is wrong.')
2055      def test_PCG_JACOBI_System(self):      def test_PCG_JACOBI_System(self):
2056          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2057          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1727  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          mypde.setSolverMethod(mypde.PCG,mypde.JACOBI)          mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
2066          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
2067          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2068            u=mypde.getSolution()
2069            self.assertTrue(self.check(u,1.),'solution is wrong.')
2070        def test_PCG_GAUSS_SEIDEL_System(self):
2071            A=Tensor4(0.,Function(self.domain))
2072            D=Tensor(1.,Function(self.domain))
2073            Y=Vector(self.domain.getDim(),Function(self.domain))
2074            for i in range(self.domain.getDim()):
2075                A[i,:,i,:]=kronecker(self.domain)
2076                D[i,i]+=i
2077                Y[i]+=i
2078            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2079            mypde.setValue(A=A,D=D,Y=Y)
2080            mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
2081            mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2082            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2083            u=mypde.getSolution()
2084            self.assertTrue(self.check(u,1.),'solution is wrong.')
2085        def test_PCG_AMG_System(self):
2086            if self.order!=2:
2087                A=Tensor4(0.,Function(self.domain))
2088                D=Tensor(1.,Function(self.domain))
2089                Y=Vector(self.domain.getDim(),Function(self.domain))
2090                for i in range(self.domain.getDim()):
2091                    A[i,:,i,:]=kronecker(self.domain)
2092                    D[i,i]+=i
2093                    Y[i]+=i
2094                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2095                mypde.setValue(A=A,D=D,Y=Y)
2096                mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
2097                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2098                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2099                u=mypde.getSolution()
2100                self.assertTrue(self.check(u,1.),'solution is wrong.')
2101      def test_PCG_ILU0_System(self):      def test_PCG_ILU0_System(self):
2102          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2103          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1740  class Test_LinearPDE_noLumping(Test_line Line 2108  class Test_LinearPDE_noLumping(Test_line
2108              Y[i]+=i              Y[i]+=i
2109          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2110          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2111          mypde.setSolverMethod(mypde.PCG,mypde.ILU0)          mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
2112          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2113          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2114            u=mypde.getSolution()
2115            self.assertTrue(self.check(u,1.),'solution is wrong.')
2116      def test_DIRECT_System(self):      def test_DIRECT_System(self):
2117          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2118          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1753  class Test_LinearPDE_noLumping(Test_line Line 2123  class Test_LinearPDE_noLumping(Test_line
2123              Y[i]+=i              Y[i]+=i
2124          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2125          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2126          mypde.setSolverMethod(mypde.DIRECT)          mypde.getSolverOptions().setSolverMethod(SolverOptions.DIRECT)
2127          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2128          self.failUnless(self.check(u,1.),'solution is wrong.')          u=mypde.getSolution()
2129            self.assertTrue(self.check(u,1.),'solution is wrong.')
2130      def test_BICGSTAB_JACOBI_System(self):      def test_BICGSTAB_JACOBI_System(self):
2131          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2132          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1766  class Test_LinearPDE_noLumping(Test_line Line 2137  class Test_LinearPDE_noLumping(Test_line
2137              Y[i]+=i              Y[i]+=i
2138          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2139          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2140      mypde.setSolverMethod(mypde.BICGSTAB,mypde.JACOBI)          mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
2141          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
2142          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2143            u=mypde.getSolution()
2144            self.assertTrue(self.check(u,1.),'solution is wrong.')
2145        def test_BICGSTAB_GAUSS_SEIDEL_System(self):
2146            A=Tensor4(0.,Function(self.domain))
2147            D=Tensor(1.,Function(self.domain))
2148            Y=Vector(self.domain.getDim(),Function(self.domain))
2149            for i in range(self.domain.getDim()):
2150                A[i,:,i,:]=kronecker(self.domain)
2151                D[i,i]+=i
2152                Y[i]+=i
2153            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2154            mypde.setValue(A=A,D=D,Y=Y)
2155            mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
2156            mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2157            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2158            u=mypde.getSolution()
2159            self.assertTrue(self.check(u,1.),'solution is wrong.')
2160        def test_BICGSTAB_AMG_System(self):
2161            if self.order!=2:
2162                A=Tensor4(0.,Function(self.domain))
2163                D=Tensor(1.,Function(self.domain))
2164                Y=Vector(self.domain.getDim(),Function(self.domain))
2165                for i in range(self.domain.getDim()):
2166                    A[i,:,i,:]=kronecker(self.domain)
2167                    D[i,i]+=i
2168                    Y[i]+=i
2169                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2170                mypde.setValue(A=A,D=D,Y=Y)
2171                mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
2172                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2173                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2174                u=mypde.getSolution()
2175                self.assertTrue(self.check(u,1.),'solution is wrong.')
2176      def test_BICGSTAB_ILU0_System(self):      def test_BICGSTAB_ILU0_System(self):
2177          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2178          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1779  class Test_LinearPDE_noLumping(Test_line Line 2183  class Test_LinearPDE_noLumping(Test_line
2183              Y[i]+=i              Y[i]+=i
2184          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2185          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2186      mypde.setSolverMethod(mypde.BICGSTAB,mypde.ILU0)          mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
2187          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2188          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2189            u=mypde.getSolution()
2190            self.assertTrue(self.check(u,1.),'solution is wrong.')
2191      def test_PRES20_JACOBI_System(self):      def test_PRES20_JACOBI_System(self):
2192          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2193          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1792  class Test_LinearPDE_noLumping(Test_line Line 2198  class Test_LinearPDE_noLumping(Test_line
2198              Y[i]+=i              Y[i]+=i
2199          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2200          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2201      mypde.setSolverMethod(mypde.PRES20,mypde.JACOBI)          mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
2202          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
2203          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2204            u=mypde.getSolution()
2205            self.assertTrue(self.check(u,1.),'solution is wrong.')
2206        def test_PRES20_GAUSS_SEIDEL_System(self):
2207            A=Tensor4(0.,Function(self.domain))
2208            D=Tensor(1.,Function(self.domain))
2209            Y=Vector(self.domain.getDim(),Function(self.domain))
2210            for i in range(self.domain.getDim()):
2211                A[i,:,i,:]=kronecker(self.domain)
2212                D[i,i]+=i
2213                Y[i]+=i
2214            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2215            mypde.setValue(A=A,D=D,Y=Y)
2216            mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
2217            mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2218            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2219            u=mypde.getSolution()
2220            self.assertTrue(self.check(u,1.),'solution is wrong.')
2221        def test_PRES20_AMG_System(self):
2222            if self.order!=2:
2223                A=Tensor4(0.,Function(self.domain))
2224                D=Tensor(1.,Function(self.domain))
2225                Y=Vector(self.domain.getDim(),Function(self.domain))
2226                for i in range(self.domain.getDim()):
2227                    A[i,:,i,:]=kronecker(self.domain)
2228                    D[i,i]+=i
2229                    Y[i]+=i
2230                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2231                mypde.setValue(A=A,D=D,Y=Y)
2232                mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
2233                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2234                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2235                u=mypde.getSolution()
2236                self.assertTrue(self.check(u,1.),'solution is wrong.')
2237      def test_PRES20_ILU0_System(self):      def test_PRES20_ILU0_System(self):
2238          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2239          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1805  class Test_LinearPDE_noLumping(Test_line Line 2244  class Test_LinearPDE_noLumping(Test_line
2244              Y[i]+=i              Y[i]+=i
2245          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2246          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2247      mypde.setSolverMethod(mypde.PRES20,mypde.ILU0)          mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
2248          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2249          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2250            u=mypde.getSolution()
2251            self.assertTrue(self.check(u,1.),'solution is wrong.')
2252      def test_GMRESnoRestart_JACOBI_System(self):      def test_GMRESnoRestart_JACOBI_System(self):
2253          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2254          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1818  class Test_LinearPDE_noLumping(Test_line Line 2259  class Test_LinearPDE_noLumping(Test_line
2259              Y[i]+=i              Y[i]+=i
2260          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2261          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2262      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)          mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2263            mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
2264            # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)
2265            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2266            u=mypde.getSolution()
2267            self.assertTrue(self.check(u,1.),'solution is wrong.')
2268        def test_GMRESnoRestart_GAUSS_SEIDEL_System(self):
2269            A=Tensor4(0.,Function(self.domain))
2270            D=Tensor(1.,Function(self.domain))
2271            Y=Vector(self.domain.getDim(),Function(self.domain))
2272            for i in range(self.domain.getDim()):
2273                A[i,:,i,:]=kronecker(self.domain)
2274                D[i,i]+=i
2275                Y[i]+=i
2276            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2277            mypde.setValue(A=A,D=D,Y=Y)
2278            mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2279            mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2280          # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)          # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)
2281          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2282          self.failUnless(self.check(u,1.),'solution is wrong.')          u=mypde.getSolution()
2283            self.assertTrue(self.check(u,1.),'solution is wrong.')
2284        def test_GMRESnoRestart_AMG_System(self):
2285            if self.order!=2:
2286                A=Tensor4(0.,Function(self.domain))
2287                D=Tensor(1.,Function(self.domain))
2288                Y=Vector(self.domain.getDim(),Function(self.domain))
2289                for i in range(self.domain.getDim()):
2290                    A[i,:,i,:]=kronecker(self.domain)
2291                    D[i,i]+=i
2292                    Y[i]+=i
2293                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2294                mypde.setValue(A=A,D=D,Y=Y)
2295                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2296                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2297                # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)
2298                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2299                u=mypde.getSolution()
2300                self.assertTrue(self.check(u,1.),'solution is wrong.')
2301      def test_GMRESnoRestart_ILU0_System(self):      def test_GMRESnoRestart_ILU0_System(self):
2302          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2303          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1832  class Test_LinearPDE_noLumping(Test_line Line 2308  class Test_LinearPDE_noLumping(Test_line
2308              Y[i]+=i              Y[i]+=i
2309          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2310          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2311      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)          mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2312            mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2313          # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)          # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)
2314          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2315          self.failUnless(self.check(u,1.),'solution is wrong.')          u=mypde.getSolution()
2316            self.assertTrue(self.check(u,1.),'solution is wrong.')
2317      def test_GMRES_JACOBI_System(self):      def test_GMRES_JACOBI_System(self):
2318          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2319          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1846  class Test_LinearPDE_noLumping(Test_line Line 2324  class Test_LinearPDE_noLumping(Test_line
2324              Y[i]+=i              Y[i]+=i
2325          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2326          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2327      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)          mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2328          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
2329          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2330            u=mypde.getSolution()
2331            self.assertTrue(self.check(u,1.),'solution is wrong.')
2332        def test_GMRES_GAUSS_SEIDEL_System(self):
2333            A=Tensor4(0.,Function(self.domain))
2334            D=Tensor(1.,Function(self.domain))
2335            Y=Vector(self.domain.getDim(),Function(self.domain))
2336            for i in range(self.domain.getDim()):
2337                A[i,:,i,:]=kronecker(self.domain)
2338                D[i,i]+=i
2339                Y[i]+=i
2340            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2341            mypde.setValue(A=A,D=D,Y=Y)
2342            mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2343            mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2344            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2345            u=mypde.getSolution()
2346            self.assertTrue(self.check(u,1.),'solution is wrong.')
2347        def test_GMRES_AMG_System(self):
2348            if self.order!=2:
2349                A=Tensor4(0.,Function(self.domain))
2350                D=Tensor(1.,Function(self.domain))
2351                Y=Vector(self.domain.getDim(),Function(self.domain))
2352                for i in range(self.domain.getDim()):
2353                    A[i,:,i,:]=kronecker(self.domain)
2354                    D[i,i]+=i
2355                    Y[i]+=i
2356                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2357                mypde.setValue(A=A,D=D,Y=Y)
2358                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2359                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2360                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2361                u=mypde.getSolution()
2362                self.assertTrue(self.check(u,1.),'solution is wrong.')
2363      def test_GMRES_ILU0_System(self):      def test_GMRES_ILU0_System(self):
2364          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2365          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1859  class Test_LinearPDE_noLumping(Test_line Line 2370  class Test_LinearPDE_noLumping(Test_line
2370              Y[i]+=i              Y[i]+=i
2371          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2372          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2373      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)          mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2374          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2375          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2376            u=mypde.getSolution()
2377            self.assertTrue(self.check(u,1.),'solution is wrong.')
2378      def test_GMRES_truncation_restart_JACOBI_System(self):      def test_GMRES_truncation_restart_JACOBI_System(self):
2379          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2380          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1872  class Test_LinearPDE_noLumping(Test_line Line 2385  class Test_LinearPDE_noLumping(Test_line
2385              Y[i]+=i              Y[i]+=i
2386          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2387          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2388      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)          mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2389          u=mypde.getSolution(verbose=self.VERBOSE,truncation=10,restart=20)          mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
2390          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2391            mypde.getSolverOptions().setTruncation(10)
2392            mypde.getSolverOptions().setRestart(20)
2393            u=mypde.getSolution()
2394            self.assertTrue(self.check(u,1.),'solution is wrong.')
2395        def test_GMRES_truncation_restart_GAUSS_SEIDEL_System(self):
2396            A=Tensor4(0.,Function(self.domain))
2397            D=Tensor(1.,Function(self.domain))
2398            Y=Vector(self.domain.getDim(),Function(self.domain))
2399            for i in range(self.domain.getDim()):
2400                A[i,:,i,:]=kronecker(self.domain)
2401                D[i,i]+=i
2402                Y[i]+=i
2403            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2404            mypde.setValue(A=A,D=D,Y=Y)
2405            mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2406            mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2407            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2408            mypde.getSolverOptions().setTruncation(10)
2409            mypde.getSolverOptions().setRestart(20)
2410            u=mypde.getSolution()
2411            self.assertTrue(self.check(u,1.),'solution is wrong.')
2412        def test_GMRES_truncation_restart_AMG_System(self):
2413            if self.order!=2:
2414                A=Tensor4(0.,Function(self.domain))
2415                D=Tensor(1.,Function(self.domain))
2416                Y=Vector(self.domain.getDim(),Function(self.domain))
2417                for i in range(self.domain.getDim()):
2418                    A[i,:,i,:]=kronecker(self.domain)
2419                    D[i,i]+=i
2420                    Y[i]+=i
2421                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2422                mypde.setValue(A=A,D=D,Y=Y)
2423                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2424                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2425                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2426                mypde.getSolverOptions().setTruncation(10)
2427                mypde.getSolverOptions().setRestart(20)
2428                u=mypde.getSolution()
2429                self.assertTrue(self.check(u,1.),'solution is wrong.')
2430      def test_GMRES_truncation_restart_ILU0_System(self):      def test_GMRES_truncation_restart_ILU0_System(self):
2431          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2432          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1885  class Test_LinearPDE_noLumping(Test_line Line 2437  class Test_LinearPDE_noLumping(Test_line
2437              Y[i]+=i              Y[i]+=i
2438          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2439          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2440      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)          mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2441          u=mypde.getSolution(verbose=self.VERBOSE,truncation=10,restart=20)          mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2442          self.failUnless(self.check(u,1.),'solution is wrong.')          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2443            mypde.getSolverOptions().setTruncation(10)
2444            mypde.getSolverOptions().setRestart(20)
2445            u=mypde.getSolution()
2446            self.assertTrue(self.check(u,1.),'solution is wrong.')
2447    
2448    
2449        def test_FluxScalar0(self):
2450            pde= LinearPDE(self.domain, numEquations=1, numSolutions=1)
2451            u=self.domain.getX()[0]
2452            f = pde.getFlux(u)
2453            self.assertEqual(f.getShape(),(self.domain.getDim(),),"wrong shape of result.")
2454            self.assertEqual(f.getFunctionSpace(),Function(self.domain),"wrong function space")
2455            self.assertEqual(Lsup(f),0.,"wrong result")
2456    
2457        def test_FluxScalar(self):
2458            pde= LinearPDE(self.domain, numEquations=1, numSolutions=1)
2459            pde.setValue(X=kronecker(self.domain)[0]*1., B=kronecker(self.domain)[1]*2, A=5*kronecker(self.domain))
2460            x=self.domain.getX()[0]
2461            f = pde.getFlux(x)
2462            self.assertEqual(f.getShape(),(self.domain.getDim(),),"wrong shape of result.")
2463            self.assertEqual(f.getFunctionSpace(),Function(self.domain),"wrong function space")
2464            f_ref=x*kronecker(self.domain)[1]*2+(5-1)*kronecker(self.domain)[0]
2465            self.assertTrue(self.check(f, f_ref),"wrong result")
2466    
2467        def test_FluxScalarReduced(self):
2468            pde= LinearPDE(self.domain, numEquations=1, numSolutions=1)
2469            pde.setValue(X_reduced=kronecker(self.domain)[0]*1., B_reduced=kronecker(self.domain)[1]*2, A_reduced=5*kronecker(self.domain))
2470            x=self.domain.getX()[0]
2471            f = pde.getFlux(x)
2472            self.assertEqual(f.getShape(),(self.domain.getDim(),),"wrong shape of result.")
2473            self.assertEqual(f.getFunctionSpace(),ReducedFunction(self.domain),"wrong function space")
2474            f_ref=x*kronecker(self.domain)[1]*2+(5-1)*kronecker(self.domain)[0]
2475            self.assertTrue(self.check(f, f_ref),"wrong result")
2476    
2477        def test_FluxSystem0(self):
2478            pde= LinearPDE(self.domain, numEquations=2, numSolutions=2)
2479            u=self.domain.getX()
2480            f = pde.getFlux(u)
2481            self.assertEqual(f.getShape(),(2, self.domain.getDim()),"wrong shape of result.")
2482            self.assertEqual(f.getFunctionSpace(),Function(self.domain),"wrong function space")
2483            self.assertEqual(Lsup(f),0.,"wrong result")
2484    
2485        def test_FluxSystem(self):
2486            pde= LinearPDE(self.domain, numEquations=2, numSolutions=2)
2487            X=Data(0., (2, self.domain.getDim()), Function(self.domain))
2488            X[0,0]=1
2489            B=Data(0., (2, self.domain.getDim(),2), Function(self.domain))
2490            B[0,0,0]=5
2491            A=Data(0., (2, self.domain.getDim(),2, self.domain.getDim()), Function(self.domain))
2492            A[0,0,0,0]=10
2493            pde.setValue(X=X, B=B, A=A)
2494            x=self.domain.getX()
2495            f = pde.getFlux(x[:2])
2496            self.assertEqual(f.getShape(),(2, self.domain.getDim()),"wrong shape of result.")
2497            self.assertEqual(f.getFunctionSpace(),Function(self.domain),"wrong function space")
2498            f_ref=X*(5*x[0]-1+10)
2499            self.assertTrue(self.check(f, f_ref),"wrong result")
2500        def test_FluxSystemReduced(self):
2501            pde= LinearPDE(self.domain, numEquations=2, numSolutions=2)
2502            X=Data(0., (2, self.domain.getDim()), ReducedFunction(self.domain))
2503            X[0,0]=1
2504            B=Data(0., (2, self.domain.getDim(),2), ReducedFunction(self.domain))
2505            B[0,0,0]=5
2506            A=Data(0., (2, self.domain.getDim(),2, self.domain.getDim()), ReducedFunction(self.domain))
2507            A[0,0,0,0]=10
2508            pde.setValue(X=X, B=B, A=A)
2509            x=self.domain.getX()
2510            f = pde.getFlux(x[:2])
2511            self.assertEqual(f.getShape(),(2, self.domain.getDim()),"wrong shape of result.")
2512            self.assertEqual(f.getFunctionSpace(),ReducedFunction(self.domain),"wrong function space")
2513            f_ref=X*(5*x[0]-1+10)
2514            self.assertTrue(self.check(f, f_ref),"wrong result")
2515            
2516  class Test_LinearPDE(Test_LinearPDE_noLumping):  class Test_LinearPDE(Test_LinearPDE_noLumping):
2517      def test_Lumping_attemptToSetA(self):      def test_Lumping_attemptToSetA(self):
2518          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2519          try:          try:
2520             success=True             success=True
2521         mypde.setSolverMethod(mypde.LUMPING)             mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2522             mypde.setValue(A=kronecker(self.domain))             mypde.setValue(A=kronecker(self.domain))
2523             u=mypde.getSolution(verbose=self.VERBOSE)             mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2524               u=mypde.getSolution()        
2525          except ValueError:          except ValueError:
2526             success=False             success=False
2527          self.failUnless(not success,'error should be issued')          self.assertTrue(not success,'error should be issued')
2528      def test_Lumping_attemptToSetB(self):      def test_Lumping_attemptToSetB(self):
2529          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2530          try:          try:
2531             success=True             success=True
2532         mypde.setSolverMethod(mypde.LUMPING)             mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2533             mypde.setValue(B=kronecker(self.domain)[0])             mypde.setValue(B=kronecker(self.domain)[0])
2534             u=mypde.getSolution(verbose=self.VERBOSE)             mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2535               u=mypde.getSolution()
2536          except ValueError:          except ValueError:
2537             success=False             success=False
2538          self.failUnless(not success,'error should be issued')          self.assertTrue(not success,'error should be issued')
2539      def test_Lumping_attemptToSetC(self):      def test_Lumping_attemptToSetC(self):
2540          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2541          try:          try:
2542             success=True             success=True
2543         mypde.setSolverMethod(mypde.LUMPING)             mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2544             mypde.setValue(C=kronecker(self.domain)[0])             mypde.setValue(C=kronecker(self.domain)[0])
2545             u=mypde.getSolution(verbose=self.VERBOSE)             mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2546               u=mypde.getSolution()
2547          except ValueError:          except ValueError:
2548             success=False             success=False
2549          self.failUnless(not success,'error should be issued')          self.assertTrue(not success,'error should be issued')
2550                    
2551      def test_Lumping_attemptToSetA_reduced(self):      def test_Lumping_attemptToSetA_reduced(self):
2552          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2553          try:          try:
2554             success=True             success=True
2555         mypde.setSolverMethod(mypde.LUMPING)             mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2556             mypde.setValue(A_reduced=kronecker(self.domain))             mypde.setValue(A_reduced=kronecker(self.domain))
2557             u=mypde.getSolution(verbose=self.VERBOSE)             mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2558               u=mypde.getSolution()
2559          except ValueError:          except ValueError:
2560             success=False             success=False
2561          self.failUnless(not success,'error should be issued')          self.assertTrue(not success,'error should be issued')
2562      def test_Lumping_attemptToSetB_reduced(self):      def test_Lumping_attemptToSetB_reduced(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(B_reduced=kronecker(self.domain)[0])             mypde.setValue(B_reduced=kronecker(self.domain)[0])
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_attemptToSetC_reduced(self):      def test_Lumping_attemptToSetC_reduced(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(C_reduced=kronecker(self.domain)[0])             mypde.setValue(C_reduced=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')
2584                    
2585      def test_Lumping(self):      def test_Lumping(self):
2586          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2587      mypde.setSolverMeth