min(a,b,c) functions in a ufl file for C++

Asked by jhameed2@illinois.edu

Hello,

A short question. If I have three coefficients a,b,c (say all Lagrange finite elements), can I find their minimum using

m = min(a,b,c)

using ffc, to use with C++?

The form compiles alright, but I couldnt find any reference to the min function in the ufl documentation, so I dont know if that works as I intend or not.

Thanks,
-Jehanzeb

Question information

Language:
English Edit question
Status:
Answered
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Mikael Mortensen (mikael-mortensen) said :
#1

min is a built in python function. Use conditional instead and define your own min function like:

from ufl import conditional

def ufl_min(a, b):
    return conditional(lt(a, b), a, b)

min(a, b, c) is then ufl_min(a, ufl_min(b, c))

Can you help with this problem?

Provide an answer of your own, or ask jhameed2@illinois.edu for more information if necessary.

To post a message you must log in.