Constant

class devito.types.Constant(*args, **kwargs)[source]

Bases: DataSymbol, ArgProvider

Symbol representing a constant, scalar value in symbolic equations. A Constant carries a scalar value.

Parameters:
  • name (str) – Name of the symbol.

  • dtype (data-type, optional) – Any object that can be interpreted as a numpy data type. Defaults to np.float32.

Examples

>>> from devito import Constant
>>> c = Constant(name='c')
>>> c
c
>>> c.data
0.0
>>> c.data = 4
>>> c.data
4.0

Notes

The parameters must always be given as keyword arguments, since SymPy uses *args to (re-)create the dimension arguments of the symbolic object.

property data

The value of the data object, as a scalar (int, float, …).