[Dune-devel] [Dune-Commit] dune-grid r8762 - trunk/dune/grid
Oliver Sander
sander at igpm.rwth-aachen.de
Sun Jan 20 13:13:10 CET 2013
Am 20.01.2013 13:05, schrieb Christian Engwer:
> Hi Oli,
>
>> Take the type from the method argument from the GridTraits class, rather than stating it directly.
>>
>> This gives the same type, but it makes the template argument deduction fail.
>> Therefore, change the template parameter of method 'entityPointer' from
>> 'int codim' to 'typename Seed'
> just as a comment... it might lead to stranger errors if the users
> accidentially passes a non-matching seed
This is true. But this is how the original implementors of EntitySeed
implemented it.
It was done differently in UGGrid and OneDGrid only because of my ignorance.
My current aim is not to discuss pros and cons of the current EntitySeed
implementation,
I just want consistency across all grids.
best,
Oliver
>
>
> Christian
>
>> Modified: trunk/dune/grid/onedgrid.hh
>> ===================================================================
>> --- trunk/dune/grid/onedgrid.hh 2013-01-19 15:09:31 UTC (rev 8761)
>> +++ trunk/dune/grid/onedgrid.hh 2013-01-19 15:55:38 UTC (rev 8762)
>> @@ -184,11 +184,12 @@
>> typename Traits::template Codim<codim>::template Partition<PiType>::LeafIterator leafend() const;
>>
>> /** \brief Create an EntityPointer from an EntitySeed */
>> - template<int codim>
>> - static typename Traits::template Codim<codim>::EntityPointer
>> - entityPointer(const OneDGridEntitySeed<codim, const OneDGrid>& seed)
>> + template<typename Seed>
>> + static typename Traits::template Codim<Seed::codimension>::EntityPointer
>> + entityPointer(const Seed& seed)
>> {
>> - return typename Traits::template Codim<codim>::EntityPointer(seed.target());
>> + enum {codim = Seed::codimension};
>> + return typename Traits::template Codim<codim>::EntityPointer(OneDGridEntityPointer<codim,const OneDGrid>(seed.target()));
>> }
>>
>>
>>
>> Modified: trunk/dune/grid/uggrid.hh
>> ===================================================================
>> --- trunk/dune/grid/uggrid.hh 2013-01-19 15:09:31 UTC (rev 8761)
>> +++ trunk/dune/grid/uggrid.hh 2013-01-19 15:55:38 UTC (rev 8762)
>> @@ -309,10 +309,11 @@
>> }
>>
>> /** \brief Create an EntityPointer from an EntitySeed */
>> - template<int codim>
>> - typename Traits::template Codim<codim>::EntityPointer
>> - entityPointer(const UGGridEntitySeed<codim, const UGGrid<dim> >& seed) const
>> + template<typename Seed>
>> + typename Traits::template Codim<Seed::codimension>::EntityPointer
>> + entityPointer(const Seed& seed) const
>> {
>> + enum {codim = Seed::codimension};
>> return typename Traits::template Codim<codim>::EntityPointer(UGGridEntityPointer<codim,const UGGrid<dim> >(seed.target(),this));
>> }
>>
>>
>>
>> _______________________________________________
>> Dune-Commit mailing list
>> Dune-Commit at dune-project.org
>> http://lists.dune-project.org/mailman/listinfo/dune-commit
>>
More information about the Dune-devel
mailing list