Piecewise CoefficientFunction

More
3 years 8 months ago - 3 years 8 months ago #3599 by Ryanleaf
Dear All,

I have a quick question. I am trying to define a piecewise Coefficient function. I noticed that I could achieve this by doing something like this,
" domain_values = {'inner': 3.7, 'outer': 1}
values_list = [domain_values[mat]
for mat in mesh.GetMaterials()]
cf = CoefficientFunction(values_list)
Draw(cf, mesh, 'piecewise') "
I am wondering is it possible to define a piecewise coefficient function without setting actual domains?
Write a coefficient function f like:
f(x,y,z)=x.  when x^2+y^2>1
f(x,y,z)=y.  when x^2+y^2<=1
Without creating a cylinder domain?

Thanks,
Ryan
Last edit: 3 years 8 months ago by Ryanleaf.
More
3 years 8 months ago #3600 by schruste
Hi,

Try IfPos(x*x+y*y-1,x,y) .

Best,
Christoph
The following user(s) said Thank You: Ryanleaf
Time to create page: 0.093 seconds