]> gitweb.michael.orlitzky.com - spline3.git/blob - src/Tests/Grid.hs
Remove a useless import.
[spline3.git] / src / Tests / Grid.hs
1 module Tests.Grid
2 where
3
4 import Data.Maybe (fromJust)
5 import Test.HUnit
6 import Test.QuickCheck
7
8 import Assertions
9 import Comparisons
10 import Cube hiding (i, j, k)
11 import Examples
12 import FunctionValues (value_at)
13 import Grid
14 import Tetrahedron
15
16
17 instance Arbitrary Grid where
18 arbitrary = do
19 (Positive h') <- arbitrary :: Gen (Positive Double)
20 fvs <- arbitrary :: Gen [[[Double]]]
21 return (make_grid h' fvs)
22
23
24 -- | Check the value of c0030 for tetrahedron0 belonging to the
25 -- cube centered on (1,1,1) with a grid constructed from the
26 -- trilinear values. See example one in the paper.
27 test_trilinear_c0030 :: Assertion
28 test_trilinear_c0030 =
29 assertAlmostEqual "c0030 is correct" (c t 0 0 3 0) (17/8)
30 where
31 g = make_grid 1 trilinear
32 cube = fromJust $ cube_at g 1 1 1
33 t = tetrahedron0 cube
34
35
36 -- | Check the value of c0003 for tetrahedron0 belonging to the
37 -- cube centered on (1,1,1) with a grid constructed from the
38 -- trilinear values. See example one in the paper.
39 test_trilinear_c0003 :: Assertion
40 test_trilinear_c0003 =
41 assertAlmostEqual "c0003 is correct" (c t 0 0 0 3) (27/8)
42 where
43 g = make_grid 1 trilinear
44 cube = fromJust $ cube_at g 1 1 1
45 t = tetrahedron0 cube
46
47
48 -- | Check the value of c0021 for tetrahedron0 belonging to the
49 -- cube centered on (1,1,1) with a grid constructed from the
50 -- trilinear values. See example one in the paper.
51 test_trilinear_c0021 :: Assertion
52 test_trilinear_c0021 =
53 assertAlmostEqual "c0021 is correct" (c t 0 0 2 1) (61/24)
54 where
55 g = make_grid 1 trilinear
56 cube = fromJust $ cube_at g 1 1 1
57 t = tetrahedron0 cube
58
59
60 -- | Check the value of c0012 for tetrahedron0 belonging to the
61 -- cube centered on (1,1,1) with a grid constructed from the
62 -- trilinear values. See example one in the paper.
63 test_trilinear_c0012 :: Assertion
64 test_trilinear_c0012 =
65 assertAlmostEqual "c0012 is correct" (c t 0 0 1 2) (71/24)
66 where
67 g = make_grid 1 trilinear
68 cube = fromJust $ cube_at g 1 1 1
69 t = tetrahedron0 cube
70
71
72 -- | Check the value of c0120 for tetrahedron0 belonging to the
73 -- cube centered on (1,1,1) with a grid constructed from the
74 -- trilinear values. See example one in the paper.
75 test_trilinear_c0120 :: Assertion
76 test_trilinear_c0120 =
77 assertAlmostEqual "c0120 is correct" (c t 0 1 2 0) (55/24)
78 where
79 g = make_grid 1 trilinear
80 cube = fromJust $ cube_at g 1 1 1
81 t = tetrahedron0 cube
82
83
84 -- | Check the value of c0102 for tetrahedron0 belonging to the
85 -- cube centered on (1,1,1) with a grid constructed from the
86 -- trilinear values. See example one in the paper.
87 test_trilinear_c0102 :: Assertion
88 test_trilinear_c0102 =
89 assertAlmostEqual "c0102 is correct" (c t 0 1 0 2) (73/24)
90 where
91 g = make_grid 1 trilinear
92 cube = fromJust $ cube_at g 1 1 1
93 t = tetrahedron0 cube
94
95
96 -- | Check the value of c0111 for tetrahedron0 belonging to the
97 -- cube centered on (1,1,1) with a grid constructed from the
98 -- trilinear values. See example one in the paper.
99 test_trilinear_c0111 :: Assertion
100 test_trilinear_c0111 =
101 assertAlmostEqual "c0111 is correct" (c t 0 1 1 1) (8/3)
102 where
103 g = make_grid 1 trilinear
104 cube = fromJust $ cube_at g 1 1 1
105 t = tetrahedron0 cube
106
107
108 -- | Check the value of c0210 for tetrahedron0 belonging to the
109 -- cube centered on (1,1,1) with a grid constructed from the
110 -- trilinear values. See example one in the paper.
111 test_trilinear_c0210 :: Assertion
112 test_trilinear_c0210 =
113 assertAlmostEqual "c0210 is correct" (c t 0 2 1 0) (29/12)
114 where
115 g = make_grid 1 trilinear
116 cube = fromJust $ cube_at g 1 1 1
117 t = tetrahedron0 cube
118
119
120 -- | Check the value of c0201 for tetrahedron0 belonging to the
121 -- cube centered on (1,1,1) with a grid constructed from the
122 -- trilinear values. See example one in the paper.
123 test_trilinear_c0201 :: Assertion
124 test_trilinear_c0201 =
125 assertAlmostEqual "c0201 is correct" (c t 0 2 0 1) (11/4)
126 where
127 g = make_grid 1 trilinear
128 cube = fromJust $ cube_at g 1 1 1
129 t = tetrahedron0 cube
130
131
132 -- | Check the value of c0300 for tetrahedron0 belonging to the
133 -- cube centered on (1,1,1) with a grid constructed from the
134 -- trilinear values. See example one in the paper.
135 test_trilinear_c0300 :: Assertion
136 test_trilinear_c0300 =
137 assertAlmostEqual "c0300 is correct" (c t 0 3 0 0) (5/2)
138 where
139 g = make_grid 1 trilinear
140 cube = fromJust $ cube_at g 1 1 1
141 t = tetrahedron0 cube
142
143
144 -- | Check the value of c1020 for tetrahedron0 belonging to the
145 -- cube centered on (1,1,1) with a grid constructed from the
146 -- trilinear values. See example one in the paper.
147 test_trilinear_c1020 :: Assertion
148 test_trilinear_c1020 =
149 assertAlmostEqual "c1020 is correct" (c t 1 0 2 0) (8/3)
150 where
151 g = make_grid 1 trilinear
152 cube = fromJust $ cube_at g 1 1 1
153 t = tetrahedron0 cube
154
155
156 -- | Check the value of c1002 for tetrahedron0 belonging to the
157 -- cube centered on (1,1,1) with a grid constructed from the
158 -- trilinear values. See example one in the paper.
159 test_trilinear_c1002 :: Assertion
160 test_trilinear_c1002 =
161 assertAlmostEqual "c1002 is correct" (c t 1 0 0 2) (23/6)
162 where
163 g = make_grid 1 trilinear
164 cube = fromJust $ cube_at g 1 1 1
165 t = tetrahedron0 cube
166
167
168 -- | Check the value of c1011 for tetrahedron0 belonging to the
169 -- cube centered on (1,1,1) with a grid constructed from the
170 -- trilinear values. See example one in the paper.
171 test_trilinear_c1011 :: Assertion
172 test_trilinear_c1011 =
173 assertAlmostEqual "c1011 is correct" (c t 1 0 1 1) (13/4)
174 where
175 g = make_grid 1 trilinear
176 cube = fromJust $ cube_at g 1 1 1
177 t = tetrahedron0 cube
178
179
180 -- | Check the value of c1110 for tetrahedron0 belonging to the
181 -- cube centered on (1,1,1) with a grid constructed from the
182 -- trilinear values. See example one in the paper.
183 test_trilinear_c1110 :: Assertion
184 test_trilinear_c1110 =
185 assertAlmostEqual "c1110 is correct" (c t 1 1 1 0) (23/8)
186 where
187 g = make_grid 1 trilinear
188 cube = fromJust $ cube_at g 1 1 1
189 t = tetrahedron0 cube
190
191
192 -- | Check the value of c1101 for tetrahedron0 belonging to the
193 -- cube centered on (1,1,1) with a grid constructed from the
194 -- trilinear values. See example one in the paper.
195 test_trilinear_c1101 :: Assertion
196 test_trilinear_c1101 =
197 assertAlmostEqual "c1101 is correct" (c t 1 1 0 1) (27/8)
198 where
199 g = make_grid 1 trilinear
200 cube = fromJust $ cube_at g 1 1 1
201 t = tetrahedron0 cube
202
203
204 -- | Check the value of c1200 for tetrahedron0 belonging to the
205 -- cube centered on (1,1,1) with a grid constructed from the
206 -- trilinear values. See example one in the paper.
207 test_trilinear_c1200 :: Assertion
208 test_trilinear_c1200 =
209 assertAlmostEqual "c1200 is correct" (c t 1 2 0 0) 3
210 where
211 g = make_grid 1 trilinear
212 cube = fromJust $ cube_at g 1 1 1
213 t = tetrahedron0 cube
214
215
216 -- | Check the value of c2010 for tetrahedron0 belonging to the
217 -- cube centered on (1,1,1) with a grid constructed from the
218 -- trilinear values. See example one in the paper.
219 test_trilinear_c2010 :: Assertion
220 test_trilinear_c2010 =
221 assertAlmostEqual "c2010 is correct" (c t 2 0 1 0) (10/3)
222 where
223 g = make_grid 1 trilinear
224 cube = fromJust $ cube_at g 1 1 1
225 t = tetrahedron0 cube
226
227
228 -- | Check the value of c2001 for tetrahedron0 belonging to the
229 -- cube centered on (1,1,1) with a grid constructed from the
230 -- trilinear values. See example one in the paper.
231 test_trilinear_c2001 :: Assertion
232 test_trilinear_c2001 =
233 assertAlmostEqual "c2001 is correct" (c t 2 0 0 1) 4
234 where
235 g = make_grid 1 trilinear
236 cube = fromJust $ cube_at g 1 1 1
237 t = tetrahedron0 cube
238
239
240 -- | Check the value of c2100 for tetrahedron0 belonging to the
241 -- cube centered on (1,1,1) with a grid constructed from the
242 -- trilinear values. See example one in the paper.
243 test_trilinear_c2100 :: Assertion
244 test_trilinear_c2100 =
245 assertAlmostEqual "c2100 is correct" (c t 2 1 0 0) (7/2)
246 where
247 g = make_grid 1 trilinear
248 cube = fromJust $ cube_at g 1 1 1
249 t = tetrahedron0 cube
250
251
252 -- | Check the value of c3000 for tetrahedron0 belonging to the
253 -- cube centered on (1,1,1) with a grid constructed from the
254 -- trilinear values. See example one in the paper.
255 test_trilinear_c3000 :: Assertion
256 test_trilinear_c3000 =
257 assertAlmostEqual "c3000 is correct" (c t 3 0 0 0) 4
258 where
259 g = make_grid 1 trilinear
260 cube = fromJust $ cube_at g 1 1 1
261 t = tetrahedron0 cube
262
263
264 -- | Make sure that v0 of tetrahedron0 belonging to the cube centered
265 -- on (1,1,1) with a grid constructed from the trilinear values
266 -- winds up in the right place. See example one in the paper.
267 test_trilinear_f0_t0_v0 :: Assertion
268 test_trilinear_f0_t0_v0 =
269 assertEqual "v0 is correct" (v0 t) (1, 1, 1)
270 where
271 g = make_grid 1 trilinear
272 cube = fromJust $ cube_at g 1 1 1
273 t = tetrahedron0 cube
274
275
276 -- | Make sure that v1 of tetrahedron0 belonging to the cube centered
277 -- on (1,1,1) with a grid constructed from the trilinear values
278 -- winds up in the right place. See example one in the paper.
279 test_trilinear_f0_t0_v1 :: Assertion
280 test_trilinear_f0_t0_v1 =
281 assertEqual "v1 is correct" (v1 t) (0.5, 1, 1)
282 where
283 g = make_grid 1 trilinear
284 cube = fromJust $ cube_at g 1 1 1
285 t = tetrahedron0 cube
286
287
288 -- | Make sure that v2 of tetrahedron0 belonging to the cube centered
289 -- on (1,1,1) with a grid constructed from the trilinear values
290 -- winds up in the right place. See example one in the paper.
291 test_trilinear_f0_t0_v2 :: Assertion
292 test_trilinear_f0_t0_v2 =
293 assertEqual "v2 is correct" (v2 t) (0.5, 0.5, 1.5)
294 where
295 g = make_grid 1 trilinear
296 cube = fromJust $ cube_at g 1 1 1
297 t = tetrahedron0 cube
298
299
300 -- | Make sure that v3 of tetrahedron0 belonging to the cube centered
301 -- on (1,1,1) with a grid constructed from the trilinear values
302 -- winds up in the right place. See example one in the paper.
303 test_trilinear_f0_t0_v3 :: Assertion
304 test_trilinear_f0_t0_v3 =
305 assertClose "v3 is correct" (v3 t) (0.5, 1.5, 1.5)
306 where
307 g = make_grid 1 trilinear
308 cube = fromJust $ cube_at g 1 1 1
309 t = tetrahedron0 cube
310
311
312 test_trilinear_reproduced_t0 :: Assertion
313 test_trilinear_reproduced_t0 =
314 assertTrue "trilinears are reproduced correctly" $
315 and [p (i', j', k') ~= value_at trilinear i j k
316 | i <- [0..2],
317 j <- [0..2],
318 k <- [0..2],
319 let i' = fromIntegral i,
320 let j' = fromIntegral j,
321 let k' = fromIntegral k]
322 where
323 g = make_grid 1 trilinear
324 c0 = fromJust $ cube_at g 1 1 1
325 t0 = tetrahedron0 c0
326 p = polynomial t0
327
328 test_trilinear_reproduced_t1 :: Assertion
329 test_trilinear_reproduced_t1 =
330 assertTrue "trilinears are reproduced correctly" $
331 and [p (i', j', k') ~= value_at trilinear i j k
332 | i <- [0..2],
333 j <- [0..2],
334 k <- [0..2],
335 let i' = fromIntegral i,
336 let j' = fromIntegral j,
337 let k' = fromIntegral k]
338 where
339 g = make_grid 1 trilinear
340 c0 = fromJust $ cube_at g 1 1 1
341 t1 = tetrahedron1 c0
342 p = polynomial t1
343
344 test_trilinear_reproduced_t2 :: Assertion
345 test_trilinear_reproduced_t2 =
346 assertTrue "trilinears are reproduced correctly" $
347 and [p (i', j', k') ~= value_at trilinear i j k
348 | i <- [0..2],
349 j <- [0..2],
350 k <- [0..2],
351 let i' = fromIntegral i,
352 let j' = fromIntegral j,
353 let k' = fromIntegral k]
354 where
355 g = make_grid 1 trilinear
356 c0 = fromJust $ cube_at g 1 1 1
357 t2 = tetrahedron2 c0
358 p = polynomial t2
359
360 test_trilinear_reproduced_t3 :: Assertion
361 test_trilinear_reproduced_t3 =
362 assertTrue "trilinears are reproduced correctly" $
363 and [p (i', j', k') ~= value_at trilinear i j k
364 | i <- [0..2],
365 j <- [0..2],
366 k <- [0..2],
367 let i' = fromIntegral i,
368 let j' = fromIntegral j,
369 let k' = fromIntegral k]
370 where
371 g = make_grid 1 trilinear
372 c0 = fromJust $ cube_at g 1 1 1
373 t3 = tetrahedron3 c0
374 p = polynomial t3
375
376 test_trilinear_reproduced_t4 :: Assertion
377 test_trilinear_reproduced_t4 =
378 assertTrue "trilinears are reproduced correctly" $
379 and [p (i', j', k') ~= value_at trilinear i j k
380 | i <- [0..2],
381 j <- [0..2],
382 k <- [0..2],
383 let i' = fromIntegral i,
384 let j' = fromIntegral j,
385 let k' = fromIntegral k]
386 where
387 g = make_grid 1 trilinear
388 c0 = fromJust $ cube_at g 1 1 1
389 t4 = tetrahedron4 c0
390 p = polynomial t4
391
392 test_trilinear_reproduced_t5 :: Assertion
393 test_trilinear_reproduced_t5 =
394 assertTrue "trilinears are reproduced correctly" $
395 and [p (i', j', k') ~= value_at trilinear i j k
396 | i <- [0..2],
397 j <- [0..2],
398 k <- [0..2],
399 let i' = fromIntegral i,
400 let j' = fromIntegral j,
401 let k' = fromIntegral k]
402 where
403 g = make_grid 1 trilinear
404 c0 = fromJust $ cube_at g 1 1 1
405 t5 = tetrahedron5 c0
406 p = polynomial t5
407
408 test_trilinear_reproduced_t6 :: Assertion
409 test_trilinear_reproduced_t6 =
410 assertTrue "trilinears are reproduced correctly" $
411 and [p (i', j', k') ~= value_at trilinear i j k
412 | i <- [0..2],
413 j <- [0..2],
414 k <- [0..2],
415 let i' = fromIntegral i,
416 let j' = fromIntegral j,
417 let k' = fromIntegral k]
418 where
419 g = make_grid 1 trilinear
420 c0 = fromJust $ cube_at g 1 1 1
421 t6 = tetrahedron6 c0
422 p = polynomial t6
423
424 test_trilinear_reproduced_t7 :: Assertion
425 test_trilinear_reproduced_t7 =
426 assertTrue "trilinears are reproduced correctly" $
427 and [p (i', j', k') ~= value_at trilinear i j k
428 | i <- [0..2],
429 j <- [0..2],
430 k <- [0..2],
431 let i' = fromIntegral i,
432 let j' = fromIntegral j,
433 let k' = fromIntegral k]
434 where
435 g = make_grid 1 trilinear
436 c0 = fromJust $ cube_at g 1 1 1
437 t7 = tetrahedron7 c0
438 p = polynomial t7
439
440 test_trilinear_reproduced_t8 :: Assertion
441 test_trilinear_reproduced_t8 =
442 assertTrue "trilinears are reproduced correctly" $
443 and [p (i', j', k') ~= value_at trilinear i j k
444 | i <- [0..2],
445 j <- [0..2],
446 k <- [0..2],
447 let i' = fromIntegral i,
448 let j' = fromIntegral j,
449 let k' = fromIntegral k]
450 where
451 g = make_grid 1 trilinear
452 c0 = fromJust $ cube_at g 1 1 1
453 t8 = tetrahedron8 c0
454 p = polynomial t8
455
456 test_trilinear_reproduced_t9 :: Assertion
457 test_trilinear_reproduced_t9 =
458 assertTrue "trilinears are reproduced correctly" $
459 and [p (i', j', k') ~= value_at trilinear i j k
460 | i <- [0..2],
461 j <- [0..2],
462 k <- [0..2],
463 let i' = fromIntegral i,
464 let j' = fromIntegral j,
465 let k' = fromIntegral k]
466 where
467 g = make_grid 1 trilinear
468 c0 = fromJust $ cube_at g 1 1 1
469 t9 = tetrahedron9 c0
470 p = polynomial t9
471
472 test_trilinear_reproduced_t10 :: Assertion
473 test_trilinear_reproduced_t10 =
474 assertTrue "trilinears are reproduced correctly" $
475 and [p (i', j', k') ~= value_at trilinear i j k
476 | i <- [0..2],
477 j <- [0..2],
478 k <- [0..2],
479 let i' = fromIntegral i,
480 let j' = fromIntegral j,
481 let k' = fromIntegral k]
482 where
483 g = make_grid 1 trilinear
484 c0 = fromJust $ cube_at g 1 1 1
485 t10 = tetrahedron10 c0
486 p = polynomial t10
487
488 test_trilinear_reproduced_t11 :: Assertion
489 test_trilinear_reproduced_t11 =
490 assertTrue "trilinears are reproduced correctly" $
491 and [p (i', j', k') ~= value_at trilinear i j k
492 | i <- [0..2],
493 j <- [0..2],
494 k <- [0..2],
495 let i' = fromIntegral i,
496 let j' = fromIntegral j,
497 let k' = fromIntegral k]
498 where
499 g = make_grid 1 trilinear
500 c0 = fromJust $ cube_at g 1 1 1
501 t11 = tetrahedron11 c0
502 p = polynomial t11
503
504 test_trilinear_reproduced_t12 :: Assertion
505 test_trilinear_reproduced_t12 =
506 assertTrue "trilinears are reproduced correctly" $
507 and [p (i', j', k') ~= value_at trilinear i j k
508 | i <- [0..2],
509 j <- [0..2],
510 k <- [0..2],
511 let i' = fromIntegral i,
512 let j' = fromIntegral j,
513 let k' = fromIntegral k]
514 where
515 g = make_grid 1 trilinear
516 c0 = fromJust $ cube_at g 1 1 1
517 t12 = tetrahedron12 c0
518 p = polynomial t12
519
520 test_trilinear_reproduced_t13 :: Assertion
521 test_trilinear_reproduced_t13 =
522 assertTrue "trilinears are reproduced correctly" $
523 and [p (i', j', k') ~= value_at trilinear i j k
524 | i <- [0..2],
525 j <- [0..2],
526 k <- [0..2],
527 let i' = fromIntegral i,
528 let j' = fromIntegral j,
529 let k' = fromIntegral k]
530 where
531 g = make_grid 1 trilinear
532 c0 = fromJust $ cube_at g 1 1 1
533 t13 = tetrahedron13 c0
534 p = polynomial t13
535
536
537 test_trilinear_reproduced_t14 :: Assertion
538 test_trilinear_reproduced_t14 =
539 assertTrue "trilinears are reproduced correctly" $
540 and [p (i', j', k') ~= value_at trilinear i j k
541 | i <- [0..2],
542 j <- [0..2],
543 k <- [0..2],
544 let i' = fromIntegral i,
545 let j' = fromIntegral j,
546 let k' = fromIntegral k]
547 where
548 g = make_grid 1 trilinear
549 c0 = fromJust $ cube_at g 1 1 1
550 t14 = tetrahedron14 c0
551 p = polynomial t14
552
553 test_trilinear_reproduced_t15 :: Assertion
554 test_trilinear_reproduced_t15 =
555 assertTrue "trilinears are reproduced correctly" $
556 and [p (i', j', k') ~= value_at trilinear i j k
557 | i <- [0..2],
558 j <- [0..2],
559 k <- [0..2],
560 let i' = fromIntegral i,
561 let j' = fromIntegral j,
562 let k' = fromIntegral k]
563 where
564 g = make_grid 1 trilinear
565 c0 = fromJust $ cube_at g 1 1 1
566 t15 = tetrahedron15 c0
567 p = polynomial t15
568
569 test_trilinear_reproduced_t16 :: Assertion
570 test_trilinear_reproduced_t16 =
571 assertTrue "trilinears are reproduced correctly" $
572 and [p (i', j', k') ~= value_at trilinear i j k
573 | i <- [0..2],
574 j <- [0..2],
575 k <- [0..2],
576 let i' = fromIntegral i,
577 let j' = fromIntegral j,
578 let k' = fromIntegral k]
579 where
580 g = make_grid 1 trilinear
581 c0 = fromJust $ cube_at g 1 1 1
582 t16 = tetrahedron16 c0
583 p = polynomial t16
584
585 test_trilinear_reproduced_t17 :: Assertion
586 test_trilinear_reproduced_t17 =
587 assertTrue "trilinears are reproduced correctly" $
588 and [p (i', j', k') ~= value_at trilinear i j k
589 | i <- [0..2],
590 j <- [0..2],
591 k <- [0..2],
592 let i' = fromIntegral i,
593 let j' = fromIntegral j,
594 let k' = fromIntegral k]
595 where
596 g = make_grid 1 trilinear
597 c0 = fromJust $ cube_at g 1 1 1
598 t17 = tetrahedron17 c0
599 p = polynomial t17
600
601 test_trilinear_reproduced_t18 :: Assertion
602 test_trilinear_reproduced_t18 =
603 assertTrue "trilinears are reproduced correctly" $
604 and [p (i', j', k') ~= value_at trilinear i j k
605 | i <- [0..2],
606 j <- [0..2],
607 k <- [0..2],
608 let i' = fromIntegral i,
609 let j' = fromIntegral j,
610 let k' = fromIntegral k]
611 where
612 g = make_grid 1 trilinear
613 c0 = fromJust $ cube_at g 1 1 1
614 t18 = tetrahedron18 c0
615 p = polynomial t18
616
617 test_trilinear_reproduced_t19 :: Assertion
618 test_trilinear_reproduced_t19 =
619 assertTrue "trilinears are reproduced correctly" $
620 and [p (i', j', k') ~= value_at trilinear i j k
621 | i <- [0..2],
622 j <- [0..2],
623 k <- [0..2],
624 let i' = fromIntegral i,
625 let j' = fromIntegral j,
626 let k' = fromIntegral k]
627 where
628 g = make_grid 1 trilinear
629 c0 = fromJust $ cube_at g 1 1 1
630 t19 = tetrahedron19 c0
631 p = polynomial t19
632
633 test_trilinear_reproduced_t20 :: Assertion
634 test_trilinear_reproduced_t20 =
635 assertTrue "trilinears are reproduced correctly" $
636 and [p (i', j', k') ~= value_at trilinear i j k
637 | i <- [0..2],
638 j <- [0..2],
639 k <- [0..2],
640 let i' = fromIntegral i,
641 let j' = fromIntegral j,
642 let k' = fromIntegral k]
643 where
644 g = make_grid 1 trilinear
645 c0 = fromJust $ cube_at g 1 1 1
646 t20 = tetrahedron20 c0
647 p = polynomial t20
648
649
650 test_trilinear_reproduced_t21 :: Assertion
651 test_trilinear_reproduced_t21 =
652 assertTrue "trilinears are reproduced correctly" $
653 and [p (i', j', k') ~= value_at trilinear i j k
654 | i <- [0..2],
655 j <- [0..2],
656 k <- [0..2],
657 let i' = fromIntegral i,
658 let j' = fromIntegral j,
659 let k' = fromIntegral k]
660 where
661 g = make_grid 1 trilinear
662 c0 = fromJust $ cube_at g 1 1 1
663 t21 = tetrahedron21 c0
664 p = polynomial t21
665
666 test_trilinear_reproduced_t22 :: Assertion
667 test_trilinear_reproduced_t22 =
668 assertTrue "trilinears are reproduced correctly" $
669 and [p (i', j', k') ~= value_at trilinear i j k
670 | i <- [0..2],
671 j <- [0..2],
672 k <- [0..2],
673 let i' = fromIntegral i,
674 let j' = fromIntegral j,
675 let k' = fromIntegral k]
676 where
677 g = make_grid 1 trilinear
678 c0 = fromJust $ cube_at g 1 1 1
679 t22 = tetrahedron22 c0
680 p = polynomial t22
681
682
683 test_trilinear_reproduced_t23 :: Assertion
684 test_trilinear_reproduced_t23 =
685 assertTrue "trilinears are reproduced correctly" $
686 and [p (i', j', k') ~= value_at trilinear i j k
687 | i <- [0..2],
688 j <- [0..2],
689 k <- [0..2],
690 let i' = fromIntegral i,
691 let j' = fromIntegral j,
692 let k' = fromIntegral k]
693 where
694 g = make_grid 1 trilinear
695 c0 = fromJust $ cube_at g 1 1 1
696 t19 = tetrahedron19 c0
697 p = polynomial t19
698
699
700 test_zeros_reproduced :: Assertion
701 test_zeros_reproduced =
702 assertTrue "the zero function is reproduced correctly" $
703 and [p (i', j', k') ~= value_at zeros i j k
704 | i <- [0..2],
705 j <- [0..2],
706 k <- [0..2],
707 let i' = fromIntegral i,
708 let j' = fromIntegral j,
709 let k' = fromIntegral k]
710 where
711 g = make_grid 1 zeros
712 c0 = fromJust $ cube_at g 1 1 1
713 t0 = tetrahedron0 c0
714 p = polynomial t0