/[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 1387 - (hide annotations)
Fri Jan 11 07:45:26 2008 UTC (11 years, 9 months ago) by trankine
Original Path: temp/escript/py_src/symbols.py
File MIME type: text/x-python
File size: 3986 byte(s)
Restore the trunk that existed before the windows changes were committed to the (now moved to branches) old trunk.
1 ksteube 1312 #
2 jgs 150 # $Id$
3 ksteube 1312 #
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 jgs 150
17 jgs 154 ## @file symbols.py
18    
19 jgs 150 """
20 gross 345 some tools supporting the usage of symbols.
21    
22     @var __author__: name of author
23 gross 637 @var __copyright__: copyrights
24 elspeth 614 @var __license__: licence agreement
25 gross 345 @var __url__: url entry point on documentation
26     @var __version__: version
27     @var __date__: date of the version
28 jgs 150 """
29 gross 345
30     __author__="Lutz Gross, l.gross@uq.edu.au"
31 elspeth 609 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
32     http://www.access.edu.au
33     Primary Business: Queensland, Australia"""
34 elspeth 614 __license__="""Licensed under the Open Software License version 3.0
35     http://www.opensource.org/licenses/osl-3.0.php"""
36 gross 345 __url__="http://www.iservo.edu.au/esys/escript"
37     __version__="$Revision$"
38     __date__="$Date$"
39 jgs 150
40 gross 345 from util import Symbol
41 jgs 150
42 gross 345 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