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

Contents of /trunk/escript/test/python/ArchiveTests.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 159 - (show annotations)
Thu Nov 10 04:01:43 2005 UTC (13 years, 10 months ago) by matt
File MIME type: text/x-python
File size: 2048 byte(s)
Added a more comprehensive data equivalence test based on X coordinates.


1 import sys
2 import unittest
3 import os
4
5 from esys.escript import *
6 from esys import bruce
7 from esys import finley
8
9 import numarray
10 from numarray import array,Float64,ones,greater
11
12 """
13
14 Miscellaneous escript/Data tests.
15
16 Version $Id: MiscTests.py 153 2005-10-25 01:51:20Z jgs $
17
18 """
19
20 #
21 # ==============================================================
22
23 print "\n\n"
24
25 mshList=(bruce.Rectangle(),
26 bruce.Brick(),
27 finley.Rectangle(2, 5, 1, l0 = 7.0, l1 = 11.0),
28 finley.Brick(2, 5, 7, 1, l0 = 11.0, l1 = 13.0, l2 = 17.0),
29 finley.Rectangle(2, 5, 2, l0 = 7.0, l1 = 11.0),
30 finley.Brick(2, 5, 7, 2, l0 = 11.0, l1 = 13.0, l2 = 17.0))
31
32 for msh in mshList:
33
34 print "\nX -- Continuous:"
35 archDataX = msh.getX()
36 archDataX.archiveData("data-archiveX")
37 exDataX=Data()
38 exDataX.extractData("data-archiveX",ContinuousFunction(msh))
39
40 diff = archDataX - exDataX
41 (infdiff, supdiff) = (inf(diff), sup(diff))
42 if infdiff != 0 or supdiff != 0:
43 print "*** ERROR: Data value discrepancies %f < X < %f" \
44 % (infdiff, supdiff)
45 sys.exit(1)
46
47 exDataX.archiveData("data-archive2X");
48
49 print "\nDataExpanded:"
50 archDataE=Data([[1.00001],[2.00001]],Function(msh),True)
51 archDataE.archiveData("data-archiveE")
52 exDataE=Data()
53 exDataE.extractData("data-archiveE",Function(msh))
54 exDataE.archiveData("data-archive2E");
55
56 print "\nDataTagged:"
57 archDataT=Data([[1.00001],[2.00001]],Function(msh))
58 archDataT.tag()
59 archDataT.archiveData("data-archiveT")
60 exDataT=Data()
61 exDataT.extractData("data-archiveT",Function(msh))
62 exDataT.archiveData("data-archive2T");
63
64 print "\nDataConstant:"
65 archDataC=Data([1.00001], Function(msh))
66 archDataC.archiveData("data-archiveC")
67 exDataC=Data()
68 exDataC.extractData("data-archiveC",Function(msh))
69 exDataC.archiveData("data-archive2C");
70
71 print "\nDataEmpty:"
72 archDataM=Data()
73 archDataM.archiveData("data-archiveE")
74 exDataM=Data()
75 exDataM.extractData("data-archiveE",FunctionSpace())
76 exDataM.archiveData("data-archive2E")
77
78 sys.exit(0)
79 # end

  ViewVC Help
Powered by ViewVC 1.1.26