← Back to team overview

dolfin team mailing list archive

Re: MeshFunctions

 

On Mon, Sep 28, 2009 at 07:44:46PM +0100, Garth N. Wells wrote:
> I've been making extension use of MeshFunctions templated over various
> objects and they're really great!
>
> However, rather than just having, for example,
>
>    MeshFunction<bool> mesh_function0(mesh, mesh.topology().dim());
>    MeshFunction<bool> mesh_function1(mesh, mesh.topology().dim()-1);
>
> would it be possible to also add
>
>    MeshFunction<bool, Cell>  function0(mesh);
>    MeshFunction<bool, Facet> function1(mesh);

Yes, this would be possible. If we get the MeshEntity subclass as a
template argument MeshEntityClass we could do

  MeshEntityClass entity(mesh, 0);
  dim = entity.dim();

We could also add static functions to Vertex, Edge, Face, Facet, Cell
which do something like

  static uint dim(const Mesh& mesh) { return mesh.topology().dim() - 1; }

The above would be for facets. Then we don't need to create a specific
object. For Vertex, Edge and Face, the mesh argument would not be
needed, but we could overload two versions for those, one with and one
without the mesh argument so that it can be templated.

> The difficulty that I have with the former approach is that it's only
> clear what type of MeshEntity the MeshFunction corresponds to at
> construction (which takes place in the constructor of an object in my
> case). When I look at the header file where I declare the MeshFunctions,
> I'm sometimes scratching my head trying to remember which MeshEntity is
> involved.

I'm not sure I see the point here, but I wouldn't mind adding the
above functionaliy.

--
Anders

Attachment: signature.asc
Description: Digital signature


References