[Dune] [Fwd: [Dune-Commit] dune-grid r5356 - trunk/grid/onedgrid]

Oliver Sander sander at mi.fu-berlin.de
Wed Sep 9 18:13:31 CEST 2009


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


-- 
************************************************************************
* 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