← Back to team overview

dolfin team mailing list archive

Value shape for subclasses of Expression

 

We are currently able to automatically detect the value shape of an
Expression defined like this:

  f = Expression(("x[0]", "sin(x[1])"))

But not if it is defined like this:

  class MyExpression(Expression):
      def eval(self, values, x):
          values[0] = x[0]
          values[1] = sin(x[1])

How should the value shape be specified for a subclass of an
expression?

We had value_rank, value_dim before. We might either require

  def value_shape(self):
      return (2,)

or sending value shape to the constructor:

  f = MyExpression(shape=(2,))

Or there might be some other trick we can do.

--
Anders

Attachment: signature.asc
Description: Digital signature


Follow ups