[Dune] dune-geometry r317 breaks test-alberta-generic
Christian Engwer
christian.engwer at uni-muenster.de
Wed Oct 17 17:35:01 CEST 2012
On Wed, Oct 17, 2012 at 01:15:08PM +0200, Martin Nolte wrote:
> Hi Christian,
>
> what about restricting the constructor to std::vector? I guess this
> is your primary use.
usually it will be std::vector, but sometimes it might be some other
container, e.g. a reservedvector.
> By the way: For me, it goes without saying that the constructor
> should be explicit. But you're right, this does not help.
I also think, we should make it explicit, but I was wondering how to
avoid such problems in the future. I think it is possible to use
SFINAE to make sure that an object with operator[] and some further
properties is passed. You can find a test program attached :-)
Christian
> I also learned a small lesson from this bug: Don't unnecessarily
> overload the copy constructor. And if you must overload it, always
> cast down to the base class.
>
> Best,
>
> Martin
>
> On 10/17/2012 11:58 AM, Christian Engwer wrote:
> >Hi Martin,
> >
> >>In any case, I think the constructor introduced in revision 316 is
> >>dangerous. What do the other developers think?
> >
> >I guess you are talking about the 317 and not 316. You are right. I
> >overlooked the potential problems of this constructor. The sad thing
> >is, it wouldn't even be sufficient to make it explicit. What do you
> >think, should be revert 317 and pass the dimension, although it is not
> >necessary?
> >
> >Christian
> >
> >>Best,
> >>
> >>Martin
> >>
> >>PS: Maybe this should be discussed on the FlySpray?
> >>
> >>On 10/17/2012 11:00 AM, Christoph Grüninger wrote:
> >>>Hi,
> >>>test-alberta-generic fails to compile for me with the nightly build
> >>>alberta-3.x-20120926-3742. It works if I revert
> >>>dune/geometry/genericgeometry/geometry.hh to revision 316. Find below the
> >>>error message test-alberta-generic with the current trunk.
> >>>
> >>>Is there a better solution than reverting the change in geometry.hh?
> >>>
> >>>Bye
> >>>Christoph
> >>>
> >>>
> >>>>/temp/gruenich/dune/complete/dune-geometry/dune/geometry/genericgeometry/geometry.hh:332:28:
> >>>>error: ‘const class Dune::AlbertaGridGeometry<2, 2, const
> >>>>Dune::AlbertaGrid<2, 2> >’ has no member named ‘size’
> >>>>In file included from ../../../dune/grid/common/grid.hh:1321:0,
> >>>> from ../../../dune/grid/albertagrid/agrid.hh:25,
> >>>> from ../../../dune/grid/albertagrid.hh:3,
> >>>> from test-alberta.cc:10:
> >>>>../../../dune/grid/common/geometry.hh: In instantiation of
> >>>>‘Dune::Geometry<mydim, cdim, GridImp, GeometryImp>::Geometry(const
> >>>>Implementation&) [with int mydim = 2; int cdim = 2; GridImp = const
> >>>>Dune::AlbertaGrid<2, 2>; GeometryImp = Dune::AlbertaGridGeometry;
> >>>>Dune::Geometry<mydim, cdim, GridImp, GeometryImp>::Implementation =
> >>>>Dune::AlbertaGridGeometry<2, 2, const Dune::AlbertaGrid<2, 2> >]’:
> >>>>../../../dune/grid/albertagrid/entity.cc:285:103: required from
> >>>>‘Dune::AlbertaGridEntity<0, dim, GridImp>::LocalGeometry
> >>>>Dune::AlbertaGridEntity<0, dim, GridImp>::geometryInFather() const [with int
> >>>>dim = 2; GridImp = const Dune::AlbertaGrid<2, 2>; Dune::AlbertaGridEntity<0,
> >>>>dim, GridImp>::LocalGeometry = Dune::Geometry<2, 2, const
> >>>>Dune::AlbertaGrid<2, 2>, Dune::AlbertaGridGeometry>]’
> >>>>../../../dune/grid/common/entity.hh:454:80: required from ‘Dune::Entity<0,
> >>>>dim, GridImp, EntityImp>::LocalGeometry Dune::Entity<0, dim, GridImp,
> >>>>EntityImp>::geometryInFather() const [with int dim = 2; GridImp = const
> >>>>Dune::AlbertaGrid<2, 2>; EntityImp = Dune::AlbertaGridEntity;
> >>>>Dune::Entity<0, dim, GridImp, EntityImp>::LocalGeometry = Dune::Geometry<2,
> >>>>2, const Dune::AlbertaGrid<2, 2>, Dune::AlbertaGridGeometry>]’
> >>>>checkgeometryinfather.cc:127:77: required from ‘void
> >>>>checkGeometryInFather(const GridType&) [with GridType = Dune::AlbertaGrid<2,
> >>>>2>]’
> >>>>test-alberta.cc:154:31: required from here
> >>>>../../../dune/grid/common/geometry.hh:295:7: warning: ‘void
> >>>>Dune::Geometry<mydim, cdim, GridImp,
> >>>>GeometryImp>::deprecationWarning(std::integral_constant<bool, true>) [with
> >>>>int mydim = 2; int cdim = 2; GridImp = const Dune::AlbertaGrid<2, 2>;
> >>>>GeometryImp = Dune::AlbertaGridGeometry]’ is deprecated (declared at
> >>>>../../../dune/grid/common/geometry.hh:303): "This Dune::Geometry is still a
> >>>>reference to its implementation." [-Wdeprecated-declarations]
> >>>>In file included from ../../../dune/grid/albertagrid/geometry.hh:4:0,
> >>>> from ../../../dune/grid/albertagrid/intersection.hh:8,
> >>>> from ../../../dune/grid/albertagrid/intersectioniterator.hh:6,
> >>>> from ../../../dune/grid/albertagrid/gridview.hh:14,
> >>>> from ../../../dune/grid/albertagrid/gridfamily.hh:20,
> >>>> from ../../../dune/grid/albertagrid/agrid.hh:42,
> >>>> from ../../../dune/grid/albertagrid.hh:3,
> >>>> from test-alberta.cc:10:
> >>>>/temp/gruenich/dune/complete/dune-geometry/dune/geometry/genericgeometry/geometry.hh:
> >>>>In instantiation of ‘Dune::GenericGeometry::BasicGeometry<mydim,
> >>>>Traits>::BasicGeometry(const CoordVector&) [with CoordVector =
> >>>>Dune::AlbertaGridGeometry<0, 2, const Dune::AlbertaGrid<2, 2> >; int mydim =
> >>>>0; Traits = Dune::AlbertaGridGeometryTraits<const Dune::AlbertaGrid<2, 2>,
> >>>>2>]’:
> >>>>../../../dune/grid/albertagrid/geometry.hh:193:20: required from
> >>>>‘Dune::AlbertaGridGeometry<mydim, cdim, GridImp>::AlbertaGridGeometry(const
> >>>>This&) [with int mydim = 0; int cdim = 2; GridImp = const
> >>>>Dune::AlbertaGrid<2, 2>; Dune::AlbertaGridGeometry<mydim, cdim,
> >>>>GridImp>::This = Dune::AlbertaGridGeometry<0, 2, const Dune::AlbertaGrid<2,
> >>>>2> >]’
> >>>>../../../dune/grid/albertagrid/geometry.hh:414:9: required from
> >>>>‘Dune::Entity<codim, dim, GridImp, EntityImp>::Geometry Dune::Entity<codim,
> >>>>dim, GridImp, EntityImp>::geometry() const [with int cd = 2; int dim = 2;
> >>>>GridImp = const Dune::AlbertaGrid<2, 2>; EntityImp =
> >>>>Dune::AlbertaGridEntity; Dune::Entity<codim, dim, GridImp,
> >>>>EntityImp>::Geometry = Dune::Geometry<0, 2, const Dune::AlbertaGrid<2, 2>,
> >>>>Dune::AlbertaGridGlobalGeometry>]’
> >>>>gridcheck.cc:202:110: required from ‘void zeroEntityConsistency(Grid&)
> >>>>[with Grid = Dune::AlbertaGrid<2, 2>]’
> >>>>gridcheck.cc:816:3: required from ‘void gridcheck(Grid&) [with Grid =
> >>>>Dune::AlbertaGrid<2, 2>]’
> >>>>test-alberta.cc:116:19: required from here
> >>>>/temp/gruenich/dune/complete/dune-geometry/dune/geometry/genericgeometry/geometry.hh:332:28:
> >>>>error: ‘const class Dune::AlbertaGridGeometry<0, 2, const
> >>>>Dune::AlbertaGrid<2, 2> >’ has no member named ‘size’
> >>>>/temp/gruenich/dune/complete/dune-geometry/dune/geometry/genericgeometry/geometry.hh:
> >>>>In instantiation of ‘Dune::GenericGeometry::BasicGeometry<mydim,
> >>>>Traits>::BasicGeometry(const CoordVector&) [with CoordVector =
> >>>>Dune::AlbertaGridGeometry<1, 2, const Dune::AlbertaGrid<2, 2> >; int mydim =
> >>>>1; Traits = Dune::AlbertaGridGeometryTraits<const Dune::AlbertaGrid<2, 2>,
> >>>>2>]’:
> >>>>../../../dune/grid/albertagrid/geometry.hh:193:20: required from
> >>>>‘Dune::AlbertaGridGeometry<mydim, cdim, GridImp>::AlbertaGridGeometry(const
> >>>>This&) [with int mydim = 1; int cdim = 2; GridImp = const
> >>>>Dune::AlbertaGrid<2, 2>; Dune::AlbertaGridGeometry<mydim, cdim,
> >>>>GridImp>::This = Dune::AlbertaGridGeometry<1, 2, const Dune::AlbertaGrid<2,
> >>>>2> >]’
> >>>>../../../dune/grid/albertagrid/geometry.hh:414:9: required from
> >>>>‘Dune::Intersection<GridImp, IntersectionImp>::Geometry
> >>>>Dune::Intersection<GridImp, IntersectionImp>::geometry() const [with GridImp
> >>>>= const Dune::AlbertaGrid<2, 2>; IntersectionImp =
> >>>>Dune::AlbertaGridLeafIntersection; Dune::Intersection<GridImp,
> >>>>IntersectionImp>::Geometry = Dune::Geometry<1, 2, const Dune::AlbertaGrid<2,
> >>>>2>, Dune::AlbertaGridGlobalGeometry>]’
> >>>>gridcheck.cc:374:9: required from ‘void assertNeighbor(Grid&) [with Grid =
> >>>>Dune::AlbertaGrid<2, 2>]’
> >>>>gridcheck.cc:818:3: required from ‘void gridcheck(Grid&) [with Grid =
> >>>>Dune::AlbertaGrid<2, 2>]’
> >>>>test-alberta.cc:116:19: required from here
> >>>>/temp/gruenich/dune/complete/dune-geometry/dune/geometry/genericgeometry/geometry.hh:332:28:
> >>>>error: ‘const class Dune::AlbertaGridGeometry<1, 2, const
> >>>>Dune::AlbertaGrid<2, 2> >’ has no member named ‘size’
> >>>
> >>>_______________________________________________
> >>>Dune mailing list
> >>>Dune at dune-project.org
> >>>http://lists.dune-project.org/mailman/listinfo/dune
> >>
> >>--
> >>Dr. Martin Nolte <nolte at mathematik.uni-freiburg.de>
> >>
> >>Universität Freiburg phone: +49-761-203-5630
> >>Abteilung für angewandte Mathematik fax: +49-761-203-5632
> >>Hermann-Herder-Straße 10
> >>79104 Freiburg, Germany
> >>
> >>_______________________________________________
> >>Dune mailing list
> >>Dune at dune-project.org
> >>http://lists.dune-project.org/mailman/listinfo/dune
> >
>
> --
> Dr. Martin Nolte <nolte at mathematik.uni-freiburg.de>
>
> Universität Freiburg phone: +49-761-203-5630
> Abteilung für angewandte Mathematik fax: +49-761-203-5632
> Hermann-Herder-Straße 10
> 79104 Freiburg, Germany
>
--
Prof. Dr. Christian Engwer
Institut für Numerische und Angewandte Mathematik
Fachbereich Mathematik und Informatik der Universität Münster
Einsteinstrasse 62
48149 Münster
E-Mail christian.engwer at uni-muenster.de
Telefon +49 251 83-35067
FAX +49 251 83-32729
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.cc
Type: text/x-c++src
Size: 2245 bytes
Desc: not available
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20121017/1cd5c623/attachment.cc>
More information about the Dune
mailing list