dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #24376
Re: Exposing MeshMarkers in Python
On Friday September 2 2011 23:19:22 Anders Logg wrote:
> On Fri, Sep 02, 2011 at 02:35:57PM -0700, Johan Hake wrote:
> > What is the different between a MeshMarker and a MeshFunction? Is
> > MeshMarker a MeshFunction but instead of storing the values in line with
> > its global entity index it stores it wrt the global cell entity index
> > together with its local entity index?
>
> Yes, that and values don't need to be stored on the entire mesh, only
> for a subset, so you can mark just 3 facets without needing to store
> markers for a million facets.
ok, I will see what I can do.
> Copy paste from the MeshMarker docstring:
>
> /// The MeshMarkers class can be used to store data associated with
> /// a subset of the entities of a mesh of a given topological
> /// dimension. It differs from the MeshFunction class in two ways.
> /// First, data does not need to be associated with all entities
> /// (only a subset). Second, data is associated with entities
> /// through the corresponding cell index and local entity number
> /// (relative to the cell), not by global entity index, which means
> /// that data may be stored robustly to file.
>
> > Also, will this take over for the way we use MeshFunctions in the
> > assembler, or will a MeshFunction be generated by a MeshMarker before
> > assemble gets called?
>
> I think we will do that as a first step (convert from MeshMarker to
> MeshFunction) since then we don't need to touch the assembler. Then
> later we can think about using MeshMarkers directly.
Ok.
> > I think I also get confused with the naming here. If my explaination of
> > what MeshMarker is doing is correct, a MeshMarker and a MeshFunction are
> > essentially doing the same thing. What differs is the way the data is
> > stored. This is not reflected in the naming of the classes
>
> It was the best I could come up with. Feel free to suggest something
> else. SubsetMeshFunction would also be confusing since it's not really
> a MeshFunction.
>
> Either way, I expect the MeshMarkers class to be used mostly
> internally by the MeshDomains class.
Ok.
Not sure these are better, but they might reflect the difference between this
guy and a MeshFunction in a slightly more intuitive way.
MeshEntityFunction, LocalMeshEntityFunction, LocalMeshFunction,
SubMeshFunction
Johan
> --
> Anders
>
> > Johan
> >
> > On Friday September 2 2011 13:58:13 Anders Logg wrote:
> > > 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.
Follow ups
References