/[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 613 - (show annotations)
Wed Mar 22 01:12:32 2006 UTC (14 years, 8 months ago) by elspeth
File MIME type: text/x-python
File size: 2337 byte(s)
More copyright information inserted.

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

  ViewVC Help
Powered by ViewVC 1.1.26