[Dune] [Fwd: [Dune-Commit] dune-grid r5356 - trunk/grid/onedgrid]
Oliver Sander
sander at mi.fu-berlin.de
Wed Sep 9 18:30:03 CEST 2009
I prefer if people talk first and then revert. You certainly would not
want me
to mess with you code when I don't like it.
The bug you report is do to some missing friend declaration in the preamble
of OneDGrid. They are
template <int codim_, class GridImp_>
friend class OneDGridEntityPointer;
template <int codim_, PartitionIteratorType pitype_, class GridImp_>
friend class OneDGridLevelIterator;
friend class OneDGridHierarchicIterator<const OneDGrid>;
Thanks for reapplying the patch,
Oliver
Instead you could have just asked me for the missing friend declarations.
Andreas Dedner schrieb:
> Hi Oliver,
>
> It did not compile for me and for other people here as well and the
> safest way to get it to work for everybody (and for all other users)
> was to revert it. I was just writting this mail to you with the
> error messages.
> Here they are:
>
> ../../dune/grid/common/grid.hh: In member function 'bool
> Dune::OneDGridEntityPointer<codim, GridImp>::equals(const
> Dune::OneDGridEntityPointer<codim, GridImp>&) const [with int codim = 0,
> GridImp = const Dune::OneDGrid]':
> ../../dune/grid/common/entitypointer.hh:269: instantiated from 'bool
> Dune::EntityPointer<GridImp, EntityPointerImp>::equals(const
> Dune::EntityPointer<GridImp, EntityPointerImp>&) const [with GridImp =
> const Dune::OneDGrid, IteratorImp = Dune::OneDGridEntityPointer<0, const
> Dune::OneDGrid>]'
> ../../dune/grid/common/entitypointer.hh:227: instantiated from 'bool
> Dune::EntityPointer<GridImp, EntityPointerImp>::operator!=(const
> Dune::EntityPointer<GridImp, typename
> Dune::EnableIfInterOperable<typename IteratorImp::EntityPointerImp,
> IteratorImp, typename IteratorImp::EntityPointerImp>::type>&) const
> [with GridImp = const Dune::OneDGrid, IteratorImp =
> Dune::OneDGridLeafIterator<0, All_Partition, const Dune::OneDGrid>]'
> onedgrid.cc:549: instantiated from here
> ../../dune/grid/common/grid.hh:1163: error: 'static typename
> Dune::GridDefaultImplementation<<anonymous>, <anonymous>,
> <template-parameter-1-3>, <template-parameter-1-4>
> >::ReturnImplementationType<T>::ImplementationType&
> Dune::GridDefaultImplementation<<anonymous>, <anonymous>,
> <template-parameter-1-3>, <template-parameter-1-4>
> >::getRealImplementation(InterfaceType&) [with InterfaceType =
> Dune::MakeableInterfaceObject<Dune::Entity<0, 1, const Dune::OneDGrid,
> Dune::OneDGridEntity> >, int dim = 1, int dimworld = 1, ct = double,
> GridFamily = Dune::OneDGridFamily<1, 1>]' is protected
> ../onedgrid/onedgridentitypointer.hh:34: error: within this context
> ../../dune/grid/common/grid.hh:1163: error: 'static typename
> Dune::GridDefaultImplementation<<anonymous>, <anonymous>,
> <template-parameter-1-3>, <template-parameter-1-4>
> >::ReturnImplementationType<T>::ImplementationType&
> Dune::GridDefaultImplementation<<anonymous>, <anonymous>,
> <template-parameter-1-3>, <template-parameter-1-4>
> >::getRealImplementation(InterfaceType&) [with InterfaceType =
> Dune::MakeableInterfaceObject<Dune::Entity<0, 1, const Dune::OneDGrid,
> Dune::OneDGridEntity> >, int dim = 1, int dimworld = 1, ct = double,
> GridFamily = Dune::OneDGridFamily<1, 1>]' is protected
> ../onedgrid/onedgridentitypointer.hh:34: error: within this context
> ../../dune/grid/common/grid.hh: In constructor
> 'Dune::OneDGridEntityPointer<codim,
> GridImp>::OneDGridEntityPointer(Dune::OneDEntityImp<(Dune::OneDGridEntityPointer<codim,
> GridImp>::dim - codim)>*) [with int codim = 0, GridImp = const
> Dune::OneDGrid]':
> ../onedgrid/onedgridleveliterator.hh:36: instantiated from
> 'Dune::OneDGridLevelIterator<codim, pitype,
> GridImp>::OneDGridLevelIterator(Dune::OneDEntityImp<(Dune::OneDGridLevelIterator<codim,
> pitype, GridImp>::dim - codim)>*) [with int codim = 0,
> Dune::PartitionIteratorType pitype = All_Partition, GridImp = const
> Dune::OneDGrid]'
> onedgrid.cc:140: instantiated from 'typename Dune::GridTraits<1, 1,
> Dune::OneDGrid, Dune::OneDGridGeometry, Dune::OneDGridEntity,
> Dune::OneDGridEntityPointer, Dune::OneDGridLevelIterator,
> Dune::OneDGridLeafIntersectionIterator,
> Dune::OneDGridLevelIntersectionIterator,
> Dune::OneDGridLeafIntersectionIterator,
> Dune::OneDGridLevelIntersectionIterator,
> Dune::OneDGridHierarchicIterator, Dune::OneDGridLeafIterator,
> Dune::OneDGridLevelIndexSet<const Dune::OneDGrid>,
> Dune::OneDGridLeafIndexSet<const Dune::OneDGrid>,
> Dune::OneDGridIdSet<const Dune::OneDGrid>, unsigned int,
> Dune::OneDGridIdSet<const Dune::OneDGrid>, unsigned int,
> Dune::CollectiveCommunication<Dune::OneDGrid>,
> Dune::DefaultLevelGridViewTraits,
> Dune::DefaultLeafGridViewTraits>::Codim<cd>::LevelIterator
> Dune::OneDGrid::lbegin(int) const [with int codim = 0]'
> onedgrid.cc:650: instantiated from here
> ../../dune/grid/common/grid.hh:1163: error: 'static typename
> Dune::GridDefaultImplementation<<anonymous>, <anonymous>,
> <template-parameter-1-3>, <template-parameter-1-4>
> >::ReturnImplementationType<T>::ImplementationType&
> Dune::GridDefaultImplementation<<anonymous>, <anonymous>,
> <template-parameter-1-3>, <template-parameter-1-4>
> >::getRealImplementation(InterfaceType&) [with InterfaceType =
> Dune::MakeableInterfaceObject<Dune::Entity<0, 1, const Dune::OneDGrid,
> Dune::OneDGridEntity> >, int dim = 1, int dimworld = 1, ct = double,
> GridFamily = Dune::OneDGridFamily<1, 1>]' is protected
> ../onedgrid/onedgridentitypointer.hh:61: error: within this context
> ../../dune/grid/common/grid.hh: In constructor
> 'Dune::OneDGridEntityPointer<codim,
> GridImp>::OneDGridEntityPointer(Dune::OneDEntityImp<(Dune::OneDGridEntityPointer<codim,
> GridImp>::dim - codim)>*) [with int codim = 1, GridImp = const
> Dune::OneDGrid]':
> ../onedgrid/onedgridleveliterator.hh:36: instantiated from
> 'Dune::OneDGridLevelIterator<codim, pitype,
> GridImp>::OneDGridLevelIterator(Dune::OneDEntityImp<(Dune::OneDGridLevelIterator<codim,
> pitype, GridImp>::dim - codim)>*) [with int codim = 1,
> Dune::PartitionIteratorType pitype = All_Partition, GridImp = const
> Dune::OneDGrid]'
> onedgrid.cc:140: instantiated from 'typename Dune::GridTraits<1, 1,
> Dune::OneDGrid, Dune::OneDGridGeometry, Dune::OneDGridEntity,
> Dune::OneDGridEntityPointer, Dune::OneDGridLevelIterator,
> Dune::OneDGridLeafIntersectionIterator,
> Dune::OneDGridLevelIntersectionIterator,
> Dune::OneDGridLeafIntersectionIterator,
> Dune::OneDGridLevelIntersectionIterator,
> Dune::OneDGridHierarchicIterator, Dune::OneDGridLeafIterator,
> Dune::OneDGridLevelIndexSet<const Dune::OneDGrid>,
> Dune::OneDGridLeafIndexSet<const Dune::OneDGrid>,
> Dune::OneDGridIdSet<const Dune::OneDGrid>, unsigned int,
> Dune::OneDGridIdSet<const Dune::OneDGrid>, unsigned int,
> Dune::CollectiveCommunication<Dune::OneDGrid>,
> Dune::DefaultLevelGridViewTraits,
> Dune::DefaultLeafGridViewTraits>::Codim<cd>::LevelIterator
> Dune::OneDGrid::lbegin(int) const [with int codim = 1]'
> onedgrid.cc:651: instantiated from here
> ../../dune/grid/common/grid.hh:1163: error: 'static typename
> Dune::GridDefaultImplementation<<anonymous>, <anonymous>,
> <template-parameter-1-3>, <template-parameter-1-4>
> >::ReturnImplementationType<T>::ImplementationType&
> Dune::GridDefaultImplementation<<anonymous>, <anonymous>,
> <template-parameter-1-3>, <template-parameter-1-4>
> >::getRealImplementation(InterfaceType&) [with InterfaceType =
> Dune::MakeableInterfaceObject<Dune::Entity<1, 1, const Dune::OneDGrid,
> Dune::OneDGridEntity> >, int dim = 1, int dimworld = 1, ct = double,
> GridFamily = Dune::OneDGridFamily<1, 1>]' is protected
> ../onedgrid/onedgridentitypointer.hh:61: error: within this context
>
> Best
> Andreas
>
> Oliver Sander wrote:
>
>> It certainly did compile for me.
>> Would you please contact me before tacitly reverting my patches?!
>>
>> Thank you,
>> Oliver
>>
>> -------- Original-Nachricht --------
>> Betreff: [Dune-Commit] dune-grid r5356 - trunk/grid/onedgrid
>> Datum: Wed, 09 Sep 2009 18:01:02 +0200
>> Von: dedner at dune-project.org
>> An: dune-commit at dune-project.org
>>
>>
>>
>> Author: dedner
>> Date: 2009-09-09 18:01:02 +0200 (Wed, 09 Sep 2009)
>> New Revision: 5356
>>
>> Modified:
>> trunk/grid/onedgrid/onedgridentity.hh
>> trunk/grid/onedgrid/onedgridentitypointer.hh
>> trunk/grid/onedgrid/onedgridhieriterator.hh
>> trunk/grid/onedgrid/onedgridleafiterator.hh
>> trunk/grid/onedgrid/onedgridleveliterator.hh
>> Log:
>> did not compile anymore
>>
>> Modified: trunk/grid/onedgrid/onedgridentity.hh
>> ===================================================================
>> --- trunk/grid/onedgrid/onedgridentity.hh 2009-09-09 15:25:07 UTC (rev 5355)
>> +++ trunk/grid/onedgrid/onedgridentity.hh 2009-09-09 16:01:02 UTC (rev 5356)
>> @@ -121,7 +121,24 @@
>> };
>>
>>
>> +template<int cd, int dim, class GridImp>
>> +class OneDEntityWrapper :
>> + public GridImp::template Codim<cd>::Entity
>> +{
>> +public:
>>
>> + OneDEntityWrapper() :
>> + GridImp::template Codim<cd>::Entity (OneDGridEntity<cd, dim, GridImp>())
>> + {}
>> +
>> + void setToTarget(OneDEntityImp<dim-cd>* target) {
>> + this->realEntity.setToTarget(target);
>> + }
>> +
>> + OneDEntityImp<dim-cd>* target() {return this->realEntity.target_;}
>> +};
>> +
>> +
>> //**********************************************************************
>> //
>> // --OneDGridEntity
>> @@ -383,8 +400,8 @@
>>
>> }
>>
>> - GridImp::getRealImplementation(it.virtualEntity_).setToTarget((it.elemStack.empty())
>> - ? OneDGridNullIteratorFactory<1>::null() : it.elemStack.top());
>> + it.virtualEntity_.setToTarget((it.elemStack.empty())
>> + ? OneDGridNullIteratorFactory<1>::null() : it.elemStack.top());
>>
>> return it;
>> }
>>
>> Modified: trunk/grid/onedgrid/onedgridentitypointer.hh
>> ===================================================================
>> --- trunk/grid/onedgrid/onedgridentitypointer.hh 2009-09-09 15:25:07 UTC (rev 5355)
>> +++ trunk/grid/onedgrid/onedgridentitypointer.hh 2009-09-09 16:01:02 UTC (rev 5356)
>> @@ -30,8 +30,7 @@
>>
>> //! equality
>> bool equals(const OneDGridEntityPointer<codim,GridImp>& other) const {
>> - return GridImp::getRealImplementation(other.virtualEntity_).target_
>> - == GridImp::getRealImplementation(virtualEntity_).target_;
>> + return other.virtualEntity_.target() == virtualEntity_.target();
>> }
>>
>> //! dereferencing
>> @@ -40,14 +39,13 @@
>> //! ask for level of entity
>> int level () const {return virtualEntity_.level();}
>>
>> - OneDGridEntityPointer()
>> - : virtualEntity_(OneDGridEntity<codim, dim, GridImp>())
>> - {}
>> + OneDGridEntityPointer() {}
>>
>> /** \brief Constructor from a given entity */
>> OneDGridEntityPointer(const OneDGridEntity<codim, dim, GridImp> & entity)
>> - : virtualEntity_(entity)
>> - {}
>> + {
>> + virtualEntity_.setToTarget(entity.target_);
>> + }
>>
>> //! empty method since internal entity is not a pointer
>> void compactify () {}
>> @@ -55,15 +53,13 @@
>> protected:
>>
>> /** \brief Constructor from a given iterator */
>> - OneDGridEntityPointer(OneDEntityImp<dim-codim>* it)
>> - : virtualEntity_(OneDGridEntity<codim, dim, GridImp>())
>> - {
>> - GridImp::getRealImplementation(virtualEntity_).setToTarget(it);
>> + OneDGridEntityPointer(OneDEntityImp<dim-codim>* it) {
>> + virtualEntity_.setToTarget(it);
>> };
>>
>> protected:
>>
>> - mutable MakeableInterfaceObject<Entity> virtualEntity_;
>> + mutable OneDEntityWrapper<codim,GridImp::dimension,GridImp> virtualEntity_;
>>
>> };
>>
>>
>> Modified: trunk/grid/onedgrid/onedgridhieriterator.hh
>> ===================================================================
>> --- trunk/grid/onedgrid/onedgridhieriterator.hh 2009-09-09 15:25:07 UTC (rev 5355)
>> +++ trunk/grid/onedgrid/onedgridhieriterator.hh 2009-09-09 16:01:02 UTC (rev 5356)
>> @@ -65,8 +65,8 @@
>>
>> }
>>
>> - GridImp::getRealImplementation(this->virtualEntity_).setToTarget((elemStack.empty())
>> - ? OneDGridNullIteratorFactory<1>::null() : elemStack.top());
>> + this->virtualEntity_.setToTarget((elemStack.empty())
>> + ? OneDGridNullIteratorFactory<1>::null() : elemStack.top());
>> }
>>
>> private:
>>
>> Modified: trunk/grid/onedgrid/onedgridleafiterator.hh
>> ===================================================================
>> --- trunk/grid/onedgrid/onedgridleafiterator.hh 2009-09-09 15:25:07 UTC (rev 5355)
>> +++ trunk/grid/onedgrid/onedgridleafiterator.hh 2009-09-09 16:01:02 UTC (rev 5356)
>> @@ -27,16 +27,16 @@
>> /** \todo Can a make the fullRefineLevel work somehow? */
>> const int fullRefineLevel = 0;
>>
>> - GridImp::getRealImplementation(this->virtualEntity_).setToTarget((OneDEntityImp<1-codim>*)Dune::get<1-codim>(grid_->entityImps_[fullRefineLevel]).begin());
>> + this->virtualEntity_.setToTarget((OneDEntityImp<1-codim>*)Dune::get<1-codim>(grid_->entityImps_[fullRefineLevel]).begin());
>>
>> - if (!GridImp::getRealImplementation(this->virtualEntity_).target_->isLeaf())
>> + if (!this->virtualEntity_.target()->isLeaf())
>> increment();
>> }
>>
>> //! Constructor
>> OneDGridLeafIterator()
>> {
>> - GridImp::getRealImplementation(this->virtualEntity_).setToTarget(OneDGridNullIteratorFactory<1-codim>::null());
>> + this->virtualEntity_.setToTarget(OneDGridNullIteratorFactory<1-codim>::null());
>> }
>>
>> //! prefix increment
>> @@ -44,8 +44,7 @@
>> // Increment until you find a leaf entity
>> do {
>> globalIncrement();
>> - } while (GridImp::getRealImplementation(this->virtualEntity_).target_
>> - && !GridImp::getRealImplementation(this->virtualEntity_).target_->isLeaf());
>> + } while (this->virtualEntity_.target() && !this->virtualEntity_.target()->isLeaf());
>> }
>>
>> private:
>> @@ -58,12 +57,12 @@
>> const int oldLevel = this->virtualEntity_.level();
>>
>> // Increment on this level
>> - GridImp::getRealImplementation(this->virtualEntity_).setToTarget(GridImp::getRealImplementation(this->virtualEntity_).target_->succ_);
>> + this->virtualEntity_.setToTarget(this->virtualEntity_.target()->succ_);
>>
>> // If beyond the end of this level set to first of next level
>> - if (!GridImp::getRealImplementation(this->virtualEntity_).target_ && oldLevel < grid_->maxLevel()) {
>> + if (!this->virtualEntity_.target() && oldLevel < grid_->maxLevel()) {
>>
>> - GridImp::getRealImplementation(this->virtualEntity_).setToTarget(const_cast<OneDEntityImp<dim-codim>*>(Dune::get<1-codim>(grid_->entityImps_[oldLevel+1]).begin()));
>> + this->virtualEntity_.setToTarget(const_cast<OneDEntityImp<dim-codim>*>(Dune::get<1-codim>(grid_->entityImps_[oldLevel+1]).begin()));
>>
>> }
>>
>>
>> Modified: trunk/grid/onedgrid/onedgridleveliterator.hh
>> ===================================================================
>> --- trunk/grid/onedgrid/onedgridleveliterator.hh 2009-09-09 15:25:07 UTC (rev 5355)
>> +++ trunk/grid/onedgrid/onedgridleveliterator.hh 2009-09-09 16:01:02 UTC (rev 5356)
>> @@ -41,7 +41,7 @@
>>
>> //! prefix increment
>> void increment() {
>> - GridImp::getRealImplementation(this->virtualEntity_).setToTarget(GridImp::getRealImplementation(this->virtualEntity_).target_->succ_);
>> + this->virtualEntity_.setToTarget(this->virtualEntity_.target()->succ_);
>> }
>> };
>>
>>
>>
>> _______________________________________________
>> Dune-Commit mailing list
>> Dune-Commit at dune-project.org
>> http://lists.dune-project.org/mailman/listinfo/dune-commit
>>
>>
>>
>
> _______________________________________________
> Dune mailing list
> Dune at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune
>
--
************************************************************************
* Oliver Sander ** email: sander at mi.fu-berlin.de *
* Freie Universität Berlin ** phone: + 49 (30) 838 75348 *
* Institut für Mathematik ** URL : page.mi.fu-berlin.de/~sander *
* Arnimallee 6 ** -------------------------------------*
* 14195 Berlin, Germany ** Member of MATHEON (www.matheon.de) *
************************************************************************
More information about the Dune
mailing list