/[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 1809 - (show annotations)
Thu Sep 25 06:43:44 2008 UTC (11 years ago) by ksteube
File MIME type: text/x-python
File size: 3747 byte(s)
Copyright updated in all python files

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