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

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

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

revision 1388 by trankine, Fri Jan 11 07:45:58 2008 UTC revision 2344 by jfenwick, Mon Mar 30 02:13:58 2009 UTC
# Line 1  Line 1 
1    
2    ########################################################
3  #  #
4  # $Id$  # Copyright (c) 2003-2008 by University of Queensland
5  #  # Earth Systems Science Computational Center (ESSCC)
6  #######################################################  # http://www.uq.edu.au/esscc
 #  
 #           Copyright 2003-2007 by ACceSS MNRF  
 #       Copyright 2007 by University of Queensland  
 #  
 #                http://esscc.uq.edu.au  
 #        Primary Business: Queensland, Australia  
 #  Licensed under the Open Software License version 3.0  
 #     http://www.opensource.org/licenses/osl-3.0.php  
7  #  #
8  #######################################################  # Primary Business: Queensland, Australia
9    # Licensed under the Open Software License version 3.0
10    # http://www.opensource.org/licenses/osl-3.0.php
11  #  #
12    ########################################################
13    
14    __copyright__="""Copyright (c) 2003-2008 by University of Queensland
15    Earth Systems Science Computational Center (ESSCC)
16    http://www.uq.edu.au/esscc
17    Primary Business: Queensland, Australia"""
18    __license__="""Licensed under the Open Software License version 3.0
19    http://www.opensource.org/licenses/osl-3.0.php"""
20    __url__="https://launchpad.net/escript-finley"
21    
22  """  """
23  Test suite for linearPDEs class  Test suite for linearPDEs class
# Line 38  The tests must be linked with a Domain c Line 43  The tests must be linked with a Domain c
43  """  """
44    
45  __author__="Lutz Gross, l.gross@uq.edu.au"  __author__="Lutz Gross, l.gross@uq.edu.au"
 __copyright__="""  Copyright (c) 2006 by ACcESS MNRF  
                     http://www.access.edu.au  
                 Primary Business: Queensland, Australia"""  
 __license__="""Licensed under the Open Software License version 3.0  
              http://www.opensource.org/licenses/osl-3.0.php"""  
 __url__="http://www.iservo.edu.au/esys/escript"  
 __version__="$Revision$"  
 __date__="$Date$"  
   
46    
47    from esys.escript.util import Lsup,kronecker,interpolate,whereZero, outer, swap_axes
 from esys.escript.util import Lsup,kronecker,interpolate,whereZero  
