/[escript]/trunk/finley/test/python/run_escriptOnFinley.py
ViewVC logotype

Contents of /trunk/finley/test/python/run_escriptOnFinley.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4963 - (show annotations)
Fri May 23 05:12:40 2014 UTC (7 years, 1 month ago) by jfenwick
File MIME type: text/x-python
File size: 20130 byte(s)
Removed JMPI from ScriptMPI.cpp.
Changed options file to build shared libraries.
Fixed error in unit tests


1
2 ##############################################################################
3 #
4 # Copyright (c) 2003-2014 by University of Queensland
5 # http://www.uq.edu.au
6 #
7 # Primary Business: Queensland, Australia
8 # Licensed under the Open Software License version 3.0
9 # http://www.opensource.org/licenses/osl-3.0.php
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 __copyright__="""Copyright (c) 2003-2014 by University of Queensland
18 http://www.uq.edu.au
19 Primary Business: Queensland, Australia"""
20 __license__="""Licensed under the Open Software License version 3.0
21 http://www.opensource.org/licenses/osl-3.0.php"""
22 __url__="https://launchpad.net/escript-finley"
23
24 import os
25 import sys
26 import esys.escriptcore.utestselect as unittest
27
28 from esys.escript import *
29 from esys.finley import Rectangle, Brick, ReadMesh, ReadGmsh
30 from test_objects import Test_Dump, Test_SetDataPointValue, Test_saveCSV, \
31 Test_TableInterpolation, Test_Domain, Test_GlobalMinMax, Test_Lazy
32 from test_shared import Test_Shared
33
34 try:
35 FINLEY_WORKDIR=os.environ['FINLEY_WORKDIR']
36 except KeyError:
37 FINLEY_WORKDIR='.'
38
39
40 try:
41 FINLEY_TEST_DATA=os.environ['FINLEY_TEST_DATA']
42 except KeyError:
43 FINLEY_TEST_DATA='.'
44
45 FINLEY_TEST_MESH_PATH=os.path.join(FINLEY_TEST_DATA,"data_meshes")
46
47 mpisize=getMPISizeWorld()
48 NE=4 # number elements, must be even
49
50 class Test_SharedOnFinley(Test_Shared):
51 def setUp(self):
52 self.domain=Rectangle(NE,NE)
53 self.tol=0.001
54
55 def tearDown(self):
56 del self.domain
57 del self.tol
58
59 class Test_DomainOnFinley(Test_Domain):
60 def setUp(self):
61 self.boundary_tag_list = [1, 2, 10, 20]
62 self.domain =Rectangle(NE,NE+1,2)
63 self.rdomain=self.domain
64
65 def tearDown(self):
66 del self.domain
67 del self.rdomain
68 del self.boundary_tag_list
69
70 def test_setXError(self):
71 domain=Rectangle(NE,NE)
72 x=domain.getX()
73 z=interpolate(x, Function(domain))
74 self.assertRaises(RuntimeError, domain.setX, z)
75 del x
76 del z
77 del domain
78
79 def test_tagsContinuousFunction(self):
80 ref_tags=[0]
81 tags=ContinuousFunction(self.domain).getListOfTags()
82 self.assertTrue(len(tags)==len(ref_tags), "tags list has wrong length.")
83 for i in ref_tags: self.assertTrue(i in tags,"tag %s is missing."%i)
84
85 def test_tagsFunction(self):
86 ref_tags=[0]
87 tags=Function(self.domain).getListOfTags()
88 self.assertTrue(len(tags)==len(ref_tags), "tags list has wrong length.")
89 for i in ref_tags: self.assertTrue(i in tags,"tag %s is missing."%i)
90 def test_tagsReducedFunction(self):
91 ref_tags=[0]
92 tags=ReducedFunction(self.domain).getListOfTags()
93 self.assertTrue(len(tags)==len(ref_tags), "tags list has wrong length.")
94 for i in ref_tags: self.assertTrue(i in tags,"tag %s is missing."%i)
95 def test_tagsFunctionOnBoundary(self):
96 ref_tags=[1, 2, 10, 20]
97 tags=FunctionOnBoundary(self.domain).getListOfTags()
98 # For an MPI-distributed domain some tags may be missing
99 if getMPISizeWorld() == 1: self.assertTrue(len(tags)==len(ref_tags), "tags list has wrong length.")
100 for i in tags: self.assertTrue(i in ref_tags,"tag %s is missing."%i)
101 def test_tagsReducedFunctionOnBoundary(self):
102 ref_tags=[1, 2, 10, 20]
103 tags=ReducedFunctionOnBoundary(self.domain).getListOfTags()
104 # For an MPI-distributed domain some tags may be missing
105 if getMPISizeWorld() == 1: self.assertTrue(len(tags)==len(ref_tags), "tags list has wrong length.")
106 for i in tags: self.assertTrue(i in ref_tags,"tag %s is missing."%i)
107 def test_tagsFunctionOnContactOne(self):
108 ref_tags=[]
109 tags=FunctionOnContactOne(self.domain).getListOfTags()
110 self.assertTrue(len(tags)==len(ref_tags), "tags list has wrong length.")
111 for i in ref_tags: self.assertTrue(i in tags,"tag %s is missing."%i)
112 def test_tagsFunctionOnContactZero(self):
113 ref_tags=[]
114 tags=FunctionOnContactZero(self.domain).getListOfTags()
115 self.assertTrue(len(tags)==len(ref_tags), "tags list has wrong length.")
116 for i in ref_tags: self.assertTrue(i in tags,"tag %s is missing."%i)
117 def test_tagsReducedFunctionOnContactOne(self):
118 ref_tags=[]
119 tags=ReducedFunctionOnContactOne(self.domain).getListOfTags()
120 self.assertTrue(len(tags)==len(ref_tags), "tags list has wrong length.")
121 for i in ref_tags: self.assertTrue(i in tags,"tag %s is missing."%i)
122 def test_tagsReducedFunctionOnContactZero(self):
123 ref_tags=[]
124 tags=ReducedFunctionOnContactZero(self.domain).getListOfTags()
125 self.assertTrue(len(tags)==len(ref_tags), "tags list has wrong length.")
126 for i in ref_tags: self.assertTrue(i in tags,"tag %s is missing."%i)
127
128 class Test_DataOpsOnFinley(Test_Dump, Test_SetDataPointValue, Test_GlobalMinMax, Test_Lazy):
129 def setUp(self):
130 self.domain =Rectangle(NE,NE+1,2)
131 self.domain_with_different_number_of_samples =Rectangle(2*NE,NE+1,2)
132 self.domain_with_different_number_of_data_points_per_sample =Rectangle(2*NE,NE+1,2,integrationOrder=2)
133 self.domain_with_different_sample_ordering =Rectangle(NE,NE+1,2, optimize=True)
134 self.filename_base=FINLEY_WORKDIR
135 self.mainfs=Function(self.domain)
136 self.otherfs=Solution(self.domain)
137
138 def tearDown(self):
139 del self.domain
140 del self.domain_with_different_number_of_samples
141 del self.domain_with_different_number_of_data_points_per_sample
142 del self.domain_with_different_sample_ordering
143 del self.mainfs
144 del self.otherfs
145
146
147 class Test_TableInterpolationOnFinley(Test_TableInterpolation):
148 def setUp(self):
149 self.domain=Brick(4,4,4)
150 self.functionspaces=[ContinuousFunction(self.domain), Function(self.domain), ReducedFunction(self.domain),
151 FunctionOnBoundary(self.domain), ReducedFunctionOnBoundary(self.domain),
152 FunctionOnContactZero(self.domain), FunctionOnContactOne(self.domain),
153 ReducedFunctionOnContactZero(self.domain), ReducedFunctionOnContactOne(self.domain)]
154 #We aren't testing DiracDeltaFunctions
155 self.xn=3 # number of grids on x axis
156 self.yn=3 # number of grids on y axis
157 self.zn=3 # number of grids on z axis
158
159 def tearDown(self):
160 del self.domain
161 del self.functionspaces
162
163
164 #This functionality is only testes on Finley.
165 #It is not finley specific but it does need a known set of input points so I've chosen to put it here
166 class Test_OtherInterpolationOnFinley(unittest.TestCase):
167 def setUp(self):
168 self.r=Rectangle(4,1).getX()[0]+2
169 self.z=Data(2)
170
171 def tearDown(self):
172 del self.z
173 del self.r
174
175 def test_nonuniformint(self):
176 self.assertRaises(RuntimeError, self.z.nonuniformInterpolate, [0,1], [5,6], True)
177 self.assertRaises(RuntimeError, self.z.nonuniformInterpolate, [3,4], [5,6], True)
178 self.assertTrue(Lsup(self.z.nonuniformInterpolate([0,1], [5,6], False)-6)<0.00001, "RHS edge not fitted")
179 self.assertTrue(Lsup(self.z.nonuniformInterpolate([3,4], [5,6], False)-5)<0.00001, "LHS edge not fitted")
180 tmp=self.r.nonuniformInterpolate([2.125, 2.4, 2.5, 2.8], [1, -1, 2, 4], False)
181 self.assertTrue(Lsup(sup(tmp)-4)<0.0001, "RHS edge not fitted for Rect")
182 self.assertTrue(Lsup(inf(tmp)-0.090909)<0.00001, "Internal interpolate failed")
183 tmp=self.r.nonuniformInterpolate([2.125, 2.4, 2.5, 3.2], [1, -1, 2, 4], False)
184 self.assertTrue(Lsup(sup(tmp)-3.42857)<0.00001, "Internal interpolate failed")
185
186 def test_nonuniformSlope(self):
187 self.assertRaises(RuntimeError, self.z.nonuniformSlope, [0,1], [5,6], True)
188 self.assertRaises(RuntimeError, self.z.nonuniformSlope, [3,4], [5,6], True)
189 self.assertTrue(Lsup(self.z.nonuniformSlope([0,1], [5,6], False))<0.00001, "RHS edge not fitted")
190 self.assertTrue(Lsup(self.z.nonuniformSlope([3,4], [5,6], False))<0.00001, "LHS edge not fitted")
191 tmp=self.r.nonuniformSlope([2.125, 2.4, 2.5, 3.2], [1, -1, 2, 4], False)
192 self.assertTrue(Lsup(sup(tmp)-30)<0.00001, "Internal interpolate failed")
193 self.assertTrue(Lsup(inf(tmp)+7.27273)<0.00001, "Internal interpolate failed")
194
195 class Test_CSVOnFinley(Test_saveCSV):
196 def setUp(self):
197 NE0=NE
198 NE1=NE+1
199 self.domain = Rectangle(NE0, NE1, order=2)
200 self.functionspaces = [ ContinuousFunction ]
201 # number of total data points for each function space
202 self.linecounts=[ (2*NE0+1)*(2*NE1+1)-NE0*NE1+1 ]
203 # number of masked points, i.e. where X[0] is non-zero
204 self.linecounts_masked=[ (2*NE0+1)*(2*NE1+1)-(2+NE0)*NE1 ]
205 # expected values in first line of masked data = [ X[:], X[0] ]
206 self.firstline=[ [1./(2*NE0), 0., 1./(2*NE0)] ]
207
208 if getMPISizeWorld() == 1:
209 self.functionspaces += [ ReducedContinuousFunction, Function,
210 ReducedFunction, FunctionOnBoundary, ReducedFunctionOnBoundary ]
211 self.linecounts += [ 31, 181, 81, 55, 37 ]
212 self.linecounts_masked += [ 25, 181, 81, 40, 27 ]
213 self.firstline += [ [.25, 0., .25],
214 [.02817541634481463,.02254033307585171,.02817541634481463],
215 [.05283121635129676,.04226497308103741,.05283121635129676],
216 [.02817541634481463,0.,.02817541634481463],
217 [.05283121635129676,0.,.05283121635129676]
218 ]
219 else:
220 print("Skipping some CSV tests on finley since MPI size > 1")
221
222 def tearDown(self):
223 del self.domain
224
225 @unittest.skipIf(mpisize>1, "more than 1 MPI rank")
226 def test_csv_multiFS(self):
227 fname=os.path.join(FINLEY_WORKDIR, "test_multifs.csv")
228 sol=Data(8,Solution(self.domain))
229 ctsfn=Data(9,ContinuousFunction(self.domain))
230 #test line 0
231 dirac=Data(-1,DiracDeltaFunctions(self.domain))
232 saveDataCSV(fname, A=sol, B=ctsfn, C=dirac)
233 #test line 1
234 fun=Data(5,Function(self.domain))
235 rfun=Data(3,ReducedFunction(self.domain))
236 saveDataCSV(fname, A=sol,B=ctsfn,C=fun, D=rfun)
237 #test line 2
238 bound=Data(1,FunctionOnBoundary(self.domain))
239 rbound=Data(3,ReducedFunctionOnBoundary(self.domain))
240 saveDataCSV(fname,A=sol,B=ctsfn,C=bound, D=rbound)
241 #test line 3
242 conzz=Data(7,FunctionOnContactZero(self.domain))
243 rconz=Data(8,ReducedFunctionOnContactZero(self.domain))
244 saveDataCSV(fname,A=sol,B=ctsfn, C=conzz, D=rconz)
245 #check for cross line exceptions
246 self.assertRaises(RuntimeError, saveDataCSV, fname, A=dirac, B=rfun)
247 self.assertRaises(RuntimeError, saveDataCSV, fname, A=bound, B=conzz)
248
249
250 class Test_DiracOnFinley(unittest.TestCase):
251 def test_rectconstr(self):
252 self.assertRaises(RuntimeError, Rectangle, 4,4, diracPoints=[(0,0)])
253 self.assertRaises(RuntimeError, Rectangle, 4,4, diracPoints=[(0,0), (1,1)], diracTags=[40])
254 self.assertRaises(RuntimeError, Rectangle, 4,4, diracPoints=[(0,0), (1,1)], diracTags=[40])
255 self.assertRaises(RuntimeError, Rectangle, 4,4, diracPoints=[(0,0), (1,1)], diracTags=["cows"])
256 self.assertRaises(RuntimeError, Rectangle, 4,4, diracPoints=[(0,)], diracTags=["test"])
257 z=Rectangle(4,4, diracPoints=[(0,0), (0.25,0.25)], diracTags=[40,51])
258 z=Rectangle(4,4, diracPoints=[(0.125,0.625), (0.5,1), (0.75, 0.25), (0.89, 0.875)], diracTags=["A", "B", "A", "C"])
259 v=interpolate(z.getX(), DiracDeltaFunctions(z))
260 if mpisize==1:
261 self.assertEquals(v.toListOfTuples(),[(0.0, 0.5), (0.5, 1.0), (0.75, 0.25), (1.0, 0.75)])
262 self.assertEquals(v.getNumberOfDataPoints(), 4)
263 self.assertEquals(inf(v[0]), 0)
264 self.assertEquals(inf(v[1]), 0.25)
265 self.assertEquals(Lsup(v[0]), 1)
266 self.assertEquals(Lsup(v[1]), 1)
267 v.setTaggedValue("A",(-10,0.5))
268 self.assertEquals(inf(v[0]), -10)
269 self.assertEquals(inf(v[1]), 0.5)
270 v.setTaggedValue(500,(-100,-100)) # non-existant tag
271 self.assertEquals(inf(v[0]), -10)
272 self.assertEquals(inf(v[1]), 0.5)
273 self.assertEquals(z.showTagNames(), 'A, B, C, bottom, left, right, top')
274 self.assertEquals(z.getTag("C"), 42)
275
276 def test_brickconstr(self):
277 self.assertRaises(RuntimeError, Brick, 4,4, diracPoints=[(0,0,0)])
278 self.assertRaises(RuntimeError, Brick, 4,4, diracPoints=[(0,0,0), (1,1,1)], diracTags=[40])
279 self.assertRaises(RuntimeError, Brick, 4,4, diracPoints=[(0,0,0), (1,1,1)], diracTags=[40])
280 self.assertRaises(RuntimeError, Brick, 4,4, diracPoints=[(0,0,0), (1,1,1)], diracTags=["cows"])
281 self.assertRaises(RuntimeError, Brick, 4,4, diracPoints=[(0,0)], diracTags=["test"])
282 z=Brick(4,4, diracPoints=[(0,0,0), (0.25,0.25, 0.25)], diracTags=[40,51])
283 z=Brick(4,4, diracPoints=[(0.125,0.625,0), (0.5,1,0), (0.75, 0.25, 0.51), (0.89, 0.875,1)], diracTags=["A", "B", "A", "C"])
284 v=interpolate(z.getX(), DiracDeltaFunctions(z))
285 if mpisize==1:
286 self.assertEquals(v.toListOfTuples(),[(0.0, 0.5, 0.0), (0.5, 1.0, 0.0), (0.75, 0.25, 1), (1.0, 0.75, 1.0)])
287 self.assertEquals(v.getNumberOfDataPoints(), 4)
288 self.assertEquals(inf(v[0]), 0)
289 self.assertEquals(inf(v[1]), 0.25)
290 self.assertEquals(Lsup(v[0]), 1)
291 self.assertEquals(Lsup(v[1]), 1)
292 v.setTaggedValue("A",(-10,0.5,-500))
293 if mpisize==1:
294 self.assertEquals(inf(v[0]), -10)
295 self.assertEquals(inf(v[1]), 0.5)
296 self.assertEquals(inf(v[2]),-500)
297 v.setTaggedValue(500,(-100,-100, -100)) # non-existant tag
298 if mpisize==1:
299 self.assertEquals(inf(v[0]), -10)
300 self.assertEquals(inf(v[1]), 0.5)
301 self.assertEquals(z.showTagNames(), 'A, B, C, back, bottom, front, left, right, top')
302 self.assertEquals(z.getTag("C"), 42)
303
304
305 def test_rectReadMesh(self):
306 fname=os.path.join(FINLEY_TEST_MESH_PATH,'rect_4x4.fly')
307 self.assertRaises(RuntimeError, ReadMesh, fname, diracPoints=[(0,)])
308 self.assertRaises(RuntimeError, ReadMesh, fname, diracPoints=[(0,0)])
309 self.assertRaises(RuntimeError, ReadMesh, fname, diracPoints=[(0,0), (1,1)], diracTags=[40])
310 self.assertRaises(RuntimeError, ReadMesh, fname, diracPoints=[(0,0), (1,1)], diracTags=["cows"])
311 z=ReadMesh(fname, diracPoints=[(0,0), (0.25,0.25)], diracTags=[40,51])
312 z=ReadMesh(fname, diracPoints=[(0.125,0.625), (0.5,1), (0.75, 0.25), (0.89, 0.875)], diracTags=["A", "B", "A", "C"])
313 v=interpolate(z.getX(), DiracDeltaFunctions(z))
314 if mpisize==1:
315 self.assertEquals(v.toListOfTuples(),[(0.0, 0.5), (0.5, 1.0), (0.75, 0.25), (1.0, 0.75)])
316 self.assertEquals(v.getNumberOfDataPoints(), 4)
317 self.assertEquals(inf(v[0]), 0)
318 self.assertEquals(inf(v[1]), 0.25)
319 self.assertEquals(Lsup(v[0]), 1)
320 self.assertEquals(Lsup(v[1]), 1)
321 v.setTaggedValue("A",(-10,0.5))
322 if mpisize==1:
323 self.assertEquals(inf(v[0]), -10)
324 self.assertEquals(inf(v[1]), 0.5)
325 v.setTaggedValue(500,(-100,-100)) # non-existant tag
326 if mpisize==1:
327 self.assertEquals(inf(v[0]), -10)
328 self.assertEquals(inf(v[1]), 0.5)
329 self.assertEquals(z.showTagNames(), 'A, B, C, bottom, left, right, top')
330 self.assertEquals(z.getTag("C"), 42)
331
332
333 def test_brickReadMesh(self):
334 fname=os.path.join(FINLEY_TEST_MESH_PATH,'brick_4x4x4.fly')
335 self.assertRaises(RuntimeError, ReadMesh, fname, diracPoints=[(0,0)])
336 self.assertRaises(RuntimeError, ReadMesh, fname, diracPoints=[(0,0,0)])
337 self.assertRaises(RuntimeError, ReadMesh, fname, diracPoints=[(0,0,0), (1,1,1)], diracTags=[40])
338 self.assertRaises(RuntimeError, ReadMesh, fname, diracPoints=[(0,0,0), (1,1,1)], diracTags=["cows"])
339 z=ReadMesh(fname, diracPoints=[(0,0,1), (0.25,0.25, 0.25)], diracTags=[40,51])
340 z=ReadMesh(fname, diracPoints=[(0.125,0.625,0), (0.5,1,1), (0.75, 0.25,0), (0.89, 0.875, 0.5)], diracTags=["A", "B", "A", "C"])
341 v=interpolate(z.getX(), DiracDeltaFunctions(z))
342 if mpisize==1:
343 self.assertEquals(v.toListOfTuples(),[(0.0, 0.5, 0.0), (0.5, 1.0, 1.0), (0.75, 0.25, 0.0), (1.0, 0.75, 0.5)])
344 self.assertEquals(v.getNumberOfDataPoints(), 4)
345 self.assertEquals(inf(v[0]), 0)
346 self.assertEquals(inf(v[1]), 0.25)
347 self.assertEquals(Lsup(v[0]), 1)
348 self.assertEquals(Lsup(v[1]), 1)
349 v.setTaggedValue("A",(-10,0.5,-0.5))
350 if mpisize==1:
351 self.assertEquals(inf(v[0]), -10)
352 self.assertEquals(inf(v[1]), 0.5)
353 self.assertEquals(inf(v[2]), -0.5)
354 v.setTaggedValue(500,(-100,-100, -100)) # non-existant tag
355 if mpisize==1:
356 self.assertEquals(inf(v[0]), -10)
357 self.assertEquals(inf(v[1]), 0.5)
358 self.assertEquals(inf(v[2]), -0.5)
359 self.assertEquals(z.showTagNames(), 'A, B, C, back, bottom, front, left, right, top')
360 self.assertEquals(z.getTag("C"), 203)
361
362
363
364 @unittest.skipIf(mpisize>1, "more than 1 MPI rank")
365 def test_rectReadGmsh(self):
366 fname=os.path.join(FINLEY_TEST_MESH_PATH, 'rect_test.msh')
367 self.assertRaises(RuntimeError, ReadGmsh, fname, 2, diracPoints=[(0,0)])
368 self.assertRaises(RuntimeError, ReadGmsh, fname, 2, diracPoints=[(0,0), (1,1)], diracTags=[40])
369 self.assertRaises(RuntimeError, ReadGmsh, fname, 2, diracPoints=[(0,0), (1,1)], diracTags=["cows"])
370 z=ReadGmsh(fname, 2, diracPoints=[(0,0), (1,1)], diracTags=[40,51])
371 z=ReadGmsh(fname, 2, diracPoints=[(0,0),(0,1),(1,0),(1,1)], diracTags=["A", "B", "A", "C"])
372 v=interpolate(z.getX(), DiracDeltaFunctions(z))
373 if mpisize==1:
374 self.assertEquals(v.toListOfTuples(),[(0,0), (0,1), (1,0), (1,1)])
375 self.assertEquals(v.getNumberOfDataPoints(), 4)
376 v.setTaggedValue("A",(-10,99))
377 self.assertEquals(inf(v[0]), -10)
378 self.assertEquals(Lsup(v[1]), 99)
379 v.setTaggedValue(500,(-100,-100)) # non-existant tag
380 self.assertEquals(inf(v[0]), -10)
381 self.assertEquals(Lsup(v[1]), 99)
382 self.assertEquals(z.showTagNames(), 'A, B, C')
383 self.assertEquals(z.getTag("C"), 42)
384
385 @unittest.skipIf(mpisize>1, "more than 1 MPI rank")
386 def test_brickReadGmsh(self):
387 fname=os.path.join(FINLEY_TEST_MESH_PATH, 'brick_test.msh')
388 self.assertRaises(RuntimeError, ReadGmsh, fname, 3, diracPoints=[(0,0)])
389 self.assertRaises(RuntimeError, ReadGmsh, fname, 3, diracPoints=[(0,0,0)])
390 self.assertRaises(RuntimeError, ReadGmsh, fname, 3, diracPoints=[(0,0,0), (1,1,1)], diracTags=[40])
391 self.assertRaises(RuntimeError, ReadGmsh, fname, 3, diracPoints=[(0,0,0), (1,1,1)], diracTags=["cows"])
392 z=ReadGmsh(fname, 3, diracPoints=[(0,0,0), (1,1,1)], diracTags=[40,51])
393 z=ReadGmsh(fname, 3, diracPoints=[(0,0,0),(0,1,0),(1,0,1),(1,1,1)], diracTags=["A", "B", "A", "C"])
394 v=interpolate(z.getX(), DiracDeltaFunctions(z))
395 if mpisize==1:
396 self.assertEquals(v.toListOfTuples(),[(0,0,0), (0,1,0), (1,0,1), (1,1,1)])
397 self.assertEquals(v.getNumberOfDataPoints(), 4)
398 v.setTaggedValue("A",(-10,99,-98))
399 self.assertEquals(inf(v[0]), -10)
400 self.assertEquals(Lsup(v[1]), 99)
401 self.assertEquals(inf(v[2]), -98)
402 v.setTaggedValue(500,(-100,-100,-100)) # non-existant tag
403 self.assertEquals(inf(v[0]), -10)
404 self.assertEquals(Lsup(v[1]), 99)
405 self.assertEquals(z.showTagNames(), 'A, B, C')
406 self.assertEquals(z.getTag("C"), 42)
407
408
409 if __name__ == '__main__':
410 suite = unittest.TestSuite()
411 suite.addTest(unittest.makeSuite(Test_DiracOnFinley))
412 suite.addTest(unittest.makeSuite(Test_SharedOnFinley))
413 suite.addTest(unittest.makeSuite(Test_DataOpsOnFinley))
414 suite.addTest(unittest.makeSuite(Test_DomainOnFinley))
415 suite.addTest(unittest.makeSuite(Test_TableInterpolationOnFinley))
416 suite.addTest(unittest.makeSuite(Test_CSVOnFinley))
417 suite.addTest(unittest.makeSuite(Test_OtherInterpolationOnFinley))
418 s=unittest.TextTestRunner(verbosity=2).run(suite)
419 if not s.wasSuccessful(): sys.exit(1)
420

  ViewVC Help
Powered by ViewVC 1.1.26