/[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 1312 - (show annotations)
Mon Sep 24 06:18:44 2007 UTC (12 years, 5 months ago) by ksteube
File MIME type: text/x-python
File size: 2615 byte(s)
The MPI branch is hereby closed. All future work should be in trunk.

Previously in revision 1295 I merged the latest changes to trunk into trunk-mpi-branch.
In this revision I copied all files from trunk-mpi-branch over the corresponding
trunk files. I did not use 'svn merge', it was a copy.

1 #
2 # $Id$
3 #
4 #######################################################
5 #
6 # Copyright 2003-2007 by ACceSS MNRF
7 # Copyright 2007 by University of Queensland
8 #
9 # http://esscc.uq.edu.au
10 # Primary Business: Queensland, Australia
11 # Licensed under the Open Software License version 3.0
12 # http://www.opensource.org/licenses/osl-3.0.php
13 #
14 #######################################################
15 #
16
17 """
18 Test writing data object to various file formats
19
20 by Lutz Gross, ACcESS, University of Queensland, Australia, 2005.
21 """
22
23 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
24 http://www.access.edu.au
25 Primary Business: Queensland, Australia"""
26 __license__="""Licensed under the Open Software License version 3.0
27 http://www.opensource.org/licenses/osl-3.0.php"""
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