← Back to team overview

dolfin team mailing list archive

Re: Namespace for CSG primitives

 

2012/11/11 Anders Logg <logg@xxxxxxxxx>

> On Sat, Nov 10, 2012 at 01:44:53AM +0100, Benjamin Kehlet wrote>
>  2012/11/6 Anders Logg <[1]logg@xxxxxxxxx>
> >
> >    On Mon, Nov 05, 2012 at 09:28:42PM +0100, Johan Hake wrote:
> >    > On 11/05/2012 09:47 AM, Garth N. Wells wrote:
> >    > > On Sun, Nov 4, 2012 at 6:50 PM, Anders Logg <[2]logg@xxxxxxxxx>
> >    wrote:
> >    > >> On Sun, Nov 04, 2012 at 05:26:53PM +0000, Garth N. Wells wrote:
> >    > >>
> >    > >>>> One option could be to rename mesh classes to UnitSquareMesh,
> >    > >>>> UnitCubeMesh, and keep deprecated (sub)classes UnitSquare,
> >    UnitCube
> >    > >>>> indefinitely to keep backwards compatibility.
> >    > >>>>
> >    > >>>
> >    > >>> No point in renaming if the deprecated names are to be kept
> >    indefinitely.
> >    > >>>
> >    > >>>> In summary, I would like to add the new classes to namespace
> >    dolfin
> >    > >>>> but I'm looking for opinions on how to best handle naming
> >    conflicts.
> >    > >>>>
> >    > >>>
> >    > >>> I'm always in favour of a consistent, meaningful interface over
> a
> >    > >>> sub-optimal interface for the purpose of backward compatibility.
> >    > >>
> >    > >> So what are our options?
> >    > >>
> >    > >> The actual name clashes are between Rectangle/Rectangle and
> >    Box/Box (+
> >    > >> maybe some more that I'm overlooking).
> >    > >>
> >    > >> We could suffix everything:
> >    > >>
> >    > >>   RectangleGeometry
> >    > >>   RectangleMesh
> >    > >>
> >    > >> or
> >    > >>
> >    > >>   RectangleShape
> >    > >>   RectangleMesh
> >    > >>
> >    > >> to keep it shorter.
> >    > >>
> >    > >> One could argue that the suffix is only nedded for the meshes,
> >    since a
> >    > >> Rectangle(Geometry) is really a rectangle, whereas the
> >    RectangleMesh
> >    > >> is not a rectangle; it's a mesh of a rectangle.
> >    > >>
> >    > >
> >    > > I would prefer the suffix only for the meshes, e.g.,
> >    > >
> >    > >    Rectangle
> >    > >    RectangleMesh
> >    >
> >    > +
> >
> >      ok. Sounds good to me. Decided then:
> >      - Rename mesh classes --> MeshFoo (RectangleMesh, UnitSquareMesh)
> >      - Put geometry classes in namespace dolfin as just Foo (Rectangle)
> >      - Make UnitSquare and UnitCube subclasses of UnitSquareMesh and
> >        UnitCubeMesh and add deprecation warnings to the constructors of
> >      the
> >        subclasses that they will be removed in the future
> >      Benjamin, please fix before merge.
> >
> >
> >    It turns out we have some actual name clashes. Box and Rectangle exist
> >    both as mesh and csg classes. The mesh classes could be renamed to
> >    BoxMesh and RectangleMesh, but then we can't keep deprecated versions
> >    of the old mesh classes.
>
> It's enough to keep the deprecation classes for UnitSquare and
> UnitCube. Those are mostly used in demos and tutorials.
>
> Rectangle is used in the book. But I think it is ok to break the
> compatibility in that case, but we should make a careful list of
> interface changes that break compatibility and announce that list when
> make the next release. We can also easily put up a new version of the
> book as a PDF with the changed syntax.
>
> I suggest filing a bug report targeted to DOLFIN 1.1 named something
> like "Interface changes" where we list all important changes to the
> interface. Then we can keep track of those when releasing 1.1.
>

Ok.

Benjamin


>
> --
> Anders
>

References