[Dune] dune-geometry r317 breaks test-alberta-generic

Martin Nolte nolte at mathematik.uni-freiburg.de
Wed Oct 17 11:46:28 CEST 2012


Hi Christoph,

the bug should be fixed in revision 8542.

The source of all evil is a template constructor with exactly one argument:

template< class CoordVector >
class BasicGeometry ( const CoordVector & );

If I implement the copy constructor for a type Foo derived from BasicGeometry 
as follows, it will call the abovementioned constructor:

struct Foo
: public BasicGeometry< ... >
{
   Foo ( const Foo &other )
   : BasicGeometry< ... >( other )
   {}
};

The correct version looks as follows:

struct Foo
: public BasicGeometry< ... >
{
   Foo ( const Foo &other )
   : BasicGeometry< ... >( static_cast< const BasicGeometry< ... > & >( other ) )
   {}
};

I resolved the trouble by simply removing the corresponding copy constructor 
in AlbertaGrid.

In any case, I think the constructor introduced in revision 316 is dangerous. 
What do the other developers think?

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




More information about the Dune mailing list