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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 345 - (show annotations)
Tue Dec 13 05:23:45 2005 UTC (13 years, 9 months ago) by gross
File MIME type: text/x-python
File size: 3738 byte(s)
advection diffusion class added
1 # $Id$
2
3 #
4 # COPYRIGHT ACcESS 2004 - All Rights Reserved
5 #
6 # This software is the property of ACcESS. No part of this code
7 # may be copied in any form or by any means without the expressed written
8 # consent of ACcESS. Copying, use or modification of this software
9 # by any unauthorised person is illegal unless that
10 # person has a software license agreement with ACcESS.
11 #
12
13 ## @file symbols.py
14
15 """
16 some tools supporting the usage of symbols.
17
18 @var __author__: name of author
19 @var __licence__: licence agreement
20 @var __url__: url entry point on documentation
21 @var __version__: version
22 @var __date__: date of the version
23 """
24
25 __author__="Lutz Gross, l.gross@uq.edu.au"
26 __licence__="contact: esys@access.uq.edu.au"
27 __url__="http://www.iservo.edu.au/esys/escript"
28 __version__="$Revision$"
29 __date__="$Date$"
30
31 from util import Symbol
32
33 def ScalarSymbol(dim=None):
34 """
35 returns a rank 0 L{Symbol}.
36
37 @param dim: spatial dimension or an object that has the C{getDim} method defining the spatial dimension. If dim=C{None}, the spatial diminsion of the returned L{Symbol} is undefined.
38 @type dim: C{None}, C{int} or any object with a C{getDim} method
39 @return: a L{Symbol} of rank 0.
40 @rtype: L{Symbol}
41 """
42 if hasattr(dim,"getDim"):
43 d=dim.getDim()
44 else:
45 d=dim
46 return Symbol(shape=(),dim=d,args=[])
47
48
49 def VectorSymbol(dim=3):
50 """
51 returns a vector L{Symbol} of rank 1 and spatial dimension C{dim}
52
53 @param dim: spatial dimension or an object that has the C{getDim} method defining the spatial dimension.
54 @type dim: C{int} or any object with a C{getDim} method
55 @return: a L{Symbol} of shape (C{dim},)
56 @rtype: L{Symbol}
57 """
58 if hasattr(dim,"getDim"):
59 d=dim.getDim()
60 else:
61 d=dim
62 return Symbol(shape=(d,),dim=d,args=[])
63
64 def TensorSymbol(dim=3):
65 """
66 returns a tensor L{Symbol} of rank 2 and spatial dimension C{dim}
67
68 @param dim: spatial dimension or an object that has the C{getDim} method defining the spatial dimension.
69 @type dim: C{int} or any object with a C{getDim} method
70 @return: a L{Symbol} of shape (C{dim},C{dim})
71 @rtype: L{Symbol}
72 """
73 if hasattr(dim,"getDim"):
74 d=dim.getDim()
75 else:
76 d=dim
77 return Symbol(shape=(d,d),dim=d,args=[])
78
79 def Tensor3Symbol(dim=3):
80 """
81 returns a tensor L{Symbol} of rank 3 and spatial dimension C{dim}
82
83 @param dim: spatial dimension or an object that has the C{getDim} method defining the spatial dimension.
84 @type dim: C{int} or any object with a C{getDim} method
85 @return: a L{Symbol} of shape (C{dim},C{dim},C{dim})
86 @rtype: L{Symbol}
87 """
88 if hasattr(dim,"getDim"):
89 d=dim.getDim()
90 else:
91 d=dim
92 return Symbol(shape=(d,d,d),dim=d,args=[])
93
94 def Tensor4Symbol(dim=3):
95 """
96 returns a tensor L{Symbol} of rank 4 and spatial dimension C{dim}
97
98 @param dim: spatial dimension or an object that has the C{getDim} method defining the spatial dimension.
99 @type dim: C{int} or any object with a C{getDim} method
100 @param name: name of the symbol
101 @type name: C{str}
102 @return: a L{Symbol} of shape (C{dim},C{dim},C{dim},C{dim})
103 @rtype: L{Symbol}
104 """
105 if hasattr(dim,"getDim"):
106 d=dim.getDim()
107 else:
108 d=dim
109 return Symbol(shape=(d,d,d,d),dim=d,args=[])
110 #
111 # $Log:$
112 #
113 # vim: expandtab shiftwidth=4:

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26