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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 155 by jgs, Wed Nov 9 02:02:19 2005 UTC revision 345 by gross, Tue Dec 13 05:23:45 2005 UTC
# Line 1  Line 1 
1  # $Id$  # $Id$
2    
3    #
4    #      COPYRIGHT ACcESS 2004 -  All Rights Reserved
5    #
6    #   This software is the property of ACcESS.  No part of this code
7    #   may be copied in any form or by any means without the expressed written
8    #   consent of ACcESS.  Copying, use or modification of this software
9    #   by any unauthorised person is illegal unless that
10    #   person has a software license agreement with ACcESS.
11    #
12    
13  ## @file symbols.py  ## @file symbols.py
14    
15  """  """
16    Dummy symbols class to keep util.py happy  some tools supporting the usage of symbols.
17    
18    @var __author__: name of author
19    @var __licence__: licence agreement
20    @var __url__: url entry point on documentation
21    @var __version__: version
22    @var __date__: date of the version
23  """  """
24                                                                                                                                                                                                        
25    __author__="Lutz Gross, l.gross@uq.edu.au"
26    __licence__="contact: esys@access.uq.edu.au"
27    __url__="http://www.iservo.edu.au/esys/escript"
28    __version__="$Revision$"
29    __date__="$Date$"
30    
31    from util import Symbol
32    
33    def ScalarSymbol(dim=None):
34          """
35          returns a rank 0 L{Symbol}.
36    
37          @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.
38          @type dim: C{None}, C{int} or any object with a C{getDim} method
39          @return: a L{Symbol} of rank 0.
40          @rtype: L{Symbol}
41          """
42          if hasattr(dim,"getDim"):
43               d=dim.getDim()
44          else:
45               d=dim
46          return Symbol(shape=(),dim=d,args=[])
47    
48    
49    def VectorSymbol(dim=3):
50          """
51          returns a vector L{Symbol} of rank 1 and spatial dimension C{dim}  
52    
53          @param dim: spatial dimension or an object that has the C{getDim} method defining the spatial dimension.
54          @type dim: C{int} or any object with a C{getDim} method
55          @return: a L{Symbol} of shape (C{dim},)
56          @rtype: L{Symbol}
57          """
58          if hasattr(dim,"getDim"):
59               d=dim.getDim()
60          else:
61               d=dim
62          return Symbol(shape=(d,),dim=d,args=[])
63    
64    def TensorSymbol(dim=3):
65          """
66          returns a tensor L{Symbol} of rank 2 and spatial dimension C{dim}
67    
68          @param dim: spatial dimension or an object that has the C{getDim} method defining the spatial dimension.
69          @type dim: C{int} or any object with a C{getDim} method
70          @return: a L{Symbol} of shape (C{dim},C{dim})
71          @rtype: L{Symbol}
72          """
73          if hasattr(dim,"getDim"):
74               d=dim.getDim()
75          else:
76               d=dim
77          return Symbol(shape=(d,d),dim=d,args=[])
78    
79    def Tensor3Symbol(dim=3):
80          """
81          returns a tensor L{Symbol} of rank 3 and spatial dimension C{dim}
82    
83          @param dim: spatial dimension or an object that has the C{getDim} method defining the spatial dimension.
84          @type dim: C{int} or any object with a C{getDim} method
85          @return: a L{Symbol} of shape (C{dim},C{dim},C{dim})
86          @rtype: L{Symbol}
87          """
88          if hasattr(dim,"getDim"):
89               d=dim.getDim()
90          else:    
91               d=dim
92          return Symbol(shape=(d,d,d),dim=d,args=[])
93    
94  class Symbol:  def Tensor4Symbol(dim=3):
95      """        """
96        Dummy symbols class to keep util.py happy        returns a tensor L{Symbol} of rank 4 and spatial dimension C{dim}
     """  
97    
98      def __init__(self):        @param dim: spatial dimension or an object that has the C{getDim} method defining the spatial dimension.
99        pass        @type dim: C{int} or any object with a C{getDim} method
100          @param name: name of the symbol
101          @type name: C{str}
102          @return: a L{Symbol} of shape (C{dim},C{dim},C{dim},C{dim})
103          @rtype: L{Symbol}
104          """
105          if hasattr(dim,"getDim"):
106               d=dim.getDim()
107          else:    
108               d=dim
109          return Symbol(shape=(d,d,d,d),dim=d,args=[])
110    #
111    # $Log:$
112    #
113    # vim: expandtab shiftwidth=4:

Legend:
Removed from v.155  
changed lines
  Added in v.345

  ViewVC Help
Powered by ViewVC 1.1.26