Hi,

Is there an easy way to define a piecewise coefficient function? I want to use it in defining mass matrices for my fem scheme:

\int \sigma(x)*u*v dx

where sigma(x) will be zeros for a range of values in the space im integrating over.

Thanks!

Hi,

Is there an easy way to define a piecewise coefficient function? I want to use it in defining mass matrices for my fem scheme:

\int \sigma(x)*u*v dx

where sigma(x) will be zeros for a range of values in the space im integrating over.

Thanks!

You can use IfPos. For a CoefficientFunction f, IfPos(f, a, b) will be equal to a when f>0 and b otherwise.