/[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 3437 by plaub, Mon Jan 10 05:05:15 2011 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.failUnlessEqual((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 83  class Test_LameEquation(Test_linearPDEs) Line 66  class Test_LameEquation(Test_linearPDEs)
66          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
67          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")
68          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")
         self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")  
         self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")  
69          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
70          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
71          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
# Line 93  class Test_LameEquation(Test_linearPDEs) Line 74  class Test_LameEquation(Test_linearPDEs)
74          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
75          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
76          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
77          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")      if self.domain.supportsContactElements():
78          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")              self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
79                self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")
80            self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
81                self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
82          self.failUnless(self.check(mypde.getCoefficient("q"),q_ref),"q is not empty")          self.failUnless(self.check(mypde.getCoefficient("q"),q_ref),"q is not empty")
83          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")
84    
# Line 112  class Test_LameEquation(Test_linearPDEs) Line 96  class Test_LameEquation(Test_linearPDEs)
96          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
97          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")
98          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")
         self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")  
         self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")  
99          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
100          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
101          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
# Line 122  class Test_LameEquation(Test_linearPDEs) Line 104  class Test_LameEquation(Test_linearPDEs)
104          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
105          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
106          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
107          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")      if self.domain.supportsContactElements():
108          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")              self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
109                self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")
110            self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
111                self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
112          self.failUnless(self.check(mypde.getCoefficient("r"),r_ref),"r is nor x")          self.failUnless(self.check(mypde.getCoefficient("r"),r_ref),"r is nor x")
113          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")
114    
# Line 142  class Test_LameEquation(Test_linearPDEs) Line 127  class Test_LameEquation(Test_linearPDEs)
127          self.failUnless(self.check(mypde.getCoefficient("Y"),Y_ref),"Y is not x")          self.failUnless(self.check(mypde.getCoefficient("Y"),Y_ref),"Y is not x")
128          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")
129          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")
         self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")  
         self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")  
130          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
131          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
132          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
# Line 152  class Test_LameEquation(Test_linearPDEs) Line 135  class Test_LameEquation(Test_linearPDEs)
135          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
136          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
137          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
138          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")      if self.domain.supportsContactElements():
139          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")              self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
140          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")              self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
141                self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
142                self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")
143        self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")
144          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")
145    
146      def test_setCoefficient_f(self):      def test_setCoefficient_f(self):
# Line 171  class Test_LameEquation(Test_linearPDEs) Line 157  class Test_LameEquation(Test_linearPDEs)
157          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
158          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")
159          self.failUnless(self.check(mypde.getCoefficient("y"),y_ref),"d is not x[0]")          self.failUnless(self.check(mypde.getCoefficient("y"),y_ref),"d is not x[0]")
         self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")  
         self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")  
160          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
161          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
162          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
# Line 181  class Test_LameEquation(Test_linearPDEs) Line 165  class Test_LameEquation(Test_linearPDEs)
165          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"X_reduced is not empty")          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"X_reduced is not empty")
166          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
167          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
168          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")      if self.domain.supportsContactElements():
169          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")              self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
170                self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
171                self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
172                self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")  
173          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")
174          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")
175    
# Line 200  class Test_LameEquation(Test_linearPDEs) Line 187  class Test_LameEquation(Test_linearPDEs)
187          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
188          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")
189          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")
         self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")  
         self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")  
190          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
191          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
192          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
# Line 210  class Test_LameEquation(Test_linearPDEs) Line 195  class Test_LameEquation(Test_linearPDEs)
195          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"X_reduced is not empty")          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"X_reduced is not empty")
196          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
197          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
198          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")          if self.domain.supportsContactElements():
199          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")          self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
200                self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")
201            self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
202                self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
203          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")
204          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")
205    
# Line 233  class Test_LameEquation(Test_linearPDEs) Line 221  class Test_LameEquation(Test_linearPDEs)
221          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
222          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")
223          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")
         self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")  
         self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")  
224          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
225          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
226          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
# Line 243  class Test_LameEquation(Test_linearPDEs) Line 229  class Test_LameEquation(Test_linearPDEs)
229          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
230          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
231          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
232          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")      if self.domain.supportsContactElements():
233          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")              self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
234                self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
235                self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
236                self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")  
237          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")
238          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")
239    
# Line 266  class Test_LameEquation(Test_linearPDEs) Line 255  class Test_LameEquation(Test_linearPDEs)
255          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
256          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")
257          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")
         self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")  
         self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")  
258          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
259          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
260          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
# Line 276  class Test_LameEquation(Test_linearPDEs) Line 263  class Test_LameEquation(Test_linearPDEs)
263          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
264          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
265          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
266          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")      if self.domain.supportsContactElements():
267          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")              self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
268          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")              self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
269                self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
270                self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")        
271        self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")
272          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")
273    
274      def test_setCoefficient_lambdamu(self):      def test_setCoefficient_lambdamu(self):
# Line 298  class Test_LameEquation(Test_linearPDEs) Line 288  class Test_LameEquation(Test_linearPDEs)
288          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
289          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")
290          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")
         self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")  
         self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")  
291          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
292          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
293          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
# Line 308  class Test_LameEquation(Test_linearPDEs) Line 296  class Test_LameEquation(Test_linearPDEs)
296          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
297          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
298          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
299          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")      if self.domain.supportsContactElements():
300          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")              self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
301          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")              self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
302                self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
303                self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")
304        self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")
305          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")
306    
307      def test_solve(self):      def test_solve(self):
# Line 330  class Test_Helmholtz(Test_linearPDEs): Line 321  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.failUnlessEqual((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 347  class Test_Helmholtz(Test_linearPDEs): Line 338  class Test_Helmholtz(Test_linearPDEs):
338          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
339          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")
340          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")
         self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")  
         self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")  
341          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
342          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
343          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
# Line 357  class Test_Helmholtz(Test_linearPDEs): Line 346  class Test_Helmholtz(Test_linearPDEs):
346          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
347          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
348          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
349          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")      if self.domain.supportsContactElements():
350          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")              self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
351                self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
352                self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
353                self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")  
354          self.failUnless(self.check(mypde.getCoefficient("q"),q_ref),"q is not empty")          self.failUnless(self.check(mypde.getCoefficient("q"),q_ref),"q is not empty")
355          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")
356    
# Line 377  class Test_Helmholtz(Test_linearPDEs): Line 369  class Test_Helmholtz(Test_linearPDEs):
369          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
370          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")
371          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")
         self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")  
         self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")  
372          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
373          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
374          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
# Line 387  class Test_Helmholtz(Test_linearPDEs): Line 377  class Test_Helmholtz(Test_linearPDEs):
377          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
378          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
379          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
380          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")      if self.domain.supportsContactElements():
381          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")              self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
382          self.failUnless(self.check(mypde.getCoefficient("r"),r_ref),"r is nor x[0]")              self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
383                self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
384                self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")
385        self.failUnless(self.check(mypde.getCoefficient("r"),r_ref),"r is nor x[0]")
386          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")
387    
388    
# Line 408  class Test_Helmholtz(Test_linearPDEs): Line 401  class Test_Helmholtz(Test_linearPDEs):
401          self.failUnless(self.check(mypde.getCoefficient("Y"),Y_ref),"Y is not x[0]")          self.failUnless(self.check(mypde.getCoefficient("Y"),Y_ref),"Y is not x[0]")
402          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")
403          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")
         self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")  
         self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")  
404          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
405          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
406          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
# Line 418  class Test_Helmholtz(Test_linearPDEs): Line 409  class Test_Helmholtz(Test_linearPDEs):
409          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
410          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
411          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
412          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")      if self.domain.supportsContactElements():
413          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")              self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
414                self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
415                self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
416                self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")  
417          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")
418          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")
419    
# Line 438  class Test_Helmholtz(Test_linearPDEs): Line 432  class Test_Helmholtz(Test_linearPDEs):
432          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
433          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")
434          self.failUnless(self.check(mypde.getCoefficient("d"),d_ref),"d is not x[0]")          self.failUnless(self.check(mypde.getCoefficient("d"),d_ref),"d is not x[0]")
         self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")  
         self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")  
435          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
436          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
437          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
# Line 448  class Test_Helmholtz(Test_linearPDEs): Line 440  class Test_Helmholtz(Test_linearPDEs):
440          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"X_reduced is not empty")          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"X_reduced is not empty")
441          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
442          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
443          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")      if self.domain.supportsContactElements():
444          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")              self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
445                self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
446                self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
447                self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")  
448          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")
449          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")
450    
# Line 468  class Test_Helmholtz(Test_linearPDEs): Line 463  class Test_Helmholtz(Test_linearPDEs):
463          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
464          self.failUnless(self.check(mypde.getCoefficient("y"),y_ref),"y is not x[0]")          self.failUnless(self.check(mypde.getCoefficient("y"),y_ref),"y is not x[0]")
465          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")
         self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")  
         self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")  
466          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
467          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
468          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
# Line 478  class Test_Helmholtz(Test_linearPDEs): Line 471  class Test_Helmholtz(Test_linearPDEs):
471          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
472          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
473          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
474          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")      if self.domain.supportsContactElements():
475          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")              self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
476                self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
477                self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
478                self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")  
479          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")
480          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")
481    
# Line 498  class Test_Helmholtz(Test_linearPDEs): Line 494  class Test_Helmholtz(Test_linearPDEs):
494          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
495          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")
496          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")
         self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")  
         self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")  
497          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
498          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
499          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
# Line 508  class Test_Helmholtz(Test_linearPDEs): Line 502  class Test_Helmholtz(Test_linearPDEs):
502          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
503          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
504          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
505          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")      if self.domain.supportsContactElements():
506          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")              self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
507          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")              self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
508                self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
509                self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")        
510        self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")
511          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")
512    
513      def test_solve(self):      def test_solve(self):
# Line 526  class Test_Poisson(Test_linearPDEs): Line 523  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.failUnlessEqual((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()
# Line 541  class Test_Poisson(Test_linearPDEs): Line 538  class Test_Poisson(Test_linearPDEs):
538          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
539          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")
540          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")
         self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")  
         self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")  
541          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
542          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
543          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
# Line 551  class Test_Poisson(Test_linearPDEs): Line 546  class Test_Poisson(Test_linearPDEs):
546          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
547          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
548          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
549          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")      if self.domain.supportsContactElements():
550          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")              self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
551          self.failUnless(self.check(mypde.getCoefficient("q"),q_ref),"q is not empty")              self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
552                self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
553                self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")
554        self.failUnless(self.check(mypde.getCoefficient("q"),q_ref),"q is not empty")
555          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")          self.failUnless(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)
# Line 569  class Test_Poisson(Test_linearPDEs): Line 567  class Test_Poisson(Test_linearPDEs):
567          self.failUnless(self.check(mypde.getCoefficient("Y"),Y_ref),"Y is not x[0]")          self.failUnless(self.check(mypde.getCoefficient("Y"),Y_ref),"Y is not x[0]")
568          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")
569          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")
         self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")  
         self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")  
570          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
571          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
572          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
# Line 579  class Test_Poisson(Test_linearPDEs): Line 575  class Test_Poisson(Test_linearPDEs):
575          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
576          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
577          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
578          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")          if self.domain.supportsContactElements():
579          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
580                self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
581            self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
582                self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")
583          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")
584          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")
585      def test_setCoefficient_f_reduced(self):      def test_setCoefficient_f_reduced(self):
# Line 597  class Test_Poisson(Test_linearPDEs): Line 596  class Test_Poisson(Test_linearPDEs):
596          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
597          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")
598          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")
         self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")  
         self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")  
