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