dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #24368
Re: Exposing MeshMarkers in Python
Typically through the Mesh class and then they are not visible:
subdomain0 = MySubDomain0()
subdomain1 = MySubDomain1()
subdomain0.mark_facets(mesh, 0)
subdomain1.mark_facets(mesh, 1)
But one should also be able to use it directly, like so:
markers = MeshMarkers("uint", mesh, mesh.topology().dim() - 1)
markers.set_marker(cell_index, local_entity, marker_value)
marker = markers.get_marker(i)
where marker = (cell_index, local_entity, marker_value) or perhaps
marker = ((cell_index, local_entity), marker_value). In C++, I
currently use the latter so I can use std::pair and it somehow makes
sense.
We should probably also add FacetMarkers, CellMarkers etc in the same
was as for MeshFunction.
--
Anders
On Fri, Sep 02, 2011 at 09:57:39AM -0700, Johan Hake wrote:
> Could you briefly sketch some different scenarios how a user should use MeshMarker in Python?
>
> Johan
>
> On Sep 2, 2011, at 5:20, Anders Logg <logg@xxxxxxxxx> wrote:
>
> > Can someone (Mr Swig...) help me expose the class MeshMarkers in
> > Python?
> >
> > Judging from mesh_post.i, some heavy swig macros are needed. I can try
> > to emulate what's in there for MeshFunction but I fear I will break
> > something. :-)
> >
Follow ups
References