boundary marking not working in snapshot release

Asked by Martin Eigel

This code used to work in the stable release.

mesh = UnitSquare(5, 5)
bottom, top = compile_subdomains(['near(x[1], 0.) && on_boundary',
                                  'near(x[1], 1.) && on_boundary'])
N_parts = FacetFunction("uint", mesh, mesh.topology().dim() - 1)
N_parts.set_all(0)
bottom.mark(N_parts, 1)

It now yields
bottom.mark(N_parts, 1)
TypeError: in method 'SubDomain_mark', argument 2 of type 'dolfin::MeshFunction< bool > &'

What has changed?

Cheers,
Martin

Question information

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

To handle larger data structures we have now moved from unsigned int,
"uint" to std::size_t, "sizet" for most of our MehsFunctions.

Use

 N_parts = FacetFunction("sizet", mesh, 0)

instead. The error message is however very confusing and needs to be
fixed...

Also you have confused the usage of initalization value of the
FacetFunction.

  FacetFunction("uint", mesh, mesh.topology().dim() - 1)

Does not make sense. Now the MeshFunction gets initialized to:

  mesh.topology().dim() - 1

Using FacetFunction instead of MeshFunction automatically set the
correct dimension of the MeshFunction. The third argument to
FacetFunction is an initialization value, similar to set_all.

Johan

On 11/22/2012 01:30 AM, Martin Eigel wrote:
> New question #214909 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/214909
>
> This code used to work in the stable release.
>
> mesh = UnitSquare(5, 5)
> bottom, top = compile_subdomains(['near(x[1], 0.) && on_boundary',
> 'near(x[1], 1.) && on_boundary'])
> N_parts = FacetFunction("uint", mesh, mesh.topology().dim() - 1)
> N_parts.set_all(0)
> bottom.mark(N_parts, 1)
>
> It now yields
> bottom.mark(N_parts, 1)
> TypeError: in method 'SubDomain_mark', argument 2 of type 'dolfin::MeshFunction< bool > &'
>
> What has changed?
>
> Cheers,
> Martin
>

Revision history for this message
Martin Eigel (meigel) said :
#2

Thanks for the quick answer. Much appreciated.

Martin