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