48  from esys.escript import Function,FunctionOnBoundary,FunctionOnContactZero,Solution,ReducedSolution,Vector,ContinuousFunction,Scalar, ReducedFunction,ReducedFunctionOnBoundary,ReducedFunctionOnContactZero,Data, Tensor4, Tensor  from esys.escript import Function,FunctionOnBoundary,FunctionOnContactZero,Solution,ReducedSolution,Vector,ContinuousFunction,Scalar, ReducedFunction,ReducedFunctionOnBoundary,ReducedFunctionOnContactZero,Data, Tensor4, Tensor
49  from esys.escript.linearPDEs import LinearPDE,IllegalCoefficientValue,Poisson, IllegalCoefficientFunctionSpace  from esys.escript.linearPDEs import LinearPDE,IllegalCoefficientValue,Poisson, IllegalCoefficientFunctionSpace, TransportPDE, IllegalCoefficient, Helmholtz, LameEquation
50  import numarray  import numarray
51  import unittest  import unittest
52    
# Line 67  class Test_linearPDEs(unittest.TestCase) Line 62  class Test_linearPDEs(unittest.TestCase)
62          if tol==None: tol=self.TOL          if tol==None: tol=self.TOL
63          return Lsup(arg-ref_arg)<=tol*Lsup(ref_arg)          return Lsup(arg-ref_arg)<=tol*Lsup(ref_arg)
64            
65    class Test_LameEquation(Test_linearPDEs):
66    
67        def test_config(self):
68            mypde=LameEquation(self.domain,debug=self.DEBUG)
69            d=self.domain.getDim()
70            self.failUnlessEqual((mypde.getNumEquations(),mypde.getNumSolutions(),mypde.isSymmetric()),(d,d,True),"set up incorrect")
71    
72        def test_setCoefficient_q(self):
73            mypde=LameEquation(self.domain,debug=self.DEBUG)
74            x=self.domain.getX()
75            mypde.setValue(q=x)
76    
77            q_ref=interpolate(x,Solution(self.domain))
78            self.failUnless(self.check(mypde.getCoefficient("A"),0),"A is not 0")
79            self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")
80            self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")
81            self.failUnless(mypde.getCoefficient("D").isEmpty(),"D is not empty")
82            self.failUnless(mypde.getCoefficient("X").isEmpty(),"X is not empty")
83            self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
84            self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")
85            self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")
86            self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
87            self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")
88            self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
89            self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
90            self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
91            self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
92            self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
93            self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
94            self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
95            self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
96            self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
97            self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
98            self.failUnless(self.check(mypde.getCoefficient("q"),q_ref),"q is not empty")
99            self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")
100    
101        def test_setCoefficient_r(self):
102            mypde=LameEquation(self.domain,debug=self.DEBUG)
103            x=self.domain.getX()
104            mypde.setValue(r=x)
105    
106            r_ref=interpolate(x,Solution(self.domain))
107            self.failUnless(self.check(mypde.getCoefficient("A"),0),"A is not 0")
108            self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")
109            self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")
110            self.failUnless(mypde.getCoefficient("D").isEmpty(),"D is not empty")
111            self.failUnless(mypde.getCoefficient("X").isEmpty(),"X is not empty")
112            self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
113            self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")
114            self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")
115            self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
116            self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")
117            self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
118            self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
119            self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
120            self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
121            self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
122            self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
123            self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
124            self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
125            self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
126            self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
127            self.failUnless(self.check(mypde.getCoefficient("r"),r_ref),"r is nor x")
128            self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")
129    
130    
131        def test_setCoefficient_F(self):
132            mypde=LameEquation(self.domain,debug=self.DEBUG)
133            x=self.domain.getX()
134            mypde.setValue(F=x)
135    
136            Y_ref=interpolate(x,Function(self.domain))
137            self.failUnless(self.check(mypde.getCoefficient("A"),0),"A is not 0")
138            self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")
139            self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")
140            self.failUnless(mypde.getCoefficient("D").isEmpty(),"D is not empty")
141            self.failUnless(mypde.getCoefficient("X").isEmpty(),"X is not empty")
142            self.failUnless(self.check(mypde.getCoefficient("Y"),Y_ref),"Y is not x")
143            self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")
144            self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")
145            self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
146            self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")
147            self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
148            self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
149            self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
150            self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
151            self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
152            self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
153            self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
154            self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
155            self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
156            self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
157            self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")
158            self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")
159    
160        def test_setCoefficient_f(self):
161            mypde=LameEquation(self.domain,debug=self.DEBUG)
162            x=self.domain.getX()
163            mypde.setValue(f=x)
164    
165            y_ref=interpolate(x,FunctionOnBoundary(self.domain))
166            self.failUnless(self.check(mypde.getCoefficient("A"),0),"A is not 0")
167            self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")
168            self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")
169            self.failUnless(mypde.getCoefficient("D").isEmpty(),"D is not empty")
170            self.failUnless(mypde.getCoefficient("X").isEmpty(),"X is not empty")
171            self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
172            self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")
173            self.failUnless(self.check(mypde.getCoefficient("y"),y_ref),"d is not x[0]")
174            self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
175            self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")
176            self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
177            self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
178            self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
179            self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
180            self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
181            self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"X_reduced is not empty")
182            self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
183            self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
184            self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
185            self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
186            self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")
187            self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")
188    
189        def test_setCoefficient_sigma(self):
190            mypde=LameEquation(self.domain,debug=self.DEBUG)
191            x=self.domain.getX()
192            mypde.setValue(sigma=outer(x,x))
193    
194            X_ref=interpolate(outer(x,x),Function(self.domain))
195            self.failUnless(self.check(mypde.getCoefficient("A"),0),"A is not 0")
196            self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")
197            self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")
198            self.failUnless(mypde.getCoefficient("D").isEmpty(),"D is not empty")
199            self.failUnless(self.check(mypde.getCoefficient("X"),X_ref),"X is not x X x")
200            self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
201            self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")
202            self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")
203            self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
204            self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")
205            self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
206            self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
207            self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
208            self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
209            self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
210            self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"X_reduced is not empty")
211            self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
212            self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
213            self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
214            self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
215            self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")
216            self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")
217    
218        def test_setCoefficient_lambda(self):
219            mypde=LameEquation(self.domain,debug=self.DEBUG)
220            x=self.domain.getX()
221            mypde.setValue(lame_lambda=x[0])
222    
223    
224            k3=kronecker(Function(self.domain))
225            k3Xk3=outer(k3,k3)
226            A_ref=x[0]*k3Xk3
227    
228            self.failUnless(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")
229            self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")
230            self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")
231            self.failUnless(mypde.getCoefficient("D").isEmpty(),"D is not empty")
232            self.failUnless(mypde.getCoefficient("X").isEmpty(),"X is not empty")
233            self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
234            self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")
235            self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")
236            self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
237            self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")
238            self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
239            self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
240            self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
241            self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
242            self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
243            self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
244            self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
245            self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
246            self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
247            self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
248            self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")
249            self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")
250    
251        def test_setCoefficient_mu(self):
252            mypde=LameEquation(self.domain,debug=self.DEBUG)
253            x=self.domain.getX()
254            mypde.setValue(lame_mu=x[0])
255    
256    
257            k3=kronecker(Function(self.domain))
258            k3Xk3=outer(k3,k3)
259            A_ref=x[0]*(swap_axes(k3Xk3,0,3)+swap_axes(k3Xk3,1,3))
260    
261            self.failUnless(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")
262            self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")
263            self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")
264            self.failUnless(mypde.getCoefficient("D").isEmpty(),"D is not empty")
265            self.failUnless(mypde.getCoefficient("X").isEmpty(),"X is not empty")
266            self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
267            self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")
268            self.failUnless(mypde.getCoefficient("y").isEmpty(),"y 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("A_reduced").isEmpty(),"A_reduced is not empty")
272            self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
273            self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
274            self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
275            self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
276            self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
277            self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
278            self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
279            self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
280            self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
281            self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")
282            self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")
283    
284        def test_setCoefficient_lambdamu(self):
285            mypde=LameEquation(self.domain,debug=self.DEBUG)
286            x=self.domain.getX()
287            mypde.setValue(lame_lambda=x[0], lame_mu=x[1])
288    
289            k3=kronecker(Function(self.domain))
290            k3Xk3=outer(k3,k3)
291            A_ref=x[0]*k3Xk3+x[1]*(swap_axes(k3Xk3,0,3)+swap_axes(k3Xk3,1,3))
292    
293            self.failUnless(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")
294            self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")
295            self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")
296            self.failUnless(mypde.getCoefficient("D").isEmpty(),"D is not empty")
297            self.failUnless(mypde.getCoefficient("X").isEmpty(),"X is not empty")
298            self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
299            self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")
300            self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")
301            self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
302            self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")
303            self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
304            self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
305            self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
306            self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
307            self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
308            self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
309            self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
310            self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
311            self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
312            self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
313            self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")
314            self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")
315    
316        def test_solve(self):
317           d=self.domain.getDim()
318           mypde=LameEquation(self.domain)
319           cf=ContinuousFunction(self.domain)
320           x=cf.getX()
321           u_ex=x
322           msk=Vector(0.,cf)
323           for i in range(d): msk[i]=whereZero(x[i])
324           mypde.setValue(q=msk,r=u_ex,lame_mu=3,lame_lambda=50,f=(2*3+50*d)*FunctionOnBoundary(self.domain).getNormal())
325    
326           u=mypde.getSolution()
327           self.failUnless(self.check(u,u_ex,10*self.TOL),"incorrect solution")
328    
329    class Test_Helmholtz(Test_linearPDEs):
330    
331        def test_config(self):
332            mypde=Helmholtz(self.domain,debug=self.DEBUG)
333            self.failUnlessEqual((mypde.getNumEquations(),mypde.getNumSolutions(),mypde.isSymmetric()),(1,1,True),"set up incorrect")
334        def test_setCoefficient_q(self):
335            mypde=Helmholtz(self.domain,debug=self.DEBUG)
336            x=self.domain.getX()
337            mypde.setValue(q=whereZero(x[0]))
338    
339            q_ref=interpolate(whereZero(x[0]),Solution(self.domain))
340            A_ref=kronecker(self.domain)
341    
342            self.failUnless(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")
343            self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")
344            self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")
345            self.failUnless(mypde.getCoefficient("D").isEmpty(),"D is not empty")
346            self.failUnless(mypde.getCoefficient("X").isEmpty(),"X is not empty")
347            self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
348            self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")
349            self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")
350            self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
351            self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")
352            self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
353            self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
354            self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
355            self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
356            self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
357            self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
358            self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
359            self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
360            self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
361            self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
362            self.failUnless(self.check(mypde.getCoefficient("q"),q_ref),"q is not empty")
363            self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")
364    
365        def test_setCoefficient_r(self):
366            mypde=Helmholtz(self.domain,debug=self.DEBUG)
367            x=self.domain.getX()
368            mypde.setValue(r=x[0])
369    
370            r_ref=interpolate(x[0],Solution(self.domain))
371            A_ref=kronecker(self.domain)
372            self.failUnless(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")
373            self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")
374            self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")
375            self.failUnless(mypde.getCoefficient("D").isEmpty(),"D is not empty")
376            self.failUnless(mypde.getCoefficient("X").isEmpty(),"X is not empty")
377            self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
378            self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")
379            self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")
380            self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
381            self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")
382            self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
383            self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
384            self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
385            self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
386            self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
387            self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
388            self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
389            self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
390            self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
391            self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
392            self.failUnless(self.check(mypde.getCoefficient("r"),r_ref),"r is nor x[0]")
393            self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")
394    
395    
396        def test_setCoefficient_f(self):
397            mypde=Helmholtz(self.domain,debug=self.DEBUG)
398            x=self.domain.getX()
399            mypde.setValue(f=x[0])
400    
401            Y_ref=interpolate(x[0],Function(self.domain))
402            A_ref=kronecker(self.domain)
403            self.failUnless(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")
404            self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")
405            self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")
406            self.failUnless(mypde.getCoefficient("D").isEmpty(),"D is not empty")
407            self.failUnless(mypde.getCoefficient("X").isEmpty(),"X is not empty")
408            self.failUnless(self.check(mypde.getCoefficient("Y"),Y_ref),"Y is not x[0]")
409            self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")
410            self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")
411            self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
412            self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")
413            self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
414            self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
415            self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
416            self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
417            self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
418            self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
419            self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
420            self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
421            self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
422            self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
423            self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")
424            self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")
425    
426        def test_setCoefficient_alpha(self):
427            mypde=Helmholtz(self.domain,debug=self.DEBUG)
428            x=self.domain.getX()
429            mypde.setValue(alpha=x[0])
430    
431            d_ref=interpolate(x[0],FunctionOnBoundary(self.domain))
432            A_ref=kronecker(self.domain)
433            self.failUnless(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")
434            self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")
435            self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")
436            self.failUnless(mypde.getCoefficient("D").isEmpty(),"D is not empty")
437            self.failUnless(mypde.getCoefficient("X").isEmpty(),"X is not empty")
438            self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
439            self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")
440            self.failUnless(self.check(mypde.getCoefficient("d"),d_ref),"d is not x[0]")
441            self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
442            self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")
443            self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
444            self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
445            self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
446            self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
447            self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
448            self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"X_reduced is not empty")
449            self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
450            self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
451            self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
452            self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
453            self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")
454            self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")
455    
456        def test_setCoefficient_g(self):
457            mypde=Helmholtz(self.domain,debug=self.DEBUG)
458            x=self.domain.getX()
459            mypde.setValue(g=x[0])
460    
461            y_ref=interpolate(x[0],FunctionOnBoundary(self.domain))
462            A_ref=kronecker(self.domain)
463            self.failUnless(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")
464            self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")
465            self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")
466            self.failUnless(mypde.getCoefficient("D").isEmpty(),"D is not empty")
467            self.failUnless(mypde.getCoefficient("X").isEmpty(),"X is not empty")
468            self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
469            self.failUnless(self.check(mypde.getCoefficient("y"),y_ref),"y is not x[0]")
470            self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")
471            self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
472            self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")
473            self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
474            self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
475            self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
476            self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
477            self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
478            self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
479            self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
480            self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
481            self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
482            self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
483            self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")
484            self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")
485    
486        def test_setCoefficient_omega(self):
487            mypde=Helmholtz(self.domain,debug=self.DEBUG)
488            x=self.domain.getX()
489            mypde.setValue(omega=x[0])
490    
491            D_ref=interpolate(x[0],Function(self.domain))
492            A_ref=kronecker(self.domain)
493            self.failUnless(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")
494            self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")
495            self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")
496            self.failUnless(self.check(mypde.getCoefficient("D"),D_ref),"D is not x[0]")
497            self.failUnless(mypde.getCoefficient("X").isEmpty(),"X is not empty")
498            self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
499            self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")
500            self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")
501            self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
502            self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")
503            self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
504            self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
505            self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
506            self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
507            self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
508            self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
509            self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
510            self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
511            self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
512            self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
513            self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")
514            self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")
515    
516        def test_solve(self):
517           d=self.domain.getDim()
518           cf=ContinuousFunction(self.domain)
519           u_ex=Scalar(1.,cf)
520           mypde=Helmholtz(self.domain)
521           mypde.setValue(f=3,omega=3,alpha=2,g=2)
522           u=mypde.getSolution()
523           self.failUnless(self.check(u,u_ex,10*self.TOL),"incorrect solution")
524    
525  class Test_Poisson(Test_linearPDEs):  class Test_Poisson(Test_linearPDEs):
526    
527      def test_config(self):      def test_config(self):
# Line 78  class Test_Poisson(Test_linearPDEs): Line 533  class Test_Poisson(Test_linearPDEs):
533          q_ref=interpolate(whereZero(x[0]),Solution(self.domain))          q_ref=interpolate(whereZero(x[0]),Solution(self.domain))
534          A_ref=kronecker(self.domain)          A_ref=kronecker(self.domain)
535          mypde.setValue(q=whereZero(x[0]))          mypde.setValue(q=whereZero(x[0]))
536          self.failUnless(self.check(mypde.getCoefficientOfGeneralPDE("A"),A_ref),"A is not kronecker")          self.failUnless(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")
537          self.failUnless(mypde.getCoefficientOfGeneralPDE("B").isEmpty(),"B is not empty")          self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")
538          self.failUnless(mypde.getCoefficientOfGeneralPDE("C").isEmpty(),"C is not empty")          self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")
539          self.failUnless(mypde.getCoefficientOfGeneralPDE("D").isEmpty(),"D is not empty")          self.failUnless(mypde.getCoefficient("D").isEmpty(),"D is not empty")
540          self.failUnless(mypde.getCoefficientOfGeneralPDE("X").isEmpty(),"X is not empty")          self.failUnless(mypde.getCoefficient("X").isEmpty(),"X is not empty")
541          self.failUnless(mypde.getCoefficientOfGeneralPDE("Y").isEmpty(),"Y is not empty")          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
542          self.failUnless(mypde.getCoefficientOfGeneralPDE("y").isEmpty(),"y is not empty")          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")
543          self.failUnless(mypde.getCoefficientOfGeneralPDE("d").isEmpty(),"d is not empty")          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")
544          self.failUnless(mypde.getCoefficientOfGeneralPDE("d_contact").isEmpty(),"d_contact is not empty")          self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
545          self.failUnless(mypde.getCoefficientOfGeneralPDE("y_contact").isEmpty(),"y_contact is not empty")          self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")
546          self.failUnless(mypde.getCoefficientOfGeneralPDE("A_reduced").isEmpty(),"A_reduced is not empty")          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
547          self.failUnless(mypde.getCoefficientOfGeneralPDE("B_reduced").isEmpty(),"B_reduced is not empty")          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
548          self.failUnless(mypde.getCoefficientOfGeneralPDE("C_reduced").isEmpty(),"C_reduced is not empty")          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
549          self.failUnless(mypde.getCoefficientOfGeneralPDE("D_reduced").isEmpty(),"D_reduced is not empty")          self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
550          self.failUnless(mypde.getCoefficientOfGeneralPDE("X_reduced").isEmpty(),"X_reduced is not empty")          self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
551          self.failUnless(mypde.getCoefficientOfGeneralPDE("Y_reduced").isEmpty(),"Y_reduced is not empty")          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
552          self.failUnless(mypde.getCoefficientOfGeneralPDE("y_reduced").isEmpty(),"y_reduced is not empty")          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
553          self.failUnless(mypde.getCoefficientOfGeneralPDE("d_reduced").isEmpty(),"d_reduced is not empty")          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
554          self.failUnless(mypde.getCoefficientOfGeneralPDE("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
555          self.failUnless(mypde.getCoefficientOfGeneralPDE("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
556          self.failUnless(self.check(mypde.getCoefficientOfGeneralPDE("q"),q_ref),"q is not empty")          self.failUnless(self.check(mypde.getCoefficient("q"),q_ref),"q is not empty")
557          self.failUnless(mypde.getCoefficientOfGeneralPDE("r").isEmpty(),"r is not empty")          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")
558      def test_setCoefficient_f(self):      def test_setCoefficient_f(self):
559          mypde=Poisson(self.domain,debug=self.DEBUG)          mypde=Poisson(self.domain,debug=self.DEBUG)
560          x=self.domain.getX()          x=self.domain.getX()
561          Y_ref=interpolate(x[0],Function(self.domain))          Y_ref=interpolate(x[0],Function(self.domain))
562          A_ref=kronecker(self.domain)          A_ref=kronecker(self.domain)
563          mypde.setValue(f=x[0])          mypde.setValue(f=x[0])
564          self.failUnless(self.check(mypde.getCoefficientOfGeneralPDE("A"),A_ref),"A is not kronecker")          self.failUnless(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")
565          self.failUnless(mypde.getCoefficientOfGeneralPDE("B").isEmpty(),"B is not empty")          self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")
566          self.failUnless(mypde.getCoefficientOfGeneralPDE("C").isEmpty(),"C is not empty")          self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")
567          self.failUnless(mypde.getCoefficientOfGeneralPDE("D").isEmpty(),"D is not empty")          self.failUnless(mypde.getCoefficient("D").isEmpty(),"D is not empty")
568          self.failUnless(mypde.getCoefficientOfGeneralPDE("X").isEmpty(),"X is not empty")          self.failUnless(mypde.getCoefficient("X").isEmpty(),"X is not empty")
569          self.failUnless(self.check(mypde.getCoefficientOfGeneralPDE("Y"),Y_ref),"Y is not x[0]")          self.failUnless(self.check(mypde.getCoefficient("Y"),Y_ref),"Y is not x[0]")
570          self.failUnless(mypde.getCoefficientOfGeneralPDE("y").isEmpty(),"y is not empty")          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")
571          self.failUnless(mypde.getCoefficientOfGeneralPDE("d").isEmpty(),"d is not empty")          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")
572          self.failUnless(mypde.getCoefficientOfGeneralPDE("d_contact").isEmpty(),"d_contact is not empty")          self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
573          self.failUnless(mypde.getCoefficientOfGeneralPDE("y_contact").isEmpty(),"y_contact is not empty")          self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")
574          self.failUnless(mypde.getCoefficientOfGeneralPDE("A_reduced").isEmpty(),"A_reduced is not empty")          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
575          self.failUnless(mypde.getCoefficientOfGeneralPDE("B_reduced").isEmpty(),"B_reduced is not empty")          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
576          self.failUnless(mypde.getCoefficientOfGeneralPDE("C_reduced").isEmpty(),"C_reduced is not empty")          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
577          self.failUnless(mypde.getCoefficientOfGeneralPDE("D_reduced").isEmpty(),"D_reduced is not empty")          self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
578          self.failUnless(mypde.getCoefficientOfGeneralPDE("X_reduced").isEmpty(),"X_reduced is not empty")          self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
579          self.failUnless(mypde.getCoefficientOfGeneralPDE("Y_reduced").isEmpty(),"Y_reduced is not empty")          self.failUnless(mypde.getCoefficient("Y_reduced").isEmpty(),"Y_reduced is not empty")
580          self.failUnless(mypde.getCoefficientOfGeneralPDE("y_reduced").isEmpty(),"y_reduced is not empty")          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
581          self.failUnless(mypde.getCoefficientOfGeneralPDE("d_reduced").isEmpty(),"d_reduced is not empty")          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
582          self.failUnless(mypde.getCoefficientOfGeneralPDE("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
583          self.failUnless(mypde.getCoefficientOfGeneralPDE("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
584          self.failUnless(mypde.getCoefficientOfGeneralPDE("q").isEmpty(),"q is not empty")          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")
585          self.failUnless(mypde.getCoefficientOfGeneralPDE("r").isEmpty(),"r is not empty")          self.failUnless(mypde.getCoefficient("r").isEmpty(),"r is not empty")
586      def test_setCoefficient_f_reduced(self):      def test_setCoefficient_f_reduced(self):
587          mypde=Poisson(self.domain,debug=self.DEBUG)          mypde=Poisson(self.domain,debug=self.DEBUG)
588          x=self.domain.getX()          x=self.domain.getX()
589          Y_ref=interpolate(x[0],ReducedFunction(self.domain))          Y_ref=interpolate(x[0],ReducedFunction(self.domain))
590          A_ref=kronecker(self.domain)          A_ref=kronecker(self.domain)
591          mypde.setValue(f_reduced=x[0])          mypde.setValue(f_reduced=x[0])
592          self.failUnless(self.check(mypde.getCoefficientOfGeneralPDE("A"),A_ref),"A is not kronecker")          self.failUnless(self.check(mypde.getCoefficient("A"),A_ref),"A is not kronecker")
593          self.failUnless(mypde.getCoefficientOfGeneralPDE("B").isEmpty(),"B is not empty")          self.failUnless(mypde.getCoefficient("B").isEmpty(),"B is not empty")
594          self.failUnless(mypde.getCoefficientOfGeneralPDE("C").isEmpty(),"C is not empty")          self.failUnless(mypde.getCoefficient("C").isEmpty(),"C is not empty")
595          self.failUnless(mypde.getCoefficientOfGeneralPDE("D").isEmpty(),"D is not empty")          self.failUnless(mypde.getCoefficient("D").isEmpty(),"D is not empty")
596          self.failUnless(mypde.getCoefficientOfGeneralPDE("X").isEmpty(),"X is not empty")          self.failUnless(mypde.getCoefficient("X").isEmpty(),"X is not empty")
597          self.failUnless(mypde.getCoefficientOfGeneralPDE("Y").isEmpty(),"Y is not empty")          self.failUnless(mypde.getCoefficient("Y").isEmpty(),"Y is not empty")
598          self.failUnless(mypde.getCoefficientOfGeneralPDE("y").isEmpty(),"y is not empty")          self.failUnless(mypde.getCoefficient("y").isEmpty(),"y is not empty")
599          self.failUnless(mypde.getCoefficientOfGeneralPDE("d").isEmpty(),"d is not empty")          self.failUnless(mypde.getCoefficient("d").isEmpty(),"d is not empty")
600          self.failUnless(mypde.getCoefficientOfGeneralPDE("d_contact").isEmpty(),"d_contact is not empty")          self.failUnless(mypde.getCoefficient("d_contact").isEmpty(),"d_contact is not empty")
601          self.failUnless(mypde.getCoefficientOfGeneralPDE("y_contact").isEmpty(),"y_contact is not empty")          self.failUnless(mypde.getCoefficient("y_contact").isEmpty(),"y_contact is not empty")
602          self.failUnless(mypde.getCoefficientOfGeneralPDE("A_reduced").isEmpty(),"A_reduced is not empty")          self.failUnless(mypde.getCoefficient("A_reduced").isEmpty(),"A_reduced is not empty")
603          self.failUnless(mypde.getCoefficientOfGeneralPDE("B_reduced").isEmpty(),"B_reduced is not empty")          self.failUnless(mypde.getCoefficient("B_reduced").isEmpty(),"B_reduced is not empty")
604          self.failUnless(mypde.getCoefficientOfGeneralPDE("C_reduced").isEmpty(),"C_reduced is not empty")          self.failUnless(mypde.getCoefficient("C_reduced").isEmpty(),"C_reduced is not empty")
605          self.failUnless(mypde.getCoefficientOfGeneralPDE("D_reduced").isEmpty(),"D_reduced is not empty")          self.failUnless(mypde.getCoefficient("D_reduced").isEmpty(),"D_reduced is not empty")
606          self.failUnless(mypde.getCoefficientOfGeneralPDE("X_reduced").isEmpty(),"X_reduced is not empty")          self.failUnless(mypde.getCoefficient("X_reduced").isEmpty(),"X_reduced is not empty")
607          self.failUnless(self.check(mypde.getCoefficientOfGeneralPDE("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]")
608          self.failUnless(mypde.getCoefficientOfGeneralPDE("y_reduced").isEmpty(),"y_reduced is not empty")          self.failUnless(mypde.getCoefficient("y_reduced").isEmpty(),"y_reduced is not empty")
609          self.failUnless(mypde.getCoefficientOfGeneralPDE("d_reduced").isEmpty(),"d_reduced is not empty")          self.failUnless(mypde.getCoefficient("d_reduced").isEmpty(),"d_reduced is not empty")
610          self.failUnless(mypde.getCoefficientOfGeneralPDE("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")          self.failUnless(mypde.getCoefficient("d_contact_reduced").isEmpty(),"d_contact_reduced is not empty")
611          self.failUnless(mypde.getCoefficientOfGeneralPDE("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")          self.failUnless(mypde.getCoefficient("y_contact_reduced").isEmpty(),"y_contact_reduced is not empty")
612          self.failUnless(mypde.getCoefficientOfGeneralPDE("q").isEmpty(),"q is not empty")          self.failUnless(mypde.getCoefficient("q").isEmpty(),"q is not empty")
613          self.failUnless(mypde.getCoefficientOfGeneralPDE("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()
616         cf=ContinuousFunction(self.domain)         cf=ContinuousFunction(self.domain)
# Line 187  class Test_LinearPDE_noLumping(Test_line Line 642  class Test_LinearPDE_noLumping(Test_line
642      N=4      N=4
643      def test_setCoefficient_WithIllegalFunctionSpace(self):      def test_setCoefficient_WithIllegalFunctionSpace(self):
644          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
645          try:          self.failUnlessRaises(IllegalCoefficientFunctionSpace,mypde.setValue, C=Vector(0.,FunctionOnBoundary(self.domain)))
646             success=True  
647             mypde.setValue(C=Vector(0.,FunctionOnBoundary(self.domain)))      def test_setCoefficient_WithWrongName(self):
648          except IllegalCoefficientFunctionSpace:          mypde=LinearPDE(self.domain,debug=self.DEBUG)
649             success=False          self.failUnlessRaises(IllegalCoefficient, mypde.setValue, ROMA=0.)
650          self.failUnless(not success,'inapropraite function space accepted')  
           
651      def test_resetCoefficient_WithWrongShape(self):      def test_resetCoefficient_WithWrongShape(self):
652          mypde=LinearPDE(self.domain,numEquations=2,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=2,debug=self.DEBUG)
653          try:          self.failUnlessRaises(IllegalCoefficientValue, mypde.setValue, C=0.)
654             success=True  
            mypde.setValue(C=0.)  
         except IllegalCoefficientValue:  
            success=False  
         self.failUnless(not success,'illegal shape accepted')  
655      def test_reducedOn(self):      def test_reducedOn(self):
656          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
657          x=self.domain.getX()          x=self.domain.getX()
# Line 213  class Test_LinearPDE_noLumping(Test_line Line 663  class Test_LinearPDE_noLumping(Test_line
663      def test_attemptToChangeOrderAfterDefinedCoefficient(self):      def test_attemptToChangeOrderAfterDefinedCoefficient(self):
664          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
665          mypde.setValue(D=1.)          mypde.setValue(D=1.)
666          try:          self.failUnlessRaises(RuntimeError,mypde.setReducedOrderOn)
            success=True  
            mypde.setReducedOrderOn()  
         except RuntimeError:  
            success=False  
         self.failUnless(not success,'alterion of order after coefficient is changed not detected.')  
667    
668      def test_reducedOnConfig(self):      def test_reducedOnConfig(self):
669          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 231  class Test_LinearPDE_noLumping(Test_line Line 676  class Test_LinearPDE_noLumping(Test_line
676          d=self.domain.getDim()          d=self.domain.getDim()
677          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
678          mypde.setValue(A=numarray.ones((d,d)))          mypde.setValue(A=numarray.ones((d,d)))
679          coeff=mypde.getCoefficientOfGeneralPDE("A")          coeff=mypde.getCoefficient("A")
680          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))
681      def test_setCoefficient_B_Scalar(self):      def test_setCoefficient_B_Scalar(self):
682          d=self.domain.getDim()          d=self.domain.getDim()
683          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
684          mypde.setValue(B=numarray.ones((d,)))          mypde.setValue(B=numarray.ones((d,)))
685          coeff=mypde.getCoefficientOfGeneralPDE("B")          coeff=mypde.getCoefficient("B")
686          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))
687      def test_setCoefficient_C_Scalar(self):      def test_setCoefficient_C_Scalar(self):
688          d=self.domain.getDim()          d=self.domain.getDim()
689          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
690          mypde.setValue(C=numarray.ones((d,)))          mypde.setValue(C=numarray.ones((d,)))
691          coeff=mypde.getCoefficientOfGeneralPDE("C")          coeff=mypde.getCoefficient("C")
692          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))
693      def test_setCoefficient_D_Scalar(self):      def test_setCoefficient_D_Scalar(self):
694          d=self.domain.getDim()          d=self.domain.getDim()
695          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
696          mypde.setValue(D=1.)          mypde.setValue(D=1.)
697          coeff=mypde.getCoefficientOfGeneralPDE("D")          coeff=mypde.getCoefficient("D")
698          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))
699      def test_setCoefficient_X_Scalar(self):      def test_setCoefficient_X_Scalar(self):
700          d=self.domain.getDim()          d=self.domain.getDim()
701          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
702          mypde.setValue(X=numarray.ones((d,)))          mypde.setValue(X=numarray.ones((d,)))
703          coeff=mypde.getCoefficientOfGeneralPDE("X")          coeff=mypde.getCoefficient("X")
704          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))
705      def test_setCoefficient_Y_Scalar(self):      def test_setCoefficient_Y_Scalar(self):
706          d=self.domain.getDim()          d=self.domain.getDim()
707          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
708          mypde.setValue(Y=1.)          mypde.setValue(Y=1.)
709          coeff=mypde.getCoefficientOfGeneralPDE("Y")          coeff=mypde.getCoefficient("Y")
710          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),Function(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),Function(self.domain),1))
711      def test_setCoefficient_y_Scalar(self):      def test_setCoefficient_y_Scalar(self):
712          d=self.domain.getDim()          d=self.domain.getDim()
713          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
714          mypde.setValue(y=1.)          mypde.setValue(y=1.)
715          coeff=mypde.getCoefficientOfGeneralPDE("y")          coeff=mypde.getCoefficient("y")
716          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1))
717      def test_setCoefficient_d_Scalar(self):      def test_setCoefficient_d_Scalar(self):
718          d=self.domain.getDim()          d=self.domain.getDim()
719          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
720          mypde.setValue(d=1.)          mypde.setValue(d=1.)
721          coeff=mypde.getCoefficientOfGeneralPDE("d")          coeff=mypde.getCoefficient("d")
722          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))
723      def test_setCoefficient_d_contact_Scalar(self):      def test_setCoefficient_d_contact_Scalar(self):
724          d=self.domain.getDim()          d=self.domain.getDim()
725          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
726          mypde.setValue(d_contact=1.)          mypde.setValue(d_contact=1.)
727          coeff=mypde.getCoefficientOfGeneralPDE("d_contact")          coeff=mypde.getCoefficient("d_contact")
728          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),FunctionOnContactZero(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),FunctionOnContactZero(self.domain),1,1))
729      def test_setCoefficient_y_contact_Scalar(self):      def test_setCoefficient_y_contact_Scalar(self):
730          d=self.domain.getDim()          d=self.domain.getDim()
731          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
732          mypde.setValue(y_contact=1.)          mypde.setValue(y_contact=1.)
733          coeff=mypde.getCoefficientOfGeneralPDE("y_contact")          coeff=mypde.getCoefficient("y_contact")
734          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),FunctionOnContactZero(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),FunctionOnContactZero(self.domain),1))
735      def test_setCoefficient_A_reduced_Scalar(self):      def test_setCoefficient_A_reduced_Scalar(self):
736          d=self.domain.getDim()          d=self.domain.getDim()
737          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
738          mypde.setValue(A_reduced=numarray.ones((d,d)))          mypde.setValue(A_reduced=numarray.ones((d,d)))
739          coeff=mypde.getCoefficientOfGeneralPDE("A_reduced")          coeff=mypde.getCoefficient("A_reduced")
740          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))
741      def test_setCoefficient_B_reduced_Scalar(self):      def test_setCoefficient_B_reduced_Scalar(self):
742          d=self.domain.getDim()          d=self.domain.getDim()
743          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
744          mypde.setValue(B_reduced=numarray.ones((d,)))          mypde.setValue(B_reduced=numarray.ones((d,)))
745          coeff=mypde.getCoefficientOfGeneralPDE("B_reduced")          coeff=mypde.getCoefficient("B_reduced")
746          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))
747      def test_setCoefficient_C_reduced_Scalar(self):      def test_setCoefficient_C_reduced_Scalar(self):
748          d=self.domain.getDim()          d=self.domain.getDim()
749          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
750          mypde.setValue(C_reduced=numarray.ones((d,)))          mypde.setValue(C_reduced=numarray.ones((d,)))
751          coeff=mypde.getCoefficientOfGeneralPDE("C_reduced")          coeff=mypde.getCoefficient("C_reduced")
752          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))
753      def test_setCoefficient_D_reduced_Scalar(self):      def test_setCoefficient_D_reduced_Scalar(self):
754          d=self.domain.getDim()          d=self.domain.getDim()
755          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
756          mypde.setValue(D_reduced=1.)          mypde.setValue(D_reduced=1.)
757          coeff=mypde.getCoefficientOfGeneralPDE("D_reduced")          coeff=mypde.getCoefficient("D_reduced")
758          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))
759      def test_setCoefficient_X_reduced_Scalar(self):      def test_setCoefficient_X_reduced_Scalar(self):
760          d=self.domain.getDim()          d=self.domain.getDim()
761          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
762          mypde.setValue(X_reduced=numarray.ones((d,)))          mypde.setValue(X_reduced=numarray.ones((d,)))
763          coeff=mypde.getCoefficientOfGeneralPDE("X_reduced")          coeff=mypde.getCoefficient("X_reduced")
764          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))
765      def test_setCoefficient_Y_reduced_Scalar(self):      def test_setCoefficient_Y_reduced_Scalar(self):
766          d=self.domain.getDim()          d=self.domain.getDim()
767          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
768          mypde.setValue(Y_reduced=1.)          mypde.setValue(Y_reduced=1.)
769          coeff=mypde.getCoefficientOfGeneralPDE("Y_reduced")          coeff=mypde.getCoefficient("Y_reduced")
770          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1))
771      def test_setCoefficient_y_reduced_Scalar(self):      def test_setCoefficient_y_reduced_Scalar(self):
772          d=self.domain.getDim()          d=self.domain.getDim()
773          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
774          mypde.setValue(y_reduced=1.)          mypde.setValue(y_reduced=1.)
775          coeff=mypde.getCoefficientOfGeneralPDE("y_reduced")          coeff=mypde.getCoefficient("y_reduced")
776          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))
777      def test_setCoefficient_d_reduced_Scalar(self):      def test_setCoefficient_d_reduced_Scalar(self):
778          d=self.domain.getDim()          d=self.domain.getDim()
779          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
780          mypde.setValue(d_reduced=1.)          mypde.setValue(d_reduced=1.)
781          coeff=mypde.getCoefficientOfGeneralPDE("d_reduced")          coeff=mypde.getCoefficient("d_reduced")
782          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))
783      def test_setCoefficient_d_contact_reduced_Scalar(self):      def test_setCoefficient_d_contact_reduced_Scalar(self):
784          d=self.domain.getDim()          d=self.domain.getDim()
785          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
786          mypde.setValue(d_contact_reduced=1.)          mypde.setValue(d_contact_reduced=1.)
787          coeff=mypde.getCoefficientOfGeneralPDE("d_contact_reduced")          coeff=mypde.getCoefficient("d_contact_reduced")
788          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))
789      def test_setCoefficient_y_contact_reduced_Scalar(self):      def test_setCoefficient_y_contact_reduced_Scalar(self):
790          d=self.domain.getDim()          d=self.domain.getDim()
791          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
792          mypde.setValue(y_contact_reduced=1.)          mypde.setValue(y_contact_reduced=1.)
793          coeff=mypde.getCoefficientOfGeneralPDE("y_contact_reduced")          coeff=mypde.getCoefficient("y_contact_reduced")
794          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))
795      def test_setCoefficient_r_Scalar(self):      def test_setCoefficient_r_Scalar(self):
796          d=self.domain.getDim()          d=self.domain.getDim()
797          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
798          mypde.setValue(r=1.)          mypde.setValue(r=1.)
799          coeff=mypde.getCoefficientOfGeneralPDE("r")          coeff=mypde.getCoefficient("r")
800          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),Solution(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),Solution(self.domain),1))
801      def test_setCoefficient_q_Scalar(self):      def test_setCoefficient_q_Scalar(self):
802          d=self.domain.getDim()          d=self.domain.getDim()
803          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
804          mypde.setValue(q=1.)          mypde.setValue(q=1.)
805          coeff=mypde.getCoefficientOfGeneralPDE("q")          coeff=mypde.getCoefficient("q")
806          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),Solution(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),Solution(self.domain),1))
807      def test_setCoefficient_r_Scalar_reducedOn(self):      def test_setCoefficient_r_Scalar_reducedOn(self):
808          d=self.domain.getDim()          d=self.domain.getDim()
809          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
810          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
811          mypde.setValue(r=1.)          mypde.setValue(r=1.)
812          coeff=mypde.getCoefficientOfGeneralPDE("r")          coeff=mypde.getCoefficient("r")
813          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))
814      def test_setCoefficient_q_Scalar_reducedOn(self):      def test_setCoefficient_q_Scalar_reducedOn(self):
815          d=self.domain.getDim()          d=self.domain.getDim()
816          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
817          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
818          mypde.setValue(q=1.)          mypde.setValue(q=1.)
819          coeff=mypde.getCoefficientOfGeneralPDE("q")          coeff=mypde.getCoefficient("q")
820          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))
821    
822      def test_setCoefficient_A_reduced_Scalar_usingA(self):      def test_setCoefficient_A_reduced_Scalar_usingA(self):
823          d=self.domain.getDim()          d=self.domain.getDim()
824          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
825          mypde.setValue(A=Data(numarray.ones((d,d)),ReducedFunction(self.domain)))          mypde.setValue(A=Data(numarray.ones((d,d)),ReducedFunction(self.domain)))
826          coeff=mypde.getCoefficientOfGeneralPDE("A_reduced")          coeff=mypde.getCoefficient("A_reduced")
827          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))
828      def test_setCoefficient_B_reduced_Scalar_usingB(self):      def test_setCoefficient_B_reduced_Scalar_usingB(self):
829          d=self.domain.getDim()          d=self.domain.getDim()
830          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
831          mypde.setValue(B=Data(numarray.ones((d,)),ReducedFunction(self.domain)))          mypde.setValue(B=Data(numarray.ones((d,)),ReducedFunction(self.domain)))
832          coeff=mypde.getCoefficientOfGeneralPDE("B_reduced")          coeff=mypde.getCoefficient("B_reduced")
833          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))
834      def test_setCoefficient_C_reduced_Scalar_usingC(self):      def test_setCoefficient_C_reduced_Scalar_usingC(self):
835          d=self.domain.getDim()          d=self.domain.getDim()
836          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
837          mypde.setValue(C=Data(numarray.ones((d,)),ReducedFunction(self.domain)))          mypde.setValue(C=Data(numarray.ones((d,)),ReducedFunction(self.domain)))
838          coeff=mypde.getCoefficientOfGeneralPDE("C_reduced")          coeff=mypde.getCoefficient("C_reduced")
839          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))
840      def test_setCoefficient_D_reduced_Scalar_usingD(self):      def test_setCoefficient_D_reduced_Scalar_usingD(self):
841          d=self.domain.getDim()          d=self.domain.getDim()
842          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
843          mypde.setValue(D=Scalar(1.,ReducedFunction(self.domain)))          mypde.setValue(D=Scalar(1.,ReducedFunction(self.domain)))
844          coeff=mypde.getCoefficientOfGeneralPDE("D_reduced")          coeff=mypde.getCoefficient("D_reduced")
845          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))
846      def test_setCoefficient_X_reduced_Scalar_usingX(self):      def test_setCoefficient_X_reduced_Scalar_usingX(self):
847          d=self.domain.getDim()          d=self.domain.getDim()
848          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
849          mypde.setValue(X_reduced=Data(numarray.ones((d,)),ReducedFunction(self.domain)))          mypde.setValue(X_reduced=Data(numarray.ones((d,)),ReducedFunction(self.domain)))
850          coeff=mypde.getCoefficientOfGeneralPDE("X_reduced")          coeff=mypde.getCoefficient("X_reduced")
851          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))
852      def test_setCoefficient_Y_reduced_Scalar_usingY(self):      def test_setCoefficient_Y_reduced_Scalar_usingY(self):
853          d=self.domain.getDim()          d=self.domain.getDim()
854          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
855          mypde.setValue(Y=Scalar(1.,ReducedFunction(self.domain)))          mypde.setValue(Y=Scalar(1.,ReducedFunction(self.domain)))
856          coeff=mypde.getCoefficientOfGeneralPDE("Y_reduced")          coeff=mypde.getCoefficient("Y_reduced")
857          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1))
858      def test_setCoefficient_y_reduced_Scalar_using_y(self):      def test_setCoefficient_y_reduced_Scalar_using_y(self):
859          d=self.domain.getDim()          d=self.domain.getDim()
860          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
861          mypde.setValue(y=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(y=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))
862          coeff=mypde.getCoefficientOfGeneralPDE("y_reduced")          coeff=mypde.getCoefficient("y_reduced")
863          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))
864      def test_setCoefficient_d_reduced_Scalar_using_d(self):      def test_setCoefficient_d_reduced_Scalar_using_d(self):
865          d=self.domain.getDim()          d=self.domain.getDim()
866          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
867          mypde.setValue(d=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(d=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))
868          coeff=mypde.getCoefficientOfGeneralPDE("d_reduced")          coeff=mypde.getCoefficient("d_reduced")
869          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))
870      def test_setCoefficient_d_contact_reduced_Scalar_using_d_contact(self):      def test_setCoefficient_d_contact_reduced_Scalar_using_d_contact(self):
871          d=self.domain.getDim()          d=self.domain.getDim()
872          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
873          mypde.setValue(d_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))          mypde.setValue(d_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))
874          coeff=mypde.getCoefficientOfGeneralPDE("d_contact_reduced")          coeff=mypde.getCoefficient("d_contact_reduced")
875          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))
876      def test_setCoefficient_y_contact_reduced_Scalar_using_y_contact(self):      def test_setCoefficient_y_contact_reduced_Scalar_using_y_contact(self):
877          d=self.domain.getDim()          d=self.domain.getDim()
878          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
879          mypde.setValue(y_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))          mypde.setValue(y_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))
880          coeff=mypde.getCoefficientOfGeneralPDE("y_contact_reduced")          coeff=mypde.getCoefficient("y_contact_reduced")
881          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))
882      #      #
883      #  set coefficients for systems:      #  set coefficients for systems:
# Line 441  class Test_LinearPDE_noLumping(Test_line Line 886  class Test_LinearPDE_noLumping(Test_line
886          d=self.domain.getDim()          d=self.domain.getDim()
887          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
888          mypde.setValue(A=numarray.ones((self.N,d,self.N,d)))          mypde.setValue(A=numarray.ones((self.N,d,self.N,d)))
889          coeff=mypde.getCoefficientOfGeneralPDE("A")          coeff=mypde.getCoefficient("A")
890          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))
891      def test_setCoefficient_B_System(self):      def test_setCoefficient_B_System(self):
892          d=self.domain.getDim()          d=self.domain.getDim()
893          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
894          mypde.setValue(B=numarray.ones((self.N,d,self.N)))          mypde.setValue(B=numarray.ones((self.N,d,self.N)))
895          coeff=mypde.getCoefficientOfGeneralPDE("B")          coeff=mypde.getCoefficient("B")
896          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))
897      def test_setCoefficient_C_System(self):      def test_setCoefficient_C_System(self):
898          d=self.domain.getDim()          d=self.domain.getDim()
899          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
900          mypde.setValue(C=numarray.ones((self.N,self.N,d)))          mypde.setValue(C=numarray.ones((self.N,self.N,d)))
901          coeff=mypde.getCoefficientOfGeneralPDE("C")          coeff=mypde.getCoefficient("C")
902          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))
903      def test_setCoefficient_D_System(self):      def test_setCoefficient_D_System(self):
904          d=self.domain.getDim()          d=self.domain.getDim()
905          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
906          mypde.setValue(D=numarray.ones((self.N,self.N)))          mypde.setValue(D=numarray.ones((self.N,self.N)))
907          coeff=mypde.getCoefficientOfGeneralPDE("D")          coeff=mypde.getCoefficient("D")
908          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))
909      def test_setCoefficient_X_System(self):      def test_setCoefficient_X_System(self):
910          d=self.domain.getDim()          d=self.domain.getDim()
911          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
912          mypde.setValue(X=numarray.ones((self.N,d)))          mypde.setValue(X=numarray.ones((self.N,d)))
913          coeff=mypde.getCoefficientOfGeneralPDE("X")          coeff=mypde.getCoefficient("X")
914          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))
915      def test_setCoefficient_Y_System(self):      def test_setCoefficient_Y_System(self):
916          d=self.domain.getDim()          d=self.domain.getDim()
917          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
918          mypde.setValue(Y=numarray.ones((self.N,)))          mypde.setValue(Y=numarray.ones((self.N,)))
919          coeff=mypde.getCoefficientOfGeneralPDE("Y")          coeff=mypde.getCoefficient("Y")
920          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))
921      def test_setCoefficient_y_System(self):      def test_setCoefficient_y_System(self):
922          d=self.domain.getDim()          d=self.domain.getDim()
923          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
924          mypde.setValue(y=numarray.ones((self.N,)))          mypde.setValue(y=numarray.ones((self.N,)))
925          coeff=mypde.getCoefficientOfGeneralPDE("y")          coeff=mypde.getCoefficient("y")
926          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))
927      def test_setCoefficient_d_System(self):      def test_setCoefficient_d_System(self):
928          d=self.domain.getDim()          d=self.domain.getDim()
929          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
930          mypde.setValue(d=numarray.ones((self.N,self.N)))          mypde.setValue(d=numarray.ones((self.N,self.N)))
931          coeff=mypde.getCoefficientOfGeneralPDE("d")          coeff=mypde.getCoefficient("d")
932          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))
933      def test_setCoefficient_d_contact_System(self):      def test_setCoefficient_d_contact_System(self):
934          d=self.domain.getDim()          d=self.domain.getDim()
935          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
936          mypde.setValue(d_contact=numarray.ones((self.N,self.N)))          mypde.setValue(d_contact=numarray.ones((self.N,self.N)))
937          coeff=mypde.getCoefficientOfGeneralPDE("d_contact")          coeff=mypde.getCoefficient("d_contact")
938          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))
939      def test_setCoefficient_y_contact_System(self):      def test_setCoefficient_y_contact_System(self):
940          d=self.domain.getDim()          d=self.domain.getDim()
941          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
942          mypde.setValue(y_contact=numarray.ones((self.N,)))          mypde.setValue(y_contact=numarray.ones((self.N,)))
943          coeff=mypde.getCoefficientOfGeneralPDE("y_contact")          coeff=mypde.getCoefficient("y_contact")
944          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))
945      def test_setCoefficient_A_reduced_System(self):      def test_setCoefficient_A_reduced_System(self):
946          d=self.domain.getDim()          d=self.domain.getDim()
947          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
948          mypde.setValue(A_reduced=numarray.ones((self.N,d,self.N,d)))          mypde.setValue(A_reduced=numarray.ones((self.N,d,self.N,d)))
949          coeff=mypde.getCoefficientOfGeneralPDE("A_reduced")          coeff=mypde.getCoefficient("A_reduced")
950          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))
951      def test_setCoefficient_B_reduced_System(self):      def test_setCoefficient_B_reduced_System(self):
952          d=self.domain.getDim()          d=self.domain.getDim()
953          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
954          mypde.setValue(B_reduced=numarray.ones((self.N,d,self.N)))          mypde.setValue(B_reduced=numarray.ones((self.N,d,self.N)))
955          coeff=mypde.getCoefficientOfGeneralPDE("B_reduced")          coeff=mypde.getCoefficient("B_reduced")
956          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))
957      def test_setCoefficient_C_reduced_System(self):      def test_setCoefficient_C_reduced_System(self):
958          d=self.domain.getDim()          d=self.domain.getDim()
959          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
960          mypde.setValue(C_reduced=numarray.ones((self.N,self.N,d)))          mypde.setValue(C_reduced=numarray.ones((self.N,self.N,d)))
961          coeff=mypde.getCoefficientOfGeneralPDE("C_reduced")          coeff=mypde.getCoefficient("C_reduced")
962          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))
963      def test_setCoefficient_D_System_reduced(self):      def test_setCoefficient_D_System_reduced(self):
964          d=self.domain.getDim()          d=self.domain.getDim()
965          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
966          mypde.setValue(D_reduced=numarray.ones((self.N,self.N)))          mypde.setValue(D_reduced=numarray.ones((self.N,self.N)))
967          coeff=mypde.getCoefficientOfGeneralPDE("D_reduced")          coeff=mypde.getCoefficient("D_reduced")
968          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))
969      def test_setCoefficient_X_System_reduced(self):      def test_setCoefficient_X_System_reduced(self):
970          d=self.domain.getDim()          d=self.domain.getDim()
971          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
972          mypde.setValue(X_reduced=numarray.ones((self.N,d)))          mypde.setValue(X_reduced=numarray.ones((self.N,d)))
973          coeff=mypde.getCoefficientOfGeneralPDE("X_reduced")          coeff=mypde.getCoefficient("X_reduced")
974          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))
975      def test_setCoefficient_Y_System_reduced(self):      def test_setCoefficient_Y_System_reduced(self):
976          d=self.domain.getDim()          d=self.domain.getDim()
977          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
978          mypde.setValue(Y_reduced=numarray.ones((self.N,)))          mypde.setValue(Y_reduced=numarray.ones((self.N,)))
979          coeff=mypde.getCoefficientOfGeneralPDE("Y_reduced")          coeff=mypde.getCoefficient("Y_reduced")
980          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))
981      def test_setCoefficient_y_System_reduced(self):      def test_setCoefficient_y_System_reduced(self):
982          d=self.domain.getDim()          d=self.domain.getDim()
983          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
984          mypde.setValue(y_reduced=numarray.ones((self.N,)))          mypde.setValue(y_reduced=numarray.ones((self.N,)))
985          coeff=mypde.getCoefficientOfGeneralPDE("y_reduced")          coeff=mypde.getCoefficient("y_reduced")
986          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))
987      def test_setCoefficient_d_reduced_System(self):      def test_setCoefficient_d_reduced_System(self):
988          d=self.domain.getDim()          d=self.domain.getDim()
989          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
990          mypde.setValue(d_reduced=numarray.ones((self.N,self.N)))          mypde.setValue(d_reduced=numarray.ones((self.N,self.N)))
991          coeff=mypde.getCoefficientOfGeneralPDE("d_reduced")          coeff=mypde.getCoefficient("d_reduced")
992          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))
993      def test_setCoefficient_d_contact_reduced_System(self):      def test_setCoefficient_d_contact_reduced_System(self):
994          d=self.domain.getDim()          d=self.domain.getDim()
995          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
996          mypde.setValue(d_contact_reduced=numarray.ones((self.N,self.N)))          mypde.setValue(d_contact_reduced=numarray.ones((self.N,self.N)))
997          coeff=mypde.getCoefficientOfGeneralPDE("d_contact_reduced")          coeff=mypde.getCoefficient("d_contact_reduced")
998          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))
999      def test_setCoefficient_y_contact_reduced_System(self):      def test_setCoefficient_y_contact_reduced_System(self):
1000          d=self.domain.getDim()          d=self.domain.getDim()
1001          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1002          mypde.setValue(y_contact_reduced=numarray.ones((self.N,)))          mypde.setValue(y_contact_reduced=numarray.ones((self.N,)))
1003          coeff=mypde.getCoefficientOfGeneralPDE("y_contact_reduced")          coeff=mypde.getCoefficient("y_contact_reduced")
1004          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))
1005      def test_setCoefficient_r_System(self):      def test_setCoefficient_r_System(self):
1006          d=self.domain.getDim()          d=self.domain.getDim()
1007          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1008          mypde.setValue(r=numarray.ones((self.N,)))          mypde.setValue(r=numarray.ones((self.N,)))
1009          coeff=mypde.getCoefficientOfGeneralPDE("r")          coeff=mypde.getCoefficient("r")
1010          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))
1011      def test_setCoefficient_q_System(self):      def test_setCoefficient_q_System(self):
1012          d=self.domain.getDim()          d=self.domain.getDim()
1013          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1014          mypde.setValue(q=numarray.ones((self.N,)))          mypde.setValue(q=numarray.ones((self.N,)))
1015          coeff=mypde.getCoefficientOfGeneralPDE("q")          coeff=mypde.getCoefficient("q")
1016          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))
1017      def test_setCoefficient_r_System_reducedOn(self):      def test_setCoefficient_r_System_reducedOn(self):
1018          d=self.domain.getDim()          d=self.domain.getDim()
1019          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1020          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
1021          mypde.setValue(r=numarray.ones((self.N,)))          mypde.setValue(r=numarray.ones((self.N,)))
1022          coeff=mypde.getCoefficientOfGeneralPDE("r")          coeff=mypde.getCoefficient("r")
1023          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))
1024      def test_setCoefficient_q_System_reducedOn(self):      def test_setCoefficient_q_System_reducedOn(self):
1025          d=self.domain.getDim()          d=self.domain.getDim()
1026          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1027          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
1028          mypde.setValue(q=numarray.ones((self.N,)))          mypde.setValue(q=numarray.ones((self.N,)))
1029          coeff=mypde.getCoefficientOfGeneralPDE("q")          coeff=mypde.getCoefficient("q")
1030          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))
1031    
1032      def test_setCoefficient_A_reduced_System_using_A(self):      def test_setCoefficient_A_reduced_System_using_A(self):
1033          d=self.domain.getDim()          d=self.domain.getDim()
1034          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1035          mypde.setValue(A=Data(numarray.ones((self.N,d,self.N,d)),ReducedFunction(self.domain)))          mypde.setValue(A=Data(numarray.ones((self.N,d,self.N,d)),ReducedFunction(self.domain)))
1036          coeff=mypde.getCoefficientOfGeneralPDE("A_reduced")          coeff=mypde.getCoefficient("A_reduced")
1037          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))
1038      def test_setCoefficient_B_reduced_System_using_B(self):      def test_setCoefficient_B_reduced_System_using_B(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(B=Data(numarray.ones((self.N,d,self.N)),ReducedFunction(self.domain)))          mypde.setValue(B=Data(numarray.ones((self.N,d,self.N)),ReducedFunction(self.domain)))
1042          coeff=mypde.getCoefficientOfGeneralPDE("B_reduced")          coeff=mypde.getCoefficient("B_reduced")
1043          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))
1044      def test_setCoefficient_C_reduced_System_using_C(self):      def test_setCoefficient_C_reduced_System_using_C(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(C=Data(numarray.ones((self.N,self.N,d)),ReducedFunction(self.domain)))          mypde.setValue(C=Data(numarray.ones((self.N,self.N,d)),ReducedFunction(self.domain)))
1048          coeff=mypde.getCoefficientOfGeneralPDE("C_reduced")          coeff=mypde.getCoefficient("C_reduced")
1049          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))
1050      def test_setCoefficient_D_System_reduced_using_D(self):      def test_setCoefficient_D_System_reduced_using_D(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(D=Data(numarray.ones((self.N,self.N)),ReducedFunction(self.domain)))          mypde.setValue(D=Data(numarray.ones((self.N,self.N)),ReducedFunction(self.domain)))
1054          coeff=mypde.getCoefficientOfGeneralPDE("D_reduced")          coeff=mypde.getCoefficient("D_reduced")
1055          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))
1056      def test_setCoefficient_X_System_reduced_using_X(self):      def test_setCoefficient_X_System_reduced_using_X(self):
1057          d=self.domain.getDim()          d=self.domain.getDim()
1058          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1059          mypde.setValue(X=Data(numarray.ones((self.N,d)),ReducedFunction(self.domain)))          mypde.setValue(X=Data(numarray.ones((self.N,d)),ReducedFunction(self.domain)))
1060          coeff=mypde.getCoefficientOfGeneralPDE("X_reduced")          coeff=mypde.getCoefficient("X_reduced")
1061          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))
1062      def test_setCoefficient_Y_System_reduced_using_Y(self):      def test_setCoefficient_Y_System_reduced_using_Y(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(Y=Data(numarray.ones((self.N,)),ReducedFunction(self.domain)))          mypde.setValue(Y=Data(numarray.ones((self.N,)),ReducedFunction(self.domain)))
1066          coeff=mypde.getCoefficientOfGeneralPDE("Y_reduced")          coeff=mypde.getCoefficient("Y_reduced")
1067          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))
1068      def test_setCoefficient_y_reduced_System_using_y(self):      def test_setCoefficient_y_reduced_System_using_y(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=Data(numarray.ones((self.N,)),ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(y=Data(numarray.ones((self.N,)),ReducedFunctionOnBoundary(self.domain)))
1072          coeff=mypde.getCoefficientOfGeneralPDE("y_reduced")          coeff=mypde.getCoefficient("y_reduced")
1073          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))
1074      def test_setCoefficient_d_reduced_System_using_d(self):      def test_setCoefficient_d_reduced_System_using_d(self):
1075          d=self.domain.getDim()          d=self.domain.getDim()
1076          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1077          mypde.setValue(d=Data(numarray.ones((self.N,self.N)),ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(d=Data(numarray.ones((self.N,self.N)),ReducedFunctionOnBoundary(self.domain)))
1078          coeff=mypde.getCoefficientOfGeneralPDE("d_reduced")          coeff=mypde.getCoefficient("d_reduced")
1079          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))
1080      def test_setCoefficient_d_contact_reduced_System_using_d_contact(self):      def test_setCoefficient_d_contact_reduced_System_using_d_contact(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_contact=Data(numarray.ones((self.N,self.N)),ReducedFunctionOnContactZero(self.domain)))          mypde.setValue(d_contact=Data(numarray.ones((self.N,self.N)),ReducedFunctionOnContactZero(self.domain)))
1084          coeff=mypde.getCoefficientOfGeneralPDE("d_contact_reduced")          coeff=mypde.getCoefficient("d_contact_reduced")
1085          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))
1086      def test_setCoefficient_y_contact_reduced_System_using_y_contact(self):      def test_setCoefficient_y_contact_reduced_System_using_y_contact(self):
1087          d=self.domain.getDim()          d=self.domain.getDim()
1088          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1089          mypde.setValue(y_contact=Data(numarray.ones((self.N,)),ReducedFunctionOnContactZero(self.domain)))          mypde.setValue(y_contact=Data(numarray.ones((self.N,)),ReducedFunctionOnContactZero(self.domain)))
1090          coeff=mypde.getCoefficientOfGeneralPDE("y_contact_reduced")          coeff=mypde.getCoefficient("y_contact_reduced")
1091          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))
1092      def test_resetCoefficient_HomogeneousConstraint(self):      def test_resetCoefficient_HomogeneousConstraint(self):
1093          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 822  class Test_LinearPDE_noLumping(Test_line Line 1267  class Test_LinearPDE_noLumping(Test_line
1267          mypde.setSolverMethod(mypde.PCG,mypde.ILU0)          mypde.setSolverMethod(mypde.PCG,mypde.ILU0)
1268          u=mypde.getSolution(verbose=self.VERBOSE)          u=mypde.getSolution(verbose=self.VERBOSE)
1269          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1270        def test_PCG_RILU(self):
1271            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1272            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1273            mypde.setSolverMethod(mypde.PCG,mypde.RILU)
1274            u=mypde.getSolution(verbose=self.VERBOSE)
1275            self.failUnless(self.check(u,1.),'solution is wrong.')
1276      def test_DIRECT(self):      def test_DIRECT(self):
1277          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1278          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
# Line 840  class Test_LinearPDE_noLumping(Test_line Line 1291  class Test_LinearPDE_noLumping(Test_line
1291      mypde.setSolverMethod(mypde.BICGSTAB,mypde.ILU0)      mypde.setSolverMethod(mypde.BICGSTAB,mypde.ILU0)
1292          u=mypde.getSolution(verbose=self.VERBOSE)          u=mypde.getSolution(verbose=self.VERBOSE)
1293          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1294        def test_BICGSTAB_RILU(self):
1295            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1296            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1297        mypde.setSolverMethod(mypde.BICGSTAB,mypde.RILU)
1298            u=mypde.getSolution(verbose=self.VERBOSE)
1299            self.failUnless(self.check(u,1.),'solution is wrong.')
1300        def test_MINRES_JACOBI(self):
1301            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1302        mypde.setSolverMethod(mypde.MINRES,mypde.JACOBI)
1303            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1304            u=mypde.getSolution(verbose=self.VERBOSE)
1305            self.failUnless(self.check(u,1.),'solution is wrong.')
1306        def test_MINRES_ILU0(self):
1307            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1308            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1309        mypde.setSolverMethod(mypde.MINRES,mypde.ILU0)
1310            u=mypde.getSolution(verbose=self.VERBOSE)
1311            self.failUnless(self.check(u,1.),'solution is wrong.')
1312        def test_MINRES_RILU(self):
1313            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1314            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1315        mypde.setSolverMethod(mypde.MINRES,mypde.RILU)
1316            u=mypde.getSolution(verbose=self.VERBOSE)
1317            self.failUnless(self.check(u,1.),'solution is wrong.')
1318        def test_TFQMR_JACOBI(self):
1319            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1320        mypde.setSolverMethod(mypde.TFQMR,mypde.JACOBI)
1321            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1322            u=mypde.getSolution(verbose=self.VERBOSE)
1323            self.failUnless(self.check(u,1.),'solution is wrong.')
1324        def test_TFQMR_ILU0(self):
1325            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1326            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1327        mypde.setSolverMethod(mypde.TFQMR,mypde.ILU0)
1328            u=mypde.getSolution(verbose=self.VERBOSE)
1329            self.failUnless(self.check(u,1.),'solution is wrong.')
1330        def test_TFQMR_RILU(self):
1331            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1332            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1333        mypde.setSolverMethod(mypde.TFQMR,mypde.RILU)
1334            u=mypde.getSolution(verbose=self.VERBOSE)
1335            self.failUnless(self.check(u,1.),'solution is wrong.')
1336      def test_PRES20_JACOBI(self):      def test_PRES20_JACOBI(self):
1337          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1338          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
# Line 852  class Test_LinearPDE_noLumping(Test_line Line 1345  class Test_LinearPDE_noLumping(Test_line
1345      mypde.setSolverMethod(mypde.PRES20,mypde.ILU0)      mypde.setSolverMethod(mypde.PRES20,mypde.ILU0)
1346          u=mypde.getSolution(verbose=self.VERBOSE)          u=mypde.getSolution(verbose=self.VERBOSE)
1347          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1348        def test_PRES20_RILU(self):
1349            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1350            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1351        mypde.setSolverMethod(mypde.PRES20,mypde.RILU)
1352            u=mypde.getSolution(verbose=self.VERBOSE)
1353            self.failUnless(self.check(u,1.),'solution is wrong.')
1354      def test_GMRESnoRestart_JACOBI(self):      def test_GMRESnoRestart_JACOBI(self):
1355          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1356          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1357      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)
1358          # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)          u=mypde.getSolution(verbose=self.VERBOSE,truncation=50)
         u=mypde.getSolution(verbose=self.VERBOSE)  
1359          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1360      def test_GMRESnoRestart_ILU0(self):      def test_GMRESnoRestart_ILU0(self):
1361          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1362          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1363      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)
1364          # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)          u=mypde.getSolution(verbose=self.VERBOSE,truncation=50)
1365            u=mypde.getSolution(verbose=self.VERBOSE)
1366            self.failUnless(self.check(u,1.),'solution is wrong.')
1367        def test_GMRESnoRestart_RILU(self):
1368            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1369            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1370        mypde.setSolverMethod(mypde.GMRES,mypde.RILU)
1371            u=mypde.getSolution(verbose=self.VERBOSE,truncation=50)
1372          u=mypde.getSolution(verbose=self.VERBOSE)          u=mypde.getSolution(verbose=self.VERBOSE)
1373          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1374      def test_GMRES_JACOBI(self):      def test_GMRES_JACOBI(self):
# Line 878  class Test_LinearPDE_noLumping(Test_line Line 1383  class Test_LinearPDE_noLumping(Test_line
1383      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)
1384          u=mypde.getSolution(verbose=self.VERBOSE)          u=mypde.getSolution(verbose=self.VERBOSE)
1385          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1386        def test_GMRES_RILU(self):
1387            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1388            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1389        mypde.setSolverMethod(mypde.GMRES,mypde.RILU)
1390            u=mypde.getSolution(verbose=self.VERBOSE)
1391            self.failUnless(self.check(u,1.),'solution is wrong.')
1392      def test_GMRES_truncation_restart_JACOBI(self):      def test_GMRES_truncation_restart_JACOBI(self):
1393          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1394          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
# Line 890  class Test_LinearPDE_noLumping(Test_line Line 1401  class Test_LinearPDE_noLumping(Test_line
1401      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)
1402          u=mypde.getSolution(verbose=self.VERBOSE,truncation=10,restart=20)          u=mypde.getSolution(verbose=self.VERBOSE,truncation=10,restart=20)
1403          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1404        def test_GMRES_truncation_restart_RILU(self):
1405            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1406            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1407        mypde.setSolverMethod(mypde.GMRES,mypde.RILU)
1408            u=mypde.getSolution(verbose=self.VERBOSE,truncation=10,restart=20)
1409            self.failUnless(self.check(u,1.),'solution is wrong.')
1410      #      #
1411      #   solver checks (PDE system)      #   solver checks (PDE system)
1412      #      #
# Line 1202  class Test_LinearPDE(Test_LinearPDE_noLu Line 1719  class Test_LinearPDE(Test_LinearPDE_noLu
1719          u=mypde.getSolution(verbose=self.VERBOSE)          u=mypde.getSolution(verbose=self.VERBOSE)
1720          self.failUnless(self.check(u,0.5),'second solution is wrong.')          self.failUnless(self.check(u,0.5),'second solution is wrong.')
1721    
1722    
1723    class Test_TransportPDE(Test_linearPDEs):
1724        N=4
1725        def test_init_useBackwardEuler(self):
1726            mypde=TransportPDE(self.domain,debug=self.DEBUG, useBackwardEuler=True)
1727            self.failUnless(mypde.useBackwardEuler()==True,'backward Euler should be used')
1728        def test_init_donntUseBackwardEuler(self):
1729            mypde=TransportPDE(self.domain,debug=self.DEBUG, useBackwardEuler=False)
1730            self.failUnless(mypde.useBackwardEuler()==False,'backward Euler should not be used')
1731        def test_setCoefficient_WithWrongName(self):
1732            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1733            self.failUnlessRaises(IllegalCoefficient,mypde.setValue, ROMA=Vector(0.,FunctionOnBoundary(self.domain)))
1734    
1735        def test_setCoefficient_WithIllegalFunctionSpace(self):
1736            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1737            self.failUnlessRaises(IllegalCoefficientFunctionSpace,mypde.setValue,C=Vector(0.,FunctionOnBoundary(self.domain)))
1738            
1739        def test_resetCoefficient_WithWrongShape(self):
1740            mypde=TransportPDE(self.domain,numEquations=2,debug=self.DEBUG)
1741            self.failUnlessRaises(IllegalCoefficientValue, mypde.setValue, C=0.)
1742    
1743        def test_setInitialSolution_scalar(self):
1744            mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)
1745            mypde.setInitialSolution(1.)
1746    
1747        def test_setInitialSolution_scalar_negative(self):
1748            mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)
1749            self.failUnlessRaises(RuntimeError,mypde.setInitialSolution,-1.)
1750    
1751        def test_setInitialSolution_scalar_WithWrongShape(self):
1752            mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)
1753            self.failUnlessRaises(ValueError,mypde.setInitialSolution,[1.,2.])
1754    
1755        def test_setInitialSolution_system(self):
1756            mypde=TransportPDE(self.domain,numSolutions=2,debug=self.DEBUG)
1757            mypde.setInitialSolution([1.,2.])
1758    
1759        def test_setInitialSolution_system(self):
1760            mypde=TransportPDE(self.domain,numSolutions=2,debug=self.DEBUG)
1761            self.failUnlessRaises(RuntimeError,mypde.setInitialSolution,[-1,2.])
1762    
1763        def test_setInitialSolution_system_WithWrongShape(self):
1764            mypde=TransportPDE(self.domain,numSolutions=2,debug=self.DEBUG)
1765            self.failUnlessRaises(ValueError,mypde.setInitialSolution,1.)
1766    
1767    
1768        def test_attemptToChangeOrderAfterDefinedCoefficient(self):
1769            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1770            mypde.setValue(D=1.)
1771            self.failUnlessRaises(RuntimeError, mypde.setReducedOrderOn)
1772    
1773        def test_reducedOnConfig(self):
1774            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1775            mypde.setReducedOrderOn()
1776            self.failUnlessEqual((mypde.getFunctionSpaceForSolution(),mypde.getFunctionSpaceForEquation()),(ReducedSolution(self.domain),ReducedSolution(self.domain)),"reduced function spaces expected.")
1777        #
1778        #  set coefficients for scalars:
1779        #
1780        def test_setCoefficient_M_Scalar(self):
1781            d=self.domain.getDim()
1782            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1783            mypde.setValue(M=1.)
1784            coeff=mypde.getCoefficient("M")
1785            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),Function(self.domain),1,1))
1786        def test_setCoefficient_A_Scalar(self):
1787            d=self.domain.getDim()
1788            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1789            mypde.setValue(A=numarray.ones((d,d)))
1790            coeff=mypde.getCoefficient("A")
1791            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,d),Function(self.domain),1,1))
1792        def test_setCoefficient_B_Scalar(self):
1793            d=self.domain.getDim()
1794            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1795            mypde.setValue(B=numarray.ones((d,)))
1796            coeff=mypde.getCoefficient("B")
1797            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),Function(self.domain),1,1))
1798        def test_setCoefficient_C_Scalar(self):
1799            d=self.domain.getDim()
1800            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1801            mypde.setValue(C=numarray.ones((d,)))
1802            coeff=mypde.getCoefficient("C")
1803            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),Function(self.domain),1,1))
1804        def test_setCoefficient_D_Scalar(self):
1805            d=self.domain.getDim()
1806            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1807            mypde.setValue(D=1.)
1808            coeff=mypde.getCoefficient("D")
1809            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),Function(self.domain),1,1))
1810        def test_setCoefficient_X_Scalar(self):
1811            d=self.domain.getDim()
1812            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1813            mypde.setValue(X=numarray.ones((d,)))
1814            coeff=mypde.getCoefficient("X")
1815            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((d,),Function(self.domain),1))
1816        def test_setCoefficient_Y_Scalar(self):
1817            d=self.domain.getDim()
1818            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1819            mypde.setValue(Y=1.)
1820            coeff=mypde.getCoefficient("Y")
1821            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),Function(self.domain),1))
1822        def test_setCoefficient_y_Scalar(self):
1823            d=self.domain.getDim()
1824            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1825            mypde.setValue(y=1.)
1826            coeff=mypde.getCoefficient("y")
1827            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1))
1828        def test_setCoefficient_d_Scalar(self):
1829            d=self.domain.getDim()
1830            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1831            mypde.setValue(d=1.)
1832            coeff=mypde.getCoefficient("d")
1833            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1,1))
1834        def test_setCoefficient_m_Scalar(self):
1835            d=self.domain.getDim()
1836            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1837            mypde.setValue(m=1.)
1838            coeff=mypde.getCoefficient("m")
1839            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1,1))
1840        def test_setCoefficient_d_contact_Scalar(self):
1841            d=self.domain.getDim()
1842            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1843            mypde.setValue(d_contact=1.)
1844            coeff=mypde.getCoefficient("d_contact")
1845            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),FunctionOnContactZero(self.domain),1,1))
1846        def test_setCoefficient_y_contact_Scalar(self):
1847            d=self.domain.getDim()
1848            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1849            mypde.setValue(y_contact=1.)
1850            coeff=mypde.getCoefficient("y_contact")
1851            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),FunctionOnContactZero(self.domain),1))
1852    
1853        def test_setCoefficient_M_reduced_Scalar(self):
1854            d=self.domain.getDim()
1855            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1856            mypde.setValue(M_reduced=1.)
1857            coeff=mypde.getCoefficient("M_reduced")
1858            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1,1))
1859        def test_setCoefficient_A_reduced_Scalar(self):
1860            d=self.domain.getDim()
1861            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1862            mypde.setValue(A_reduced=numarray.ones((d,d)))
1863            coeff=mypde.getCoefficient("A_reduced")
1864            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,d),ReducedFunction(self.domain),1,1))
1865        def test_setCoefficient_B_reduced_Scalar(self):
1866            d=self.domain.getDim()
1867            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1868            mypde.setValue(B_reduced=numarray.ones((d,)))
1869            coeff=mypde.getCoefficient("B_reduced")
1870            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))
1871        def test_setCoefficient_C_reduced_Scalar(self):
1872            d=self.domain.getDim()
1873            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1874            mypde.setValue(C_reduced=numarray.ones((d,)))
1875            coeff=mypde.getCoefficient("C_reduced")
1876            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))
1877        def test_setCoefficient_D_reduced_Scalar(self):
1878            d=self.domain.getDim()
1879            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1880            mypde.setValue(D_reduced=1.)
1881            coeff=mypde.getCoefficient("D_reduced")
1882            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1,1))
1883        def test_setCoefficient_X_reduced_Scalar(self):
1884            d=self.domain.getDim()
1885            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1886            mypde.setValue(X_reduced=numarray.ones((d,)))
1887            coeff=mypde.getCoefficient("X_reduced")
1888            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1))
1889        def test_setCoefficient_Y_reduced_Scalar(self):
1890            d=self.domain.getDim()
1891            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1892            mypde.setValue(Y_reduced=1.)
1893            coeff=mypde.getCoefficient("Y_reduced")
1894            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1))
1895        def test_setCoefficient_y_reduced_Scalar(self):
1896            d=self.domain.getDim()
1897            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1898            mypde.setValue(y_reduced=1.)
1899            coeff=mypde.getCoefficient("y_reduced")
1900            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))
1901        def test_setCoefficient_m_reduced_Scalar(self):
1902            d=self.domain.getDim()
1903            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1904            mypde.setValue(m_reduced=1.)
1905            coeff=mypde.getCoefficient("m_reduced")
1906            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1,1))
1907        def test_setCoefficient_d_reduced_Scalar(self):
1908            d=self.domain.getDim()
1909            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1910            mypde.setValue(d_reduced=1.)
1911            coeff=mypde.getCoefficient("d_reduced")
1912            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1,1))
1913        def test_setCoefficient_d_contact_reduced_Scalar(self):
1914            d=self.domain.getDim()
1915            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1916            mypde.setValue(d_contact_reduced=1.)
1917            coeff=mypde.getCoefficient("d_contact_reduced")
1918            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1,1))
1919        def test_setCoefficient_y_contact_reduced_Scalar(self):
1920            d=self.domain.getDim()
1921            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1922            mypde.setValue(y_contact_reduced=1.)
1923            coeff=mypde.getCoefficient("y_contact_reduced")
1924            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))
1925        def test_setCoefficient_r_Scalar(self):
1926            d=self.domain.getDim()
1927            mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
1928            mypde.setValue(r=1.)
1929            coeff=mypde.getCoefficient("r")
1930            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),Solution(self.domain),1))
1931        def test_setCoefficient_q_Scalar(self):
1932            d=self.domain.getDim()
1933            mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
1934            mypde.setValue(q=1.)
1935            coeff=mypde.getCoefficient("q")
1936            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),Solution(self.domain),1))
1937        def test_setCoefficient_r_Scalar_reducedOn(self):
1938            d=self.domain.getDim()
1939            mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
1940            mypde.setReducedOrderOn()
1941            mypde.setValue(r=1.)
1942            coeff=mypde.getCoefficient("r")
1943            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))
1944        def test_setCoefficient_q_Scalar_reducedOn(self):
1945            d=self.domain.getDim()
1946            mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
1947            mypde.setReducedOrderOn()
1948            mypde.setValue(q=1.)
1949            coeff=mypde.getCoefficient("q")
1950            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))
1951    
1952        def test_setCoefficient_M_reduced_Scalar_usingM(self):
1953            d=self.domain.getDim()
1954            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1955            mypde.setValue(M=Scalar(1.,ReducedFunction(self.domain)))
1956            coeff=mypde.getCoefficient("M_reduced")
1957            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1,1))
1958        def test_setCoefficient_A_reduced_Scalar_usingA(self):
1959            d=self.domain.getDim()
1960            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1961            mypde.setValue(A=Data(numarray.ones((d,d)),ReducedFunction(self.domain)))
1962            coeff=mypde.getCoefficient("A_reduced")
1963            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,d),ReducedFunction(self.domain),1,1))
1964        def test_setCoefficient_B_reduced_Scalar_usingB(self):
1965            d=self.domain.getDim()
1966            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1967            mypde.setValue(B=Data(numarray.ones((d,)),ReducedFunction(self.domain)))
1968            coeff=mypde.getCoefficient("B_reduced")
1969            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))
1970        def test_setCoefficient_C_reduced_Scalar_usingC(self):
1971            d=self.domain.getDim()
1972            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1973            mypde.setValue(C=Data(numarray.ones((d,)),ReducedFunction(self.domain)))
1974            coeff=mypde.getCoefficient("C_reduced")
1975            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))
1976        def test_setCoefficient_D_reduced_Scalar_usingD(self):
1977            d=self.domain.getDim()
1978            mypde=TransportPDE(self.domain,debug=self.DEBUG)
1979            mypde.setValue(D=Scalar(1.,ReducedFunction(self.domain)))
1980            coeff=mypde.getCoefficient("D_reduced")
1981            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1,1))
1982        def test_setCoefficient_X_reduced_Scalar_usingX(self):
1983            d=self.domain.getDim()
1984            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1985            mypde.setValue(X_reduced=Data(numarray.ones((d,)),ReducedFunction(self.domain)))
1986            coeff=mypde.getCoefficient("X_reduced")
1987            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1))
1988        def test_setCoefficient_Y_reduced_Scalar_usingY(self):
1989            d=self.domain.getDim()
1990            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1991            mypde.setValue(Y=Scalar(1.,ReducedFunction(self.domain)))
1992            coeff=mypde.getCoefficient("Y_reduced")
1993            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1))
1994        def test_setCoefficient_y_reduced_Scalar_using_y(self):
1995            d=self.domain.getDim()
1996            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1997            mypde.setValue(y=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))
1998            coeff=mypde.getCoefficient("y_reduced")
1999            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))
2000        def test_setCoefficient_m_reduced_Scalar_using_m(self):
2001            d=self.domain.getDim()
2002            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2003            mypde.setValue(d=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))
2004            coeff=mypde.getCoefficient("d_reduced")
2005            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1,1))
2006        def test_setCoefficient_d_reduced_Scalar_using_d(self):
2007            d=self.domain.getDim()
2008            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2009            mypde.setValue(m=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))
2010            coeff=mypde.getCoefficient("m_reduced")
2011            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1,1))
2012        def test_setCoefficient_d_contact_reduced_Scalar_using_d_contact(self):
2013            d=self.domain.getDim()
2014            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2015            mypde.setValue(d_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))
2016            coeff=mypde.getCoefficient("d_contact_reduced")
2017            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1,1))
2018        def test_setCoefficient_y_contact_reduced_Scalar_using_y_contact(self):
2019            d=self.domain.getDim()
2020            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2021            mypde.setValue(y_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))
2022            coeff=mypde.getCoefficient("y_contact_reduced")
2023            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))
2024        #
2025        #  set coefficients for systems:
2026        #
2027        def test_setCoefficient_M_System(self):
2028            d=self.domain.getDim()
2029            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2030            mypde.setValue(M=numarray.ones((self.N,self.N)))
2031            coeff=mypde.getCoefficient("M")
2032            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),Function(self.domain),self.N,self.N))
2033        def test_setCoefficient_A_System(self):
2034            d=self.domain.getDim()
2035            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2036            mypde.setValue(A=numarray.ones((self.N,d,self.N,d)))
2037            coeff=mypde.getCoefficient("A")
2038            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N,d),Function(self.domain),self.N,self.N))
2039        def test_setCoefficient_B_System(self):
2040            d=self.domain.getDim()
2041            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2042            mypde.setValue(B=numarray.ones((self.N,d,self.N)))
2043            coeff=mypde.getCoefficient("B")
2044            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N),Function(self.domain),self.N,self.N))
2045        def test_setCoefficient_C_System(self):
2046            d=self.domain.getDim()
2047            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2048            mypde.setValue(C=numarray.ones((self.N,self.N,d)))
2049            coeff=mypde.getCoefficient("C")
2050            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N,d),Function(self.domain),self.N,self.N))
2051        def test_setCoefficient_D_System(self):
2052            d=self.domain.getDim()
2053            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2054            mypde.setValue(D=numarray.ones((self.N,self.N)))
2055            coeff=mypde.getCoefficient("D")
2056            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),Function(self.domain),self.N,self.N))
2057        def test_setCoefficient_X_System(self):
2058            d=self.domain.getDim()
2059            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2060            mypde.setValue(X=numarray.ones((self.N,d)))
2061            coeff=mypde.getCoefficient("X")
2062            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,d),Function(self.domain),self.N))
2063        def test_setCoefficient_Y_System(self):
2064            d=self.domain.getDim()
2065            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2066            mypde.setValue(Y=numarray.ones((self.N,)))
2067            coeff=mypde.getCoefficient("Y")
2068            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),Function(self.domain),self.N))
2069        def test_setCoefficient_y_System(self):
2070            d=self.domain.getDim()
2071            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2072            mypde.setValue(y=numarray.ones((self.N,)))
2073            coeff=mypde.getCoefficient("y")
2074            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),FunctionOnBoundary(self.domain),self.N))
2075        def test_setCoefficient_m_System(self):
2076            d=self.domain.getDim()
2077            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2078            mypde.setValue(m=numarray.ones((self.N,self.N)))
2079            coeff=mypde.getCoefficient("m")
2080            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),FunctionOnBoundary(self.domain),self.N,self.N))
2081        def test_setCoefficient_d_System(self):
2082            d=self.domain.getDim()
2083            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2084            mypde.setValue(d=numarray.ones((self.N,self.N)))
2085            coeff=mypde.getCoefficient("d")
2086            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),FunctionOnBoundary(self.domain),self.N,self.N))
2087        def test_setCoefficient_d_contact_System(self):
2088            d=self.domain.getDim()
2089            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2090            mypde.setValue(d_contact=numarray.ones((self.N,self.N)))
2091            coeff=mypde.getCoefficient("d_contact")
2092            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),FunctionOnContactZero(self.domain),self.N,self.N))
2093        def test_setCoefficient_y_contact_System(self):
2094            d=self.domain.getDim()
2095            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2096            mypde.setValue(y_contact=numarray.ones((self.N,)))
2097            coeff=mypde.getCoefficient("y_contact")
2098            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),FunctionOnContactZero(self.domain),self.N))
2099        def test_setCoefficient_M_System_reduced(self):
2100            d=self.domain.getDim()
2101            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2102            mypde.setValue(M_reduced=numarray.ones((self.N,self.N)))
2103            coeff=mypde.getCoefficient("M_reduced")
2104            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunction(self.domain),self.N,self.N))
2105        def test_setCoefficient_A_reduced_System(self):
2106            d=self.domain.getDim()
2107            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2108            mypde.setValue(A_reduced=numarray.ones((self.N,d,self.N,d)))
2109            coeff=mypde.getCoefficient("A_reduced")
2110            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N,d),ReducedFunction(self.domain),self.N,self.N))
2111        def test_setCoefficient_B_reduced_System(self):
2112            d=self.domain.getDim()
2113            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2114            mypde.setValue(B_reduced=numarray.ones((self.N,d,self.N)))
2115            coeff=mypde.getCoefficient("B_reduced")
2116            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N),ReducedFunction(self.domain),self.N,self.N))
2117        def test_setCoefficient_C_reduced_System(self):
2118            d=self.domain.getDim()
2119            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2120            mypde.setValue(C_reduced=numarray.ones((self.N,self.N,d)))
2121            coeff=mypde.getCoefficient("C_reduced")
2122            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N,d),ReducedFunction(self.domain),self.N,self.N))
2123        def test_setCoefficient_D_System_reduced(self):
2124            d=self.domain.getDim()
2125            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2126            mypde.setValue(D_reduced=numarray.ones((self.N,self.N)))
2127            coeff=mypde.getCoefficient("D_reduced")
2128            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunction(self.domain),self.N,self.N))
2129        def test_setCoefficient_X_System_reduced(self):
2130            d=self.domain.getDim()
2131            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2132            mypde.setValue(X_reduced=numarray.ones((self.N,d)))
2133            coeff=mypde.getCoefficient("X_reduced")
2134            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,d),ReducedFunction(self.domain),self.N))
2135        def test_setCoefficient_Y_System_reduced(self):
2136            d=self.domain.getDim()
2137            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2138            mypde.setValue(Y_reduced=numarray.ones((self.N,)))
2139            coeff=mypde.getCoefficient("Y_reduced")
2140            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunction(self.domain),self.N))
2141        def test_setCoefficient_y_System_reduced(self):
2142            d=self.domain.getDim()
2143            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2144            mypde.setValue(y_reduced=numarray.ones((self.N,)))
2145            coeff=mypde.getCoefficient("y_reduced")
2146            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunctionOnBoundary(self.domain),self.N))
2147        def test_setCoefficient_m_reduced_System(self):
2148            d=self.domain.getDim()
2149            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2150            mypde.setValue(m_reduced=numarray.ones((self.N,self.N)))
2151            coeff=mypde.getCoefficient("m_reduced")
2152            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnBoundary(self.domain),self.N,self.N))
2153        def test_setCoefficient_d_reduced_System(self):
2154            d=self.domain.getDim()
2155            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2156            mypde.setValue(d_reduced=numarray.ones((self.N,self.N)))
2157            coeff=mypde.getCoefficient("d_reduced")
2158            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnBoundary(self.domain),self.N,self.N))
2159        def test_setCoefficient_d_contact_reduced_System(self):
2160            d=self.domain.getDim()
2161            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2162            mypde.setValue(d_contact_reduced=numarray.ones((self.N,self.N)))
2163            coeff=mypde.getCoefficient("d_contact_reduced")
2164            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnContactZero(self.domain),self.N,self.N))
2165        def test_setCoefficient_y_contact_reduced_System(self):
2166            d=self.domain.getDim()
2167            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2168            mypde.setValue(y_contact_reduced=numarray.ones((self.N,)))
2169            coeff=mypde.getCoefficient("y_contact_reduced")
2170            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunctionOnContactZero(self.domain),self.N))
2171        def test_setCoefficient_r_System(self):
2172            d=self.domain.getDim()
2173            mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
2174            mypde.setValue(r=numarray.ones((self.N,)))
2175            coeff=mypde.getCoefficient("r")
2176            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((self.N,),Solution(self.domain),self.N))
2177        def test_setCoefficient_q_System(self):
2178            d=self.domain.getDim()
2179            mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
2180            mypde.setValue(q=numarray.ones((self.N,)))
2181            coeff=mypde.getCoefficient("q")
2182            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((self.N,),Solution(self.domain),self.N))
2183        def test_setCoefficient_r_System_reducedOn(self):
2184            d=self.domain.getDim()
2185            mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
2186            mypde.setReducedOrderOn()
2187            mypde.setValue(r=numarray.ones((self.N,)))
2188            coeff=mypde.getCoefficient("r")
2189            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((self.N,),ReducedSolution(self.domain),self.N))
2190        def test_setCoefficient_q_System_reducedOn(self):
2191            d=self.domain.getDim()
2192            mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
2193            mypde.setReducedOrderOn()
2194            mypde.setValue(q=numarray.ones((self.N,)))
2195            coeff=mypde.getCoefficient("q")
2196            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((self.N,),ReducedSolution(self.domain),self.N))
2197    
2198        def test_setCoefficient_M_System_reduced_using_D(self):
2199            d=self.domain.getDim()
2200            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2201            mypde.setValue(M=Data(numarray.ones((self.N,self.N)),ReducedFunction(self.domain)))
2202            coeff=mypde.getCoefficient("M_reduced")
2203            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunction(self.domain),self.N,self.N))
2204        def test_setCoefficient_A_reduced_System_using_A(self):
2205            d=self.domain.getDim()
2206            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2207            mypde.setValue(A=Data(numarray.ones((self.N,d,self.N,d)),ReducedFunction(self.domain)))
2208            coeff=mypde.getCoefficient("A_reduced")
2209            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N,d),ReducedFunction(self.domain),self.N,self.N))
2210        def test_setCoefficient_B_reduced_System_using_B(self):
2211            d=self.domain.getDim()
2212            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2213            mypde.setValue(B=Data(numarray.ones((self.N,d,self.N)),ReducedFunction(self.domain)))
2214            coeff=mypde.getCoefficient("B_reduced")
2215            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N),ReducedFunction(self.domain),self.N,self.N))
2216        def test_setCoefficient_C_reduced_System_using_C(self):
2217            d=self.domain.getDim()
2218            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2219            mypde.setValue(C=Data(numarray.ones((self.N,self.N,d)),ReducedFunction(self.domain)))
2220            coeff=mypde.getCoefficient("C_reduced")
2221            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N,d),ReducedFunction(self.domain),self.N,self.N))
2222        def test_setCoefficient_D_System_reduced_using_D(self):
2223            d=self.domain.getDim()
2224            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2225            mypde.setValue(D=Data(numarray.ones((self.N,self.N)),ReducedFunction(self.domain)))
2226            coeff=mypde.getCoefficient("D_reduced")
2227            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunction(self.domain),self.N,self.N))
2228        def test_setCoefficient_X_System_reduced_using_X(self):
2229            d=self.domain.getDim()
2230            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2231            mypde.setValue(X=Data(numarray.ones((self.N,d)),ReducedFunction(self.domain)))
2232            coeff=mypde.getCoefficient("X_reduced")
2233            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,d),ReducedFunction(self.domain),self.N))
2234        def test_setCoefficient_Y_System_reduced_using_Y(self):
2235            d=self.domain.getDim()
2236            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2237            mypde.setValue(Y=Data(numarray.ones((self.N,)),ReducedFunction(self.domain)))
2238            coeff=mypde.getCoefficient("Y_reduced")
2239            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunction(self.domain),self.N))
2240        def test_setCoefficient_y_reduced_System_using_y(self):
2241            d=self.domain.getDim()
2242            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2243            mypde.setValue(y=Data(numarray.ones((self.N,)),ReducedFunctionOnBoundary(self.domain)))
2244            coeff=mypde.getCoefficient("y_reduced")
2245            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunctionOnBoundary(self.domain),self.N))
2246        def test_setCoefficient_m_reduced_System_using_m(self):
2247            d=self.domain.getDim()
2248            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2249            mypde.setValue(m=Data(numarray.ones((self.N,self.N)),ReducedFunctionOnBoundary(self.domain)))
2250            coeff=mypde.getCoefficient("m_reduced")
2251            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnBoundary(self.domain),self.N,self.N))
2252        def test_setCoefficient_d_reduced_System_using_d(self):
2253            d=self.domain.getDim()
2254            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2255            mypde.setValue(d=Data(numarray.ones((self.N,self.N)),ReducedFunctionOnBoundary(self.domain)))
2256            coeff=mypde.getCoefficient("d_reduced")
2257            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnBoundary(self.domain),self.N,self.N))
2258        def test_setCoefficient_d_contact_reduced_System_using_d_contact(self):
2259            d=self.domain.getDim()
2260            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2261            mypde.setValue(d_contact=Data(numarray.ones((self.N,self.N)),ReducedFunctionOnContactZero(self.domain)))
2262            coeff=mypde.getCoefficient("d_contact_reduced")
2263            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnContactZero(self.domain),self.N,self.N))
2264        def test_setCoefficient_y_contact_reduced_System_using_y_contact(self):
2265            d=self.domain.getDim()
2266            mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2267            mypde.setValue(y_contact=Data(numarray.ones((self.N,)),ReducedFunctionOnContactZero(self.domain)))
2268            coeff=mypde.getCoefficient("y_contact_reduced")
2269            self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunctionOnContactZero(self.domain),self.N))
2270    
2271        def test_symmetryCheckTrue_System(self):
2272            d=self.domain.getDim()
2273            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2274            M=100*numarray.ones((self.N,self.N))
2275            A=numarray.ones((self.N,d,self.N,d))
2276            C=2*numarray.ones((self.N,self.N,d))
2277            B=2*numarray.ones((self.N,d,self.N))
2278            D=3*numarray.ones((self.N,self.N))
2279            d=4*numarray.ones((self.N,self.N))
2280            m=64*numarray.ones((self.N,self.N))
2281            d_contact=5*numarray.ones((self.N,self.N))
2282            mypde.setValue(M=M,A=A,B=B,C=C,D=D,d=d,d_contact=d_contact,m=m,M_reduced=-M,A_reduced=-A,B_reduced=-B,C_reduced=-C,D_reduced=-D,d_reduced=-d,d_contact_reduced=-d_contact, m_reduced=-m)
2283            self.failUnless(mypde.checkSymmetry(verbose=False),"symmetry detected")
2284    
2285        def test_symmetryCheckFalse_M_System(self):
2286            d=self.domain.getDim()
2287            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2288            M=numarray.ones((self.N,self.N))
2289            M[1,0]=0.
2290            mypde.setValue(M=M)
2291            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
2292    
2293        def test_symmetryCheckFalse_A_System(self):
2294            d=self.domain.getDim()
2295            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2296            A=numarray.ones((self.N,d,self.N,d))
2297            A[1,1,1,0]=0.
2298            mypde.setValue(A=A)
2299            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
2300    
2301        def test_symmetryCheckFalse_BC_System(self):
2302            d=self.domain.getDim()
2303            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2304            C=2*numarray.ones((self.N,self.N,d))
2305            B=2*numarray.ones((self.N,d,self.N))
2306            B[0,0,1]=1.
2307            mypde.setValue(B=B,C=C)
2308            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
2309    
2310        def test_symmetryCheckFalse_D_System(self):
2311            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2312            D=3*numarray.ones((self.N,self.N))
2313            D[0,1]=0.
2314            mypde.setValue(D=D)
2315            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
2316    
2317        def test_symmetryCheckFalse_m_System(self):
2318            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2319            m=4*numarray.ones((self.N,self.N))
2320            m[0,1]=0.
2321            mypde.setValue(m=m)
2322            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
2323    
2324        def test_symmetryCheckFalse_d_System(self):
2325            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2326            d=4*numarray.ones((self.N,self.N))
2327            d[0,1]=0.
2328            mypde.setValue(d=d)
2329            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
2330    
2331        def test_symmetryCheckFalse_d_contact_System(self):
2332            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2333            d_contact=5*numarray.ones((self.N,self.N))
2334            d_contact[0,1]=0.
2335            mypde.setValue(d_contact=d_contact)
2336            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
2337    
2338        def test_symmetryCheckFalse_M_reduced_System(self):
2339            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2340            M=3*numarray.ones((self.N,self.N))
2341            M[0,1]=0.
2342            mypde.setValue(M_reduced=M)
2343            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
2344    
2345        def test_symmetryCheckFalse_A_reduced_System(self):
2346            d=self.domain.getDim()
2347            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2348            A=numarray.ones((self.N,d,self.N,d))
2349            A[1,1,1,0]=0.
2350            mypde.setValue(A_reduced=A)
2351            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
2352    
2353        def test_symmetryCheckFalse_BC_reduced_System(self):
2354            d=self.domain.getDim()
2355            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2356            C=2*numarray.ones((self.N,self.N,d))
2357            B=2*numarray.ones((self.N,d,self.N))
2358            B[0,0,1]=1.
2359            mypde.setValue(B_reduced=B,C_reduced=C)
2360            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
2361    
2362        def test_symmetryCheckFalse_D_reduced_System(self):
2363            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2364            D=3*numarray.ones((self.N,self.N))
2365            D[0,1]=0.
2366            mypde.setValue(D_reduced=D)
2367            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
2368    
2369        def test_symmetryCheckFalse_m_reduced_System(self):
2370            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2371            m=4*numarray.ones((self.N,self.N))
2372            m[0,1]=0.
2373            mypde.setValue(m_reduced=m)
2374            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
2375    
2376        def test_symmetryCheckFalse_d_reduced_System(self):
2377            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2378            d=4*numarray.ones((self.N,self.N))
2379            d[0,1]=0.
2380            mypde.setValue(d_reduced=d)
2381            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
2382    
2383        def test_symmetryCheckFalse_d_contact_reduced_System(self):
2384            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2385            d_contact=5*numarray.ones((self.N,self.N))
2386            d_contact[0,1]=0.
2387            mypde.setValue(d_contact_reduced=d_contact)
2388            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
2389    
2390        #==============================================================
2391        def test_symmetryCheckTrue_Scalar(self):
2392            d=self.domain.getDim()
2393            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2394            M=100
2395            A=numarray.ones((d,d))
2396            C=2*numarray.ones((d,))
2397            B=2*numarray.ones((d,))
2398            D=3
2399            m=10
2400            d=4
2401            d_contact=5
2402            mypde.setValue(M=M,A=A,B=B,C=C,D=D,d=d,m=m,d_contact=d_contact,M_reduced=-M,A_reduced=-A,B_reduced=-B,C_reduced=-C,D_reduced=-D,d_reduced=-d,d_contact_reduced=-d_contact,m_reduced=-m)
2403            self.failUnless(mypde.checkSymmetry(verbose=False),"symmetry detected")
2404    
2405        def test_symmetryCheckFalse_A_Scalar(self):
2406            d=self.domain.getDim()
2407            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2408            A=numarray.ones((d,d))
2409            A[1,0]=0.
2410            mypde.setValue(A=A)
2411            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
2412        def test_symmetryCheckFalse_BC_Scalar(self):
2413            d=self.domain.getDim()
2414            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2415            C=2*numarray.ones((d,))
2416            B=2*numarray.ones((d,))
2417            B[0]=1.
2418            mypde.setValue(B=B,C=C)
2419            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
2420        def test_symmetryCheckFalse_A_reduced_Scalar(self):
2421            d=self.domain.getDim()
2422            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2423            A=numarray.ones((d,d))
2424            A[1,0]=0.
2425            mypde.setValue(A_reduced=A)
2426            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
2427        def test_symmetryCheckFalse_BC_reduced_Scalar(self):
2428            d=self.domain.getDim()
2429            mypde=TransportPDE(self.domain,debug=self.DEBUG)
2430            C=2*numarray.ones((d,))
2431            B=2*numarray.ones((d,))
2432            B[0]=1.
2433            mypde.setValue(B_reduced=B,C_reduced=C)
2434            self.failUnless(not mypde.checkSymmetry(verbose=False),"symmetry detected")
2435    
2436        def test_reducedOn(self):
2437            dt=0.1
2438            mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)
2439            mypde.setReducedOrderOn()
2440            mypde.setInitialSolution(10.)
2441            mypde.setValue(M=1.,Y=1)
2442            u=mypde.getSolution(dt)
2443            self.failUnless(u.getFunctionSpace() == ReducedSolution(self.domain), "wrong function space")
2444            self.failUnless(self.check(u,10.+dt),'solution is wrong.')
2445    
2446        def Off_test_reducedOff(self):
2447            dt=0.1
2448            mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)
2449            mypde.setInitialSolution(10.)
2450            mypde.setValue(M=1.,Y=1.)
2451            u=mypde.getSolution(0.1)
2452            self.failUnless(u.getFunctionSpace() == Solution(self.domain), "wrong function space")
2453            self.failUnless(self.check(u,10.+dt),'solution is wrong.')

Legend:
Removed from v.1388  
changed lines
  Added in v.2344

  ViewVC Help
Powered by ViewVC 1.1.26