599          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
600          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
601          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
# Line 607  class Test_Poisson(Test_linearPDEs): Line 604  class Test_Poisson(Test_linearPDEs):
604          self.failUnless(self.check(mypde.getCoefficient("Y_reduced"),Y_ref),"Y_reduced is not x[0]")          self.failUnless(self.check(mypde.getCoefficient("Y_reduced"),Y_ref),"Y_reduced is not x[0]")
605          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
606          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
607          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")      if self.domain.supportsContactElements():
608          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")              self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
609          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")              self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
610                self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
611                self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")        
612        self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")
613          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")          self.failUnless(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()
# 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           print u,u_ex, self.TOL
640         self.failUnless(self.check(u,u_ex,10*self.TOL),"incorrect solution")         self.failUnless(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.failUnless(so.getSmoother() == 28, "initial Smoother is wrong.")
648            self.failUnlessRaises(ValueError,so.setSmoother,-1)
649            so.setSmoother(so.GAUSS_SEIDEL)
650            self.failUnless(so.getSmoother() == 28, "Gauss-Seidel smoother is not set.")
651            so.setSmoother(so.JACOBI)
652            self.failUnless(so.getSmoother() == 10, "Jacobi smoother is not set.")
653    
654          self.failUnless(so.getLevelMax() == 10, "initial  LevelMax is wrong.")          self.failUnless(so.getLevelMax() == 100, "initial  LevelMax is wrong.")
655          self.failUnlessRaises(ValueError,so.setLevelMax,-1)          self.failUnlessRaises(ValueError,so.setLevelMax,-1)
656          so.setLevelMax(3)          so.setLevelMax(20)
657          self.failUnless(so.getLevelMax() == 3, "LevelMax is wrong.")          self.failUnless(so.getLevelMax() == 20, "LevelMax is wrong.")
658    
659          self.failUnless(so.getCoarseningThreshold() == 0.05, "initial  CoarseningThreshold is wrong.")          self.failUnless(so.getCoarseningThreshold() == 0.25, "initial  CoarseningThreshold is wrong.")
660          self.failUnlessRaises(ValueError,so.setCoarseningThreshold,-1)          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.failUnless(so.getCoarseningThreshold() == 0.1, "CoarseningThreshold is wrong.")
663            
664            self.failUnless(so.getMinCoarseMatrixSize() == 500, "initial  Minimum Coarse Matrix Size is wrong.")
665            self.failUnlessRaises(ValueError,so.setMinCoarseMatrixSize,-1)
666            so.setMinCoarseMatrixSize(1000)
667            self.failUnless(so.getMinCoarseMatrixSize() == 1000, "Minimum Coarse Matrix Size is wrong.")
668    
669          self.failUnless(so.getNumSweeps() == 2, "initial  Sweeps is wrong.")          self.failUnless(so.getNumSweeps() == 1, "initial  Sweeps is wrong.")
670          self.failUnlessRaises(ValueError,so.setNumSweeps,-1)          self.failUnlessRaises(ValueError,so.setNumSweeps,-1)
671          so.setNumSweeps(3)          so.setNumSweeps(3)
672          self.failUnless(so.getNumSweeps() == 3, "Sweeps is wrong.")          self.failUnless(so.getNumSweeps() == 3, "Sweeps is wrong.")
673    
674          self.failUnless(so.getNumPreSweeps() == 2, "initial  PreSweeps is wrong.")          self.failUnless(so.getNumPreSweeps() == 1, "initial  PreSweeps is wrong.")
675          self.failUnlessRaises(ValueError,so.setNumPreSweeps,-1)          self.failUnlessRaises(ValueError,so.setNumPreSweeps,-1)
676          so.setNumPreSweeps(4)          so.setNumPreSweeps(4)
677          self.failUnless(so.getNumPreSweeps() == 4, "PreSweeps is wrong.")          self.failUnless(so.getNumPreSweeps() == 4, "PreSweeps is wrong.")
678    
679          self.failUnless(so.getNumPostSweeps() == 2, "initial  PreSweeps is wrong.")          self.failUnless(so.getNumPostSweeps() == 1, "initial  PostSweeps is wrong.")
680          self.failUnlessRaises(ValueError,so.setNumPostSweeps,-1)          self.failUnlessRaises(ValueError,so.setNumPostSweeps,-1)
681          so.setNumPostSweeps(5)          so.setNumPostSweeps(5)
682          self.failUnless(so.getNumPostSweeps() == 5, "PreSweeps is wrong.")          self.failUnless(so.getNumPostSweeps() == 5, "PostSweeps is wrong.")
683    
684          self.failUnless(so.getTolerance() == 1.e-8, "initial Tolerance is wrong.")          self.failUnless(so.getTolerance() == 1.e-8, "initial Tolerance is wrong.")
685          self.failUnlessRaises(ValueError,so.setTolerance,-1)          self.failUnlessRaises(ValueError,so.setTolerance,-1)
# Line 699  class Test_LinearPDE_noLumping(Test_line Line 712  class Test_LinearPDE_noLumping(Test_line
712          self.failUnless(so.getRelaxationFactor() == 0.1, "Relaxation is wrong.")          self.failUnless(so.getRelaxationFactor() == 0.1, "Relaxation is wrong.")
713    
714    
715          self.failUnless(so.getIterMax() == 10000, "initial IterMax is wrong.")          self.failUnless(so.getIterMax() == 100000, "initial IterMax is wrong.")
716          self.failUnlessRaises(ValueError,so.setIterMax,0)          self.failUnlessRaises(ValueError,so.setIterMax,0)
717          so.setIterMax(11)          so.setIterMax(11)
718          self.failUnless(so.getIterMax() == 11, "IterMax is wrong.")          self.failUnless(so.getIterMax() == 11, "IterMax is wrong.")
# Line 720  class Test_LinearPDE_noLumping(Test_line Line 733  class Test_LinearPDE_noLumping(Test_line
733          self.failUnless(so.getRestart() == 14, "Truncation is wrong.")          self.failUnless(so.getRestart() == 14, "Truncation is wrong.")
734          so.setRestart(None)          so.setRestart(None)
735          self.failUnless(so.getRestart() == None, "Truncation is wrong.")          self.failUnless(so.getRestart() == None, "Truncation is wrong.")
736            
737            self.failUnless(not so.isVerbose(), "initial verbosity flag is wrong.")
738            so.setVerbosityOn()
739            self.failUnless(so.isVerbose(), "verbosity (1) flag is wrong.")
740            so.setVerbosityOff()
741            self.failUnless(not so.isVerbose(), "verbosity (2) flag is wrong.")
742            so.setVerbosity(verbose=True)
743            self.failUnless(so.isVerbose(), "verbosity (3) flag is wrong.")
744            so.setVerbosity(verbose=False)
745            self.failUnless(not so.isVerbose(), "verbosity (4) flag is wrong.")
746    
747          self.failUnless(not so.isSymmetric(), "initial symmetry flag is wrong.")          self.failUnless(not so.isSymmetric(), "initial symmetry flag is wrong.")
748          so.setSymmetryOn()          so.setSymmetryOn()
749          self.failUnless(so.isSymmetric(), "symmetry (1) flag is wrong.")          self.failUnless(so.isSymmetric(), "symmetry (1) flag is wrong.")
# Line 791  class Test_LinearPDE_noLumping(Test_line Line 814  class Test_LinearPDE_noLumping(Test_line
814          self.failUnless(so.getSolverMethod() == 5, "CGS is not set.")          self.failUnless(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.failUnless(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.failUnless(so.getSolverMethod() == 11, "GMRES is not set.")
819          so.setSolverMethod(so.PRES20)          so.setSolverMethod(so.PRES20)
# Line 801  class Test_LinearPDE_noLumping(Test_line Line 822  class Test_LinearPDE_noLumping(Test_line
822          self.failUnless(so.getSolverMethod() == 13, "LUMPING is not set.")          self.failUnless(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.failUnless(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.failUnless(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.failUnless(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.failUnless(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.failUnless(so.getSolverMethod() == 0, "DEFAULT is not set.")
833    
# Line 818  class Test_LinearPDE_noLumping(Test_line Line 835  class Test_LinearPDE_noLumping(Test_line
835          self.failUnlessRaises(ValueError,so.setPreconditioner,-1)          self.failUnlessRaises(ValueError,so.setPreconditioner,-1)
836          so.setPreconditioner(so.ILU0)          so.setPreconditioner(so.ILU0)
837          self.failUnless(so.getPreconditioner() == 8, "ILU0 is not set.")          self.failUnless(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.failUnless(so.getPreconditioner() == 9, "ILUT is not set.")
840          so.setPreconditioner(so.JACOBI)          so.setPreconditioner(so.JACOBI)
# Line 832  class Test_LinearPDE_noLumping(Test_line Line 847  class Test_LinearPDE_noLumping(Test_line
847          self.failUnless(so.getPreconditioner() == 28, "GAUSS_SEIDEL is not set.")          self.failUnless(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.failUnless(so.getPreconditioner() == 29, "RILU is not set.")
850            so.setPreconditioner(so.AMLI)
851            self.failUnless(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.failUnless(so.getPreconditioner() == 36, "NO_PRECONDITIONER is not set.")        
854    
# Line 843  class Test_LinearPDE_noLumping(Test_line Line 860  class Test_LinearPDE_noLumping(Test_line
860          self.failUnless(so.getCoarsening() == 34, "RUGE_STUEBEN_COARSENING is not set.")          self.failUnless(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.failUnless(so.getCoarsening() == 35, "AGREGATION_COARSENING is not set.")
863            so.setCoarsening(so.STANDARD_COARSENING)
864            self.failUnless(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.failUnless(so.getCoarsening() == 0, "DEFAULT is not set.")
867    
# Line 924  class Test_LinearPDE_noLumping(Test_line Line 943  class Test_LinearPDE_noLumping(Test_line
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.failUnlessRaises(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)
# Line 945  class Test_LinearPDE_noLumping(Test_line Line 964  class Test_LinearPDE_noLumping(Test_line
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.failUnlessRaises(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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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.failUnlessEqual((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 1383  class Test_LinearPDE_noLumping(Test_line Line 1414  class Test_LinearPDE_noLumping(Test_line
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.failUnless(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.failUnless(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.failUnless(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.failUnless(mypde.getDomainStatus() == mypde.getSystemStatus(), "status of first pde does not match domain status.")
1442            self.domain.setX(x*5)
1443            self.failUnless(mypde.getDomainStatus() != mypde.getSystemStatus(), "status of first pde matches updated domain status.")
1444            x2=self.domain.getX()
1445            u2_ref=x2[0]*(5.-x2[0])
1446            u2=mypde.getSolution()
1447            error2=Lsup(u2-u2_ref)/Lsup(u2_ref)
1448            self.failUnless(error2 <= max(error1,self.RES_TOL)*10., "solution of second PDE wrong.")
1449            self.failUnless(mypde.getDomainStatus() == mypde.getSystemStatus(), "status of second pde does not match domain status.")
1450    
1451      def test_symmetryCheckTrue_System(self):      def test_symmetryCheckTrue_System(self):
1452          d=self.domain.getDim()          d=self.domain.getDim()
1453          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 1404  class Test_LinearPDE_noLumping(Test_line Line 1457  class Test_LinearPDE_noLumping(Test_line
1457          D=3*numpy.ones((self.N,self.N))          D=3*numpy.ones((self.N,self.N))
1458          d=4*numpy.ones((self.N,self.N))          d=4*numpy.ones((self.N,self.N))
1459          d_contact=5*numpy.ones((self.N,self.N))          d_contact=5*numpy.ones((self.N,self.N))
1460          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}
1461        if self.domain.supportsContactElements():
1462            pars["d_contact"]=d_contact
1463            pars["d_contact_reduced"]=-d_contact
1464        mypde.setValue(**pars)
1465          self.failUnless(mypde.checkSymmetry(verbose=False),"symmetry detected")          self.failUnless(mypde.checkSymmetry(verbose=False),"symmetry detected")
1466    
1467      def test_symmetryCheckFalse_A_System(self):      def test_symmetryCheckFalse_A_System(self):
# Line 1438  class Test_LinearPDE_noLumping(Test_line Line 1495  class Test_LinearPDE_noLumping(Test_line
1495          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1496    
1497      def test_symmetryCheckFalse_d_contact_System(self):      def test_symmetryCheckFalse_d_contact_System(self):
1498          mypde=LinearPDE(self.domain,debug=self.DEBUG)      if self.domain.supportsContactElements():
1499          d_contact=5*numpy.ones((self.N,self.N))              mypde=LinearPDE(self.domain,debug=self.DEBUG)
1500          d_contact[0,1]=0.              d_contact=5*numpy.ones((self.N,self.N))
1501          mypde.setValue(d_contact=d_contact)              d_contact[0,1]=0.
1502          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")              mypde.setValue(d_contact=d_contact)
1503                self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1504    
1505      def test_symmetryCheckFalse_A_reduced_System(self):      def test_symmetryCheckFalse_A_reduced_System(self):
1506          d=self.domain.getDim()          d=self.domain.getDim()
# Line 1475  class Test_LinearPDE_noLumping(Test_line Line 1533  class Test_LinearPDE_noLumping(Test_line
1533          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1534    
1535      def test_symmetryCheckFalse_d_contact_reduced_System(self):      def test_symmetryCheckFalse_d_contact_reduced_System(self):
1536          mypde=LinearPDE(self.domain,debug=self.DEBUG)      if self.domain.supportsContactElements():
1537          d_contact=5*numpy.ones((self.N,self.N))              mypde=LinearPDE(self.domain,debug=self.DEBUG)
1538          d_contact[0,1]=0.              d_contact=5*numpy.ones((self.N,self.N))
1539          mypde.setValue(d_contact_reduced=d_contact)              d_contact[0,1]=0.
1540          self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")              mypde.setValue(d_contact_reduced=d_contact)
1541                self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
1542    
1543      def test_symmetryCheckTrue_Scalar(self):      def test_symmetryCheckTrue_Scalar(self):
1544          d=self.domain.getDim()          d=self.domain.getDim()
# Line 1490  class Test_LinearPDE_noLumping(Test_line Line 1549  class Test_LinearPDE_noLumping(Test_line
1549          D=3          D=3
1550          d=4          d=4
1551          d_contact=5          d_contact=5
1552          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}
1553        if self.domain.supportsContactElements():
1554            pars["d_contact"]=d_contact
1555            pars["d_contact_reduced"]=-d_contact
1556        mypde.setValue(**pars)
1557          self.failUnless(mypde.checkSymmetry(verbose=False),"symmetry detected")          self.failUnless(mypde.checkSymmetry(verbose=False),"symmetry detected")
1558    
1559      def test_symmetryCheckFalse_A_Scalar(self):      def test_symmetryCheckFalse_A_Scalar(self):
# Line 1529  class Test_LinearPDE_noLumping(Test_line Line 1592  class Test_LinearPDE_noLumping(Test_line
1592      def test_symmetryOnIterative(self):      def test_symmetryOnIterative(self):
1593          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1594          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1595          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1596            u=mypde.getSolution()
1597          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1598      def test_symmetryOnDirect(self):      def test_symmetryOnDirect(self):
1599          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1600          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1601          mypde.setSolverMethod(mypde.DIRECT)          mypde.getSolverOptions().setSolverMethod(SolverOptions.DIRECT)
1602          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1603            u=mypde.getSolution()
1604          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1605      def test_PCG_JACOBI(self):      def test_PCG_JACOBI(self):
1606          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1607          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1608          mypde.setSolverMethod(mypde.PCG,mypde.JACOBI)          mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1609          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1610        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1611            u=mypde.getSolution()
1612            self.failUnless(self.check(u,1.),'solution is wrong.')
1613        def test_PCG_GAUSS_SEIDEL(self):
1614            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1615            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1616            mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1617        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1618        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1619            u=mypde.getSolution()
1620          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1621        def test_PCG_AMG(self):
1622            if self.order!=2:
1623                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1624                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1625                mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1626                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1627                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1628                u=mypde.getSolution()
1629                self.failUnless(self.check(u,1.),'solution is wrong.')
1630      def test_PCG_ILU0(self):      def test_PCG_ILU0(self):
1631          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1632          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1633          mypde.setSolverMethod(mypde.PCG,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1634          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1635        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1636            u=mypde.getSolution()
1637          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1638      def test_PCG_RILU(self):      def test_PCG_RILU(self):
1639          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1640          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1641          mypde.setSolverMethod(mypde.PCG,mypde.RILU)      mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1642          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1643        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1644            u=mypde.getSolution()
1645            self.failUnless(self.check(u,1.),'solution is wrong.')
1646        def test_PCG_REC_ILU(self):
1647            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1648            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1649        mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1650        mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
1651        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1652            u=mypde.getSolution()
1653          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1654      def test_DIRECT(self):      def test_DIRECT(self):
1655          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1656          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1657          mypde.setSolverMethod(mypde.DIRECT)          mypde.getSolverOptions().setSolverMethod(SolverOptions.DIRECT)
1658          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1659            u=mypde.getSolution()
1660          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1661      def test_BICGSTAB_JACOBI(self):      def test_BICGSTAB_JACOBI(self):
1662          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1663      mypde.setSolverMethod(mypde.BICGSTAB,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1664        mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1665            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1666            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1667            u=mypde.getSolution()
1668            self.failUnless(self.check(u,1.),'solution is wrong.')
1669        def test_BICGSTAB_GAUSS_SEIDEL(self):
1670            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1671        mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1672        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1673          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1674          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1675            u=mypde.getSolution()
1676          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1677        def test_BICGSTAB_AMG(self):
1678            if self.order!=2:
1679                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1680                mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1681                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1682                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1683                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1684                u=mypde.getSolution()
1685                self.failUnless(self.check(u,1.),'solution is wrong.')
1686      def test_BICGSTAB_ILU0(self):      def test_BICGSTAB_ILU0(self):
1687          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1688          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1689      mypde.setSolverMethod(mypde.BICGSTAB,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1690          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1691            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1692            u=mypde.getSolution()
1693          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1694      def test_BICGSTAB_RILU(self):      def test_BICGSTAB_RILU(self):
1695          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1696          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1697      mypde.setSolverMethod(mypde.BICGSTAB,mypde.RILU)      mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1698          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1699            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1700            u=mypde.getSolution()
1701            self.failUnless(self.check(u,1.),'solution is wrong.')
1702        def test_BICGSTAB_REC_ILU(self):
1703            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1704            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1705        mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1706        mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
1707            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1708            u=mypde.getSolution()
1709          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1710      def test_MINRES_JACOBI(self):      def test_MINRES_JACOBI(self):
1711          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1712      mypde.setSolverMethod(mypde.MINRES,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1713        mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1714            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1715            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1716            u=mypde.getSolution()
1717            self.failUnless(self.check(u,1.),'solution is wrong.')
1718        def test_MINRES_GAUSS_SEIDEL(self):
1719            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1720        mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1721        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1722          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1723          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1724            u=mypde.getSolution()
1725          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1726        def test_MINRES_AMG(self):
1727            if self.order!=2:
1728                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1729                mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1730                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1731                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1732                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1733                u=mypde.getSolution()
1734                self.failUnless(self.check(u,1.),'solution is wrong.')
1735      def test_MINRES_ILU0(self):      def test_MINRES_ILU0(self):
1736          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1737          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1738      mypde.setSolverMethod(mypde.MINRES,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1739          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1740            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1741            u=mypde.getSolution()
1742          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1743      def test_MINRES_RILU(self):      def test_MINRES_RILU(self):
1744          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1745          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1746      mypde.setSolverMethod(mypde.MINRES,mypde.RILU)      mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1747          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1748            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1749            u=mypde.getSolution()
1750            self.failUnless(self.check(u,1.),'solution is wrong.')
1751        def test_MINRES_REC_ILU(self):
1752            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1753            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1754        mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1755        mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
1756            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1757            u=mypde.getSolution()
1758          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1759      def test_TFQMR_JACOBI(self):      def test_TFQMR_JACOBI(self):
1760          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1761      mypde.setSolverMethod(mypde.TFQMR,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
1762        mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1763            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1764            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1765            u=mypde.getSolution()
1766            self.failUnless(self.check(u,1.),'solution is wrong.')
1767        def test_TFQMR_GAUSS_SEIDEL(self):
1768            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1769        mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
1770        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1771          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1772          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1773            u=mypde.getSolution()
1774          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1775        def test_TFQMR_AMG(self):
1776            if self.order!=2:
1777                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1778                mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
1779                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1780                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1781                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1782                u=mypde.getSolution()
1783                self.failUnless(self.check(u,1.),'solution is wrong.')
1784      def test_TFQMR_ILU0(self):      def test_TFQMR_ILU0(self):
1785          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1786          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1787      mypde.setSolverMethod(mypde.TFQMR,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
1788          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1789            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1790            u=mypde.getSolution()
1791          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1792      def test_TFQMR_RILU(self):      def test_TFQMR_RILU(self):
1793          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1794          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1795      mypde.setSolverMethod(mypde.TFQMR,mypde.RILU)      mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
1796          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1797            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1798            u=mypde.getSolution()
1799            self.failUnless(self.check(u,1.),'solution is wrong.')
1800        def test_TFQMR_REC_ILU(self):
1801            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1802            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1803        mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
1804        mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
1805            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1806            u=mypde.getSolution()
1807          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1808      def test_PRES20_JACOBI(self):      def test_PRES20_JACOBI(self):
1809          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1810          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1811      mypde.setSolverMethod(mypde.PRES20,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
1812          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1813            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1814            u=mypde.getSolution()
1815            self.failUnless(self.check(u,1.),'solution is wrong.')
1816        def test_PRES20_GAUSS_SEIDEL(self):
1817            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1818            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1819        mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
1820        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1821            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1822            u=mypde.getSolution()
1823          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1824        def test_PRES20_AMG(self):
1825            if self.order!=2:
1826                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1827                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1828                mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
1829                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1830                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1831                u=mypde.getSolution()
1832                self.failUnless(self.check(u,1.),'solution is wrong.')
1833      def test_PRES20_ILU0(self):      def test_PRES20_ILU0(self):
1834          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1835          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1836      mypde.setSolverMethod(mypde.PRES20,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
1837          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1838            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1839            u=mypde.getSolution()
1840          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1841      def test_PRES20_RILU(self):      def test_PRES20_RILU(self):
1842          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1843          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1844      mypde.setSolverMethod(mypde.PRES20,mypde.RILU)      mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
1845          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1846            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1847            u=mypde.getSolution()
1848            self.failUnless(self.check(u,1.),'solution is wrong.')
1849        def test_PRES20_REC_ILU(self):
1850            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1851            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1852        mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
1853        mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
1854            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1855            u=mypde.getSolution()
1856          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1857      def test_GMRESnoRestart_JACOBI(self):      def test_GMRESnoRestart_JACOBI(self):
1858          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1859          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1860      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1861          u=mypde.getSolution(verbose=self.VERBOSE,truncation=50)      mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1862        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1863        mypde.getSolverOptions().setTruncation(50)
1864            u=mypde.getSolution()
1865          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1866        def test_GMRESnoRestart_GAUSS_SEIDEL(self):
1867            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1868            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1869        mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1870        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1871        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1872        mypde.getSolverOptions().setTruncation(50)
1873            u=mypde.getSolution()
1874            self.failUnless(self.check(u,1.),'solution is wrong.')
1875        def test_GMRESnoRestart_AMG(self):
1876            if self.order!=2:
1877                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1878                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1879                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1880                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1881                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1882                mypde.getSolverOptions().setTruncation(50)
1883                u=mypde.getSolution()
1884                self.failUnless(self.check(u,1.),'solution is wrong.')
1885      def test_GMRESnoRestart_ILU0(self):      def test_GMRESnoRestart_ILU0(self):
1886          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1887          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1888      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1889          u=mypde.getSolution(verbose=self.VERBOSE,truncation=50)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1890          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1891        mypde.getSolverOptions().setTruncation(50)                        
1892            u=mypde.getSolution()
1893          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1894      def test_GMRESnoRestart_RILU(self):      def test_GMRESnoRestart_RILU(self):
1895          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1896          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1897      mypde.setSolverMethod(mypde.GMRES,mypde.RILU)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1898          u=mypde.getSolution(verbose=self.VERBOSE,truncation=50)      mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1899          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1900        mypde.getSolverOptions().setTruncation(50)
1901            u=mypde.getSolution()
1902            self.failUnless(self.check(u,1.),'solution is wrong.')
1903        def test_GMRESnoRestart_REC_ILU(self):
1904            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1905            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1906        mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1907        mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
1908        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1909        mypde.getSolverOptions().setTruncation(50)
1910            u=mypde.getSolution()
1911          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1912      def test_GMRES_JACOBI(self):      def test_GMRES_JACOBI(self):
1913          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1914          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1915      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1916          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1917            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1918            u=mypde.getSolution()
1919            self.failUnless(self.check(u,1.),'solution is wrong.')
1920        def test_GMRES_GAUSS_SEIDEL(self):
1921            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1922            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1923        mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1924        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1925            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1926            u=mypde.getSolution()
1927          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1928        def test_GMRES_AMG(self):
1929            if self.order!=2:
1930                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1931                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1932                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1933                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1934                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1935                u=mypde.getSolution()
1936                self.failUnless(self.check(u,1.),'solution is wrong.')        
1937      def test_GMRES_ILU0(self):      def test_GMRES_ILU0(self):
1938          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1939          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1940      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1941          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1942            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1943            u=mypde.getSolution()
1944          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1945      def test_GMRES_RILU(self):      def test_GMRES_RILU(self):
1946          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1947          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1948      mypde.setSolverMethod(mypde.GMRES,mypde.RILU)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1949          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1950            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1951            u=mypde.getSolution()
1952            self.failUnless(self.check(u,1.),'solution is wrong.')
1953        def test_GMRES_REC_ILU(self):
1954            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1955            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1956        mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1957        mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
1958            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1959            u=mypde.getSolution()
1960          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1961      def test_GMRES_truncation_restart_JACOBI(self):      def test_GMRES_truncation_restart_JACOBI(self):
1962          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1963          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1964      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1965          u=mypde.getSolution(verbose=self.VERBOSE,truncation=10,restart=20)      mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1966        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1967        mypde.getSolverOptions().setTruncation(10)
1968        mypde.getSolverOptions().setRestart(20)
1969            u=mypde.getSolution()
1970            self.failUnless(self.check(u,1.),'solution is wrong.')
1971        def test_GMRES_truncation_restart_GAUSS_SEIDEL(self):
1972            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1973            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1974        mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1975        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1976        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1977        mypde.getSolverOptions().setTruncation(10)
1978        mypde.getSolverOptions().setRestart(20)
1979            u=mypde.getSolution()
1980          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1981        def test_GMRES_truncation_restart_AMG(self):
1982            if self.order!=2:
1983                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1984                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1985                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1986                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1987                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1988                mypde.getSolverOptions().setTruncation(10)
1989                mypde.getSolverOptions().setRestart(20)
1990                u=mypde.getSolution()
1991                self.failUnless(self.check(u,1.),'solution is wrong.')
1992      def test_GMRES_truncation_restart_ILU0(self):      def test_GMRES_truncation_restart_ILU0(self):
1993          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1994          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1995      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1996          u=mypde.getSolution(verbose=self.VERBOSE,truncation=10,restart=20)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1997        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1998        mypde.getSolverOptions().setTruncation(10)
1999        mypde.getSolverOptions().setRestart(20)
2000            u=mypde.getSolution()
2001          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2002      def test_GMRES_truncation_restart_RILU(self):      def test_GMRES_truncation_restart_RILU(self):
2003          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2004          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2005      mypde.setSolverMethod(mypde.GMRES,mypde.RILU)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2006          u=mypde.getSolution(verbose=self.VERBOSE,truncation=10,restart=20)      mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
2007        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2008        mypde.getSolverOptions().setTruncation(10)
2009        mypde.getSolverOptions().setRestart(20)
2010            u=mypde.getSolution()
2011            self.failUnless(self.check(u,1.),'solution is wrong.')
2012        def test_GMRES_truncation_restart_REC_ILU(self):
2013            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2014            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
2015        mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2016        mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
2017        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2018        mypde.getSolverOptions().setTruncation(10)
2019        mypde.getSolverOptions().setRestart(20)
2020            u=mypde.getSolution()
2021          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2022      #      #
2023      #   solver checks (PDE system)      #   solver checks (PDE system)
# Line 1702  class Test_LinearPDE_noLumping(Test_line Line 2032  class Test_LinearPDE_noLumping(Test_line
2032              Y[i]+=i              Y[i]+=i
2033          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2034          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2035          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2036            u=mypde.getSolution()
2037          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2038      def test_symmetryOnDirect_System(self):      def test_symmetryOnDirect_System(self):
2039          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
# Line 1714  class Test_LinearPDE_noLumping(Test_line Line 2045  class Test_LinearPDE_noLumping(Test_line
2045              Y[i]+=i              Y[i]+=i
2046          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2047          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2048          mypde.setSolverMethod(mypde.DIRECT)          mypde.getSolverOptions().setSolverMethod(SolverOptions.DIRECT)
2049          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2050            u=mypde.getSolution()
2051          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2052      def test_PCG_JACOBI_System(self):      def test_PCG_JACOBI_System(self):
2053          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
# Line 1727  class Test_LinearPDE_noLumping(Test_line Line 2059  class Test_LinearPDE_noLumping(Test_line
2059              Y[i]+=i              Y[i]+=i
2060          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2061          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2062          mypde.setSolverMethod(mypde.PCG,mypde.JACOBI)          mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
2063          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
2064            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2065            u=mypde.getSolution()
2066          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2067        def test_PCG_GAUSS_SEIDEL_System(self):
2068            A=Tensor4(0.,Function(self.domain))
2069            D=Tensor(1.,Function(self.domain))
2070            Y=Vector(self.domain.getDim(),Function(self.domain))
2071            for i in range(self.domain.getDim()):
2072                A[i,:,i,:]=kronecker(self.domain)
2073                D[i,i]+=i
2074                Y[i]+=i
2075            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2076            mypde.setValue(A=A,D=D,Y=Y)
2077            mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
2078        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2079            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2080            u=mypde.getSolution()
2081            self.failUnless(self.check(u,1.),'solution is wrong.')
2082        def test_PCG_AMG_System(self):
2083            if self.order!=2:
2084                A=Tensor4(0.,Function(self.domain))
2085                D=Tensor(1.,Function(self.domain))
2086                Y=Vector(self.domain.getDim(),Function(self.domain))
2087                for i in range(self.domain.getDim()):
2088                    A[i,:,i,:]=kronecker(self.domain)
2089                    D[i,i]+=i
2090                    Y[i]+=i
2091                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2092                mypde.setValue(A=A,D=D,Y=Y)
2093                mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
2094                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2095                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2096                u=mypde.getSolution()
2097                self.failUnless(self.check(u,1.),'solution is wrong.')
2098      def test_PCG_ILU0_System(self):      def test_PCG_ILU0_System(self):
2099          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2100          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1740  class Test_LinearPDE_noLumping(Test_line Line 2105  class Test_LinearPDE_noLumping(Test_line
2105              Y[i]+=i              Y[i]+=i
2106          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2107          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2108          mypde.setSolverMethod(mypde.PCG,mypde.ILU0)          mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
2109          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2110            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2111            u=mypde.getSolution()
2112          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2113      def test_DIRECT_System(self):      def test_DIRECT_System(self):
2114          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
# Line 1753  class Test_LinearPDE_noLumping(Test_line Line 2120  class Test_LinearPDE_noLumping(Test_line
2120              Y[i]+=i              Y[i]+=i
2121          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2122          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2123          mypde.setSolverMethod(mypde.DIRECT)          mypde.getSolverOptions().setSolverMethod(SolverOptions.DIRECT)
2124          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2125            u=mypde.getSolution()
2126          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2127      def test_BICGSTAB_JACOBI_System(self):      def test_BICGSTAB_JACOBI_System(self):
2128          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
# Line 1766  class Test_LinearPDE_noLumping(Test_line Line 2134  class Test_LinearPDE_noLumping(Test_line
2134              Y[i]+=i              Y[i]+=i
2135          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2136          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2137      mypde.setSolverMethod(mypde.BICGSTAB,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
2138          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
2139            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2140            u=mypde.getSolution()
2141          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2142        def test_BICGSTAB_GAUSS_SEIDEL_System(self):
2143            A=Tensor4(0.,Function(self.domain))
2144            D=Tensor(1.,Function(self.domain))
2145            Y=Vector(self.domain.getDim(),Function(self.domain))
2146            for i in range(self.domain.getDim()):
2147                A[i,:,i,:]=kronecker(self.domain)
2148                D[i,i]+=i
2149                Y[i]+=i
2150            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2151            mypde.setValue(A=A,D=D,Y=Y)
2152        mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
2153        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2154            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2155            u=mypde.getSolution()
2156            self.failUnless(self.check(u,1.),'solution is wrong.')
2157        def test_BICGSTAB_AMG_System(self):
2158            if self.order!=2:
2159                A=Tensor4(0.,Function(self.domain))
2160                D=Tensor(1.,Function(self.domain))
2161                Y=Vector(self.domain.getDim(),Function(self.domain))
2162                for i in range(self.domain.getDim()):
2163                    A[i,:,i,:]=kronecker(self.domain)
2164                    D[i,i]+=i
2165                    Y[i]+=i
2166                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2167                mypde.setValue(A=A,D=D,Y=Y)
2168                mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
2169                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2170                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2171                u=mypde.getSolution()
2172                self.failUnless(self.check(u,1.),'solution is wrong.')
2173      def test_BICGSTAB_ILU0_System(self):      def test_BICGSTAB_ILU0_System(self):
2174          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2175          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1779  class Test_LinearPDE_noLumping(Test_line Line 2180  class Test_LinearPDE_noLumping(Test_line
2180              Y[i]+=i              Y[i]+=i
2181          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2182          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2183      mypde.setSolverMethod(mypde.BICGSTAB,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
2184          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2185            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2186            u=mypde.getSolution()
2187          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2188      def test_PRES20_JACOBI_System(self):      def test_PRES20_JACOBI_System(self):
2189          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
# Line 1792  class Test_LinearPDE_noLumping(Test_line Line 2195  class Test_LinearPDE_noLumping(Test_line
2195              Y[i]+=i              Y[i]+=i
2196          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2197          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2198      mypde.setSolverMethod(mypde.PRES20,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
2199          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
2200            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2201            u=mypde.getSolution()
2202          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2203        def test_PRES20_GAUSS_SEIDEL_System(self):
2204            A=Tensor4(0.,Function(self.domain))
2205            D=Tensor(1.,Function(self.domain))
2206            Y=Vector(self.domain.getDim(),Function(self.domain))
2207            for i in range(self.domain.getDim()):
2208                A[i,:,i,:]=kronecker(self.domain)
2209                D[i,i]+=i
2210                Y[i]+=i
2211            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2212            mypde.setValue(A=A,D=D,Y=Y)
2213        mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
2214        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2215            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2216            u=mypde.getSolution()
2217            self.failUnless(self.check(u,1.),'solution is wrong.')
2218        def test_PRES20_AMG_System(self):
2219            if self.order!=2:
2220                A=Tensor4(0.,Function(self.domain))
2221                D=Tensor(1.,Function(self.domain))
2222                Y=Vector(self.domain.getDim(),Function(self.domain))
2223                for i in range(self.domain.getDim()):
2224                    A[i,:,i,:]=kronecker(self.domain)
2225                    D[i,i]+=i
2226                    Y[i]+=i
2227                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2228                mypde.setValue(A=A,D=D,Y=Y)
2229                mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
2230                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2231                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2232                u=mypde.getSolution()
2233                self.failUnless(self.check(u,1.),'solution is wrong.')
2234      def test_PRES20_ILU0_System(self):      def test_PRES20_ILU0_System(self):
2235          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2236          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1805  class Test_LinearPDE_noLumping(Test_line Line 2241  class Test_LinearPDE_noLumping(Test_line
2241              Y[i]+=i              Y[i]+=i
2242          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2243          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2244      mypde.setSolverMethod(mypde.PRES20,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
2245          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2246            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2247            u=mypde.getSolution()
2248          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2249      def test_GMRESnoRestart_JACOBI_System(self):      def test_GMRESnoRestart_JACOBI_System(self):
2250          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
# Line 1818  class Test_LinearPDE_noLumping(Test_line Line 2256  class Test_LinearPDE_noLumping(Test_line
2256              Y[i]+=i              Y[i]+=i
2257          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2258          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2259      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2260        mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
2261          # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)          # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)
2262          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2263            u=mypde.getSolution()
2264          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2265        def test_GMRESnoRestart_GAUSS_SEIDEL_System(self):
2266            A=Tensor4(0.,Function(self.domain))
2267            D=Tensor(1.,Function(self.domain))
2268            Y=Vector(self.domain.getDim(),Function(self.domain))
2269            for i in range(self.domain.getDim()):
2270                A[i,:,i,:]=kronecker(self.domain)
2271                D[i,i]+=i
2272                Y[i]+=i
2273            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2274            mypde.setValue(A=A,D=D,Y=Y)
2275        mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2276        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2277            # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)
2278            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2279            u=mypde.getSolution()
2280            self.failUnless(self.check(u,1.),'solution is wrong.')
2281        def test_GMRESnoRestart_AMG_System(self):
2282            if self.order!=2:
2283                A=Tensor4(0.,Function(self.domain))
2284                D=Tensor(1.,Function(self.domain))
2285                Y=Vector(self.domain.getDim(),Function(self.domain))
2286                for i in range(self.domain.getDim()):
2287                    A[i,:,i,:]=kronecker(self.domain)
2288                    D[i,i]+=i
2289                    Y[i]+=i
2290                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2291                mypde.setValue(A=A,D=D,Y=Y)
2292                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2293                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2294                # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)
2295                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2296                u=mypde.getSolution()
2297                self.failUnless(self.check(u,1.),'solution is wrong.')
2298      def test_GMRESnoRestart_ILU0_System(self):      def test_GMRESnoRestart_ILU0_System(self):
2299          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2300          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1832  class Test_LinearPDE_noLumping(Test_line Line 2305  class Test_LinearPDE_noLumping(Test_line
2305              Y[i]+=i              Y[i]+=i
2306          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2307          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2308      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2309        mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2310          # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)          # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)
2311          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2312            u=mypde.getSolution()
2313          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2314      def test_GMRES_JACOBI_System(self):      def test_GMRES_JACOBI_System(self):
2315          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
# Line 1846  class Test_LinearPDE_noLumping(Test_line Line 2321  class Test_LinearPDE_noLumping(Test_line
2321              Y[i]+=i              Y[i]+=i
2322          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2323          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2324      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2325          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
2326            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2327            u=mypde.getSolution()
2328          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2329        def test_GMRES_GAUSS_SEIDEL_System(self):
2330            A=Tensor4(0.,Function(self.domain))
2331            D=Tensor(1.,Function(self.domain))
2332            Y=Vector(self.domain.getDim(),Function(self.domain))
2333            for i in range(self.domain.getDim()):
2334                A[i,:,i,:]=kronecker(self.domain)
2335                D[i,i]+=i
2336                Y[i]+=i
2337            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2338            mypde.setValue(A=A,D=D,Y=Y)
2339        mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2340        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2341            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2342            u=mypde.getSolution()
2343            self.failUnless(self.check(u,1.),'solution is wrong.')
2344        def test_GMRES_AMG_System(self):
2345            if self.order!=2:
2346                A=Tensor4(0.,Function(self.domain))
2347                D=Tensor(1.,Function(self.domain))
2348                Y=Vector(self.domain.getDim(),Function(self.domain))
2349                for i in range(self.domain.getDim()):
2350                    A[i,:,i,:]=kronecker(self.domain)
2351                    D[i,i]+=i
2352                    Y[i]+=i
2353                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2354                mypde.setValue(A=A,D=D,Y=Y)
2355                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2356                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2357                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2358                u=mypde.getSolution()
2359                self.failUnless(self.check(u,1.),'solution is wrong.')
2360      def test_GMRES_ILU0_System(self):      def test_GMRES_ILU0_System(self):
2361          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2362          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1859  class Test_LinearPDE_noLumping(Test_line Line 2367  class Test_LinearPDE_noLumping(Test_line
2367              Y[i]+=i              Y[i]+=i
2368          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2369          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2370      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2371          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2372            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2373            u=mypde.getSolution()
2374          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2375      def test_GMRES_truncation_restart_JACOBI_System(self):      def test_GMRES_truncation_restart_JACOBI_System(self):
2376          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
# Line 1872  class Test_LinearPDE_noLumping(Test_line Line 2382  class Test_LinearPDE_noLumping(Test_line
2382              Y[i]+=i              Y[i]+=i
2383          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2384          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2385      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2386          u=mypde.getSolution(verbose=self.VERBOSE,truncation=10,restart=20)      mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
2387            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2388        mypde.getSolverOptions().setTruncation(10)
2389        mypde.getSolverOptions().setRestart(20)
2390            u=mypde.getSolution()
2391            self.failUnless(self.check(u,1.),'solution is wrong.')
2392        def test_GMRES_truncation_restart_GAUSS_SEIDEL_System(self):
2393            A=Tensor4(0.,Function(self.domain))
2394            D=Tensor(1.,Function(self.domain))
2395            Y=Vector(self.domain.getDim(),Function(self.domain))
2396            for i in range(self.domain.getDim()):
2397                A[i,:,i,:]=kronecker(self.domain)
2398                D[i,i]+=i
2399                Y[i]+=i
2400            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2401            mypde.setValue(A=A,D=D,Y=Y)
2402        mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2403        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2404            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2405        mypde.getSolverOptions().setTruncation(10)
2406        mypde.getSolverOptions().setRestart(20)
2407            u=mypde.getSolution()
2408          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2409        def test_GMRES_truncation_restart_AMG_System(self):
2410            if self.order!=2:
2411                A=Tensor4(0.,Function(self.domain))
2412                D=Tensor(1.,Function(self.domain))
2413                Y=Vector(self.domain.getDim(),Function(self.domain))
2414                for i in range(self.domain.getDim()):
2415                    A[i,:,i,:]=kronecker(self.domain)
2416                    D[i,i]+=i
2417                    Y[i]+=i
2418                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2419                mypde.setValue(A=A,D=D,Y=Y)
2420                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2421                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2422                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2423                mypde.getSolverOptions().setTruncation(10)
2424                mypde.getSolverOptions().setRestart(20)
2425                u=mypde.getSolution()
2426                self.failUnless(self.check(u,1.),'solution is wrong.')
2427      def test_GMRES_truncation_restart_ILU0_System(self):      def test_GMRES_truncation_restart_ILU0_System(self):
2428          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2429          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1885  class Test_LinearPDE_noLumping(Test_line Line 2434  class Test_LinearPDE_noLumping(Test_line
2434              Y[i]+=i              Y[i]+=i
2435          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2436          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2437      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2438          u=mypde.getSolution(verbose=self.VERBOSE,truncation=10,restart=20)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2439            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2440        mypde.getSolverOptions().setTruncation(10)
2441        mypde.getSolverOptions().setRestart(20)
2442            u=mypde.getSolution()
2443          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2444    
2445  class Test_LinearPDE(Test_LinearPDE_noLumping):  class Test_LinearPDE(Test_LinearPDE_noLumping):
# Line 1894  class Test_LinearPDE(Test_LinearPDE_noLu Line 2447  class Test_LinearPDE(Test_LinearPDE_noLu
2447          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2448          try:          try:
2449             success=True             success=True
2450         mypde.setSolverMethod(mypde.LUMPING)         mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2451             mypde.setValue(A=kronecker(self.domain))             mypde.setValue(A=kronecker(self.domain))
2452             u=mypde.getSolution(verbose=self.VERBOSE)             mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2453               u=mypde.getSolution()    
2454          except ValueError:          except ValueError:
2455             success=False             success=False
2456          self.failUnless(not success,'error should be issued')          self.failUnless(not success,'error should be issued')
# Line 1904  class Test_LinearPDE(Test_LinearPDE_noLu Line 2458  class Test_LinearPDE(Test_LinearPDE_noLu
2458          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2459          try:          try:
2460             success=True             success=True
2461         mypde.setSolverMethod(mypde.LUMPING)         mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2462             mypde.setValue(B=kronecker(self.domain)[0])             mypde.setValue(B=kronecker(self.domain)[0])
2463             u=mypde.getSolution(verbose=self.VERBOSE)             mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2464               u=mypde.getSolution()
2465          except ValueError:          except ValueError:
2466             success=False             success=False
2467          self.failUnless(not success,'error should be issued')          self.failUnless(not success,'error should be issued')
# Line 1914  class Test_LinearPDE(Test_LinearPDE_noLu Line 2469  class Test_LinearPDE(Test_LinearPDE_noLu
2469          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2470          try:          try:
2471             success=True             success=True
2472         mypde.setSolverMethod(mypde.LUMPING)         mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2473             mypde.setValue(C=kronecker(self.domain)[0])             mypde.setValue(C=kronecker(self.domain)[0])
2474             u=mypde.getSolution(verbose=self.VERBOSE)             mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2475               u=mypde.getSolution()
2476          except ValueError:          except ValueError:
2477             success=False             success=False
2478          self.failUnless(not success,'error should be issued')          self.failUnless(not success,'error should be issued')
# Line 1925  class Test_LinearPDE(Test_LinearPDE_noLu Line 2481  class Test_LinearPDE(Test_LinearPDE_noLu
2481          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2482          try:          try:
2483             success=True             success=True
2484         mypde.setSolverMethod(mypde.LUMPING)         mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2485             mypde.setValue(A_reduced=kronecker(self.domain))             mypde.setValue(A_reduced=kronecker(self.domain))
2486             u=mypde.getSolution(verbose=self.VERBOSE)             mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2487               u=mypde.getSolution()
2488          except ValueError:          except ValueError:
2489             success=False             success=False
2490          self.failUnless(not success,'error should be issued')          self.failUnless(not success,'error should be issued')
# Line 1935  class Test_LinearPDE(Test_LinearPDE_noLu Line 2492  class Test_LinearPDE(Test_LinearPDE_noLu
2492          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2493          try:          try:
2494             success=True             success=True
2495         mypde.setSolverMethod(mypde.LUMPING)         mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2496             mypde.setValue(B_reduced=kronecker(self.domain)[0])             mypde.setValue(B_reduced=kronecker(self.domain)[0])
2497             u=mypde.getSolution(verbose=self.VERBOSE)             mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2498               u=mypde.getSolution()
2499          except ValueError:          except ValueError:
2500             success=False             success=False
2501          self.failUnless(not success,'error should be issued')          self.failUnless(not success,'error should be issued')
# Line 1945  class Test_LinearPDE(Test_LinearPDE_noLu Line 2503  class Test_LinearPDE(Test_LinearPDE_noLu
2503          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2504          try:          try:
2505             success=True             success=True
2506         mypde.setSolverMethod(mypde.LUMPING)         mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2507             mypde.setValue(C_reduced=kronecker(self.domain)[0])             mypde.setValue(C_reduced=kronecker(self.domain)[0])
2508             u=mypde.getSolution(verbose=self.VERBOSE)             mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2509               u=mypde.getSolution()
2510          except ValueError:          except ValueError:
2511             success=False             success=False
2512          self.failUnless(not success,'error should be issued')          self.failUnless(not success,'error should be issued')
2513                    
2514      def test_Lumping(self):      def test_Lumping(self):
2515          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2516      mypde.setSolverMethod(mypde.LUMPING)      mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2517          mypde.setValue(D=1.,Y=1.)          mypde.setValue(D=1.,Y=1.)
2518          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2519            u=mypde.getSolution()
2520          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2521      def test_Constrained_Lumping(self):      def test_Constrained_Lumping(self):
2522          x=self.domain.getX()          x=self.domain.getX()
2523          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2524      mypde.setSolverMethod(mypde.LUMPING)      mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2525          mypde.setValue(D=1.,Y=1.,q=whereZero(x[0]),r=1.)          mypde.setValue(D=1.,Y=1.,q=whereZero(x[0]),r=1.)
2526          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2527            u=mypde.getSolution()
2528          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2529    
2530      def test_Lumping_System(self):      def test_Lumping_System(self):
2531          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2532      mypde.setSolverMethod(mypde.LUMPING)      mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2533          mypde.setValue(D=numpy.array([[1.,0.],[0.,2.]]),Y=numpy.array([1.,2.]))          mypde.setValue(D=numpy.array([[1.,0.],[0.,2.]]),Y=numpy.array([1.,2.]))
2534          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2535            u=mypde.getSolution()
2536          self.failUnless(self.check(u,numpy.ones((2,))),'solution is wrong.')          self.failUnless(self.check(u,numpy.ones((2,))),'solution is wrong.')
2537      def test_Constrained_Lumping_System(self):      def test_Constrained_Lumping_System(self):
2538          x=self.domain.getX()          x=self.domain.getX()
2539          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2540      mypde.setSolverMethod(mypde.LUMPING)      mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2541          mypde.setValue(D=numpy.array([[1.,0.],[0.,2.]]),Y=numpy.array([1.,2.]), \          mypde.setValue(D=numpy.array([[1.,0.],[0.,2.]]),Y=numpy.array([1.,2.]), \
2542                         q=whereZero(x[0])*[0.,1],r=[0.,1.])                         q=whereZero(x[0])*[0.,1],r=[0.,1.])
2543          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2544            u=mypde.getSolution()
2545          self.failUnless(self.check(u,numpy.ones((2,))),'solution is wrong.')          self.failUnless(self.check(u,numpy.ones((2,))),'solution is wrong.')
2546    
2547      def test_Lumping_updateRHS(self):      def test_Lumping_updateRHS(self):
2548          x=self.domain.getX()          x=self.domain.getX()
2549          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2550      mypde.setSolverMethod(mypde.LUMPING)      mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2551          mypde.setValue(D=1.,Y=1.)          mypde.setValue(D=1.,Y=1.)
2552          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2553            u=mypde.getSolution()
2554          self.failUnless(self.check(u,1.),'first solution is wrong.')          self.failUnless(self.check(u,1.),'first solution is wrong.')
2555          mypde.setValue(Y=2.,q=whereZero(x[0]),r=2.)          mypde.setValue(Y=2.,q=whereZero(x[0]),r=2.)
2556          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2557            u=mypde.getSolution()
2558          self.failUnless(self.check(u,2.),'second solution is wrong.')          self.failUnless(self.check(u,2.),'second solution is wrong.')
2559      def test_Lumping_updateOperator(self):      def test_Lumping_updateOperator(self):
2560          x=self.domain.getX()          x=self.domain.getX()
2561          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2562      mypde.setSolverMethod(mypde.LUMPING)      mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2563          mypde.setValue(D=1.,Y=1.)          mypde.setValue(D=1.,Y=1.)
2564          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2565            u=mypde.getSolution()
2566          mypde.setValue(D=2.)          mypde.setValue(D=2.)
2567          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2568            u=mypde.getSolution()
2569          self.failUnless(self.check(u,0.5),'second solution is wrong.')          self.failUnless(self.check(u,0.5),'second solution is wrong.')
2570    
2571    
# Line 2012  class Test_TransportPDE(Test_linearPDEs) Line 2579  class Test_TransportPDE(Test_linearPDEs)
2579          self.failUnless(mypde.useBackwardEuler()==False,'backward Euler should not be used')          self.failUnless(mypde.useBackwardEuler()==False,'backward Euler should not be used')
2580      def test_setCoefficient_WithWrongName(self):      def test_setCoefficient_WithWrongName(self):
2581          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2582          self.failUnlessRaises(IllegalCoefficient,mypde.setValue, ROMA=Vector(0.,FunctionOnBoundary(self.domain)))          self.failUnlessRaises(IllegalCoefficient)
2583        mypde.getSolverOptions().setSolverMethod(SolverOptions.setValue, ROMA=Vector(0.,FunctionOnBoundary(self.domain)))
2584    
2585      def test_setCoefficient_WithIllegalFunctionSpace(self):      def test_setCoefficient_WithIllegalFunctionSpace(self):
2586          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2587          self.failUnlessRaises(IllegalCoefficientFunctionSpace,mypde.setValue,C=Vector(0.,FunctionOnBoundary(self.domain)))          self.failUnlessRaises(IllegalCoefficientFunctionSpace)
2588        mypde.getSolverOptions().setSolverMethod(SolverOptions.setValue,C=Vector(0.,FunctionOnBoundary(self.domain)))
2589                    
2590      def test_resetCoefficient_WithWrongShape(self):      def test_resetCoefficient_WithWrongShape(self):
2591          mypde=TransportPDE(self.domain,numEquations=2,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numEquations=2,debug=self.DEBUG)
# Line 2026  class Test_TransportPDE(Test_linearPDEs) Line 2595  class Test_TransportPDE(Test_linearPDEs)
2595          mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)
2596          mypde.setInitialSolution(1.)          mypde.setInitialSolution(1.)
2597    
     def test_setInitialSolution_scalar_negative(self):  
         mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)  
         self.failUnlessRaises(RuntimeError,mypde.setInitialSolution,-1.)  
   
2598      def test_setInitialSolution_scalar_WithWrongShape(self):      def test_setInitialSolution_scalar_WithWrongShape(self):
2599          mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)
2600          self.failUnlessRaises(ValueError,mypde.setInitialSolution,[1.,2.])          self.failUnlessRaises(ValueError,mypde.setInitialSolution,[1.,2.])
# Line 2038  class Test_TransportPDE(Test_linearPDEs) Line 2603  class Test_TransportPDE(Test_linearPDEs)
2603          mypde=TransportPDE(self.domain,numSolutions=2,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=2,debug=self.DEBUG)
2604          mypde.setInitialSolution([1.,2.])          mypde.setInitialSolution([1.,2.])
2605    
     def test_setInitialSolution_system(self):  
         mypde=TransportPDE(self.domain,numSolutions=2,debug=self.DEBUG)  
         self.failUnlessRaises(RuntimeError,mypde.setInitialSolution,[-1,2.])  
   
2606      def test_setInitialSolution_system_WithWrongShape(self):      def test_setInitialSolution_system_WithWrongShape(self):
2607          mypde=TransportPDE(self.domain,numSolutions=2,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=2,debug=self.DEBUG)
2608          self.failUnlessRaises(ValueError,mypde.setInitialSolution,1.)          self.failUnlessRaises(ValueError, mypde.setInitialSolution,1.)
   
2609    
2610      def test_attemptToChangeOrderAfterDefinedCoefficient(self):      def test_attemptToChangeOrderAfterDefinedCoefficient(self):
2611          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
# Line 2055  class Test_TransportPDE(Test_linearPDEs) Line 2615  class Test_TransportPDE(Test_linearPDEs)
2615      def test_reducedOnConfig(self):      def test_reducedOnConfig(self):
2616          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2617          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
2618          self.failUnlessEqual((mypde.getFunctionSpaceForSolution(),mypde.getFunctionSpaceForEquation()),(ReducedSolution(self.domain),ReducedSolution(self.domain)),"reduced function spaces expected.")          self.failUnlessEqual((mypde.getFunctionSpaceForSolution(), mypde.getFunctionSpaceForEquation()),(ReducedSolution(self.domain),ReducedSolution(self.domain)),"reduced function spaces expected.")
2619      #      #
2620      #  set coefficients for scalars:      #  set coefficients for scalars:
2621      #      #
# Line 2064  class Test_TransportPDE(Test_linearPDEs) Line 2624  class Test_TransportPDE(Test_linearPDEs)
2624          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2625          mypde.setValue(M=1.)          mypde.setValue(M=1.)
2626          coeff=mypde.getCoefficient("M")          coeff=mypde.getCoefficient("M")
2627          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),Function(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),Function(self.domain),1,1))
2628      def test_setCoefficient_A_Scalar(self):      def test_setCoefficient_A_Scalar(self):
2629          d=self.domain.getDim()          d=self.domain.getDim()
2630          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2631          mypde.setValue(A=numpy.ones((d,d)))          mypde.setValue(A=numpy.ones((d,d)))
2632          coeff=mypde.getCoefficient("A")          coeff=mypde.getCoefficient("A")
2633          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,d),Function(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,d),Function(self.domain),1,1))
2634      def test_setCoefficient_B_Scalar(self):      def test_setCoefficient_B_Scalar(self):
2635          d=self.domain.getDim()          d=self.domain.getDim()
2636          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2637          mypde.setValue(B=numpy.ones((d,)))          mypde.setValue(B=numpy.ones((d,)))
2638          coeff=mypde.getCoefficient("B")          coeff=mypde.getCoefficient("B")
2639          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),Function(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,),Function(self.domain),1,1))
2640      def test_setCoefficient_C_Scalar(self):      def test_setCoefficient_C_Scalar(self):
2641          d=self.domain.getDim()          d=self.domain.getDim()
2642          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2643          mypde.setValue(C=numpy.ones((d,)))          mypde.setValue(C=numpy.ones((d,)))
2644          coeff=mypde.getCoefficient("C")          coeff=mypde.getCoefficient("C")
2645          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),Function(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,),Function(self.domain),1,1))
2646      def test_setCoefficient_D_Scalar(self):      def test_setCoefficient_D_Scalar(self):
2647          d=self.domain.getDim()          d=self.domain.getDim()
2648          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2649          mypde.setValue(D=1.)          mypde.setValue(D=1.)
2650          coeff=mypde.getCoefficient("D")          coeff=mypde.getCoefficient("D")
2651          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),Function(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),Function(self.domain),1,1))
2652      def test_setCoefficient_X_Scalar(self):      def test_setCoefficient_X_Scalar(self):
2653          d=self.domain.getDim()          d=self.domain.getDim()
2654          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2655          mypde.setValue(X=numpy.ones((d,)))          mypde.setValue(X=numpy.ones((d,)))
2656          coeff=mypde.getCoefficient("X")          coeff=mypde.getCoefficient("X")
2657          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((d,),Function(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((d,),Function(self.domain),1))
2658      def test_setCoefficient_Y_Scalar(self):      def test_setCoefficient_Y_Scalar(self):
2659          d=self.domain.getDim()          d=self.domain.getDim()
2660          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2661          mypde.setValue(Y=1.)          mypde.setValue(Y=1.)
2662          coeff=mypde.getCoefficient("Y")          coeff=mypde.getCoefficient("Y")
2663          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),Function(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),Function(self.domain),1))
2664      def test_setCoefficient_y_Scalar(self):      def test_setCoefficient_y_Scalar(self):
2665          d=self.domain.getDim()          d=self.domain.getDim()
2666          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2667          mypde.setValue(y=1.)          mypde.setValue(y=1.)
2668          coeff=mypde.getCoefficient("y")          coeff=mypde.getCoefficient("y")
2669          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1))
2670      def test_setCoefficient_d_Scalar(self):      def test_setCoefficient_d_Scalar(self):
2671          d=self.domain.getDim()          d=self.domain.getDim()
2672          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2673          mypde.setValue(d=1.)          mypde.setValue(d=1.)
2674          coeff=mypde.getCoefficient("d")          coeff=mypde.getCoefficient("d")
2675          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1,1))
2676      def test_setCoefficient_m_Scalar(self):      def test_setCoefficient_m_Scalar(self):
2677          d=self.domain.getDim()          d=self.domain.getDim()
2678          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2679          mypde.setValue(m=1.)          mypde.setValue(m=1.)
2680          coeff=mypde.getCoefficient("m")          coeff=mypde.getCoefficient("m")
2681          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1,1))
2682      def test_setCoefficient_d_contact_Scalar(self):      def test_setCoefficient_d_contact_Scalar(self):
2683          d=self.domain.getDim()      if self.domain.supportsContactElements():
2684          mypde=TransportPDE(self.domain,debug=self.DEBUG)              d=self.domain.getDim()
2685          mypde.setValue(d_contact=1.)              mypde=TransportPDE(self.domain,debug=self.DEBUG)
2686          coeff=mypde.getCoefficient("d_contact")              mypde.setValue(d_contact=1.)
2687          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),FunctionOnContactZero(self.domain),1,1))              coeff=mypde.getCoefficient("d_contact")
2688                self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),FunctionOnContactZero(self.domain),1,1))
2689      def test_setCoefficient_y_contact_Scalar(self):      def test_setCoefficient_y_contact_Scalar(self):
2690          d=self.domain.getDim()          d=self.domain.getDim()
2691          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2692          mypde.setValue(y_contact=1.)          mypde.setValue(y_contact=1.)
2693          coeff=mypde.getCoefficient("y_contact")          coeff=mypde.getCoefficient("y_contact")
2694          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),FunctionOnContactZero(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),FunctionOnContactZero(self.domain),1))
2695    
2696      def test_setCoefficient_M_reduced_Scalar(self):      def test_setCoefficient_M_reduced_Scalar(self):
2697          d=self.domain.getDim()          d=self.domain.getDim()
2698          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2699          mypde.setValue(M_reduced=1.)          mypde.setValue(M_reduced=1.)
2700          coeff=mypde.getCoefficient("M_reduced")          coeff=mypde.getCoefficient("M_reduced")
2701          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunction(self.domain),1,1))
2702      def test_setCoefficient_A_reduced_Scalar(self):      def test_setCoefficient_A_reduced_Scalar(self):
2703          d=self.domain.getDim()          d=self.domain.getDim()
2704          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2705          mypde.setValue(A_reduced=numpy.ones((d,d)))          mypde.setValue(A_reduced=numpy.ones((d,d)))
2706          coeff=mypde.getCoefficient("A_reduced")          coeff=mypde.getCoefficient("A_reduced")
2707          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,d),ReducedFunction(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,d),ReducedFunction(self.domain),1,1))
2708      def test_setCoefficient_B_reduced_Scalar(self):      def test_setCoefficient_B_reduced_Scalar(self):
2709          d=self.domain.getDim()          d=self.domain.getDim()
2710          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2711          mypde.setValue(B_reduced=numpy.ones((d,)))          mypde.setValue(B_reduced=numpy.ones((d,)))
2712          coeff=mypde.getCoefficient("B_reduced")          coeff=mypde.getCoefficient("B_reduced")
2713          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))
2714      def test_setCoefficient_C_reduced_Scalar(self):      def test_setCoefficient_C_reduced_Scalar(self):
2715          d=self.domain.getDim()          d=self.domain.getDim()
2716          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2717          mypde.setValue(C_reduced=numpy.ones((d,)))          mypde.setValue(C_reduced=numpy.ones((d,)))
2718          coeff=mypde.getCoefficient("C_reduced")          coeff=mypde.getCoefficient("C_reduced")
2719          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))
2720      def test_setCoefficient_D_reduced_Scalar(self):      def test_setCoefficient_D_reduced_Scalar(self):
2721          d=self.domain.getDim()          d=self.domain.getDim()
2722          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2723          mypde.setValue(D_reduced=1.)          mypde.setValue(D_reduced=1.)
2724          coeff=mypde.getCoefficient("D_reduced")          coeff=mypde.getCoefficient("D_reduced")
2725          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunction(self.domain),1,1))
2726      def test_setCoefficient_X_reduced_Scalar(self):      def test_setCoefficient_X_reduced_Scalar(self):
2727          d=self.domain.getDim()          d=self.domain.getDim()
2728          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2729          mypde.setValue(X_reduced=numpy.ones((d,)))          mypde.setValue(X_reduced=numpy.ones((d,)))
2730          coeff=mypde.getCoefficient("X_reduced")          coeff=mypde.getCoefficient("X_reduced")
2731          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1))
2732      def test_setCoefficient_Y_reduced_Scalar(self):      def test_setCoefficient_Y_reduced_Scalar(self):
2733          d=self.domain.getDim()          d=self.domain.getDim()
2734          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2735          mypde.setValue(Y_reduced=1.)          mypde.setValue(Y_reduced=1.)
2736          coeff=mypde.getCoefficient("Y_reduced")          coeff=mypde.getCoefficient("Y_reduced")
2737          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunction(self.domain),1))
2738      def test_setCoefficient_y_reduced_Scalar(self):      def test_setCoefficient_y_reduced_Scalar(self):
2739          d=self.domain.getDim()          d=self.domain.getDim()
2740          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2741          mypde.setValue(y_reduced=1.)          mypde.setValue(y_reduced=1.)
2742          coeff=mypde.getCoefficient("y_reduced")          coeff=mypde.getCoefficient("y_reduced")
2743          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))
2744      def test_setCoefficient_m_reduced_Scalar(self):      def test_setCoefficient_m_reduced_Scalar(self):
2745          d=self.domain.getDim()          d=self.domain.getDim()
2746          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2747          mypde.setValue(m_reduced=1.)          mypde.setValue(m_reduced=1.)
2748          coeff=mypde.getCoefficient("m_reduced")          coeff=mypde.getCoefficient("m_reduced")
2749          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1,1))
2750      def test_setCoefficient_d_reduced_Scalar(self):      def test_setCoefficient_d_reduced_Scalar(self):
2751          d=self.domain.getDim()          d=self.domain.getDim()
2752          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2753          mypde.setValue(d_reduced=1.)          mypde.setValue(d_reduced=1.)
2754          coeff=mypde.getCoefficient("d_reduced")          coeff=mypde.getCoefficient("d_reduced")
2755          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1,1))
2756      def test_setCoefficient_d_contact_reduced_Scalar(self):      def test_setCoefficient_d_contact_reduced_Scalar(self):
2757          d=self.domain.getDim()          d=self.domain.getDim()
2758          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2759          mypde.setValue(d_contact_reduced=1.)          mypde.setValue(d_contact_reduced=1.)
2760          coeff=mypde.getCoefficient("d_contact_reduced")          coeff=mypde.getCoefficient("d_contact_reduced")
2761          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1,1))
2762      def test_setCoefficient_y_contact_reduced_Scalar(self):      def test_setCoefficient_y_contact_reduced_Scalar(self):
2763          d=self.domain.getDim()          d=self.domain.getDim()
2764          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2765          mypde.setValue(y_contact_reduced=1.)          mypde.setValue(y_contact_reduced=1.)
2766          coeff=mypde.getCoefficient("y_contact_reduced")          coeff=mypde.getCoefficient("y_contact_reduced")
2767          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))
2768      def test_setCoefficient_r_Scalar(self):      def test_setCoefficient_r_Scalar(self):
2769          d=self.domain.getDim()          d=self.domain.getDim()
2770          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
2771          mypde.setValue(r=1.)          mypde.setValue(r=1.)
2772          coeff=mypde.getCoefficient("r")          coeff=mypde.getCoefficient("r")
2773          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),Solution(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((),Solution(self.domain),1))
2774      def test_setCoefficient_q_Scalar(self):      def test_setCoefficient_q_Scalar(self):
2775          d=self.domain.getDim()          d=self.domain.getDim()
2776          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
2777          mypde.setValue(q=1.)          mypde.setValue(q=1.)
2778          coeff=mypde.getCoefficient("q")          coeff=mypde.getCoefficient("q")
2779          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),Solution(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((),Solution(self.domain),1))
2780      def test_setCoefficient_r_Scalar_reducedOn(self):      def test_setCoefficient_r_Scalar_reducedOn(self):
2781          d=self.domain.getDim()          d=self.domain.getDim()
2782          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
2783          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
2784          mypde.setValue(r=1.)          mypde.setValue(r=1.)
2785          coeff=mypde.getCoefficient("r")          coeff=mypde.getCoefficient("r")
2786          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))
2787      def test_setCoefficient_q_Scalar_reducedOn(self):      def test_setCoefficient_q_Scalar_reducedOn(self):
2788          d=self.domain.getDim()          d=self.domain.getDim()
2789          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
2790          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
2791          mypde.setValue(q=1.)          mypde.setValue(q=1.)
2792          coeff=mypde.getCoefficient("q")          coeff=mypde.getCoefficient("q")
2793          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))
2794    
2795      def test_setCoefficient_M_reduced_Scalar_usingM(self):      def test_setCoefficient_M_reduced_Scalar_usingM(self):
2796          d=self.domain.getDim()          d=self.domain.getDim()
2797          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2798          mypde.setValue(M=Scalar(1.,ReducedFunction(self.domain)))          mypde.setValue(M=Scalar(1.,ReducedFunction(self.domain)))
2799          coeff=mypde.getCoefficient("M_reduced")          coeff=mypde.getCoefficient("M_reduced")
2800          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunction(self.domain),1,1))
2801      def test_setCoefficient_A_reduced_Scalar_usingA(self):      def test_setCoefficient_A_reduced_Scalar_usingA(self):
2802          d=self.domain.getDim()          d=self.domain.getDim()
2803          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2804          mypde.setValue(A=Data(numpy.ones((d,d)),ReducedFunction(self.domain)))          mypde.setValue(A=Data(numpy.ones((d,d)),ReducedFunction(self.domain)))
2805          coeff=mypde.getCoefficient("A_reduced")          coeff=mypde.getCoefficient("A_reduced")
2806          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,d),ReducedFunction(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,d),ReducedFunction(self.domain),1,1))
2807      def test_setCoefficient_B_reduced_Scalar_usingB(self):      def test_setCoefficient_B_reduced_Scalar_usingB(self):
2808          d=self.domain.getDim()          d=self.domain.getDim()
2809          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2810          mypde.setValue(B=Data(numpy.ones((d,)),ReducedFunction(self.domain)))          mypde.setValue(B=Data(numpy.ones((d,)),ReducedFunction(self.domain)))
2811          coeff=mypde.getCoefficient("B_reduced")          coeff=mypde.getCoefficient("B_reduced")
2812          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))
2813      def test_setCoefficient_C_reduced_Scalar_usingC(self):      def test_setCoefficient_C_reduced_Scalar_usingC(self):
2814          d=self.domain.getDim()          d=self.domain.getDim()
2815          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2816          mypde.setValue(C=Data(numpy.ones((d,)),ReducedFunction(self.domain)))          mypde.setValue(C=Data(numpy.ones((d,)),ReducedFunction(self.domain)))
2817          coeff=mypde.getCoefficient("C_reduced")          coeff=mypde.getCoefficient("C_reduced")
2818          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))
2819      def test_setCoefficient_D_reduced_Scalar_usingD(self):      def test_setCoefficient_D_reduced_Scalar_usingD(self):
2820          d=self.domain.getDim()          d=self.domain.getDim()
2821          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2822          mypde.setValue(D=Scalar(1.,ReducedFunction(self.domain)))          mypde.setValue(D=Scalar(1.,ReducedFunction(self.domain)))
2823          coeff=mypde.getCoefficient("D_reduced")          coeff=mypde.getCoefficient("D_reduced")
2824          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunction(self.domain),1,1))
2825      def test_setCoefficient_X_reduced_Scalar_usingX(self):      def test_setCoefficient_X_reduced_Scalar_usingX(self):
2826          d=self.domain.getDim()          d=self.domain.getDim()
2827          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2828          mypde.setValue(X_reduced=Data(numpy.ones((d,)),ReducedFunction(self.domain)))          mypde.setValue(X_reduced=Data(numpy.ones((d,)),ReducedFunction(self.domain)))
2829          coeff=mypde.getCoefficient("X_reduced")          coeff=mypde.getCoefficient("X_reduced")
2830          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1))
2831      def test_setCoefficient_Y_reduced_Scalar_usingY(self):      def test_setCoefficient_Y_reduced_Scalar_usingY(self):
2832          d=self.domain.getDim()          d=self.domain.getDim()
2833          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2834          mypde.setValue(Y=Scalar(1.,ReducedFunction(self.domain)))          mypde.setValue(Y=Scalar(1.,ReducedFunction(self.domain)))
2835          coeff=mypde.getCoefficient("Y_reduced")          coeff=mypde.getCoefficient("Y_reduced")
2836          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunction(self.domain),1))
2837      def test_setCoefficient_y_reduced_Scalar_using_y(self):      def test_setCoefficient_y_reduced_Scalar_using_y(self):
2838          d=self.domain.getDim()          d=self.domain.getDim()
2839          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2840          mypde.setValue(y=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(y=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))
2841          coeff=mypde.getCoefficient("y_reduced")          coeff=mypde.getCoefficient("y_reduced")
2842          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))
2843      def test_setCoefficient_m_reduced_Scalar_using_m(self):      def test_setCoefficient_m_reduced_Scalar_using_m(self):
2844          d=self.domain.getDim()          d=self.domain.getDim()
2845          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2846          mypde.setValue(d=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(d=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))
2847          coeff=mypde.getCoefficient("d_reduced")          coeff=mypde.getCoefficient("d_reduced")
2848          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1,1))
2849      def test_setCoefficient_d_reduced_Scalar_using_d(self):      def test_setCoefficient_d_reduced_Scalar_using_d(self):
2850          d=self.domain.getDim()          d=self.domain.getDim()
2851          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2852          mypde.setValue(m=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(m=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))
2853          coeff=mypde.getCoefficient("m_reduced")          coeff=mypde.getCoefficient("m_reduced")
2854          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1,1))
2855      def test_setCoefficient_d_contact_reduced_Scalar_using_d_contact(self):      def test_setCoefficient_d_contact_reduced_Scalar_using_d_contact(self):
2856          d=self.domain.getDim()          d=self.domain.getDim()
2857          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2858          mypde.setValue(d_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))          mypde.setValue(d_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))
2859          coeff=mypde.getCoefficient("d_contact_reduced")          coeff=mypde.getCoefficient("d_contact_reduced")
2860          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1,1))
2861      def test_setCoefficient_y_contact_reduced_Scalar_using_y_contact(self):      def test_setCoefficient_y_contact_reduced_Scalar_using_y_contact(self):
2862          d=self.domain.getDim()          d=self.domain.getDim()
2863          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2864          mypde.setValue(y_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))          mypde.setValue(y_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))
2865          coeff=mypde.getCoefficient("y_contact_reduced")          coeff=mypde.getCoefficient("y_contact_reduced")
2866          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))
2867      #      #
2868      #  set coefficients for systems:      #  set coefficients for systems:
2869      #      #
# Line 2311  class Test_TransportPDE(Test_linearPDEs) Line 2872  class Test_TransportPDE(Test_linearPDEs)
2872          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2873          mypde.setValue(M=numpy.ones((self.N,self.N)))          mypde.setValue(M=numpy.ones((self.N,self.N)))
2874          coeff=mypde.getCoefficient("M")          coeff=mypde.getCoefficient("M")
2875          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),Function(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),Function(self.domain),self.N,self.N))
2876      def test_setCoefficient_A_System(self):      def test_setCoefficient_A_System(self):
2877          d=self.domain.getDim()          d=self.domain.getDim()
2878          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2879          mypde.setValue(A=numpy.ones((self.N,d,self.N,d)))          mypde.setValue(A=numpy.ones((self.N,d,self.N,d)))
2880          coeff=mypde.getCoefficient("A")          coeff=mypde.getCoefficient("A")
2881          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N,d),Function(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,d,self.N,d),Function(self.domain),self.N,self.N))
2882      def test_setCoefficient_B_System(self):      def test_setCoefficient_B_System(self):
2883          d=self.domain.getDim()          d=self.domain.getDim()
2884          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2885          mypde.setValue(B=numpy.ones((self.N,d,self.N)))          mypde.setValue(B=numpy.ones((self.N,d,self.N)))
2886          coeff=mypde.getCoefficient("B")          coeff=mypde.getCoefficient("B")
2887          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N),Function(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,d,self.N),Function(self.domain),self.N,self.N))
2888      def test_setCoefficient_C_System(self):      def test_setCoefficient_C_System(self):
2889          d=self.domain.getDim()          d=self.domain.getDim()
2890          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2891          mypde.setValue(C=numpy.ones((self.N,self.N,d)))          mypde.setValue(C=numpy.ones((self.N,self.N,d)))
2892          coeff=mypde.getCoefficient("C")          coeff=mypde.getCoefficient("C")
2893          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N,d),Function(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N,d),Function(self.domain),self.N,self.N))
2894      def test_setCoefficient_D_System(self):      def test_setCoefficient_D_System(self):
2895          d=self.domain.getDim()          d=self.domain.getDim()
2896          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2897          mypde.setValue(D=numpy.ones((self.N,self.N)))          mypde.setValue(D=numpy.ones((self.N,self.N)))
2898          coeff=mypde.getCoefficient("D")          coeff=mypde.getCoefficient("D")
2899          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),Function(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),Function(self.domain),self.N,self.N))
2900      def test_setCoefficient_X_System(self):      def test_setCoefficient_X_System(self):
2901          d=self.domain.getDim()          d=self.domain.getDim()
2902          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2903          mypde.setValue(X=numpy.ones((self.N,d)))          mypde.setValue(X=numpy.ones((self.N,d)))
2904          coeff=mypde.getCoefficient("X")          coeff=mypde.getCoefficient("X")
2905          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,d),Function(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,d),Function(self.domain),self.N))
2906      def test_setCoefficient_Y_System(self):      def test_setCoefficient_Y_System(self):
2907          d=self.domain.getDim()          d=self.domain.getDim()
2908          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2909          mypde.setValue(Y=numpy.ones((self.N,)))          mypde.setValue(Y=numpy.ones((self.N,)))
2910          coeff=mypde.getCoefficient("Y")          coeff=mypde.getCoefficient("Y")
2911          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),Function(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),Function(self.domain),self.N))
2912      def test_setCoefficient_y_System(self):      def test_setCoefficient_y_System(self):
2913          d=self.domain.getDim()          d=self.domain.getDim()
2914          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2915          mypde.setValue(y=numpy.ones((self.N,)))          mypde.setValue(y=numpy.ones((self.N,)))
2916          coeff=mypde.getCoefficient("y")          coeff=mypde.getCoefficient("y")
2917          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),FunctionOnBoundary(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),FunctionOnBoundary(self.domain),self.N))
2918      def test_setCoefficient_m_System(self):      def test_setCoefficient_m_System(self):
2919          d=self.domain.getDim()          d=self.domain.getDim()
2920          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2921          mypde.setValue(m=numpy.ones((self.N,self.N)))          mypde.setValue(m=numpy.ones((self.N,self.N)))
2922          coeff=mypde.getCoefficient("m")          coeff=mypde.getCoefficient("m")
2923          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),FunctionOnBoundary(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),FunctionOnBoundary(self.domain),self.N,self.N))
2924      def test_setCoefficient_d_System(self):      def test_setCoefficient_d_System(self):
2925          d=self.domain.getDim()          d=self.domain.getDim()
2926          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2927          mypde.setValue(d=numpy.ones((self.N,self.N)))          mypde.setValue(d=numpy.ones((self.N,self.N)))
2928          coeff=mypde.getCoefficient("d")          coeff=mypde.getCoefficient("d")
2929          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),FunctionOnBoundary(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),FunctionOnBoundary(self.domain),self.N,self.N))
2930      def test_setCoefficient_d_contact_System(self):      def test_setCoefficient_d_contact_System(self):
2931        
2932          d=self.domain.getDim()          d=self.domain.getDim()
2933          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2934          mypde.setValue(d_contact=numpy.ones((self.N,self.N)))          mypde.setValue(d_contact=numpy.ones((self.N,self.N)))
2935          coeff=mypde.getCoefficient("d_contact")          coeff=mypde.getCoefficient("d_contact")
2936          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),FunctionOnContactZero(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),FunctionOnContactZero(self.domain),self.N,self.N))
2937      def test_setCoefficient_y_contact_System(self):      def test_setCoefficient_y_contact_System(self):
2938          d=self.domain.getDim()          d=self.domain.getDim()
2939          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2940          mypde.setValue(y_contact=numpy.ones((self.N,)))          mypde.setValue(y_contact=numpy.ones((self.N,)))
2941          coeff=mypde.getCoefficient("y_contact")          coeff=mypde.getCoefficient("y_contact")
2942          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),FunctionOnContactZero(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),FunctionOnContactZero(self.domain),self.N))
2943      def test_setCoefficient_M_System_reduced(self):      def test_setCoefficient_M_System_reduced(self):
2944          d=self.domain.getDim()          d=self.domain.getDim()
2945          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2946          mypde.setValue(M_reduced=numpy.ones((self.N,self.N)))          mypde.setValue(M_reduced=numpy.ones((self.N,self.N)))
2947          coeff=mypde.getCoefficient("M_reduced")          coeff=mypde.getCoefficient("M_reduced")
2948          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunction(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),ReducedFunction(self.domain),self.N,self.N))
2949      def test_setCoefficient_A_reduced_System(self):      def test_setCoefficient_A_reduced_System(self):
2950          d=self.domain.getDim()          d=self.domain.getDim()
2951          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2952          mypde.setValue(A_reduced=numpy.ones((self.N,d,self.N,d)))          mypde.setValue(A_reduced=numpy.ones((self.N,d,self.N,d)))
2953          coeff=mypde.getCoefficient("A_reduced")          coeff=mypde.getCoefficient("A_reduced")
2954          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N,d),ReducedFunction(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,d,self.N,d),ReducedFunction(self.domain),self.N,self.N))
2955      def test_setCoefficient_B_reduced_System(self):      def test_setCoefficient_B_reduced_System(self):
2956          d=self.domain.getDim()          d=self.domain.getDim()
2957          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2958          mypde.setValue(B_reduced=numpy.ones((self.N,d,self.N)))          mypde.setValue(B_reduced=numpy.ones((self.N,d,self.N)))
2959          coeff=mypde.getCoefficient("B_reduced")          coeff=mypde.getCoefficient("B_reduced")
2960          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N),ReducedFunction(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,d,self.N),ReducedFunction(self.domain),self.N,self.N))
2961      def test_setCoefficient_C_reduced_System(self):      def test_setCoefficient_C_reduced_System(self):
2962          d=self.domain.getDim()          d=self.domain.getDim()
2963          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2964          mypde.setValue(C_reduced=numpy.ones((self.N,self.N,d)))          mypde.setValue(C_reduced=numpy.ones((self.N,self.N,d)))
2965          coeff=mypde.getCoefficient("C_reduced")          coeff=mypde.getCoefficient("C_reduced")
2966          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N,d),ReducedFunction(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N,d),ReducedFunction(self.domain),self.N,self.N))
2967      def test_setCoefficient_D_System_reduced(self):      def test_setCoefficient_D_System_reduced(self):
2968          d=self.domain.getDim()          d=self.domain.getDim()
2969          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2970          mypde.setValue(D_reduced=numpy.ones((self.N,self.N)))          mypde.setValue(D_reduced=numpy.ones((self.N,self.N)))
2971          coeff=mypde.getCoefficient("D_reduced")          coeff=mypde.getCoefficient("D_reduced")
2972          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunction(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),ReducedFunction(self.domain),self.N,self.N))
2973      def test_setCoefficient_X_System_reduced(self):      def test_setCoefficient_X_System_reduced(self):
2974          d=self.domain.getDim()          d=self.domain.getDim()
2975          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2976          mypde.setValue(X_reduced=numpy.ones((self.N,d)))          mypde.setValue(X_reduced=numpy.ones((self.N,d)))
2977          coeff=mypde.getCoefficient("X_reduced")          coeff=mypde.getCoefficient("X_reduced")
2978          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,d),ReducedFunction(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,d),ReducedFunction(self.domain),self.N))
2979      def test_setCoefficient_Y_System_reduced(self):      def test_setCoefficient_Y_System_reduced(self):
2980          d=self.domain.getDim()          d=self.domain.getDim()
2981          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2982          mypde.setValue(Y_reduced=numpy.ones((self.N,)))          mypde.setValue(Y_reduced=numpy.ones((self.N,)))
2983          coeff=mypde.getCoefficient("Y_reduced")          coeff=mypde.getCoefficient("Y_reduced")
2984          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunction(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),ReducedFunction(self.domain),self.N))
2985      def test_setCoefficient_y_System_reduced(self):      def test_setCoefficient_y_System_reduced(self):
2986          d=self.domain.getDim()          d=self.domain.getDim()
2987          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2988          mypde.setValue(y_reduced=numpy.ones((self.N,)))          mypde.setValue(y_reduced=numpy.ones((self.N,)))
2989          coeff=mypde.getCoefficient("y_reduced")          coeff=mypde.getCoefficient("y_reduced")
2990          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunctionOnBoundary(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),ReducedFunctionOnBoundary(self.domain),self.N))
2991      def test_setCoefficient_m_reduced_System(self):      def test_setCoefficient_m_reduced_System(self):
2992          d=self.domain.getDim()          d=self.domain.getDim()
2993          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2994          mypde.setValue(m_reduced=numpy.ones((self.N,self.N)))          mypde.setValue(m_reduced=numpy.ones((self.N,self.N)))
2995          coeff=mypde.getCoefficient("m_reduced")          coeff=mypde.getCoefficient("m_reduced")
2996          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnBoundary(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnBoundary(self.domain),self.N,self.N))
2997      def test_setCoefficient_d_reduced_System(self):      def test_setCoefficient_d_reduced_System(self):
2998          d=self.domain.getDim()          d=self.domain.getDim()
2999          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
3000          mypde.setValue(d_reduced=numpy.ones((self.N,self.N)))          mypde.setValue(d_reduced=numpy.ones((self.N,self.N)))
3001          coeff=mypde.getCoefficient("d_reduced")          coeff=mypde.getCoefficient("d_reduced")
3002          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnBoundary(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnBoundary(self.domain),self.N,self.N))
3003      def test_setCoefficient_d_contact_reduced_System(self):      def test_setCoefficient_d_contact_reduced_System(self):
3004          d=self.domain.getDim()          d=self.domain.getDim()
3005          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
3006          mypde.setValue(d_contact_reduced=numpy.ones((self.N,self.N)))          mypde.setValue(d_contact_reduced=numpy.ones((self.N,self.N)))
3007          coeff=mypde.getCoefficient("d_contact_reduced")          coeff=mypde.getCoefficient("d_contact_reduced")
3008          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnContactZero(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnContactZero(self.domain),self.N,self.N))
3009      def test_setCoefficient_y_contact_reduced_System(self):      def test_setCoefficient_y_contact_reduced_System(self):
3010          d=self.domain.getDim()          d=self.domain.getDim()
3011          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
3012          mypde.setValue(y_contact_reduced=numpy.ones((self.N,)))          mypde.setValue(y_contact_reduced=numpy.ones((self.N,)))
3013          coeff=mypde.getCoefficient("y_contact_reduced")          coeff=mypde.getCoefficient("y_contact_reduced")
3014          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunctionOnContactZero(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),ReducedFunctionOnContactZero(self.domain),self.N))
3015      def test_setCoefficient_r_System(self):      def test_setCoefficient_r_System(self):
3016          d=self.domain.getDim()          d=self.domain.getDim()
3017          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
3018          mypde.setValue(r=numpy.ones((self.N,)))          mypde.setValue(r=numpy.ones((self.N,)))
3019          coeff=mypde.getCoefficient("r")          coeff=mypde.getCoefficient("r")
3020          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((self.N,),Solution(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((self.N,),Solution(self.domain),self.N))
3021      def test_setCoefficient_q_System(self):      def test_setCoefficient_q_System(self):
3022          d=self.domain.getDim()          d=self.domain.getDim()
3023          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
3024          mypde.setValue(q=numpy.ones((self.N,)))          mypde.setValue(q=numpy.ones((self.N,)))
3025          coeff=mypde.getCoefficient("q")          coeff=mypde.getCoefficient("q")
3026          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((self.N,),Solution(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((self.N,),Solution(self.domain),self.N))
3027      def test_setCoefficient_r_System_reducedOn(self):      def test_setCoefficient_r_System_reducedOn(self):
3028          d=self.domain.getDim()          d=self.domain.getDim()
3029          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
3030          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
3031          mypde.setValue(r=numpy.ones((self.N,)))          mypde.setValue(r=numpy.ones((self.N,)))
3032          coeff=mypde.getCoefficient("r")          coeff=mypde.getCoefficient("r")
3033          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((self.N,),ReducedSolution(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((self.N,),ReducedSolution(self.domain),self.N))
3034      def test_setCoefficient_q_System_reducedOn(self):      def test_setCoefficient_q_System_reducedOn(self):
3035          d=self.domain.getDim()          d=self.domain.getDim()
3036          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
3037          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
3038          mypde.setValue(q=numpy.ones((self.N,)))          mypde.setValue(q=numpy.ones((self.N,)))
3039          coeff=mypde.getCoefficient("q")          coeff=mypde.getCoefficient("q")
3040          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((self.N,),ReducedSolution(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((self.N,),ReducedSolution(self.domain),self.N))
3041    
3042      def test_setCoefficient_M_System_reduced_using_D(self):      def test_setCoefficient_M_System_reduced_using_D(self):
3043          d=self.domain.getDim()          d=self.domain.getDim()
3044          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
3045          mypde.setValue(M=Data(numpy.ones((self.N,self.N)),ReducedFunction(self.domain)))          mypde.setValue(M=Data(numpy.ones((self.N,self.N)),ReducedFunction(self.domain)))
3046          coeff=mypde.getCoefficient("M_reduced")          coeff=mypde.getCoefficient("M_reduced")
3047          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunction(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),ReducedFunction(self.domain),self.N,self.N))
3048      def test_setCoefficient_A_reduced_System_using_A(self):      def test_setCoefficient_A_reduced_System_using_A(self):
3049          d=self.domain.getDim()          d=self.domain.getDim()
3050          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
3051          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)))
3052          coeff=mypde.getCoefficient("A_reduced")          coeff=mypde.getCoefficient("A_reduced")
3053          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N,d),ReducedFunction(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,d,self.N,d),ReducedFunction(self.domain),self.N,self.N))
3054      def test_setCoefficient_B_reduced_System_using_B(self):      def test_setCoefficient_B_reduced_System_using_B(self):
3055          d=self.domain.getDim()          d=self.domain.getDim()
3056          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
3057          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)))
3058          coeff=mypde.getCoefficient("B_reduced")          coeff=mypde.getCoefficient("B_reduced")
3059          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N),ReducedFunction(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,d,self.N),ReducedFunction(self.domain),self.N,self.N))
3060      def test_setCoefficient_C_reduced_System_using_C(self):      def test_setCoefficient_C_reduced_System_using_C(self):
3061          d=self.domain.getDim()          d=self.domain.getDim()
3062          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
3063          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)))
3064          coeff=mypde.getCoefficient("C_reduced")          coeff=mypde.getCoefficient("C_reduced")
3065          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N,d),ReducedFunction(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N,d),ReducedFunction(self.domain),self.N,self.N))
3066      def test_setCoefficient_D_System_reduced_using_D(self):      def test_setCoefficient_D_System_reduced_using_D(self):
3067          d=self.domain.getDim()          d=self.domain.getDim()
3068          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
3069          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)))
3070          coeff=mypde.getCoefficient("D_reduced")          coeff=mypde.getCoefficient("D_reduced")
3071          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunction(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),ReducedFunction(self.domain),self.N,self.N))
3072      def test_setCoefficient_X_System_reduced_using_X(self):      def test_setCoefficient_X_System_reduced_using_X(self):
3073          d=self.domain.getDim()          d=self.domain.getDim()
3074          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
3075          mypde.setValue(X=Data(numpy.ones((self.N,d)),ReducedFunction(self.domain)))   &n