/[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 720 - (show annotations)
Thu Apr 27 10:16:05 2006 UTC (13 years, 7 months ago) by gross
File MIME type: text/x-python
File size: 3566 byte(s)
formatting errors in epydoc tags fixed
1 # $Id$
2
3 ## @file symbols.py
4
5 """
6 some tools supporting the usage of symbols.
7
8 @var __author__: name of author
9 @var __copyright__: copyrights
10 @var __license__: licence agreement
11 @var __url__: url entry point on documentation
12 @var __version__: version
13 @var __date__: date of the version
14 """
15
16 __author__="Lutz Gross, l.gross@uq.edu.au"
17 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
18 http://www.access.edu.au
19 Primary Business: Queensland, Australia"""
20 __license__="""Licensed under the Open Software License version 3.0
21 http://www.opensource.org/licenses/osl-3.0.php"""
22 __url__="http://www.iservo.edu.au/esys/escript"
23 __version__="$Revision$"
24 __date__="$Date$"
25
26 from util import Symbol
27
28 def ScalarSymbol(dim=None):
29 """
30 returns a rank 0 L{Symbol}.
31
32 @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.
33 @type dim: C{None}, C{int} or any object with a C{getDim} method
34 @return: a L{Symbol} of rank 0.
35 @rtype: L{Symbol}
36 """
37 if hasattr(dim,"getDim"):
38 d=dim.getDim()
39 else:
40 d=dim
41 return Symbol(shape=(),dim=d,args=[])
42
43
44 def VectorSymbol(dim=3):
45 """
46 returns a vector L{Symbol} of rank 1 and spatial dimension C{dim}
47
48 @param dim: spatial dimension or an object that has the C{getDim} method defining the spatial dimension.
49 @type dim: C{int} or any object with a C{getDim} method
50 @return: a L{Symbol} of shape (C{dim},)
51 @rtype: L{Symbol}
52 """
53 if hasattr(dim,"getDim"):
54 d=dim.getDim()
55 else:
56 d=dim
57 return Symbol(shape=(d,),dim=d,args=[])
58
59 def TensorSymbol(dim=3):
60 """
61 returns a tensor L{Symbol} of rank 2 and spatial dimension C{dim}
62
63 @param dim: spatial dimension or an object that has the C{getDim} method defining the spatial dimension.
64 @type dim: C{int} or any object with a C{getDim} method
65 @return: a L{Symbol} of shape (C{dim},C{dim})
66 @rtype: L{Symbol}
67 """
68 if hasattr(dim,"getDim"):
69 d=dim.getDim()
70 else:
71 d=dim
72 return Symbol(shape=(d,d),dim=d,args=[])
73
74 def Tensor3Symbol(dim=3):
75 """
76 returns a tensor L{Symbol} of rank 3 and spatial dimension C{dim}
77
78 @param dim: spatial dimension or an object that has the C{getDim} method defining the spatial dimension.
79 @type dim: C{int} or any object with a C{getDim} method
80 @return: a L{Symbol} of shape (C{dim},C{dim},C{dim})
81 @rtype: L{Symbol}
82 """
83 if hasattr(dim,"getDim"):
84 d=dim.getDim()
85 else:
86 d=dim
87 return Symbol(shape=(d,d,d),dim=d,args=[])
88
89 def Tensor4Symbol(dim=3):
90 """
91 returns a tensor L{Symbol} of rank 4 and spatial dimension C{dim}
92
93 @param dim: spatial dimension or an object that has the C{getDim} method defining the spatial dimension.
94 @type dim: C{int} or any object with a C{getDim} method
95 @return: a L{Symbol} of shape (C{dim},C{dim},C{dim},C{dim})
96 @rtype: L{Symbol}
97 """
98 if hasattr(dim,"getDim"):
99 d=dim.getDim()
100 else:
101 d=dim
102 return Symbol(shape=(d,d,d,d),dim=d,args=[])
103 #
104 # $Log:$
105 #
106 # 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