← Back to team overview

dolfin team mailing list archive

Re: [Question #142746]: setting double meshfunction on subdomain

 

Question #142746 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/142746

    Status: Open => Answered

Johan Hake proposed the following answer:
Use a uint cell function and then convert the values:

m = UnitInterval(100)
f = CellFunction('uint',m)

class Left(SubDomain):
  def inside(self, x, on_boundary):
    return x[0] < 0.5

left = Left()
f.set_all(0)
left.mark(f,1)

fd = CellFunction('double',m)
fd.values()[:] = f.values()*0.01

Johan

On Monday January 24 2011 17:34:33 Chaffra wrote:
> New question #142746 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/142746
> 
> This is what I'd like to do:
> 
> m = UnitInterval(100)
> f = CellFunction('double',m)
> 
> class Left(SubDomain):
>   def inside(self, x, on_boundary):
>     return x[0] < 0.5
> 
> left = Left()
> left.mark(f,0.01)
> 
> Obviously this does not work because mark only accepts MeshFunctionUInt. Is
> there a simple way to do this with a MeshFunctionDouble?
> 
> Thanks,
> Chaffra

-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.