[Dune] Problem with compiling grid.globalIdSet()

Christoph_Gersbacher gersbach at mathematik.uni-freiburg.de
Thu Feb 26 10:18:09 CET 2015


Hi Aleksejs,

the forward declaration you are missing can be found in line 360 of 
dune/grid/common/grid.hh:

    template< class GridImp, class IndexSetImp,
                      class IndexTypeImp = unsigned int,
                      class TypesImp = std::vector< GeometryType > >
    class IndexSet;

If you are not happy with the default values just explicitly state the 
optional third and fourth template parameters.

Regards,
Christoph


On 02/26/2015 08:48 AM, Aleksejs Fomins wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Could somebody please give me some suggestions with this bug? I am still stuck on it, so any advice would be appreciated
>
> Greetings,
> Aleksejs
>
> On 24/02/15 16:21, Aleksejs Fomins wrote:
>> Dear Christoph,
>>
>> Thank you for your suggestion, this indeed was the bug, I figured it
>> out more or less at the same time.
>>
>> Now this problem is fixed, but I have the same problem with
>> LeafIndexSet, but this time all of the const Grid are in place. (error
>> code below). What I do notice is that it finds the IndexType to be
>> "unsigned int" whereas in the derived derived class it is clearly "int".
>>
>> I am using the default Dune::GridTraits, and, as I see, it only
>> explicitly specifies 2 out of 4 template parameters when defining
>> Dune::IndexSet.
>>
>> I would be happy to know how does it determine the missing template
>> parameters, and why is it "unsigned int"?
>>
>> Best,
>> Aleksejs
>>
>>
>>
>> In file included from
>> /home/fomins/gitwork/hades-github-lspr-ag/dune-curvilineargrid/dune/curvilineargrid/test/test-curvgrid.cc:12:0:
>> /home/fomins/gitwork/hades-github-lspr-ag/dune-curvilineargrid/dune/curvilineargrid/curvilineargrid/grid.hh:
>> In instantiation of ‘const LeafIndexSet& Dune::CurvilinearGrid<dim,
>> dimworld, ct>::leafIndexSet() const [with int dim = 3; int dimworld =
>> 3; ct = double; Dune::CurvilinearGrid<dim, dimworld, ct>::LeafIndexSet
>> = Dune::IndexSet<const Dune::CurvilinearGrid<3, 3, double>,
>> Dune::CurvGrid::CurvIndexSet<const Dune::CurvilinearGrid<3, 3, double>
>>> , unsigned int, std::vector<Dune::GeometryType> >]’:
>> /home/fomins/gitwork/hades-github-lspr-ag/dune-grid/dune/grid/test/gridcheck.cc:151:68:
>>    required from ‘void zeroEntityConsistency(Grid&) [with Grid =
>> Dune::CurvilinearGrid<3, 3, double>]’
>> /home/fomins/gitwork/hades-github-lspr-ag/dune-grid/dune/grid/test/gridcheck.cc:929:26:
>>    required from ‘void gridcheck(Grid&) [with Grid =
>> Dune::CurvilinearGrid<3, 3, double>]’
>> /home/fomins/gitwork/hades-github-lspr-ag/dune-curvilineargrid/dune/curvilineargrid/test/test-curvgrid.cc:79:17:
>>    required from ‘void check_grid(Dune::CurvilinearGrid<cdim, cdim,
>> ctype>&) [with ctype = double; int cdim = 3]’
>> /home/fomins/gitwork/hades-github-lspr-ag/dune-curvilineargrid/dune/curvilineargrid/test/test-curvgrid.cc:109:25:
>>    required from here
>> /home/fomins/gitwork/hades-github-lspr-ag/dune-curvilineargrid/dune/curvilineargrid/curvilineargrid/grid.hh:333:57:
>> error: invalid initialization of reference of type ‘const
>> LeafIndexSet& {aka const Dune::IndexSet<const Dune::CurvilinearGrid<3,
>> 3, double>, Dune::CurvGrid::CurvIndexSet<const
>> Dune::CurvilinearGrid<3, 3, double> >, unsigned int,
>> std::vector<Dune::GeometryType> >&}’ from expression of type ‘const
>> IndexSetImpl {aka const Dune::CurvGrid::CurvIndexSet<const
>> Dune::CurvilinearGrid<3, 3, double> >}’
>>       const LeafIndexSet &leafIndexSet () const  { return leafIndexSet_; }
>>                                                           ^
>> In file included from
>> /home/fomins/gitwork/hades-github-lspr-ag/dune-grid/dune/grid/common/grid.hh:1408:0,
>>                   from
>> /home/fomins/gitwork/hades-github-lspr-ag/dune-curvilineargrid/dune/curvilineargrid/curvilineargrid/grid.hh:8,
>>                   from
>> /home/fomins/gitwork/hades-github-lspr-ag/dune-curvilineargrid/dune/curvilineargrid/test/test-curvgrid.cc:12:
>> /home/fomins/gitwork/hades-github-lspr-ag/dune-grid/dune/grid/common/indexidset.hh:
>> In instantiation of ‘const IndexSetImp& Dune::IndexSet<GridImp,
>> IndexSetImp, IndexTypeImp, TypesImp>::asImp() const [with GridImp =
>> const Dune::CurvilinearGrid<3, 3, double>; IndexSetImp =
>> Dune::CurvGrid::CurvIndexSet<const Dune::CurvilinearGrid<3, 3, double>
>>> ; IndexTypeImp = unsigned int; TypesImp =
>> std::vector<Dune::GeometryType>]’:
>> /home/fomins/gitwork/hades-github-lspr-ag/dune-grid/dune/grid/common/indexidset.hh:136:20:
>>    required from ‘Dune::IndexSet<GridImp, IndexSetImp, IndexTypeImp,
>> TypesImp>::IndexType Dune::IndexSet<GridImp, IndexSetImp,
>> IndexTypeImp, TypesImp>::index(const Entity&) const [with Entity =
>> Dune::Entity<0, 3, const Dune::CurvilinearGrid<3, 3, double>,
>> Dune::CurvGrid::CurvEntity>; GridImp = const Dune::CurvilinearGrid<3,
>> 3, double>; IndexSetImp = Dune::CurvGrid::CurvIndexSet<const
>> Dune::CurvilinearGrid<3, 3, double> >; IndexTypeImp = unsigned int;
>> TypesImp = std::vector<Dune::GeometryType>; Dune::IndexSet<GridImp,
>> IndexSetImp, IndexTypeImp, TypesImp>::IndexType = unsigned int]’
>> /home/fomins/gitwork/hades-github-lspr-ag/dune-grid/dune/grid/test/gridcheck.cc:625:3:
>>    required from ‘void iteratorEquals(Grid&) [with Grid =
>> Dune::CurvilinearGrid<3, 3, double>]’
>> /home/fomins/gitwork/hades-github-lspr-ag/dune-grid/dune/grid/test/gridcheck.cc:925:19:
>>    required from ‘void gridcheck(Grid&) [with Grid =
>> Dune::CurvilinearGrid<3, 3, double>]’
>> /home/fomins/gitwork/hades-github-lspr-ag/dune-curvilineargrid/dune/curvilineargrid/test/test-curvgrid.cc:79:17:
>>    required from ‘void check_grid(Dune::CurvilinearGrid<cdim, cdim,
>> ctype>&) [with ctype = double; int cdim = 3]’
>> /home/fomins/gitwork/hades-github-lspr-ag/dune-curvilineargrid/dune/curvilineargrid/test/test-curvgrid.cc:109:25:
>>    required from here
>> /home/fomins/gitwork/hades-github-lspr-ag/dune-grid/dune/grid/common/indexidset.hh:275:85:
>> error: invalid static_cast from type ‘const Dune::IndexSet<const
>> Dune::CurvilinearGrid<3, 3, double>,
>> Dune::CurvGrid::CurvIndexSet<const Dune::CurvilinearGrid<3, 3, double>
>>> , unsigned int, std::vector<Dune::GeometryType> >’ to type ‘const
>> Dune::CurvGrid::CurvIndexSet<const Dune::CurvilinearGrid<3, 3, double> >&’
>>       const IndexSetImp& asImp () const {return static_cast<const
>> IndexSetImp &>(*this);}
>>
>> On 24/02/15 15:28, Aleksejs Fomins wrote:
>>> Dear Dune,
>>> I am still having problems with compiling my curvgrid.globalIdSet()
>>> method
>>> When I look at YaspGrid, the method YaspGrid.globalIdSet() returns
>>> Dune::IdSet<...> but what is actually returned is
>>> YaspGlobalIdSet<const YaspGrid> : public Dune::IdSet<...>
>>> and that seems to work. Now, when I try to do something similar, I
>>> get the error
>>> error: invalid initialization of reference of type ‘const
>>> GlobalIdSet& {aka const Dune::IdSet<const Dune::CurvilinearGrid<3,
>>> 3, double>, Dune::CurvGrid::CurvIdSet<Dune::CurvilinearGrid<3, 3,
>>> double> >, Dune::CurvilinearGridStorage<double, 3>::IdType>&}’ from
>>> expression of type ‘const IdSetImpl {aka const
>>> Dune::CurvGrid::CurvIdSet<const Dune::CurvilinearGrid<3, 3, double>
>>>> }’
>>> const GlobalIdSet &globalIdSet () const  { return globalIdSet_; }
>>
>>> Any hints will be appreciated.
>>> Cheers, Aleksejs
>>> _______________________________________________ Dune mailing list
>>> Dune at dune-project.org
>>> http://lists.dune-project.org/mailman/listinfo/dune
>>
>> _______________________________________________
>> Dune mailing list
>> Dune at dune-project.org
>> http://lists.dune-project.org/mailman/listinfo/dune
>>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.12 (GNU/Linux)
>
> iQIcBAEBAgAGBQJU7s/VAAoJEDkNM7UOEwMZ/EcQALPsrx4QaEgIiok2oKKUW1z6
> X87QcUYQtwId5/MKdM11SYF6kHBk5VratARyeKFOtBetW8uKVfLCMa0wCF5abDOx
> 618lPGtQr4FdDmHAvLbgA0YNVhhYKmMB7B4Ky0yt3qG1Aow6efWj1MMEnuz/2acF
> Y/CNeNhUJ0wM3FQaGBkGJjeHqlCX8PZE7UkdrGg3g6tv+B31+4trKxASDdPFEahl
> QmIfDVsMic0D4jhRsXIS9NowKqtjEpcls+KKg4OluOtkjC85lWPItVL9PRbnLWvS
> F4fsX96lf+kXjZUE1NQCTEKJLFXsRbe3zO6UHlGZ4aubH1TMICr1A3sNX0jh3Z3v
> xriW0/+0n6HGldZgB02bYI8sBIzftNtzn02+JA0XLG3uopnBMKpu65QlDAPRyhnH
> FPRP9GBkgmkFU2e3Le839dbML/utSBmrBAKZfRE7W+pfx2D6O862dMGvnVDpPyej
> /EYTc+eYr6WZnpabkrL1DdrODtNfyePLCoxg3jqESCUrVvVqnQ/8cdlsQUeMm127
> P2MLfR8HzbK/X8ZOYO1FpIkakwWhRwr+up6gYCOMV6yweeQ49ClzLY30c35Pd11V
> 4Pas44Yaqmlcpuu9ZrkFWKkmCLh64nfh+2mW4gF3D9RUHGXx99qTcHgMiMgy/Z5l
> OXPbOItCeCuZ0kmeLqWW
> =L1Ov
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> Dune mailing list
> Dune at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune


-- 
Christoph Gersbacher<christoph.gersbacher at mathematik.uni-freiburg.de> 
<mailto:christoph.gersbacher at mathematik.uni-freiburg.de>
Abteilung für Angewandte Mathematik
Albert-Ludwigs-Universität Freiburg
Hermann-Herder-Str. 10
D-79104 Freiburg im Breisgau
Tel.: +49 (0)761 / 203 5645
Fax: +49 (0)761 / 203 5632
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20150226/91b880ca/attachment-0001.html>


More information about the Dune mailing list