/[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 706 - (show annotations)
Sat Apr 8 16:13:02 2006 UTC (13 years, 8 months ago) by gross
File MIME type: text/x-python
File size: 2861 byte(s)
python tests compile and run but there is still a problem with dependencies'

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

  ViewVC Help
Powered by ViewVC 1.1.26