How to assign a mesh function to a mesh's domains' marker

Asked by Marie Rognes

What is the blessed way of assigning a certain mesh function to a mesh's domains' marker?

I'm thinking of something along the lines of the below, but have not been able to find
the suitable assign functionalities...:

from dolfin import *

mesh = UnitCube(2, 2, 2)
mf = FaceFunction("uint", mesh)
mf.set_all(0)

# Want to accomplish something like this
# (Syntax is of course not valid)
mvc = MeshValueCollection("uint", mf)
mesh.domains().markers(2) := mvc

# Or maybe something like this
mesh.facet_domains() := mf

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Johan Hake
Solved:
Last query:
Last reply:
Revision history for this message
Best Johan Hake (johan-hake) said :
#1

On 10/08/2012 02:36 PM, Marie Rognes wrote:
> New question #210666 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/210666
>
> What is the blessed way of assigning a certain mesh function to a mesh's domains' marker?
>
> I'm thinking of something along the lines of the below, but have not been able to find
> the suitable assign functionalities...:
>
> from dolfin import *
>
> mesh = UnitCube(2, 2, 2)
> mf = FaceFunction("uint", mesh)
> mf.set_all(0)
>
> # Want to accomplish something like this
> # (Syntax is of course not valid)
> mvc = MeshValueCollection("uint", mf)
> mesh.domains().markers(2) := mvc

  mesh.domains().markers(2).assign(mvc)

> # Or maybe something like this
> mesh.facet_domains() := mf

  mesh.domains().markers(2).assign(mf)

:)

Johan

Revision history for this message
Marie Rognes (meg-simula) said :
#2

Thanks Johan! (This is evidently what happens when you only read the code and not the doc ;-) )

Revision history for this message
Evan Cummings (pf4d) said :
#4

The call mesh.domains().markers(n) returns a python dict object with the latest development version (1.2.0+).

Has this function been deprecated? If so, do you know a way around this?

thanks!