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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 614 - (hide annotations)
Wed Mar 22 01:37:07 2006 UTC (13 years, 7 months ago) by elspeth
File MIME type: text/x-python
File size: 3598 byte(s)
Corrected spelling of 'license' in url so that the link actually points to the license.

1 jgs 150 # $Id$
2    
3 jgs 154 ## @file symbols.py
4    
5 jgs 150 """
6 gross 345 some tools supporting the usage of symbols.
7    
8     @var __author__: name of author
9 elspeth 614 @var __license__: licence agreement
10 gross 345 @var __url__: url entry point on documentation
11     @var __version__: version
12     @var __date__: date of the version
13 jgs 150 """
14 gross 345
15     __author__="Lutz Gross, l.gross@uq.edu.au"
16 elspeth 609 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
17     http://www.access.edu.au
18     Primary Business: Queensland, Australia"""
19 elspeth 614 __license__="""Licensed under the Open Software License version 3.0
20     http://www.opensource.org/licenses/osl-3.0.php"""
21 gross 345 __url__="http://www.iservo.edu.au/esys/escript"
22     __version__="$Revision$"
23     __date__="$Date$"
24 jgs 150
25 gross 345 from util import Symbol
26 jgs 150
27 gross 345 def ScalarSymbol(dim=None):
28     """
29     returns a rank 0 L{Symbol}.
30    
31     @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.
32     @type dim: C{None}, C{int} or any object with a C{getDim} method
33     @return: a L{Symbol} of rank 0.
34     @rtype: L{Symbol}
35     """
36     if hasattr(dim,"getDim"):
37     d=dim.getDim()
38     else:
39     d=dim
40     return Symbol(shape=(),dim=d,args=[])
41    
42    
43     def VectorSymbol(dim=3):
44     """
45     returns a vector L{Symbol} of rank 1 and spatial dimension C{dim}
46    
47     @param dim: spatial dimension or an object that has the C{getDim} method defining the spatial dimension.
48     @type dim: C{int} or any object with a C{getDim} method
49     @return: a L{Symbol} of shape (C{dim},)
50     @rtype: L{Symbol}
51     """
52     if hasattr(dim,"getDim"):
53     d=dim.getDim()
54     else:
55     d=dim
56     return Symbol(shape=(d,),dim=d,args=[])
57    
58     def TensorSymbol(dim=3):
59     """
60     returns a tensor L{Symbol} of rank 2 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},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,d),dim=d,args=[])
72    
73     def Tensor3Symbol(dim=3):
74     """
75     returns a tensor L{Symbol} of rank 3 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},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,d),dim=d,args=[])
87    
88     def Tensor4Symbol(dim=3):
89     """
90     returns a tensor L{Symbol} of rank 4 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     @param name: name of the symbol
95     @type name: C{str}
96     @return: a L{Symbol} of shape (C{dim},C{dim},C{dim},C{dim})
97     @rtype: L{Symbol}
98     """
99     if hasattr(dim,"getDim"):
100     d=dim.getDim()
101     else:
102     d=dim
103     return Symbol(shape=(d,d,d,d),dim=d,args=[])
104     #
105     # $Log:$
106     #
107     # 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