I have a complicated vector analytic expression as a source and I would like to write some of its components separately. How can I declare and expression using one or more expressions? Could I use a python function/s to do it?
It is a very vague question, but if you manage to define two expressions
f = CustomExpression1(args) g = CustomExpression2(args)
then putting everyting together is simply done with
F = as_vector([f, g])
Best regards
Yes it was, let me be more specific:
I would like the following functionality:
someExpression = Expression('funct(x[0] + 20.0) + x[0] + 40.0', degree=1)
Where funct is either a function as shown or just another expression, written outside the line either as an expression or a python function or a c++ function.
For this you would need to subclass Expression so that is has your desired function as follows:
class CustomExpression(Expression): def __init__(self, func, element): self.func = func self.element = element def eval(self, value,x): value[0] = func(x) + etc
and then create the expression with your new argument
F = CustomExpression(func, element)
Best regards!