Naming of `DofMap::{vertex_to_dof_map,dof_map_to_vertex}` should be changed

Issue #111 resolved
Johan Hake created an issue

As pointed out in this thread the naming of DofMap::{vertex_to_dof_map,dof_map_to_vertex} is right to left, when it should be left to right.

The documentation of the two methods should also be improved.

Comments (14)

  1. Johan Hake reporter

    I suggest we just rename the methods and make a note on the list and in the ChangeLog. Users then need to update code that uses these mappings.

    Other more permanent fixes for assigning mesh based values to Function discussed in the thread above need its own issue/feature request.

  2. Jan Blechta

    There was also suggestion to create new dof2vertex_map and vertex2dof_map, keep original ones but issue a message with deprecation and remove in a future (say 1.3.0 or 1.4.0 release).

  3. Martin Sandve Alnæs

    But should these really be members in DofMap? I can think of a large amount of variations of "get collections of dofs with properties x,y,z" for different contexts and elements, maybe that should be in a collection of stand-alone functions instead.

  4. Prof Garth Wells

    I agree that these function should probably not be members of DofMap and be free functions instead. It will then also not contributed to the bloat of DofMap.

    Names of the form dof2vertex_map (with the numerall '2') are inconsistent with the function naming convection in DOLFIN.

  5. Johan Hake reporter

    Free functions sounds very attractive. As Martin says there is a number of useful free functions that could be added. Should we keep a deprecated version in DofMap? With a free function that is very easy.

    Where to put these then? Should we add a subdirectory called utils to collect misc such functions?

  6. Prof Garth Wells

    I would suggest still keeping the functions 'close to home'. Maybe in files dolfin/fem/fem_utils.h/.cpp.

    For the old functions, they could print either a deprecation message or throw an error. The problem with deprecation is that removing them later tends to be forgotten.

  7. Jan Blechta

    You can keep the issue open, convert it to task: remove deprecated DofMap::foo_to_bar_map at release quux.

  8. Jan Blechta
    • changed milestone to 1.4
    • changed version to dev
    • marked as minor

    There is missing corresponding update in ale/HarmonicSmoothing.cpp.

    Testing HarmonicSmoothing and ALE operations
    ------------------------------------------------
    Process 0: Number of global vertices: 121
    Process 0: Number of global cells: 200
    
    Testing HarmonicSmoothing::move(Mesh& mesh, const BoundaryMesh& new_boundary)
    Process 2: *** -------------------------------------------------------------------------
    *** Warning: dof_to_vertex_map has been deprecated in DOLFIN version 1.3.0.
    *** DofMap::dof_to_vertex_map has been replaced by the free function vertex_to_dof_map.
    *** -------------------------------------------------------------------------
    
    Process 0: *** -------------------------------------------------------------------------
    *** Warning: dof_to_vertex_map has been deprecated in DOLFIN version 1.3.0.
    *** DofMap::dof_to_vertex_map has been replaced by the free function vertex_to_dof_map.
    *** -------------------------------------------------------------------------
    
    Process 1: *** -------------------------------------------------------------------------
    *** Warning: dof_to_vertex_map has been deprecated in DOLFIN version 1.3.0.
    *** DofMap::dof_to_vertex_map has been replaced by the free function vertex_to_dof_map.
    *** -------------------------------------------------------------------------
    
  9. Johan Hake reporter

    @blechta isn't this an easy fix? couldn't we just change the name of the used method to the updated name?

    V->dofmap()->dof_to_vertex_map(mesh) --> vertex_to_dof_map(V)
    
  10. Log in to comment