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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 617 - (hide annotations)
Wed Mar 22 02:58:17 2006 UTC (14 years, 11 months ago) by elspeth
File MIME type: text/x-python
File size: 2194 byte(s)
More copyright.

1 jgs 115 # $Id$
2     """
3     Test writing data object to various file formats
4    
5     by Lutz Gross, ACcESS, University of Queensland, Australia, 2005.
6     """
7    
8 elspeth 617 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
9     http://www.access.edu.au
10     Primary Business: Queensland, Australia"""
11     __license__="""Licensed under the Open Software License version 3.0
12     http://www.opensource.org/licenses/osl-3.0.php"""
13 jgs 149 from esys.escript import *
14     from esys.finley import Rectangle,Brick
15 jgs 115
16    
17 jgs 147 ne=1
18 jgs 150 work_dir="."
19 jgs 115
20     def writeInFormat(fs,format,filetype):
21     d=fs.getDim()
22     x=length(fs.getX())
23     # generate scalar data:
24     filename="%s/scalar.%s.%s"%(work_dir,filetype,format)
25     print "file ",filename," is generated"
26     try:
27 jgs 150 eval("x.save%s(\"%s\")"%(format.upper(),filename))
28 jgs 115 except StandardError, msg:
29     print "%% failed because of ",msg
30     # generate vector data:
31     print "file ",filename," is generated"
32     filename="%s/vector.%s.%s"%(work_dir,filetype,format)
33     if d==2:
34     m=[1.,2.]
35     else:
36     m=[1.,2.,3.]
37     try:
38 jgs 150 eval("(x*m).save%s(\"%s\")"%(format.upper(),filename))
39 jgs 115 except StandardError, msg:
40     print "%% failed because of ",msg
41     # generate tensor data:
42     filename="%s/tensor.%s.%s"%(work_dir,filetype,format)
43     print "file ",filename," is generated"
44     if d==2:
45     m=[[11.,12.],[21.,22.]]
46     else:
47     m=[[11.,12.,13.],[21.,22.,23.],[31.,32.,33.]]
48     try:
49 jgs 150 eval("(x*m).save%s(\"%s\")"%(format.upper(),filename))
50 jgs 115 except StandardError, msg:
51     print "%% failed because of ",msg
52    
53 jgs 150 for format in ["vtk","dx"]:
54 jgs 115 for d in [2,3]:
55     for order in [1,2]:
56     if (d == 2):
57     mesh = Rectangle(ne, ne,order,l0=order*ne,l1=order*ne)
58     elif (d == 3):
59     mesh = Brick(ne,ne,ne,order,l0=order*ne,l1=order*ne,l2=order*ne)
60 jgs 150 for fs in ["ContinuousFunction","Function","FunctionOnBoundary","Solution","ReducedSolution","FunctionOnContact"]:
61 jgs 115 filetype="%s.o%d.d%d"%(fs,order,d)
62     writeInFormat(eval("%s(mesh)"%fs),format,filetype)
63    

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26