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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2549 - (show annotations)
Mon Jul 20 06:43:47 2009 UTC (10 years, 4 months ago) by jfenwick
File MIME type: text/x-python
File size: 2659 byte(s)
Remainder of copyright date fixes
1
2 ########################################################
3 #
4 # Copyright (c) 2003-2009 by University of Queensland
5 # Earth Systems Science Computational Center (ESSCC)
6 # http://www.uq.edu.au/esscc
7 #
8 # Primary Business: Queensland, Australia
9 # Licensed under the Open Software License version 3.0
10 # http://www.opensource.org/licenses/osl-3.0.php
11 #
12 ########################################################
13
14 __copyright__="""Copyright (c) 2003-2009 by University of Queensland
15 Earth Systems Science Computational Center (ESSCC)
16 http://www.uq.edu.au/esscc
17 Primary Business: Queensland, Australia"""
18 __license__="""Licensed under the Open Software License version 3.0
19 http://www.opensource.org/licenses/osl-3.0.php"""
20 __url__="https://launchpad.net/escript-finley"
21
22 """
23 Test writing data object to various file formats
24
25 by Lutz Gross, ACcESS, University of Queensland, Australia, 2005.
26 """
27
28 from esys.escript import *
29 from esys.finley import Rectangle,Brick
30
31
32 ne=1
33 work_dir="."
34
35 def writeInFormat(fs,format,filetype):
36 d=fs.getDim()
37 x=length(fs.getX())
38 # generate scalar data:
39 filename="%s/scalar.%s.%s"%(work_dir,filetype,format)
40 print "file ",filename," is generated"
41 try:
42 eval("x.save%s(\"%s\")"%(format.upper(),filename))
43 except StandardError, msg:
44 print "%% failed because of ",msg
45 # generate vector data:
46 print "file ",filename," is generated"
47 filename="%s/vector.%s.%s"%(work_dir,filetype,format)
48 if d==2:
49 m=[1.,2.]
50 else:
51 m=[1.,2.,3.]
52 try:
53 eval("(x*m).save%s(\"%s\")"%(format.upper(),filename))
54 except StandardError, msg:
55 print "%% failed because of ",msg
56 # generate tensor data:
57 filename="%s/tensor.%s.%s"%(work_dir,filetype,format)
58 print "file ",filename," is generated"
59 if d==2:
60 m=[[11.,12.],[21.,22.]]
61 else:
62 m=[[11.,12.,13.],[21.,22.,23.],[31.,32.,33.]]
63 try:
64 eval("(x*m).save%s(\"%s\")"%(format.upper(),filename))
65 except StandardError, msg:
66 print "%% failed because of ",msg
67
68 for format in ["vtk","dx"]:
69 for d in [2,3]:
70 for order in [1,2]:
71 if (d == 2):
72 mesh = Rectangle(ne, ne,order,l0=order*ne,l1=order*ne)
73 elif (d == 3):
74 mesh = Brick(ne,ne,ne,order,l0=order*ne,l1=order*ne,l2=order*ne)
75 for fs in ["ContinuousFunction","Function","FunctionOnBoundary","Solution","ReducedSolution","FunctionOnContact"]:
76 filetype="%s.o%d.d%d"%(fs,order,d)
77 writeInFormat(eval("%s(mesh)"%fs),format,filetype)
78

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26