Package esys :: Package escript :: Module util :: Class GetSlice_Symbol
[hide private]
[frames] | no frames]

Class GetSlice_Symbol

 object --+        
          |        
     Symbol --+    
              |    
DependendSymbol --+
                  |
                 GetSlice_Symbol

Symbol representing getting a slice for a Symbol.

Instance Methods [hide private]
 
__init__(self, arg, index)
Initialization of the Symbol with argument arg.
str
getMyCode(self, argstrs, format='escript')
Returns program code that can be used to evaluate the symbol.
escript.Symbol, float, escript.Data, numpy.ndarray depending on the degree of substitution
substitute(self, argvals)
Assigns new values to symbols in the definition of the symbol.

Inherited from DependendSymbol: __eq__, __ne__

Inherited from Symbol: __abs__, __add__, __div__, __getitem__, __mul__, __neg__, __pos__, __pow__, __radd__, __rdiv__, __rmul__, __rpow__, __rsub__, __str__, __sub__, diff, getArgument, getDifferentiatedArguments, getDim, getRank, getShape, getSubstitutedArguments, isAppropriateValue

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, arg, index)
(Constructor)

 

Initialization of the Symbol with argument arg.

Parameters:
  • arg (Symbol) - argument
  • index (slice or int or a tuple of them) - defines index
Raises:
  • IndexError - if length of index is larger than rank of arg or index start or stop is out of range
  • ValueError - if a step is given
Overrides: object.__init__

getMyCode(self, argstrs, format='escript')

 

Returns program code that can be used to evaluate the symbol.

Parameters:
  • argstrs (str or a list of length 1 of str) - a string for each argument representing the argument for the evaluation
  • format (str) - specifies the format to be used. At the moment only "escript", "str" and "text" are supported.
Returns: str
a piece of program code which can be used to evaluate the expression assuming the values for the arguments are available
Raises:
  • NotImplementedError - if no implementation for the given format is available
Overrides: Symbol.getMyCode

substitute(self, argvals)

 

Assigns new values to symbols in the definition of the symbol. The method replaces the Symbol u by argvals[u] in the expression defining this object.

Parameters:
  • argvals (dict with keywords of type Symbol) - new values assigned to symbols
Returns: escript.Symbol, float, escript.Data, numpy.ndarray depending on the degree of substitution
result of the substitution process. Operations are executed as much as possible.
Raises:
  • TypeError - if a value for a Symbol cannot be substituted
Overrides: Symbol.substitute