/[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

trunk/esys2/escript/py_src/symbols.py revision 154 by jgs, Mon Nov 7 05:51:17 2005 UTC temp/escript/py_src/symbols.py revision 1387 by trankine, Fri Jan 11 07:45:26 2008 UTC
# Line 1  Line 1 
1    #
2  # $Id$  # $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  ## @file symbols.py
18    
19  """  """
20    Dummy symbols class to keep util.py happy  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  class Symbol:  def Tensor4Symbol(dim=3):
104      """        """
105        Dummy symbols class to keep util.py happy        returns a tensor L{Symbol} of rank 4 and spatial dimension C{dim}
     """  
106    
107      def __init__(self):        @param dim: spatial dimension or an object that has the C{getDim} method defining the spatial dimension.
108        pass        @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:

Legend:
Removed from v.154  
changed lines
  Added in v.1387

  ViewVC Help
Powered by ViewVC 1.1.26