/[escript]/trunk/escript/py_src/util.py
ViewVC logotype

Contents of /trunk/escript/py_src/util.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 82 - (show annotations)
Tue Oct 26 06:53:54 2004 UTC (14 years, 10 months ago) by jgs
Original Path: trunk/esys2/escript/py_src/util.py
File MIME type: text/x-python
File size: 3093 byte(s)
Initial revision

1 # $Id$
2
3 ## @file util.py
4
5 """
6 @brief Utility functions for escript
7 """
8
9 import numarray
10 #
11 # escript constants:
12 #
13 FALSE=0
14 TRUE=1
15 UNKNOWN=-1
16 EPSILON=1.e-15
17 Pi=3.1415926535897931
18 # matrix types
19 CSC=0
20 CSR=1
21 LUMPED=10
22 # some solver options:
23 NO_REORDERING=0
24 MINIMUM_FILL_IN=1
25 NESTED_DISSECTION=2
26 DEFAULT_METHOD=0
27 PCG=1
28 CR=2
29 CGS=3
30 BICGSTAB=4
31 SSOR=5
32 ILU0=6
33 ILUT=7
34 JACOBI=8
35 # supported file formats:
36 VRML=1
37 PNG=2
38 JPEG=3
39 JPG=3
40 PS=4
41 OOGL=5
42 BMP=6
43 TIFF=7
44 OPENINVENTOR=8
45 RENDERMAN=9
46 PNM=10
47 #
48 # wrapper for various functions: if the argument has attribute the function name
49 # as an argument it calls the correspong methods. Otherwise the coresponsing numarray
50 # function is called.
51 #
52 def L2(arg):
53 """
54 @brief
55
56 @param arg
57 """
58 return arg.L2()
59
60 def grad(arg,where=None):
61 """
62 @brief
63
64 @param arg
65 @param where
66 """
67 if where==None:
68 return arg.grad()
69 else:
70 return arg.grad(where)
71
72 def integrate(arg):
73 """
74 @brief
75
76 @param arg
77 """
78 return arg.integrate()
79
80 def interpolate(arg,where):
81 """
82 @brief
83
84 @param arg
85 @param where
86 """
87 return arg.interpolate(where)
88
89 def transpose(arg):
90 """
91 @brief
92
93 @param arg
94 """
95 if hasattr(arg,"transpose"):
96 return arg.transpose()
97 else:
98 return numarray.transpose(arg,axis=None)
99
100 def trace(arg):
101 """
102 @brief
103
104 @param arg
105 """
106 if hasattr(arg,"trace"):
107 return arg.trace()
108 else:
109 return numarray.trace(arg,k=0)
110
111 def exp(arg):
112 """
113 @brief
114
115 @param arg
116 """
117 if hasattr(arg,"exp"):
118 return arg.exp()
119 else:
120 return numarray.exp(arg)
121
122 def sqrt(arg):
123 """
124 @brief
125
126 @param arg
127 """
128 if hasattr(arg,"sqrt"):
129 return arg.sqrt()
130 else:
131 return numarray.sqrt(arg)
132
133 def sin(arg):
134 """
135 @brief
136
137 @param arg
138 """
139 if hasattr(arg,"sin"):
140 return arg.sin()
141 else:
142 return numarray.sin(arg)
143
144 def cos(arg):
145 """
146 @brief
147
148 @param arg
149 """
150 if hasattr(arg,"cos"):
151 return arg.cos()
152 else:
153 return numarray.cos(arg)
154
155 def maxval(arg):
156 """
157 @brief
158
159 @param arg
160 """
161 return arg.maxval()
162
163 def minval(arg):
164 """
165 @brief
166
167 @param arg
168 """
169 return arg.minval()
170
171 def sup(arg):
172 """
173 @brief
174
175 @param arg
176 """
177 return arg.sup()
178
179 def inf(arg):
180 """
181 @brief
182
183 @param arg
184 """
185 return arg.inf()
186
187 def Lsup(arg):
188 """
189 @brief
190
191 @param arg
192 """
193 return arg.Lsup()
194
195 def length(arg):
196 """
197 @brief
198
199 @param arg
200 """
201 return arg.length()
202
203 def sign(arg):
204 """
205 @brief
206
207 @param arg
208 """
209 return arg.sign()
210 #
211 # $Log$
212 # Revision 1.1 2004/10/26 06:53:56 jgs
213 # Initial revision
214 #
215 # Revision 1.1.2.3 2004/10/26 06:43:48 jgs
216 # committing Lutz's and Paul's changes to brach jgs
217 #
218 # Revision 1.1.4.1 2004/10/20 05:32:51 cochrane
219 # Added incomplete Doxygen comments to files, or merely put the docstrings that already exist into Doxygen form.
220 #
221 # Revision 1.1 2004/08/05 03:58:27 gross
222 # Bug in Assemble_NodeCoordinates fixed
223 #
224 #

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26