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

Contents of /trunk/escriptcore/test/python/test_util_spatial_functions2.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6651 - (show annotations)
Wed Feb 7 02:12:08 2018 UTC (19 months, 1 week ago) by jfenwick
File MIME type: text/x-python
File size: 91191 byte(s)
Make everyone sad by touching all the files

Copyright dates update

1
2 ##############################################################################
3 #
4 # Copyright (c) 2003-2018 by The University of Queensland
5 # http://www.uq.edu.au
6 #
7 # Primary Business: Queensland, Australia
8 # Licensed under the Apache License, version 2.0
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 # Development 2012-2013 by School of Earth Sciences
13 # Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 #
15 ##############################################################################
16
17 from __future__ import print_function, division
18
19 __copyright__="""Copyright (c) 2003-2018 by The University of Queensland
20 http://www.uq.edu.au
21 Primary Business: Queensland, Australia"""
22 __license__="""Licensed under the Apache License, version 2.0
23 http://www.apache.org/licenses/LICENSE-2.0"""
24 __url__="https://launchpad.net/escript-finley"
25
26 """
27 basic tests for functions in util.py effecting the spatial distribution
28
29 it is assumed that the domain is the usint square/cube
30
31 not all these test will run for all domains. check the doc string for the assumptions of a particular test
32
33 :var __author__: name of author
34 :var __copyright__: copyrights
35 :var __license__: licence agreement
36 :var __url__: url entry point on documentation
37 :var __version__: version
38 :var __date__: date of the version
39 """
40 __author__="Lutz Gross, l.gross@uq.edu.au"
41
42 import esys.escriptcore.utestselect as unittest
43 from esys.escript import *
44 from numpy import array
45 import numpy
46
47 from test_util_spatial_functions1 import Test_Util_SpatialFunctions_noGradOnBoundary_noContact
48 from test_util_integrals import Test_Util_Integration
49 from test_util_interpolation import Test_Util_Interpolation
50
51 #begin
52
53 class Test_Util_SpatialFunctions_noGradOnBoundary(Test_Util_SpatialFunctions_noGradOnBoundary_noContact, Test_Util_Integration, Test_Util_Interpolation):
54 RES_TOL=1.e-8
55
56 def test_normal_onFunctionOnContactZero(self):
57 """
58 test getNormal() on contact side 0
59
60 assumptions: FunctionOnContactZero(self.domain) exists
61 """
62 dim=self.domain.getDim()
63 f=FunctionOnContactZero(self.domain)
64 x=f.getX()
65 ref=Vector(0.,what=f)
66 if dim==3:
67 ref+=whereZero(x[0]-0.5,tol=self.RES_TOL)*[1,0,0]
68 else:
69 ref+=whereZero(x[0]-0.5,tol=self.RES_TOL)*[1,0]
70
71 res=f.getNormal()
72 self.assertEqual(res.getShape(),(dim,),"wrong shape of result.")
73 self.assertEqual(res.getFunctionSpace(),f,"wrong functionspace of result.")
74 self.assertTrue(Lsup(length(res)-1)<=self.RES_TOL,"wrong length")
75 self.assertTrue(Lsup(abs(inner(ref,res))-1)<=self.RES_TOL,"wrong direction")
76 def test_normal_onReducedFunctionOnContactZero(self):
77 """
78 test getNormal() on contact side 0
79
80 assumptions: FunctionOnContactZero(self.domain) exists
81 """
82 dim=self.domain.getDim()
83 f=ReducedFunctionOnContactZero(self.domain)
84 x=f.getX()
85 ref=Vector(0.,what=f)
86 if dim==3:
87 ref+=whereZero(x[0]-0.5,tol=self.RES_TOL)*[1,0,0]
88 else:
89 ref+=whereZero(x[0]-0.5,tol=self.RES_TOL)*[1,0]
90
91 res=f.getNormal()
92 self.assertEqual(res.getShape(),(dim,),"wrong shape of result.")
93 self.assertEqual(res.getFunctionSpace(),f,"wrong functionspace of result.")
94 self.assertTrue(Lsup(length(res)-1)<=self.RES_TOL,"wrong length")
95 self.assertTrue(Lsup(abs(inner(ref,res))-1)<=self.RES_TOL,"wrong direction")
96 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
97 def test_normal_onFunctionOnContactOne(self):
98 """
99 test getNormal() on contact side 1
100
101 assumptions: FunctionOnContactOne(self.domain) exists
102 """
103 dim=self.domain.getDim()
104 f=FunctionOnContactOne(self.domain)
105 x=f.getX()
106 ref=Vector(0.,what=f)
107 if dim==3:
108 ref+=whereZero(x[0]-0.5,tol=self.RES_TOL)*[-1,0,0]
109 else:
110 ref+=whereZero(x[0]-0.5,tol=self.RES_TOL)*[-1,0]
111
112 res=f.getNormal()
113 self.assertEqual(res.getShape(),(dim,),"wrong shape of result.")
114 self.assertEqual(res.getFunctionSpace(),f,"wrong functionspace of result.")
115 self.assertTrue(Lsup(length(res)-1)<=self.RES_TOL,"wrong length")
116 self.assertTrue(Lsup(abs(inner(ref,res))-1)<=self.RES_TOL,"wrong direction")
117 def test_normal_onReducedFunctionOnContactOne(self):
118 """
119 test getNormal() on contact side 1
120
121 assumptions: FunctionOnContactOne(self.domain) exists
122 """
123 dim=self.domain.getDim()
124 f=ReducedFunctionOnContactOne(self.domain)
125 x=f.getX()
126 ref=Vector(0.,what=f)
127 if dim==3:
128 ref+=whereZero(x[0]-0.5,tol=self.RES_TOL)*[-1,0,0]
129 else:
130 ref+=whereZero(x[0]-0.5,tol=self.RES_TOL)*[-1,0]
131
132 res=f.getNormal()
133 self.assertEqual(res.getShape(),(dim,),"wrong shape of result.")
134 self.assertEqual(res.getFunctionSpace(),f,"wrong functionspace of result.")
135 self.assertTrue(Lsup(length(res)-1)<=self.RES_TOL,"wrong length")
136 self.assertTrue(Lsup(abs(inner(ref,res))-1)<=self.RES_TOL,"wrong direction")
137 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
138 def test_L2_onFunctionOnContactZero_fromData_rank0(self):
139 """
140 tests L2-norm of Data on the FunctionOnContactZero
141
142 assumptions: self.domain supports integration on FunctionOnContactZero
143 """
144 dim=self.domain.getDim()
145 w=FunctionOnContactZero(self.domain)
146 x=w.getX()
147 if dim==2:
148 arg=Data(0,(),w)
149 arg=(-0.908822474879)*x[0]
150 ref=sqrt((0.0)+(0.206489572711))
151
152 else:
153 arg=Data(0,(),w)
154 arg=(-0.893168521371)*x[0]
155 ref=sqrt((0.0)+(0.199437501892))
156
157 res=L2(arg)
158 self.assertTrue(isinstance(res,float),"wrong type of result.")
159 self.assertAlmostEqual(res,ref,int(-log10(self.RES_TOL)),"wrong result")
160 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
161 def test_L2_onFunctionOnContactZero_fromData_rank1(self):
162 """
163 tests L2-norm of Data on the FunctionOnContactZero
164
165 assumptions: self.domain supports integration on FunctionOnContactZero
166 """
167 dim=self.domain.getDim()
168 w=FunctionOnContactZero(self.domain)
169 x=w.getX()
170 if dim==2:
171 arg=Data(0,(2,),w)
172 arg[0]=(-0.30839170903)*x[0]
173 arg[1]=(0.108352504587)*x[1]
174 ref=sqrt((0.00391342175007)+(0.0237763615497))
175
176 else:
177 arg=Data(0,(3,),w)
178 arg[0]=(-0.260572084359)*x[0]
179 arg[1]=(0.250696802346)*x[1]
180 arg[2]=(-0.498857619202)*x[2]
181 ref=sqrt((0.103902603647)+(0.0169744527868))
182
183 res=L2(arg)
184 self.assertTrue(isinstance(res,float),"wrong type of result.")
185 self.assertAlmostEqual(res,ref,int(-log10(self.RES_TOL)),"wrong result")
186 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
187 def test_L2_onFunctionOnContactZero_fromData_rank2(self):
188 """
189 tests L2-norm of Data on the FunctionOnContactZero
190
191 assumptions: self.domain supports integration on FunctionOnContactZero
192 """
193 dim=self.domain.getDim()
194 w=FunctionOnContactZero(self.domain)
195 x=w.getX()
196 if dim==2:
197 arg=Data(0,(4, 2),w)
198 arg[0,0]=(0.0107777943992)*x[0]
199 arg[0,1]=(0.0188929341636)*x[1]
200 arg[1,0]=(-0.00268267834861)*x[0]
201 arg[1,1]=(-0.656039971477)*x[1]
202 arg[2,0]=(-0.997645982047)*x[0]
203 arg[2,1]=(0.993049748017)*x[1]
204 arg[3,0]=(0.938636169945)*x[0]
205 arg[3,1]=(-0.609892243528)*x[1]
206 ref=sqrt((0.596287245963)+(0.46911468066))
207
208 else:
209 arg=Data(0,(4, 3),w)
210 arg[0,0]=(0.128987155564)*x[0]
211 arg[0,1]=(-0.582660210551)*x[1]
212 arg[0,2]=(-0.605040149822)*x[2]
213 arg[1,0]=(0.494540007291)*x[0]
214 arg[1,1]=(0.563900397935)*x[1]
215 arg[1,2]=(-0.806214220737)*x[2]
216 arg[2,0]=(0.878027993704)*x[0]
217 arg[2,1]=(0.597165310427)*x[1]
218 arg[2,2]=(-0.444798130742)*x[2]
219 arg[3,0]=(0.982067213342)*x[0]
220 arg[3,1]=(-0.160013302763)*x[1]
221 arg[3,2]=(-0.490830124654)*x[2]
222 ref=sqrt((0.831500595262)+(0.49914916859))
223
224 res=L2(arg)
225 self.assertTrue(isinstance(res,float),"wrong type of result.")
226 self.assertAlmostEqual(res,ref,int(-log10(self.RES_TOL)),"wrong result")
227 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
228 def test_L2_onFunctionOnContactZero_fromData_rank3(self):
229 """
230 tests L2-norm of Data on the FunctionOnContactZero
231
232 assumptions: self.domain supports integration on FunctionOnContactZero
233 """
234 dim=self.domain.getDim()
235 w=FunctionOnContactZero(self.domain)
236 x=w.getX()
237 if dim==2:
238 arg=Data(0,(6, 2, 2),w)
239 arg[0,0,0]=(0.83264345248)*x[0]
240 arg[0,0,1]=(-0.29697614845)*x[1]
241 arg[0,1,0]=(-0.903150797089)*x[0]
242 arg[0,1,1]=(-0.569048463149)*x[1]
243 arg[1,0,0]=(0.317087339385)*x[0]
244 arg[1,0,1]=(0.0120740865344)*x[1]
245 arg[1,1,0]=(-0.221145803457)*x[0]
246 arg[1,1,1]=(-0.15362409313)*x[1]
247 arg[2,0,0]=(0.459428065932)*x[0]
248 arg[2,0,1]=(-0.495488213623)*x[1]
249 arg[2,1,0]=(0.919114285084)*x[0]
250 arg[2,1,1]=(0.54511942052)*x[1]
251 arg[3,0,0]=(0.442207797529)*x[0]
252 arg[3,0,1]=(0.958341188449)*x[1]
253 arg[3,1,0]=(-0.0915205976682)*x[0]
254 arg[3,1,1]=(-0.410964460336)*x[1]
255 arg[4,0,0]=(-0.243030095673)*x[0]
256 arg[4,0,1]=(-0.413661756935)*x[1]
257 arg[4,1,0]=(-0.0973014277464)*x[0]
258 arg[4,1,1]=(0.204130676874)*x[1]
259 arg[5,0,0]=(0.38083750131)*x[0]
260 arg[5,0,1]=(0.286331574579)*x[1]
261 arg[5,1,0]=(0.583320730408)*x[0]
262 arg[5,1,1]=(-0.0899419806181)*x[1]
263 ref=sqrt((0.789530406063)+(0.868006693351))
264
265 else:
266 arg=Data(0,(6, 2, 3),w)
267 arg[0,0,0]=(-0.98411764268)*x[0]
268 arg[0,0,1]=(-0.180549567137)*x[1]
269 arg[0,0,2]=(0.357923974709)*x[2]
270 arg[0,1,0]=(0.67691778218)*x[0]
271 arg[0,1,1]=(-0.643267669153)*x[1]
272 arg[0,1,2]=(0.452374328301)*x[2]
273 arg[1,0,0]=(0.494303694439)*x[0]
274 arg[1,0,1]=(0.00767629822214)*x[1]
275 arg[1,0,2]=(0.232436713422)*x[2]
276 arg[1,1,0]=(-0.698568975983)*x[0]
277 arg[1,1,1]=(-0.08483720353)*x[1]
278 arg[1,1,2]=(-0.723935799719)*x[2]
279 arg[2,0,0]=(0.931313239646)*x[0]
280 arg[2,0,1]=(-0.0988070442341)*x[1]
281 arg[2,0,2]=(-0.166201798278)*x[2]
282 arg[2,1,0]=(-0.733172171406)*x[0]
283 arg[2,1,1]=(0.24542706584)*x[1]
284 arg[2,1,2]=(0.49170717592)*x[2]
285 arg[3,0,0]=(-0.718346096869)*x[0]
286 arg[3,0,1]=(0.297442410539)*x[1]
287 arg[3,0,2]=(0.0277708718174)*x[2]
288 arg[3,1,0]=(0.735100702194)*x[0]
289 arg[3,1,1]=(-0.808007526296)*x[1]
290 arg[3,1,2]=(-0.423023238313)*x[2]
291 arg[4,0,0]=(0.383188529876)*x[0]
292 arg[4,0,1]=(-0.190101601814)*x[1]
293 arg[4,0,2]=(-0.404380990215)*x[2]
294 arg[4,1,0]=(-0.31098204217)*x[0]
295 arg[4,1,1]=(-0.715247945432)*x[1]
296 arg[4,1,2]=(0.435774772982)*x[2]
297 arg[5,0,0]=(-0.0662056096206)*x[0]
298 arg[5,0,1]=(0.746710247367)*x[1]
299 arg[5,0,2]=(0.753267249301)*x[2]
300 arg[5,1,0]=(0.258102962518)*x[0]
301 arg[5,1,1]=(-0.0270028483187)*x[1]
302 arg[5,1,2]=(-0.971060107954)*x[2]
303 ref=sqrt((1.86493016409)+(1.23371587938))
304
305 res=L2(arg)
306 self.assertTrue(isinstance(res,float),"wrong type of result.")
307 self.assertAlmostEqual(res,ref,int(-log10(self.RES_TOL)),"wrong result")
308 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
309 def test_L2_onFunctionOnContactZero_fromData_rank4(self):
310 """
311 tests L2-norm of Data on the FunctionOnContactZero
312
313 assumptions: self.domain supports integration on FunctionOnContactZero
314 """
315 dim=self.domain.getDim()
316 w=FunctionOnContactZero(self.domain)
317 x=w.getX()
318 if dim==2:
319 arg=Data(0,(4, 5, 3, 2),w)
320 arg[0,0,0,0]=(-0.144741217139)*x[0]
321 arg[0,0,0,1]=(-0.188187241012)*x[1]
322 arg[0,0,1,0]=(0.056339373733)*x[0]
323 arg[0,0,1,1]=(0.222177130759)*x[1]
324 arg[0,0,2,0]=(-0.437240978497)*x[0]
325 arg[0,0,2,1]=(-0.479213082014)*x[1]
326 arg[0,1,0,0]=(0.343204141181)*x[0]
327 arg[0,1,0,1]=(0.099683148208)*x[1]
328 arg[0,1,1,0]=(0.167657906331)*x[0]
329 arg[0,1,1,1]=(0.371064917656)*x[1]
330 arg[0,1,2,0]=(-0.175796118619)*x[0]
331 arg[0,1,2,1]=(-0.523477567832)*x[1]
332 arg[0,2,0,0]=(0.188832282277)*x[0]
333 arg[0,2,0,1]=(0.948618356423)*x[1]
334 arg[0,2,1,0]=(-0.3835066594)*x[0]
335 arg[0,2,1,1]=(0.872875257641)*x[1]
336 arg[0,2,2,0]=(-0.98414676194)*x[0]
337 arg[0,2,2,1]=(0.59170993756)*x[1]
338 arg[0,3,0,0]=(0.875820385471)*x[0]
339 arg[0,3,0,1]=(-0.209139794169)*x[1]
340 arg[0,3,1,0]=(0.783312979835)*x[0]
341 arg[0,3,1,1]=(-0.440048708153)*x[1]
342 arg[0,3,2,0]=(-0.906741480158)*x[0]
343 arg[0,3,2,1]=(0.63834196559)*x[1]
344 arg[0,4,0,0]=(0.0142616166715)*x[0]
345 arg[0,4,0,1]=(-0.0745581409622)*x[1]
346 arg[0,4,1,0]=(-0.779966728505)*x[0]
347 arg[0,4,1,1]=(0.734744791584)*x[1]
348 arg[0,4,2,0]=(0.0407627699446)*x[0]
349 arg[0,4,2,1]=(-0.629666423098)*x[1]
350 arg[1,0,0,0]=(-0.782291768803)*x[0]
351 arg[1,0,0,1]=(-0.197799867335)*x[1]
352 arg[1,0,1,0]=(-0.487323212409)*x[0]
353 arg[1,0,1,1]=(-0.789940409633)*x[1]
354 arg[1,0,2,0]=(-0.523871448728)*x[0]
355 arg[1,0,2,1]=(-0.622272488658)*x[1]
356 arg[1,1,0,0]=(0.370095832941)*x[0]
357 arg[1,1,0,1]=(-0.0683624906905)*x[1]
358 arg[1,1,1,0]=(-0.180583695959)*x[0]
359 arg[1,1,1,1]=(-0.0529097308814)*x[1]
360 arg[1,1,2,0]=(0.440088045764)*x[0]
361 arg[1,1,2,1]=(-0.207665675854)*x[1]
362 arg[1,2,0,0]=(-0.360120735448)*x[0]
363 arg[1,2,0,1]=(0.877797020694)*x[1]
364 arg[1,2,1,0]=(0.655192721419)*x[0]
365 arg[1,2,1,1]=(0.978781227463)*x[1]
366 arg[1,2,2,0]=(-0.205886258554)*x[0]
367 arg[1,2,2,1]=(-0.0050396100363)*x[1]
368 arg[1,3,0,0]=(-0.484332943177)*x[0]
369 arg[1,3,0,1]=(0.964697361018)*x[1]
370 arg[1,3,1,0]=(0.0815652906824)*x[0]
371 arg[1,3,1,1]=(-0.531163025802)*x[1]
372 arg[1,3,2,0]=(-0.229615479833)*x[0]
373 arg[1,3,2,1]=(0.139971291609)*x[1]
374 arg[1,4,0,0]=(0.960839193726)*x[0]
375 arg[1,4,0,1]=(-0.9744930023)*x[1]
376 arg[1,4,1,0]=(-0.0919000363634)*x[0]
377 arg[1,4,1,1]=(0.483909186003)*x[1]
378 arg[1,4,2,0]=(0.248597552464)*x[0]
379 arg[1,4,2,1]=(0.965872402486)*x[1]
380 arg[2,0,0,0]=(-0.935049188033)*x[0]
381 arg[2,0,0,1]=(-0.823239964421)*x[1]
382 arg[2,0,1,0]=(0.30901193713)*x[0]
383 arg[2,0,1,1]=(-0.0538396976182)*x[1]
384 arg[2,0,2,0]=(-0.449416473099)*x[0]
385 arg[2,0,2,1]=(-0.857785267819)*x[1]
386 arg[2,1,0,0]=(-0.167802578334)*x[0]
387 arg[2,1,0,1]=(-0.7016101186)*x[1]
388 arg[2,1,1,0]=(0.995848317929)*x[0]
389 arg[2,1,1,1]=(-0.824595018011)*x[1]
390 arg[2,1,2,0]=(-0.826030527686)*x[0]
391 arg[2,1,2,1]=(-0.856151725651)*x[1]
392 arg[2,2,0,0]=(0.342047605028)*x[0]
393 arg[2,2,0,1]=(-0.342370307931)*x[1]
394 arg[2,2,1,0]=(-0.540693890831)*x[0]
395 arg[2,2,1,1]=(-0.720754897785)*x[1]
396 arg[2,2,2,0]=(-0.0941215154824)*x[0]
397 arg[2,2,2,1]=(0.115887914141)*x[1]
398 arg[2,3,0,0]=(-0.0920059639279)*x[0]
399 arg[2,3,0,1]=(0.910948619784)*x[1]
400 arg[2,3,1,0]=(-0.40846609126)*x[0]
401 arg[2,3,1,1]=(0.542728733954)*x[1]
402 arg[2,3,2,0]=(0.451361830368)*x[0]
403 arg[2,3,2,1]=(0.0767538617936)*x[1]
404 arg[2,4,0,0]=(-0.431757008766)*x[0]
405 arg[2,4,0,1]=(0.258988103513)*x[1]
406 arg[2,4,1,0]=(-0.584559859464)*x[0]
407 arg[2,4,1,1]=(-0.776827606804)*x[1]
408 arg[2,4,2,0]=(-0.867078960637)*x[0]
409 arg[2,4,2,1]=(-0.0972960135129)*x[1]
410 arg[3,0,0,0]=(0.999511727022)*x[0]
411 arg[3,0,0,1]=(-0.753218704622)*x[1]
412 arg[3,0,1,0]=(0.506439354885)*x[0]
413 arg[3,0,1,1]=(-0.0845853282297)*x[1]
414 arg[3,0,2,0]=(-0.871475028801)*x[0]
415 arg[3,0,2,1]=(-0.69261642657)*x[1]
416 arg[3,1,0,0]=(0.549778399933)*x[0]
417 arg[3,1,0,1]=(0.246187536149)*x[1]
418 arg[3,1,1,0]=(-0.620454200676)*x[0]
419 arg[3,1,1,1]=(0.372738564315)*x[1]
420 arg[3,1,2,0]=(0.0544097075138)*x[0]
421 arg[3,1,2,1]=(-0.0883198944676)*x[1]
422 arg[3,2,0,0]=(-0.671057180545)*x[0]
423 arg[3,2,0,1]=(-0.118991797907)*x[1]
424 arg[3,2,1,0]=(-0.27196730081)*x[0]
425 arg[3,2,1,1]=(-0.458807068968)*x[1]
426 arg[3,2,2,0]=(-0.31485399083)*x[0]
427 arg[3,2,2,1]=(0.487291960328)*x[1]
428 arg[3,3,0,0]=(-0.750302723531)*x[0]
429 arg[3,3,0,1]=(-0.486428789771)*x[1]
430 arg[3,3,1,0]=(-0.295909324594)*x[0]
431 arg[3,3,1,1]=(0.325702372596)*x[1]
432 arg[3,3,2,0]=(-0.512109540631)*x[0]
433 arg[3,3,2,1]=(0.563284721908)*x[1]
434 arg[3,4,0,0]=(0.53579406798)*x[0]
435 arg[3,4,0,1]=(-0.468431927975)*x[1]
436 arg[3,4,1,0]=(0.570851401329)*x[0]
437 arg[3,4,1,1]=(0.107791149865)*x[1]
438 arg[3,4,2,0]=(-0.211543670157)*x[0]
439 arg[3,4,2,1]=(0.848189550468)*x[1]
440 ref=sqrt((6.54316712884)+(4.39564064326))
441
442 else:
443 arg=Data(0,(4, 5, 3, 3),w)
444 arg[0,0,0,0]=(-0.392256494872)*x[0]
445 arg[0,0,0,1]=(0.271488478841)*x[1]
446 arg[0,0,0,2]=(-0.878268531987)*x[2]
447 arg[0,0,1,0]=(0.106903787643)*x[0]
448 arg[0,0,1,1]=(-0.117986434516)*x[1]
449 arg[0,0,1,2]=(0.912673598522)*x[2]
450 arg[0,0,2,0]=(-0.652598945824)*x[0]
451 arg[0,0,2,1]=(-0.984195895647)*x[1]
452 arg[0,0,2,2]=(-0.137845459589)*x[2]
453 arg[0,1,0,0]=(0.696713200721)*x[0]
454 arg[0,1,0,1]=(0.480337929223)*x[1]
455 arg[0,1,0,2]=(-0.628726114325)*x[2]
456 arg[0,1,1,0]=(-0.356503461347)*x[0]
457 arg[0,1,1,1]=(-0.64670584045)*x[1]
458 arg[0,1,1,2]=(-0.737787618908)*x[2]
459 arg[0,1,2,0]=(-0.14207595302)*x[0]
460 arg[0,1,2,1]=(-0.573485525334)*x[1]
461 arg[0,1,2,2]=(-0.955542178481)*x[2]
462 arg[0,2,0,0]=(0.371952883975)*x[0]
463 arg[0,2,0,1]=(0.114016178762)*x[1]
464 arg[0,2,0,2]=(0.552721218169)*x[2]
465 arg[0,2,1,0]=(0.318426742113)*x[0]
466 arg[0,2,1,1]=(0.862220239384)*x[1]
467 arg[0,2,1,2]=(0.887376889978)*x[2]
468 arg[0,2,2,0]=(0.203656742981)*x[0]
469 arg[0,2,2,1]=(0.350541335144)*x[1]
470 arg[0,2,2,2]=(-0.448401957447)*x[2]
471 arg[0,3,0,0]=(-0.349200084042)*x[0]
472 arg[0,3,0,1]=(-0.546012602125)*x[1]
473 arg[0,3,0,2]=(-0.931488270979)*x[2]
474 arg[0,3,1,0]=(0.207457831058)*x[0]
475 arg[0,3,1,1]=(0.557715840549)*x[1]
476 arg[0,3,1,2]=(-0.978130146744)*x[2]
477 arg[0,3,2,0]=(-0.55088967957)*x[0]
478 arg[0,3,2,1]=(0.0490328838057)*x[1]
479 arg[0,3,2,2]=(0.150209929122)*x[2]
480 arg[0,4,0,0]=(-0.484145614698)*x[0]
481 arg[0,4,0,1]=(0.393078411279)*x[1]
482 arg[0,4,0,2]=(0.0678631863917)*x[2]
483 arg[0,4,1,0]=(-0.350980464628)*x[0]
484 arg[0,4,1,1]=(-0.784203839564)*x[1]
485 arg[0,4,1,2]=(0.636960296147)*x[2]
486 arg[0,4,2,0]=(0.592799503581)*x[0]
487 arg[0,4,2,1]=(-0.672104833683)*x[1]
488 arg[0,4,2,2]=(0.0366914082467)*x[2]
489 arg[1,0,0,0]=(-0.147168019774)*x[0]
490 arg[1,0,0,1]=(-0.0823637938956)*x[1]
491 arg[1,0,0,2]=(-0.852729690176)*x[2]
492 arg[1,0,1,0]=(-0.612338430408)*x[0]
493 arg[1,0,1,1]=(-0.85820035747)*x[1]
494 arg[1,0,1,2]=(-0.463664966162)*x[2]
495 arg[1,0,2,0]=(0.274600720491)*x[0]
496 arg[1,0,2,1]=(-0.488508234093)*x[1]
497 arg[1,0,2,2]=(-0.28251466519)*x[2]
498 arg[1,1,0,0]=(-0.0196532462794)*x[0]
499 arg[1,1,0,1]=(0.239352528871)*x[1]
500 arg[1,1,0,2]=(-0.17054773873)*x[2]
501 arg[1,1,1,0]=(-0.2396627789)*x[0]
502 arg[1,1,1,1]=(0.868970323003)*x[1]
503 arg[1,1,1,2]=(0.401487430312)*x[2]
504 arg[1,1,2,0]=(-0.624411449783)*x[0]
505 arg[1,1,2,1]=(0.0036634266684)*x[1]
506 arg[1,1,2,2]=(0.736129120967)*x[2]
507 arg[1,2,0,0]=(0.183756511707)*x[0]
508 arg[1,2,0,1]=(-0.288651848639)*x[1]
509 arg[1,2,0,2]=(-0.0672121537447)*x[2]
510 arg[1,2,1,0]=(-0.323274725936)*x[0]
511 arg[1,2,1,1]=(0.298001016025)*x[1]
512 arg[1,2,1,2]=(-0.976052460675)*x[2]
513 arg[1,2,2,0]=(0.596504441096)*x[0]
514 arg[1,2,2,1]=(0.873776068983)*x[1]
515 arg[1,2,2,2]=(-0.994068273196)*x[2]
516 arg[1,3,0,0]=(-0.495387299681)*x[0]
517 arg[1,3,0,1]=(-0.123674756551)*x[1]
518 arg[1,3,0,2]=(0.581213818577)*x[2]
519 arg[1,3,1,0]=(0.146405749701)*x[0]
520 arg[1,3,1,1]=(-0.594994686675)*x[1]
521 arg[1,3,1,2]=(-0.059093568436)*x[2]
522 arg[1,3,2,0]=(0.651004255104)*x[0]
523 arg[1,3,2,1]=(-0.977880706193)*x[1]
524 arg[1,3,2,2]=(0.370344651319)*x[2]
525 arg[1,4,0,0]=(-0.503657215247)*x[0]
526 arg[1,4,0,1]=(-0.170885297253)*x[1]
527 arg[1,4,0,2]=(0.533424480956)*x[2]
528 arg[1,4,1,0]=(-0.220533193308)*x[0]
529 arg[1,4,1,1]=(0.344537611882)*x[1]
530 arg[1,4,1,2]=(0.861473877282)*x[2]
531 arg[1,4,2,0]=(-0.0923010438884)*x[0]
532 arg[1,4,2,1]=(-0.338256780498)*x[1]
533 arg[1,4,2,2]=(0.528567959345)*x[2]
534 arg[2,0,0,0]=(-0.0423053381485)*x[0]
535 arg[2,0,0,1]=(0.856798579151)*x[1]
536 arg[2,0,0,2]=(0.383258153853)*x[2]
537 arg[2,0,1,0]=(0.350994872736)*x[0]
538 arg[2,0,1,1]=(-0.78055158106)*x[1]
539 arg[2,0,1,2]=(-0.770876699915)*x[2]
540 arg[2,0,2,0]=(-0.935133287106)*x[0]
541 arg[2,0,2,1]=(0.618238076989)*x[1]
542 arg[2,0,2,2]=(-0.846783087949)*x[2]
543 arg[2,1,0,0]=(-0.657394511405)*x[0]
544 arg[2,1,0,1]=(0.576218821654)*x[1]
545 arg[2,1,0,2]=(0.0269446356493)*x[2]
546 arg[2,1,1,0]=(-0.310710230949)*x[0]
547 arg[2,1,1,1]=(0.425412515598)*x[1]
548 arg[2,1,1,2]=(-0.225225290862)*x[2]
549 arg[2,1,2,0]=(-0.539928589495)*x[0]
550 arg[2,1,2,1]=(-0.348082121765)*x[1]
551 arg[2,1,2,2]=(-0.0287274646233)*x[2]
552 arg[2,2,0,0]=(0.746132865923)*x[0]
553 arg[2,2,0,1]=(-0.0234203693548)*x[1]
554 arg[2,2,0,2]=(0.517411821941)*x[2]
555 arg[2,2,1,0]=(-0.183204217349)*x[0]
556 arg[2,2,1,1]=(0.714988861836)*x[1]
557 arg[2,2,1,2]=(0.829083318937)*x[2]
558 arg[2,2,2,0]=(0.458067555841)*x[0]
559 arg[2,2,2,1]=(0.639317125869)*x[1]
560 arg[2,2,2,2]=(0.104611520408)*x[2]
561 arg[2,3,0,0]=(-0.420513461135)*x[0]
562 arg[2,3,0,1]=(0.888686162754)*x[1]
563 arg[2,3,0,2]=(0.939305777879)*x[2]
564 arg[2,3,1,0]=(0.856795132015)*x[0]
565 arg[2,3,1,1]=(0.817593141895)*x[1]
566 arg[2,3,1,2]=(0.962503342535)*x[2]
567 arg[2,3,2,0]=(-0.334586700245)*x[0]
568 arg[2,3,2,1]=(0.182696129528)*x[1]
569 arg[2,3,2,2]=(-0.707271571206)*x[2]
570 arg[2,4,0,0]=(-0.594795981069)*x[0]
571 arg[2,4,0,1]=(0.451239168073)*x[1]
572 arg[2,4,0,2]=(0.191212211556)*x[2]
573 arg[2,4,1,0]=(-0.503465984944)*x[0]
574 arg[2,4,1,1]=(0.725377884208)*x[1]
575 arg[2,4,1,2]=(-0.40719255752)*x[2]
576 arg[2,4,2,0]=(0.268071476451)*x[0]
577 arg[2,4,2,1]=(0.85066639942)*x[1]
578 arg[2,4,2,2]=(-0.906021406945)*x[2]
579 arg[3,0,0,0]=(-0.922179152122)*x[0]
580 arg[3,0,0,1]=(-0.0903841240007)*x[1]
581 arg[3,0,0,2]=(-0.751482803516)*x[2]
582 arg[3,0,1,0]=(0.960697809119)*x[0]
583 arg[3,0,1,1]=(0.638878873158)*x[1]
584 arg[3,0,1,2]=(0.390932234724)*x[2]
585 arg[3,0,2,0]=(-0.925078301694)*x[0]
586 arg[3,0,2,1]=(0.793590580665)*x[1]
587 arg[3,0,2,2]=(0.535478366911)*x[2]
588 arg[3,1,0,0]=(-0.431951993217)*x[0]
589 arg[3,1,0,1]=(0.211750261417)*x[1]
590 arg[3,1,0,2]=(-0.930706580442)*x[2]
591 arg[3,1,1,0]=(0.330979313323)*x[0]
592 arg[3,1,1,1]=(-0.838919076081)*x[1]
593 arg[3,1,1,2]=(0.134250050168)*x[2]
594 arg[3,1,2,0]=(0.414922811301)*x[0]
595 arg[3,1,2,1]=(-0.663692878121)*x[1]
596 arg[3,1,2,2]=(0.88499278543)*x[2]
597 arg[3,2,0,0]=(0.0884662742233)*x[0]
598 arg[3,2,0,1]=(-0.412630722821)*x[1]
599 arg[3,2,0,2]=(-0.730850884928)*x[2]
600 arg[3,2,1,0]=(0.722207547366)*x[0]
601 arg[3,2,1,1]=(-0.260067950749)*x[1]
602 arg[3,2,1,2]=(0.426259201494)*x[2]
603 arg[3,2,2,0]=(0.0516111795322)*x[0]
604 arg[3,2,2,1]=(0.922853710048)*x[1]
605 arg[3,2,2,2]=(-0.991912758116)*x[2]
606 arg[3,3,0,0]=(0.263933965905)*x[0]
607 arg[3,3,0,1]=(0.840541758799)*x[1]
608 arg[3,3,0,2]=(0.417658511125)*x[2]
609 arg[3,3,1,0]=(-0.901745614723)*x[0]
610 arg[3,3,1,1]=(-0.623608908699)*x[1]
611 arg[3,3,1,2]=(0.0522167208784)*x[2]
612 arg[3,3,2,0]=(-0.549431264931)*x[0]
613 arg[3,3,2,1]=(0.919971855457)*x[1]
614 arg[3,3,2,2]=(0.142757773397)*x[2]
615 arg[3,4,0,0]=(-0.258875259824)*x[0]
616 arg[3,4,0,1]=(-0.0373872187041)*x[1]
617 arg[3,4,0,2]=(0.445989164864)*x[2]
618 arg[3,4,1,0]=(0.0273711397038)*x[0]
619 arg[3,4,1,1]=(-0.85522629)*x[1]
620 arg[3,4,1,2]=(-0.835392581226)*x[2]
621 arg[3,4,2,0]=(0.402929450189)*x[0]
622 arg[3,4,2,1]=(0.549623033221)*x[1]
623 arg[3,4,2,2]=(0.237803212109)*x[2]
624 ref=sqrt((15.1448100099)+(3.61598249819))
625
626 res=L2(arg)
627 self.assertTrue(isinstance(res,float),"wrong type of result.")
628 self.assertAlmostEqual(res,ref,int(-log10(self.RES_TOL)),"wrong result")
629 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
630 def test_L2_onReducedFunctionOnContactZero_fromData_rank0(self):
631 """
632 tests L2-norm of Data on the ReducedFunctionOnContactZero
633
634 assumptions: self.domain supports integration on ReducedFunctionOnContactZero
635 """
636 dim=self.domain.getDim()
637 w=ReducedFunctionOnContactZero(self.domain)
638 x=w.getX()
639 if dim==2:
640 arg=Data(0,(),w)
641 arg=(-0.908822474879)*sqrt(x[0])
642 ref=sqrt((0.0)*3./2.+(0.206489572711)/0.5)
643
644 else:
645 arg=Data(0,(),w)
646 arg=(-0.893168521371)*sqrt(x[0])
647 ref=sqrt((0.0)*3./2.+(0.199437501892)/0.5)
648
649 res=L2(arg)
650 self.assertTrue(isinstance(res,float),"wrong type of result.")
651 self.assertAlmostEqual(res,ref,int(-log10(self.RES_TOL)),"wrong result")
652 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
653 def test_L2_onReducedFunctionOnContactZero_fromData_rank1(self):
654 """
655 tests L2-norm of Data on the ReducedFunctionOnContactZero
656
657 assumptions: self.domain supports integration on ReducedFunctionOnContactZero
658 """
659 dim=self.domain.getDim()
660 w=ReducedFunctionOnContactZero(self.domain)
661 x=w.getX()
662 if dim==2:
663 arg=Data(0,(2,),w)
664 arg[0]=(-0.30839170903)*sqrt(x[0])
665 arg[1]=(0.108352504587)*sqrt(x[1])
666 ref=sqrt((0.00391342175007)*3./2.+(0.0237763615497)/0.5)
667
668 else:
669 arg=Data(0,(3,),w)
670 arg[0]=(-0.260572084359)*sqrt(x[0])
671 arg[1]=(0.250696802346)*sqrt(x[1])
672 arg[2]=(-0.498857619202)*sqrt(x[2])
673 ref=sqrt((0.103902603647)*3./2.+(0.0169744527868)/0.5)
674
675 res=L2(arg)
676 self.assertTrue(isinstance(res,float),"wrong type of result.")
677 self.assertAlmostEqual(res,ref,int(-log10(self.RES_TOL)),"wrong result")
678 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
679 def test_L2_onReducedFunctionOnContactZero_fromData_rank2(self):
680 """
681 tests L2-norm of Data on the ReducedFunctionOnContactZero
682
683 assumptions: self.domain supports integration on ReducedFunctionOnContactZero
684 """
685 dim=self.domain.getDim()
686 w=ReducedFunctionOnContactZero(self.domain)
687 x=w.getX()
688 if dim==2:
689 arg=Data(0,(4, 2),w)
690 arg[0,0]=(0.0107777943992)*sqrt(x[0])
691 arg[0,1]=(0.0188929341636)*sqrt(x[1])
692 arg[1,0]=(-0.00268267834861)*sqrt(x[0])
693 arg[1,1]=(-0.656039971477)*sqrt(x[1])
694 arg[2,0]=(-0.997645982047)*sqrt(x[0])
695 arg[2,1]=(0.993049748017)*sqrt(x[1])
696 arg[3,0]=(0.938636169945)*sqrt(x[0])
697 arg[3,1]=(-0.609892243528)*sqrt(x[1])
698 ref=sqrt((0.596287245963)*3./2.+(0.46911468066)/0.5)
699
700 else:
701 arg=Data(0,(4, 3),w)
702 arg[0,0]=(0.128987155564)*sqrt(x[0])
703 arg[0,1]=(-0.582660210551)*sqrt(x[1])
704 arg[0,2]=(-0.605040149822)*sqrt(x[2])
705 arg[1,0]=(0.494540007291)*sqrt(x[0])
706 arg[1,1]=(0.563900397935)*sqrt(x[1])
707 arg[1,2]=(-0.806214220737)*sqrt(x[2])
708 arg[2,0]=(0.878027993704)*sqrt(x[0])
709 arg[2,1]=(0.597165310427)*sqrt(x[1])
710 arg[2,2]=(-0.444798130742)*sqrt(x[2])
711 arg[3,0]=(0.982067213342)*sqrt(x[0])
712 arg[3,1]=(-0.160013302763)*sqrt(x[1])
713 arg[3,2]=(-0.490830124654)*sqrt(x[2])
714 ref=sqrt((0.831500595262)*3./2.+(0.49914916859)/0.5)
715
716 res=L2(arg)
717 self.assertTrue(isinstance(res,float),"wrong type of result.")
718 self.assertAlmostEqual(res,ref,int(-log10(self.RES_TOL)),"wrong result")
719 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
720 def test_L2_onReducedFunctionOnContactZero_fromData_rank3(self):
721 """
722 tests L2-norm of Data on the ReducedFunctionOnContactZero
723
724 assumptions: self.domain supports integration on ReducedFunctionOnContactZero
725 """
726 dim=self.domain.getDim()
727 w=ReducedFunctionOnContactZero(self.domain)
728 x=w.getX()
729 if dim==2:
730 arg=Data(0,(6, 2, 2),w)
731 arg[0,0,0]=(0.83264345248)*sqrt(x[0])
732 arg[0,0,1]=(-0.29697614845)*sqrt(x[1])
733 arg[0,1,0]=(-0.903150797089)*sqrt(x[0])
734 arg[0,1,1]=(-0.569048463149)*sqrt(x[1])
735 arg[1,0,0]=(0.317087339385)*sqrt(x[0])
736 arg[1,0,1]=(0.0120740865344)*sqrt(x[1])
737 arg[1,1,0]=(-0.221145803457)*sqrt(x[0])
738 arg[1,1,1]=(-0.15362409313)*sqrt(x[1])
739 arg[2,0,0]=(0.459428065932)*sqrt(x[0])
740 arg[2,0,1]=(-0.495488213623)*sqrt(x[1])
741 arg[2,1,0]=(0.919114285084)*sqrt(x[0])
742 arg[2,1,1]=(0.54511942052)*sqrt(x[1])
743 arg[3,0,0]=(0.442207797529)*sqrt(x[0])
744 arg[3,0,1]=(0.958341188449)*sqrt(x[1])
745 arg[3,1,0]=(-0.0915205976682)*sqrt(x[0])
746 arg[3,1,1]=(-0.410964460336)*sqrt(x[1])
747 arg[4,0,0]=(-0.243030095673)*sqrt(x[0])
748 arg[4,0,1]=(-0.413661756935)*sqrt(x[1])
749 arg[4,1,0]=(-0.0973014277464)*sqrt(x[0])
750 arg[4,1,1]=(0.204130676874)*sqrt(x[1])
751 arg[5,0,0]=(0.38083750131)*sqrt(x[0])
752 arg[5,0,1]=(0.286331574579)*sqrt(x[1])
753 arg[5,1,0]=(0.583320730408)*sqrt(x[0])
754 arg[5,1,1]=(-0.0899419806181)*sqrt(x[1])
755 ref=sqrt((0.789530406063)*3./2.+(0.868006693351)/0.5)
756
757 else:
758 arg=Data(0,(6, 2, 3),w)
759 arg[0,0,0]=(-0.98411764268)*sqrt(x[0])
760 arg[0,0,1]=(-0.180549567137)*sqrt(x[1])
761 arg[0,0,2]=(0.357923974709)*sqrt(x[2])
762 arg[0,1,0]=(0.67691778218)*sqrt(x[0])
763 arg[0,1,1]=(-0.643267669153)*sqrt(x[1])
764 arg[0,1,2]=(0.452374328301)*sqrt(x[2])
765 arg[1,0,0]=(0.494303694439)*sqrt(x[0])
766 arg[1,0,1]=(0.00767629822214)*sqrt(x[1])
767 arg[1,0,2]=(0.232436713422)*sqrt(x[2])
768 arg[1,1,0]=(-0.698568975983)*sqrt(x[0])
769 arg[1,1,1]=(-0.08483720353)*sqrt(x[1])
770 arg[1,1,2]=(-0.723935799719)*sqrt(x[2])
771 arg[2,0,0]=(0.931313239646)*sqrt(x[0])
772 arg[2,0,1]=(-0.0988070442341)*sqrt(x[1])
773 arg[2,0,2]=(-0.166201798278)*sqrt(x[2])
774 arg[2,1,0]=(-0.733172171406)*sqrt(x[0])
775 arg[2,1,1]=(0.24542706584)*sqrt(x[1])
776 arg[2,1,2]=(0.49170717592)*sqrt(x[2])
777 arg[3,0,0]=(-0.718346096869)*sqrt(x[0])
778 arg[3,0,1]=(0.297442410539)*sqrt(x[1])
779 arg[3,0,2]=(0.0277708718174)*sqrt(x[2])
780 arg[3,1,0]=(0.735100702194)*sqrt(x[0])
781 arg[3,1,1]=(-0.808007526296)*sqrt(x[1])
782 arg[3,1,2]=(-0.423023238313)*sqrt(x[2])
783 arg[4,0,0]=(0.383188529876)*sqrt(x[0])
784 arg[4,0,1]=(-0.190101601814)*sqrt(x[1])
785 arg[4,0,2]=(-0.404380990215)*sqrt(x[2])
786 arg[4,1,0]=(-0.31098204217)*sqrt(x[0])
787 arg[4,1,1]=(-0.715247945432)*sqrt(x[1])
788 arg[4,1,2]=(0.435774772982)*sqrt(x[2])
789 arg[5,0,0]=(-0.0662056096206)*sqrt(x[0])
790 arg[5,0,1]=(0.746710247367)*sqrt(x[1])
791 arg[5,0,2]=(0.753267249301)*sqrt(x[2])
792 arg[5,1,0]=(0.258102962518)*sqrt(x[0])
793 arg[5,1,1]=(-0.0270028483187)*sqrt(x[1])
794 arg[5,1,2]=(-0.971060107954)*sqrt(x[2])
795 ref=sqrt((1.86493016409)*3./2.+(1.23371587938)/0.5)
796
797 res=L2(arg)
798 self.assertTrue(isinstance(res,float),"wrong type of result.")
799 self.assertAlmostEqual(res,ref,int(-log10(self.RES_TOL)),"wrong result")
800 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
801 def test_L2_onReducedFunctionOnContactZero_fromData_rank4(self):
802 """
803 tests L2-norm of Data on the ReducedFunctionOnContactZero
804
805 assumptions: self.domain supports integration on ReducedFunctionOnContactZero
806 """
807 dim=self.domain.getDim()
808 w=ReducedFunctionOnContactZero(self.domain)
809 x=w.getX()
810 if dim==2:
811 arg=Data(0,(4, 5, 3, 2),w)
812 arg[0,0,0,0]=(-0.144741217139)*sqrt(x[0])
813 arg[0,0,0,1]=(-0.188187241012)*sqrt(x[1])
814 arg[0,0,1,0]=(0.056339373733)*sqrt(x[0])
815 arg[0,0,1,1]=(0.222177130759)*sqrt(x[1])
816 arg[0,0,2,0]=(-0.437240978497)*sqrt(x[0])
817 arg[0,0,2,1]=(-0.479213082014)*sqrt(x[1])
818 arg[0,1,0,0]=(0.343204141181)*sqrt(x[0])
819 arg[0,1,0,1]=(0.099683148208)*sqrt(x[1])
820 arg[0,1,1,0]=(0.167657906331)*sqrt(x[0])
821 arg[0,1,1,1]=(0.371064917656)*sqrt(x[1])
822 arg[0,1,2,0]=(-0.175796118619)*sqrt(x[0])
823 arg[0,1,2,1]=(-0.523477567832)*sqrt(x[1])
824 arg[0,2,0,0]=(0.188832282277)*sqrt(x[0])
825 arg[0,2,0,1]=(0.948618356423)*sqrt(x[1])
826 arg[0,2,1,0]=(-0.3835066594)*sqrt(x[0])
827 arg[0,2,1,1]=(0.872875257641)*sqrt(x[1])
828 arg[0,2,2,0]=(-0.98414676194)*sqrt(x[0])
829 arg[0,2,2,1]=(0.59170993756)*sqrt(x[1])
830 arg[0,3,0,0]=(0.875820385471)*sqrt(x[0])
831 arg[0,3,0,1]=(-0.209139794169)*sqrt(x[1])
832 arg[0,3,1,0]=(0.783312979835)*sqrt(x[0])
833 arg[0,3,1,1]=(-0.440048708153)*sqrt(x[1])
834 arg[0,3,2,0]=(-0.906741480158)*sqrt(x[0])
835 arg[0,3,2,1]=(0.63834196559)*sqrt(x[1])
836 arg[0,4,0,0]=(0.0142616166715)*sqrt(x[0])
837 arg[0,4,0,1]=(-0.0745581409622)*sqrt(x[1])
838 arg[0,4,1,0]=(-0.779966728505)*sqrt(x[0])
839 arg[0,4,1,1]=(0.734744791584)*sqrt(x[1])
840 arg[0,4,2,0]=(0.0407627699446)*sqrt(x[0])
841 arg[0,4,2,1]=(-0.629666423098)*sqrt(x[1])
842 arg[1,0,0,0]=(-0.782291768803)*sqrt(x[0])
843 arg[1,0,0,1]=(-0.197799867335)*sqrt(x[1])
844 arg[1,0,1,0]=(-0.487323212409)*sqrt(x[0])
845 arg[1,0,1,1]=(-0.789940409633)*sqrt(x[1])
846 arg[1,0,2,0]=(-0.523871448728)*sqrt(x[0])
847 arg[1,0,2,1]=(-0.622272488658)*sqrt(x[1])
848 arg[1,1,0,0]=(0.370095832941)*sqrt(x[0])
849 arg[1,1,0,1]=(-0.0683624906905)*sqrt(x[1])
850 arg[1,1,1,0]=(-0.180583695959)*sqrt(x[0])
851 arg[1,1,1,1]=(-0.0529097308814)*sqrt(x[1])
852 arg[1,1,2,0]=(0.440088045764)*sqrt(x[0])
853 arg[1,1,2,1]=(-0.207665675854)*sqrt(x[1])
854 arg[1,2,0,0]=(-0.360120735448)*sqrt(x[0])
855 arg[1,2,0,1]=(0.877797020694)*sqrt(x[1])
856 arg[1,2,1,0]=(0.655192721419)*sqrt(x[0])
857 arg[1,2,1,1]=(0.978781227463)*sqrt(x[1])
858 arg[1,2,2,0]=(-0.205886258554)*sqrt(x[0])
859 arg[1,2,2,1]=(-0.0050396100363)*sqrt(x[1])
860 arg[1,3,0,0]=(-0.484332943177)*sqrt(x[0])
861 arg[1,3,0,1]=(0.964697361018)*sqrt(x[1])
862 arg[1,3,1,0]=(0.0815652906824)*sqrt(x[0])
863 arg[1,3,1,1]=(-0.531163025802)*sqrt(x[1])
864 arg[1,3,2,0]=(-0.229615479833)*sqrt(x[0])
865 arg[1,3,2,1]=(0.139971291609)*sqrt(x[1])
866 arg[1,4,0,0]=(0.960839193726)*sqrt(x[0])
867 arg[1,4,0,1]=(-0.9744930023)*sqrt(x[1])
868 arg[1,4,1,0]=(-0.0919000363634)*sqrt(x[0])
869 arg[1,4,1,1]=(0.483909186003)*sqrt(x[1])
870 arg[1,4,2,0]=(0.248597552464)*sqrt(x[0])
871 arg[1,4,2,1]=(0.965872402486)*sqrt(x[1])
872 arg[2,0,0,0]=(-0.935049188033)*sqrt(x[0])
873 arg[2,0,0,1]=(-0.823239964421)*sqrt(x[1])
874 arg[2,0,1,0]=(0.30901193713)*sqrt(x[0])
875 arg[2,0,1,1]=(-0.0538396976182)*sqrt(x[1])
876 arg[2,0,2,0]=(-0.449416473099)*sqrt(x[0])
877 arg[2,0,2,1]=(-0.857785267819)*sqrt(x[1])
878 arg[2,1,0,0]=(-0.167802578334)*sqrt(x[0])
879 arg[2,1,0,1]=(-0.7016101186)*sqrt(x[1])
880 arg[2,1,1,0]=(0.995848317929)*sqrt(x[0])
881 arg[2,1,1,1]=(-0.824595018011)*sqrt(x[1])
882 arg[2,1,2,0]=(-0.826030527686)*sqrt(x[0])
883 arg[2,1,2,1]=(-0.856151725651)*sqrt(x[1])
884 arg[2,2,0,0]=(0.342047605028)*sqrt(x[0])
885 arg[2,2,0,1]=(-0.342370307931)*sqrt(x[1])
886 arg[2,2,1,0]=(-0.540693890831)*sqrt(x[0])
887 arg[2,2,1,1]=(-0.720754897785)*sqrt(x[1])
888 arg[2,2,2,0]=(-0.0941215154824)*sqrt(x[0])
889 arg[2,2,2,1]=(0.115887914141)*sqrt(x[1])
890 arg[2,3,0,0]=(-0.0920059639279)*sqrt(x[0])
891 arg[2,3,0,1]=(0.910948619784)*sqrt(x[1])
892 arg[2,3,1,0]=(-0.40846609126)*sqrt(x[0])
893 arg[2,3,1,1]=(0.542728733954)*sqrt(x[1])
894 arg[2,3,2,0]=(0.451361830368)*sqrt(x[0])
895 arg[2,3,2,1]=(0.0767538617936)*sqrt(x[1])
896 arg[2,4,0,0]=(-0.431757008766)*sqrt(x[0])
897 arg[2,4,0,1]=(0.258988103513)*sqrt(x[1])
898 arg[2,4,1,0]=(-0.584559859464)*sqrt(x[0])
899 arg[2,4,1,1]=(-0.776827606804)*sqrt(x[1])
900 arg[2,4,2,0]=(-0.867078960637)*sqrt(x[0])
901 arg[2,4,2,1]=(-0.0972960135129)*sqrt(x[1])
902 arg[3,0,0,0]=(0.999511727022)*sqrt(x[0])
903 arg[3,0,0,1]=(-0.753218704622)*sqrt(x[1])
904 arg[3,0,1,0]=(0.506439354885)*sqrt(x[0])
905 arg[3,0,1,1]=(-0.0845853282297)*sqrt(x[1])
906 arg[3,0,2,0]=(-0.871475028801)*sqrt(x[0])
907 arg[3,0,2,1]=(-0.69261642657)*sqrt(x[1])
908 arg[3,1,0,0]=(0.549778399933)*sqrt(x[0])
909 arg[3,1,0,1]=(0.246187536149)*sqrt(x[1])
910 arg[3,1,1,0]=(-0.620454200676)*sqrt(x[0])
911 arg[3,1,1,1]=(0.372738564315)*sqrt(x[1])
912 arg[3,1,2,0]=(0.0544097075138)*sqrt(x[0])
913 arg[3,1,2,1]=(-0.0883198944676)*sqrt(x[1])
914 arg[3,2,0,0]=(-0.671057180545)*sqrt(x[0])
915 arg[3,2,0,1]=(-0.118991797907)*sqrt(x[1])
916 arg[3,2,1,0]=(-0.27196730081)*sqrt(x[0])
917 arg[3,2,1,1]=(-0.458807068968)*sqrt(x[1])
918 arg[3,2,2,0]=(-0.31485399083)*sqrt(x[0])
919 arg[3,2,2,1]=(0.487291960328)*sqrt(x[1])
920 arg[3,3,0,0]=(-0.750302723531)*sqrt(x[0])
921 arg[3,3,0,1]=(-0.486428789771)*sqrt(x[1])
922 arg[3,3,1,0]=(-0.295909324594)*sqrt(x[0])
923 arg[3,3,1,1]=(0.325702372596)*sqrt(x[1])
924 arg[3,3,2,0]=(-0.512109540631)*sqrt(x[0])
925 arg[3,3,2,1]=(0.563284721908)*sqrt(x[1])
926 arg[3,4,0,0]=(0.53579406798)*sqrt(x[0])
927 arg[3,4,0,1]=(-0.468431927975)*sqrt(x[1])
928 arg[3,4,1,0]=(0.570851401329)*sqrt(x[0])
929 arg[3,4,1,1]=(0.107791149865)*sqrt(x[1])
930 arg[3,4,2,0]=(-0.211543670157)*sqrt(x[0])
931 arg[3,4,2,1]=(0.848189550468)*sqrt(x[1])
932 ref=sqrt((6.54316712884)*3./2.+(4.39564064326)/0.5)
933
934 else:
935 arg=Data(0,(4, 5, 3, 3),w)
936 arg[0,0,0,0]=(-0.392256494872)*sqrt(x[0])
937 arg[0,0,0,1]=(0.271488478841)*sqrt(x[1])
938 arg[0,0,0,2]=(-0.878268531987)*sqrt(x[2])
939 arg[0,0,1,0]=(0.106903787643)*sqrt(x[0])
940 arg[0,0,1,1]=(-0.117986434516)*sqrt(x[1])
941 arg[0,0,1,2]=(0.912673598522)*sqrt(x[2])
942 arg[0,0,2,0]=(-0.652598945824)*sqrt(x[0])
943 arg[0,0,2,1]=(-0.984195895647)*sqrt(x[1])
944 arg[0,0,2,2]=(-0.137845459589)*sqrt(x[2])
945 arg[0,1,0,0]=(0.696713200721)*sqrt(x[0])
946 arg[0,1,0,1]=(0.480337929223)*sqrt(x[1])
947 arg[0,1,0,2]=(-0.628726114325)*sqrt(x[2])
948 arg[0,1,1,0]=(-0.356503461347)*sqrt(x[0])
949 arg[0,1,1,1]=(-0.64670584045)*sqrt(x[1])
950 arg[0,1,1,2]=(-0.737787618908)*sqrt(x[2])
951 arg[0,1,2,0]=(-0.14207595302)*sqrt(x[0])
952 arg[0,1,2,1]=(-0.573485525334)*sqrt(x[1])
953 arg[0,1,2,2]=(-0.955542178481)*sqrt(x[2])
954 arg[0,2,0,0]=(0.371952883975)*sqrt(x[0])
955 arg[0,2,0,1]=(0.114016178762)*sqrt(x[1])
956 arg[0,2,0,2]=(0.552721218169)*sqrt(x[2])
957 arg[0,2,1,0]=(0.318426742113)*sqrt(x[0])
958 arg[0,2,1,1]=(0.862220239384)*sqrt(x[1])
959 arg[0,2,1,2]=(0.887376889978)*sqrt(x[2])
960 arg[0,2,2,0]=(0.203656742981)*sqrt(x[0])
961 arg[0,2,2,1]=(0.350541335144)*sqrt(x[1])
962 arg[0,2,2,2]=(-0.448401957447)*sqrt(x[2])
963 arg[0,3,0,0]=(-0.349200084042)*sqrt(x[0])
964 arg[0,3,0,1]=(-0.546012602125)*sqrt(x[1])
965 arg[0,3,0,2]=(-0.931488270979)*sqrt(x[2])
966 arg[0,3,1,0]=(0.207457831058)*sqrt(x[0])
967 arg[0,3,1,1]=(0.557715840549)*sqrt(x[1])
968 arg[0,3,1,2]=(-0.978130146744)*sqrt(x[2])
969 arg[0,3,2,0]=(-0.55088967957)*sqrt(x[0])
970 arg[0,3,2,1]=(0.0490328838057)*sqrt(x[1])
971 arg[0,3,2,2]=(0.150209929122)*sqrt(x[2])
972 arg[0,4,0,0]=(-0.484145614698)*sqrt(x[0])
973 arg[0,4,0,1]=(0.393078411279)*sqrt(x[1])
974 arg[0,4,0,2]=(0.0678631863917)*sqrt(x[2])
975 arg[0,4,1,0]=(-0.350980464628)*sqrt(x[0])
976 arg[0,4,1,1]=(-0.784203839564)*sqrt(x[1])
977 arg[0,4,1,2]=(0.636960296147)*sqrt(x[2])
978 arg[0,4,2,0]=(0.592799503581)*sqrt(x[0])
979 arg[0,4,2,1]=(-0.672104833683)*sqrt(x[1])
980 arg[0,4,2,2]=(0.0366914082467)*sqrt(x[2])
981 arg[1,0,0,0]=(-0.147168019774)*sqrt(x[0])
982 arg[1,0,0,1]=(-0.0823637938956)*sqrt(x[1])
983 arg[1,0,0,2]=(-0.852729690176)*sqrt(x[2])
984 arg[1,0,1,0]=(-0.612338430408)*sqrt(x[0])
985 arg[1,0,1,1]=(-0.85820035747)*sqrt(x[1])
986 arg[1,0,1,2]=(-0.463664966162)*sqrt(x[2])
987 arg[1,0,2,0]=(0.274600720491)*sqrt(x[0])
988 arg[1,0,2,1]=(-0.488508234093)*sqrt(x[1])
989 arg[1,0,2,2]=(-0.28251466519)*sqrt(x[2])
990 arg[1,1,0,0]=(-0.0196532462794)*sqrt(x[0])
991 arg[1,1,0,1]=(0.239352528871)*sqrt(x[1])
992 arg[1,1,0,2]=(-0.17054773873)*sqrt(x[2])
993 arg[1,1,1,0]=(-0.2396627789)*sqrt(x[0])
994 arg[1,1,1,1]=(0.868970323003)*sqrt(x[1])
995 arg[1,1,1,2]=(0.401487430312)*sqrt(x[2])
996 arg[1,1,2,0]=(-0.624411449783)*sqrt(x[0])
997 arg[1,1,2,1]=(0.0036634266684)*sqrt(x[1])
998 arg[1,1,2,2]=(0.736129120967)*sqrt(x[2])
999 arg[1,2,0,0]=(0.183756511707)*sqrt(x[0])
1000 arg[1,2,0,1]=(-0.288651848639)*sqrt(x[1])
1001 arg[1,2,0,2]=(-0.0672121537447)*sqrt(x[2])
1002 arg[1,2,1,0]=(-0.323274725936)*sqrt(x[0])
1003 arg[1,2,1,1]=(0.298001016025)*sqrt(x[1])
1004 arg[1,2,1,2]=(-0.976052460675)*sqrt(x[2])
1005 arg[1,2,2,0]=(0.596504441096)*sqrt(x[0])
1006 arg[1,2,2,1]=(0.873776068983)*sqrt(x[1])
1007 arg[1,2,2,2]=(-0.994068273196)*sqrt(x[2])
1008 arg[1,3,0,0]=(-0.495387299681)*sqrt(x[0])
1009 arg[1,3,0,1]=(-0.123674756551)*sqrt(x[1])
1010 arg[1,3,0,2]=(0.581213818577)*sqrt(x[2])
1011 arg[1,3,1,0]=(0.146405749701)*sqrt(x[0])
1012 arg[1,3,1,1]=(-0.594994686675)*sqrt(x[1])
1013 arg[1,3,1,2]=(-0.059093568436)*sqrt(x[2])
1014 arg[1,3,2,0]=(0.651004255104)*sqrt(x[0])
1015 arg[1,3,2,1]=(-0.977880706193)*sqrt(x[1])
1016 arg[1,3,2,2]=(0.370344651319)*sqrt(x[2])
1017 arg[1,4,0,0]=(-0.503657215247)*sqrt(x[0])
1018 arg[1,4,0,1]=(-0.170885297253)*sqrt(x[1])
1019 arg[1,4,0,2]=(0.533424480956)*sqrt(x[2])
1020 arg[1,4,1,0]=(-0.220533193308)*sqrt(x[0])
1021 arg[1,4,1,1]=(0.344537611882)*sqrt(x[1])
1022 arg[1,4,1,2]=(0.861473877282)*sqrt(x[2])
1023 arg[1,4,2,0]=(-0.0923010438884)*sqrt(x[0])
1024 arg[1,4,2,1]=(-0.338256780498)*sqrt(x[1])
1025 arg[1,4,2,2]=(0.528567959345)*sqrt(x[2])
1026 arg[2,0,0,0]=(-0.0423053381485)*sqrt(x[0])
1027 arg[2,0,0,1]=(0.856798579151)*sqrt(x[1])
1028 arg[2,0,0,2]=(0.383258153853)*sqrt(x[2])
1029 arg[2,0,1,0]=(0.350994872736)*sqrt(x[0])
1030 arg[2,0,1,1]=(-0.78055158106)*sqrt(x[1])
1031 arg[2,0,1,2]=(-0.770876699915)*sqrt(x[2])
1032 arg[2,0,2,0]=(-0.935133287106)*sqrt(x[0])
1033 arg[2,0,2,1]=(0.618238076989)*sqrt(x[1])
1034 arg[2,0,2,2]=(-0.846783087949)*sqrt(x[2])
1035 arg[2,1,0,0]=(-0.657394511405)*sqrt(x[0])
1036 arg[2,1,0,1]=(0.576218821654)*sqrt(x[1])
1037 arg[2,1,0,2]=(0.0269446356493)*sqrt(x[2])
1038 arg[2,1,1,0]=(-0.310710230949)*sqrt(x[0])
1039 arg[2,1,1,1]=(0.425412515598)*sqrt(x[1])
1040 arg[2,1,1,2]=(-0.225225290862)*sqrt(x[2])
1041 arg[2,1,2,0]=(-0.539928589495)*sqrt(x[0])
1042 arg[2,1,2,1]=(-0.348082121765)*sqrt(x[1])
1043 arg[2,1,2,2]=(-0.0287274646233)*sqrt(x[2])
1044 arg[2,2,0,0]=(0.746132865923)*sqrt(x[0])
1045 arg[2,2,0,1]=(-0.0234203693548)*sqrt(x[1])
1046 arg[2,2,0,2]=(0.517411821941)*sqrt(x[2])
1047 arg[2,2,1,0]=(-0.183204217349)*sqrt(x[0])
1048 arg[2,2,1,1]=(0.714988861836)*sqrt(x[1])
1049 arg[2,2,1,2]=(0.829083318937)*sqrt(x[2])
1050 arg[2,2,2,0]=(0.458067555841)*sqrt(x[0])
1051 arg[2,2,2,1]=(0.639317125869)*sqrt(x[1])
1052 arg[2,2,2,2]=(0.104611520408)*sqrt(x[2])
1053 arg[2,3,0,0]=(-0.420513461135)*sqrt(x[0])
1054 arg[2,3,0,1]=(0.888686162754)*sqrt(x[1])
1055 arg[2,3,0,2]=(0.939305777879)*sqrt(x[2])
1056 arg[2,3,1,0]=(0.856795132015)*sqrt(x[0])
1057 arg[2,3,1,1]=(0.817593141895)*sqrt(x[1])
1058 arg[2,3,1,2]=(0.962503342535)*sqrt(x[2])
1059 arg[2,3,2,0]=(-0.334586700245)*sqrt(x[0])
1060 arg[2,3,2,1]=(0.182696129528)*sqrt(x[1])
1061 arg[2,3,2,2]=(-0.707271571206)*sqrt(x[2])
1062 arg[2,4,0,0]=(-0.594795981069)*sqrt(x[0])
1063 arg[2,4,0,1]=(0.451239168073)*sqrt(x[1])
1064 arg[2,4,0,2]=(0.191212211556)*sqrt(x[2])
1065 arg[2,4,1,0]=(-0.503465984944)*sqrt(x[0])
1066 arg[2,4,1,1]=(0.725377884208)*sqrt(x[1])
1067 arg[2,4,1,2]=(-0.40719255752)*sqrt(x[2])
1068 arg[2,4,2,0]=(0.268071476451)*sqrt(x[0])
1069 arg[2,4,2,1]=(0.85066639942)*sqrt(x[1])
1070 arg[2,4,2,2]=(-0.906021406945)*sqrt(x[2])
1071 arg[3,0,0,0]=(-0.922179152122)*sqrt(x[0])
1072 arg[3,0,0,1]=(-0.0903841240007)*sqrt(x[1])
1073 arg[3,0,0,2]=(-0.751482803516)*sqrt(x[2])
1074 arg[3,0,1,0]=(0.960697809119)*sqrt(x[0])
1075 arg[3,0,1,1]=(0.638878873158)*sqrt(x[1])
1076 arg[3,0,1,2]=(0.390932234724)*sqrt(x[2])
1077 arg[3,0,2,0]=(-0.925078301694)*sqrt(x[0])
1078 arg[3,0,2,1]=(0.793590580665)*sqrt(x[1])
1079 arg[3,0,2,2]=(0.535478366911)*sqrt(x[2])
1080 arg[3,1,0,0]=(-0.431951993217)*sqrt(x[0])
1081 arg[3,1,0,1]=(0.211750261417)*sqrt(x[1])
1082 arg[3,1,0,2]=(-0.930706580442)*sqrt(x[2])
1083 arg[3,1,1,0]=(0.330979313323)*sqrt(x[0])
1084 arg[3,1,1,1]=(-0.838919076081)*sqrt(x[1])
1085 arg[3,1,1,2]=(0.134250050168)*sqrt(x[2])
1086 arg[3,1,2,0]=(0.414922811301)*sqrt(x[0])
1087 arg[3,1,2,1]=(-0.663692878121)*sqrt(x[1])
1088 arg[3,1,2,2]=(0.88499278543)*sqrt(x[2])
1089 arg[3,2,0,0]=(0.0884662742233)*sqrt(x[0])
1090 arg[3,2,0,1]=(-0.412630722821)*sqrt(x[1])
1091 arg[3,2,0,2]=(-0.730850884928)*sqrt(x[2])
1092 arg[3,2,1,0]=(0.722207547366)*sqrt(x[0])
1093 arg[3,2,1,1]=(-0.260067950749)*sqrt(x[1])
1094 arg[3,2,1,2]=(0.426259201494)*sqrt(x[2])
1095 arg[3,2,2,0]=(0.0516111795322)*sqrt(x[0])
1096 arg[3,2,2,1]=(0.922853710048)*sqrt(x[1])
1097 arg[3,2,2,2]=(-0.991912758116)*sqrt(x[2])
1098 arg[3,3,0,0]=(0.263933965905)*sqrt(x[0])
1099 arg[3,3,0,1]=(0.840541758799)*sqrt(x[1])
1100 arg[3,3,0,2]=(0.417658511125)*sqrt(x[2])
1101 arg[3,3,1,0]=(-0.901745614723)*sqrt(x[0])
1102 arg[3,3,1,1]=(-0.623608908699)*sqrt(x[1])
1103 arg[3,3,1,2]=(0.0522167208784)*sqrt(x[2])
1104 arg[3,3,2,0]=(-0.549431264931)*sqrt(x[0])
1105 arg[3,3,2,1]=(0.919971855457)*sqrt(x[1])
1106 arg[3,3,2,2]=(0.142757773397)*sqrt(x[2])
1107 arg[3,4,0,0]=(-0.258875259824)*sqrt(x[0])
1108 arg[3,4,0,1]=(-0.0373872187041)*sqrt(x[1])
1109 arg[3,4,0,2]=(0.445989164864)*sqrt(x[2])
1110 arg[3,4,1,0]=(0.0273711397038)*sqrt(x[0])
1111 arg[3,4,1,1]=(-0.85522629)*sqrt(x[1])
1112 arg[3,4,1,2]=(-0.835392581226)*sqrt(x[2])
1113 arg[3,4,2,0]=(0.402929450189)*sqrt(x[0])
1114 arg[3,4,2,1]=(0.549623033221)*sqrt(x[1])
1115 arg[3,4,2,2]=(0.237803212109)*sqrt(x[2])
1116 ref=sqrt((15.1448100099)*3./2.+(3.61598249819)/0.5)
1117
1118 res=L2(arg)
1119 self.assertTrue(isinstance(res,float),"wrong type of result.")
1120 self.assertAlmostEqual(res,ref,int(-log10(self.RES_TOL)),"wrong result")
1121 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1122 def test_L2_onFunctionOnContactOne_fromData_rank0(self):
1123 """
1124 tests L2-norm of Data on the FunctionOnContactOne
1125
1126 assumptions: self.domain supports integration on FunctionOnContactOne
1127 """
1128 dim=self.domain.getDim()
1129 w=FunctionOnContactOne(self.domain)
1130 x=w.getX()
1131 if dim==2:
1132 arg=Data(0,(),w)
1133 arg=(0.39039157828)*x[0]
1134 ref=sqrt((0.0)+(0.038101396098))
1135
1136 else:
1137 arg=Data(0,(),w)
1138 arg=(0.893204658234)*x[0]
1139 ref=sqrt((0.0)+(0.199453640373))
1140
1141 res=L2(arg)
1142 self.assertTrue(isinstance(res,float),"wrong type of result.")
1143 self.assertAlmostEqual(res,ref,int(-log10(self.RES_TOL)),"wrong result")
1144 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1145 def test_L2_onFunctionOnContactOne_fromData_rank1(self):
1146 """
1147 tests L2-norm of Data on the FunctionOnContactOne
1148
1149 assumptions: self.domain supports integration on FunctionOnContactOne
1150 """
1151 dim=self.domain.getDim()
1152 w=FunctionOnContactOne(self.domain)
1153 x=w.getX()
1154 if dim==2:
1155 arg=Data(0,(2,),w)
1156 arg[0]=(0.697576620054)*x[0]
1157 arg[1]=(-0.302037273777)*x[1]
1158 ref=sqrt((0.0304088382502)+(0.121653285212))
1159
1160 else:
1161 arg=Data(0,(3,),w)
1162 arg[0]=(0.649308272675)*x[0]
1163 arg[1]=(-0.408829699836)*x[1]
1164 arg[2]=(-0.984892977949)*x[2]
1165 ref=sqrt((0.37905196716)+(0.105400308241))
1166
1167 res=L2(arg)
1168 self.assertTrue(isinstance(res,float),"wrong type of result.")
1169 self.assertAlmostEqual(res,ref,int(-log10(self.RES_TOL)),"wrong result")
1170 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1171 def test_L2_onFunctionOnContactOne_fromData_rank2(self):
1172 """
1173 tests L2-norm of Data on the FunctionOnContactOne
1174
1175 assumptions: self.domain supports integration on FunctionOnContactOne
1176 """
1177 dim=self.domain.getDim()
1178 w=FunctionOnContactOne(self.domain)
1179 x=w.getX()
1180 if dim==2:
1181 arg=Data(0,(4, 2),w)
1182 arg[0,0]=(0.504133645896)*x[0]
1183 arg[0,1]=(0.728228500775)*x[1]
1184 arg[1,0]=(0.968237164633)*x[0]
1185 arg[1,1]=(-0.205351628957)*x[1]
1186 arg[2,0]=(-0.154008228702)*x[0]
1187 arg[2,1]=(-0.972088404566)*x[1]
1188 arg[3,0]=(0.585153521593)*x[0]
1189 arg[3,1]=(0.371861820001)*x[1]
1190 ref=sqrt((0.551907706774)+(0.389439279561))
1191
1192 else:
1193 arg=Data(0,(4, 3),w)
1194 arg[0,0]=(-0.4847970605)*x[0]
1195 arg[0,1]=(-0.664433021479)*x[1]
1196 arg[0,2]=(-0.93730914676)*x[2]
1197 arg[1,0]=(0.712624065023)*x[0]
1198 arg[1,1]=(0.105431976424)*x[1]
1199 arg[1,2]=(-0.452636806104)*x[2]
1200 arg[2,0]=(0.488406064176)*x[0]
1201 arg[2,1]=(0.0594879976584)*x[1]
1202 arg[2,2]=(0.596963883202)*x[2]
1203 arg[3,0]=(0.619366395328)*x[0]
1204 arg[3,1]=(0.719965901041)*x[1]
1205 arg[3,2]=(-0.568971277169)*x[2]
1206 ref=sqrt((0.912666523048)+(0.341254115776))
1207
1208 res=L2(arg)
1209 self.assertTrue(isinstance(res,float),"wrong type of result.")
1210 self.assertAlmostEqual(res,ref,int(-log10(self.RES_TOL)),"wrong result")
1211 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1212 def test_L2_onFunctionOnContactOne_fromData_rank3(self):
1213 """
1214 tests L2-norm of Data on the FunctionOnContactOne
1215
1216 assumptions: self.domain supports integration on FunctionOnContactOne
1217 """
1218 dim=self.domain.getDim()
1219 w=FunctionOnContactOne(self.domain)
1220 x=w.getX()
1221 if dim==2:
1222 arg=Data(0,(6, 2, 2),w)
1223 arg[0,0,0]=(-0.481233278183)*x[0]
1224 arg[0,0,1]=(-0.883447576048)*x[1]
1225 arg[0,1,0]=(0.525938652633)*x[0]
1226 arg[0,1,1]=(-0.694971850651)*x[1]
1227 arg[1,0,0]=(-0.935880633291)*x[0]
1228 arg[1,0,1]=(0.970445286468)*x[1]
1229 arg[1,1,0]=(-0.302571977945)*x[0]
1230 arg[1,1,1]=(-0.237750319821)*x[1]
1231 arg[2,0,0]=(0.922940652883)*x[0]
1232 arg[2,0,1]=(-0.624756614078)*x[1]
1233 arg[2,1,0]=(-0.146839388764)*x[0]
1234 arg[2,1,1]=(-0.995551211092)*x[1]
1235 arg[3,0,0]=(0.719184541649)*x[0]
1236 arg[3,0,1]=(-0.629461063375)*x[1]
1237 arg[3,1,0]=(-0.925581215276)*x[0]
1238 arg[3,1,1]=(-0.564418658495)*x[1]
1239 arg[4,0,0]=(-0.724035884026)*x[0]
1240 arg[4,0,1]=(0.78393984221)*x[1]
1241 arg[4,1,0]=(-0.722375249317)*x[0]
1242 arg[4,1,1]=(0.27571990944)*x[1]
1243 arg[5,0,0]=(-0.197579392553)*x[0]
1244 arg[5,0,1]=(0.341717398275)*x[1]
1245 arg[5,1,0]=(0.926327822859)*x[0]
1246 arg[5,1,1]=(0.44114488285)*x[1]
1247 ref=sqrt((1.78665006238)+(1.41652558894))
1248
1249 else:
1250 arg=Data(0,(6, 2, 3),w)
1251 arg[0,0,0]=(-0.348448140437)*x[0]
1252 arg[0,0,1]=(-0.530793589782)*x[1]
1253 arg[0,0,2]=(0.386511493376)*x[2]
1254 arg[0,1,0]=(0.00776536299593)*x[0]
1255 arg[0,1,1]=(-0.0696129074064)*x[1]
1256 arg[0,1,2]=(0.114179504216)*x[2]
1257 arg[1,0,0]=(-0.681009917406)*x[0]
1258 arg[1,0,1]=(0.763595403719)*x[1]
1259 arg[1,0,2]=(-0.54459342544)*x[2]
1260 arg[1,1,0]=(0.0839255723157)*x[0]
1261 arg[1,1,1]=(0.269389515003)*x[1]
1262 arg[1,1,2]=(0.612446509453)*x[2]
1263 arg[2,0,0]=(0.600070579238)*x[0]
1264 arg[2,0,1]=(-0.49585867531)*x[1]
1265 arg[2,0,2]=(-0.766857395141)*x[2]
1266 arg[2,1,0]=(-0.84515816441)*x[0]
1267 arg[2,1,1]=(-0.594337789049)*x[1]
1268 arg[2,1,2]=(0.774596009811)*x[2]
1269 arg[3,0,0]=(-0.833982234688)*x[0]
1270 arg[3,0,1]=(0.747667281218)*x[1]
1271 arg[3,0,2]=(-0.77025764051)*x[2]
1272 arg[3,1,0]=(0.0367023286497)*x[0]
1273 arg[3,1,1]=(-0.503080137993)*x[1]
1274 arg[3,1,2]=(-0.129478323797)*x[2]
1275 arg[4,0,0]=(0.304123530695)*x[0]
1276 arg[4,0,1]=(-0.873023368289)*x[1]
1277 arg[4,0,2]=(-0.712740806672)*x[2]
1278 arg[4,1,0]=(-0.0629132979843)*x[0]
1279 arg[4,1,1]=(0.096843438525)*x[1]
1280 arg[4,1,2]=(-0.608716559621)*x[2]
1281 arg[5,0,0]=(-0.642902822517)*x[0]
1282 arg[5,0,1]=(0.478134785533)*x[1]
1283 arg[5,0,2]=(0.757891512092)*x[2]
1284 arg[5,1,0]=(-0.144492755065)*x[0]
1285 arg[5,1,1]=(0.286775195938)*x[1]
1286 arg[5,1,2]=(-0.063580488638)*x[2]
1287 ref=sqrt((2.50835195543)+(0.723549067206))
1288
1289 res=L2(arg)
1290 self.assertTrue(isinstance(res,float),"wrong type of result.")
1291 self.assertAlmostEqual(res,ref,int(-log10(self.RES_TOL)),"wrong result")
1292 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1293 def test_L2_onFunctionOnContactOne_fromData_rank4(self):
1294 """
1295 tests L2-norm of Data on the FunctionOnContactOne
1296
1297 assumptions: self.domain supports integration on FunctionOnContactOne
1298 """
1299 dim=self.domain.getDim()
1300 w=FunctionOnContactOne(self.domain)
1301 x=w.getX()
1302 if dim==2:
1303 arg=Data(0,(4, 5, 3, 2),w)
1304 arg[0,0,0,0]=(0.523372259748)*x[0]
1305 arg[0,0,0,1]=(-0.732795389957)*x[1]
1306 arg[0,0,1,0]=(0.0571737128606)*x[0]
1307 arg[0,0,1,1]=(-0.627260438721)*x[1]
1308 arg[0,0,2,0]=(-0.945159375045)*x[0]
1309 arg[0,0,2,1]=(-0.145103328237)*x[1]
1310 arg[0,1,0,0]=(-0.0586985419455)*x[0]
1311 arg[0,1,0,1]=(-0.788101334389)*x[1]
1312 arg[0,1,1,0]=(0.615023802803)*x[0]
1313 arg[0,1,1,1]=(0.965381283357)*x[1]
1314 arg[0,1,2,0]=(0.173979432067)*x[0]
1315 arg[0,1,2,1]=(-0.980483156424)*x[1]
1316 arg[0,2,0,0]=(-0.345940909471)*x[0]
1317 arg[0,2,0,1]=(0.00162430279595)*x[1]
1318 arg[0,2,1,0]=(-0.0847413350082)*x[0]
1319 arg[0,2,1,1]=(-0.911248036753)*x[1]
1320 arg[0,2,2,0]=(-0.817295589942)*x[0]
1321 arg[0,2,2,1]=(-0.0514569401185)*x[1]
1322 arg[0,3,0,0]=(0.329704440159)*x[0]
1323 arg[0,3,0,1]=(0.580379057442)*x[1]
1324 arg[0,3,1,0]=(0.737014729605)*x[0]
1325 arg[0,3,1,1]=(0.535521740242)*x[1]
1326 arg[0,3,2,0]=(-0.943554721405)*x[0]
1327 arg[0,3,2,1]=(0.798294295959)*x[1]
1328 arg[0,4,0,0]=(-0.1814410847)*x[0]
1329 arg[0,4,0,1]=(0.968476629577)*x[1]
1330 arg[0,4,1,0]=(0.26595250332)*x[0]
1331 arg[0,4,1,1]=(-0.493516007909)*x[1]
1332 arg[0,4,2,0]=(0.374323739856)*x[0]
1333 arg[0,4,2,1]=(-0.914413601829)*x[1]
1334 arg[1,0,0,0]=(-0.701090812201)*x[0]
1335 arg[1,0,0,1]=(-0.403596866322)*x[1]
1336 arg[1,0,1,0]=(0.587183778075)*x[0]
1337 arg[1,0,1,1]=(-0.218129059558)*x[1]
1338 arg[1,0,2,0]=(-0.0205642762349)*x[0]
1339 arg[1,0,2,1]=(0.441382235525)*x[1]
1340 arg[1,1,0,0]=(0.909683859519)*x[0]
1341 arg[1,1,0,1]=(0.960088832754)*x[1]
1342 arg[1,1,1,0]=(0.0450355911985)*x[0]
1343 arg[1,1,1,1]=(0.366849576658)*x[1]
1344 arg[1,1,2,0]=(0.315490164497)*x[0]
1345 arg[1,1,2,1]=(0.533746946808)*x[1]
1346 arg[1,2,0,0]=(-0.552919155957)*x[0]
1347 arg[1,2,0,1]=(-0.647373009727)*x[1]
1348 arg[1,2,1,0]=(0.32617079311)*x[0]
1349 arg[1,2,1,1]=(-0.3424263412)*x[1]
1350 arg[1,2,2,0]=(0.848733118893)*x[0]
1351 arg[1,2,2,1]=(-0.65341712364)*x[1]
1352 arg[1,3,0,0]=(-0.698538235208)*x[0]
1353 arg[1,3,0,1]=(-0.176858090319)*x[1]
1354 arg[1,3,1,0]=(-0.956962782849)*x[0]
1355 arg[1,3,1,1]=(0.53041598553)*x[1]
1356 arg[1,3,2,0]=(-0.241715236701)*x[0]
1357 arg[1,3,2,1]=(0.0340608544103)*x[1]
1358 arg[1,4,0,0]=(-0.399279751219)*x[0]
1359 arg[1,4,0,1]=(0.383860128496)*x[1]
1360 arg[1,4,1,0]=(0.229189108307)*x[0]
1361 arg[1,4,1,1]=(0.963667605308)*x[1]
1362 arg[1,4,2,0]=(0.731912848998)*x[0]
1363 arg[1,4,2,1]=(0.0534970206048)*x[1]
1364 arg[2,0,0,0]=(0.422292915614)*x[0]
1365 arg[2,0,0,1]=(0.915607515426)*x[1]
1366 arg[2,0,1,0]=(0.451054723135)*x[0]
1367 arg[2,0,1,1]=(0.0400870534188)*x[1]
1368 arg[2,0,2,0]=(-0.851047453002)*x[0]
1369 arg[2,0,2,1]=(0.300957420969)*x[1]
1370 arg[2,1,0,0]=(0.636801515211)*x[0]
1371 arg[2,1,0,1]=(0.386798062533)*x[1]
1372 arg[2,1,1,0]=(-0.0501653606261)*x[0]
1373 arg[2,1,1,1]=(0.46515271421)*x[1]
1374 arg[2,1,2,0]=(-0.416436918527)*x[0]
1375 arg[2,1,2,1]=(0.214018855333)*x[1]
1376 arg[2,2,0,0]=(0.0516439357756)*x[0]
1377 arg[2,2,0,1]=(-0.237707451356)*x[1]
1378 arg[2,2,1,0]=(0.117559050121)*x[0]
1379 arg[2,2,1,1]=(0.164349348553)*x[1]
1380 arg[2,2,2,0]=(0.0524038362463)*x[0]
1381 arg[2,2,2,1]=(0.690751059081)*x[1]
1382 arg[2,3,0,0]=(-0.942079336547)*x[0]
1383 arg[2,3,0,1]=(0.340143899875)*x[1]
1384 arg[2,3,1,0]=(-0.630411753789)*x[0]
1385 arg[2,3,1,1]=(-0.722078100418)*x[1]
1386 arg[2,3,2,0]=(-0.310606406168)*x[0]
1387 arg[2,3,2,1]=(0.728069014178)*x[1]
1388 arg[2,4,0,0]=(0.981678768954)*x[0]
1389 arg[2,4,0,1]=(-0.273023706956)*x[1]
1390 arg[2,4,1,0]=(0.307187251211)*x[0]
1391 arg[2,4,1,1]=(-0.885309661176)*x[1]
1392 arg[2,4,2,0]=(-0.808022645995)*x[0]
1393 arg[2,4,2,1]=(-0.21488080753)*x[1]
1394 arg[3,0,0,0]=(-0.785416067695)*x[0]
1395 arg[3,0,0,1]=(0.344457091999)*x[1]
1396 arg[3,0,1,0]=(-0.845835855973)*x[0]
1397 arg[3,0,1,1]=(0.365474280353)*x[1]
1398 arg[3,0,2,0]=(-0.250535373488)*x[0]
1399 arg[3,0,2,1]=(-0.888004656815)*x[1]
1400 arg[3,1,0,0]=(-0.0652508248717)*x[0]
1401 arg[3,1,0,1]=(0.402069695186)*x[1]
1402 arg[3,1,1,0]=(-0.229714763188)*x[0]
1403 arg[3,1,1,1]=(-0.866938136156)*x[1]
1404 arg[3,1,2,0]=(-0.638603745536)*x[0]
1405 arg[3,1,2,1]=(-0.997108734664)*x[1]
1406 arg[3,2,0,0]=(-0.182784593825)*x[0]
1407 arg[3,2,0,1]=(0.426951207538)*x[1]
1408 arg[3,2,1,0]=(-0.958149736654)*x[0]
1409 arg[3,2,1,1]=(-0.58458370587)*x[1]
1410 arg[3,2,2,0]=(0.410243417149)*x[0]
1411 arg[3,2,2,1]=(0.764474507608)*x[1]
1412 arg[3,3,0,0]=(0.235623988334)*x[0]
1413 arg[3,3,0,1]=(-0.105137401903)*x[1]
1414 arg[3,3,1,0]=(-0.957743319072)*x[0]
1415 arg[3,3,1,1]=(0.285680328399)*x[1]
1416 arg[3,3,2,0]=(-0.525269717395)*x[0]
1417 arg[3,3,2,1]=(0.655974370871)*x[1]
1418 arg[3,4,0,0]=(0.926779313365)*x[0]
1419 arg[3,4,0,1]=(-0.111556488031)*x[1]
1420 arg[3,4,1,0]=(-0.672785588938)*x[0]
1421 arg[3,4,1,1]=(-0.687907843899)*x[1]
1422 arg[3,4,2,0]=(0.503984478085)*x[0]
1423 arg[3,4,2,1]=(0.213194091516)*x[1]
1424 ref=sqrt((6.92178561091)+(4.96610502195))
1425
1426 else:
1427 arg=Data(0,(4, 5, 3, 3),w)
1428 arg[0,0,0,0]=(-0.641108959812)*x[0]
1429 arg[0,0,0,1]=(0.395837684631)*x[1]
1430 arg[0,0,0,2]=(0.36258240616)*x[2]
1431 arg[0,0,1,0]=(-0.0543293722691)*x[0]
1432 arg[0,0,1,1]=(0.850820297369)*x[1]
1433 arg[0,0,1,2]=(0.0910730209593)*x[2]
1434 arg[0,0,2,0]=(-0.831108730829)*x[0]
1435 arg[0,0,2,1]=(-0.653018722047)*x[1]
1436 arg[0,0,2,2]=(0.29052921548)*x[2]
1437 arg[0,1,0,0]=(-0.115846569271)*x[0]
1438 arg[0,1,0,1]=(-0.828080308748)*x[1]
1439 arg[0,1,0,2]=(0.715255255273)*x[2]
1440 arg[0,1,1,0]=(-0.0106077934044)*x[0]
1441 arg[0,1,1,1]=(0.358323295554)*x[1]
1442 arg[0,1,1,2]=(-0.916496266702)*x[2]
1443 arg[0,1,2,0]=(0.740969432327)*x[0]
1444 arg[0,1,2,1]=(0.0631507192754)*x[1]
1445 arg[0,1,2,2]=(0.440009320758)*x[2]
1446 arg[0,2,0,0]=(0.689964376385)*x[0]
1447 arg[0,2,0,1]=(0.58199412545)*x[1]
1448 arg[0,2,0,2]=(0.649058556936)*x[2]
1449 arg[0,2,1,0]=(0.811660544475)*x[0]
1450 arg[0,2,1,1]=(-0.121902248927)*x[1]
1451 arg[0,2,1,2]=(-0.0750232179247)*x[2]
1452 arg[0,2,2,0]=(0.779166450882)*x[0]
1453 arg[0,2,2,1]=(0.298560101475)*x[1]
1454 arg[0,2,2,2]=(-0.776198356206)*x[2]
1455 arg[0,3,0,0]=(0.79804128408)*x[0]
1456 arg[0,3,0,1]=(-0.378223308322)*x[1]
1457 arg[0,3,0,2]=(0.191534109359)*x[2]
1458 arg[0,3,1,0]=(-0.59973117885)*x[0]
1459 arg[0,3,1,1]=(0.149042766249)*x[1]
1460 arg[0,3,1,2]=(-0.357473233062)*x[2]
1461 arg[0,3,2,0]=(-0.343758339283)*x[0]
1462 arg[0,3,2,1]=(-0.140764743713)*x[1]
1463 arg[0,3,2,2]=(-0.506377878901)*x[2]
1464 arg[0,4,0,0]=(-0.967765607304)*x[0]
1465 arg[0,4,0,1]=(-0.121373931498)*x[1]
1466 arg[0,4,0,2]=(-0.300794608584)*x[2]
1467 arg[0,4,1,0]=(-0.604537150389)*x[0]
1468 arg[0,4,1,1]=(-0.290834102056)*x[1]
1469 arg[0,4,1,2]=(0.509331591828)*x[2]
1470 arg[0,4,2,0]=(0.643653985564)*x[0]
1471 arg[0,4,2,1]=(-0.599746831159)*x[1]
1472 arg[0,4,2,2]=(0.843193710828)*x[2]
1473 arg[1,0,0,0]=(-0.598249432719)*x[0]
1474 arg[1,0,0,1]=(0.840724468488)*x[1]
1475 arg[1,0,0,2]=(0.558893493847)*x[2]
1476 arg[1,0,1,0]=(0.843245438555)*x[0]
1477 arg[1,0,1,1]=(0.280919545563)*x[1]
1478 arg[1,0,1,2]=(-0.0549504830615)*x[2]
1479 arg[1,0,2,0]=(0.295812998973)*x[0]
1480 arg[1,0,2,1]=(0.513221249344)*x[1]
1481 arg[1,0,2,2]=(-0.432253600492)*x[2]
1482 arg[1,1,0,0]=(0.300696333449)*x[0]
1483 arg[1,1,0,1]=(0.964202717779)*x[1]
1484 arg[1,1,0,2]=(0.131730374204)*x[2]
1485 arg[1,1,1,0]=(0.209135189207)*x[0]
1486 arg[1,1,1,1]=(0.301389564979)*x[1]
1487 arg[1,1,1,2]=(0.378481289816)*x[2]
1488 arg[1,1,2,0]=(0.407413524533)*x[0]
1489 arg[1,1,2,1]=(0.184345610049)*x[1]
1490 arg[1,1,2,2]=(-0.884401323556)*x[2]
1491 arg[1,2,0,0]=(0.886883417187)*x[0]
1492 arg[1,2,0,1]=(-0.0524504232352)*x[1]
1493 arg[1,2,0,2]=(0.049116549681)*x[2]
1494 arg[1,2,1,0]=(-0.41240815391)*x[0]
1495 arg[1,2,1,1]=(-0.523033558623)*x[1]
1496 arg[1,2,1,2]=(-0.920238404199)*x[2]
1497 arg[1,2,2,0]=(-0.635169424461)*x[0]
1498 arg[1,2,2,1]=(0.773163888164)*x[1]
1499 arg[1,2,2,2]=(0.554400056145)*x[2]
1500 arg[1,3,0,0]=(0.573361031392)*x[0]
1501 arg[1,3,0,1]=(-0.107749750058)*x[1]
1502 arg[1,3,0,2]=(-0.971799077244)*x[2]
1503 arg[1,3,1,0]=(-0.103579714499)*x[0]
1504 arg[1,3,1,1]=(0.93329275867)*x[1]
1505 arg[1,3,1,2]=(0.994409555402)*x[2]
1506 arg[1,3,2,0]=(0.571961012279)*x[0]
1507 arg[1,3,2,1]=(-0.54961086377)*x[1]
1508 arg[1,3,2,2]=(0.563815465418)*x[2]
1509 arg[1,4,0,0]=(-0.820638948871)*x[0]
1510 arg[1,4,0,1]=(0.407750087109)*x[1]
1511 arg[1,4,0,2]=(0.0911636159786)*x[2]
1512 arg[1,4,1,0]=(0.371133349901)*x[0]
1513 arg[1,4,1,1]=(0.688167208194)*x[1]
1514 arg[1,4,1,2]=(0.188789217725)*x[2]
1515 arg[1,4,2,0]=(0.961439941063)*x[0]
1516 arg[1,4,2,1]=(0.524326385264)*x[1]
1517 arg[1,4,2,2]=(-0.0866064394717)*x[2]
1518 arg[2,0,0,0]=(0.392756517944)*x[0]
1519 arg[2,0,0,1]=(0.713723092455)*x[1]
1520 arg[2,0,0,2]=(0.68441988583)*x[2]
1521 arg[2,0,1,0]=(-0.471505369012)*x[0]
1522 arg[2,0,1,1]=(0.152712812211)*x[1]
1523 arg[2,0,1,2]=(-0.579106568625)*x[2]
1524 arg[2,0,2,0]=(0.637759469489)*x[0]