From fe064b1860ee61c8e43a1fab6c2ad72025ae2157 Mon Sep 17 00:00:00 2001
From: Oliver Sander <sander@dune-project.org>
Date: Thu, 6 Apr 2006 13:00:49 +0000
Subject: [PATCH] The method getChildrenOfSubface() now returns a std::vector
 of EntityPointers instead of a Dune::Array of UGGridEntityPointers

[[Imported from SVN: r4484]]
---
 grid/uggrid.hh        |  4 ++--
 grid/uggrid/uggrid.cc | 16 ++++++++++------
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/grid/uggrid.hh b/grid/uggrid.hh
index 0d8c8778b..e68d2c045 100644
--- a/grid/uggrid.hh
+++ b/grid/uggrid.hh
@@ -450,8 +450,8 @@ namespace Dune {
     void getChildrenOfSubface(typename Traits::template Codim<0>::EntityPointer & e,
                               int elementSide,
                               int maxl,
-                              Array<typename Dune::UGGridEntityPointer<0,UGGrid> >& childElements,
-                              Array<unsigned char>& childElementSides) const;
+                              std::vector<typename Traits::template Codim<0>::EntityPointer>& childElements,
+                              std::vector<unsigned char>& childElementSides) const;
 
     /** \brief The different forms of grid refinement that UG supports */
     enum RefinementType {
diff --git a/grid/uggrid/uggrid.cc b/grid/uggrid/uggrid.cc
index d6b18d160..dafca66eb 100644
--- a/grid/uggrid/uggrid.cc
+++ b/grid/uggrid/uggrid.cc
@@ -562,8 +562,8 @@ template <int dim, int dimworld>
 void Dune::UGGrid<dim,dimworld>::getChildrenOfSubface(typename Traits::template Codim<0>::EntityPointer & e,
                                                       int elementSide,
                                                       int maxl,
-                                                      Array<typename Dune::UGGridEntityPointer<0, UGGrid> >& childElements,
-                                                      Array<unsigned char>& childElementSides) const
+                                                      std::vector<typename Traits::template Codim<0>::EntityPointer>& childElements,
+                                                      std::vector<unsigned char>& childElementSides) const
 {
 
   typedef typename TargetType<0,dim>::T ElementType;
@@ -574,7 +574,8 @@ void Dune::UGGrid<dim,dimworld>::getChildrenOfSubface(typename Traits::template
   // The starting level
   int level = e->level();
 
-  const int MAX_SONS = 30;    // copied from UG
+  /** \todo This is a copy from within UG.  It should be used directly. */
+  const int MAX_SONS = 30;
 
   // //////////////////////////////////////////////////////////////////////
   //   Change the input face number from Dune numbering to UG numbering
@@ -643,20 +644,23 @@ void Dune::UGGrid<dim,dimworld>::getChildrenOfSubface(typename Traits::template
   // //////////////////////////////
   //   Extract result from stack
   // //////////////////////////////
-  childElements.resize(list.size());
+
+  /** \todo Initialized with a dummy value because EntityPointer isn't default constructible */
+  childElements.resize(list.size(), lbegin<0>(0));
   childElementSides.resize(list.size());
 
   int i=0;
   for (f = list.begin(); f!=list.end(); ++f, ++i) {
 
     // Set element
-    childElements[i].setToTarget(Element<0>::get(*f), Element<2>::get(*f));
+    //childElements[i].setToTarget(Element<0>::get(*f), Element<2>::get(*f));
+    this->getRealImplementation(childElements[i]).setToTarget(Element<0>::get(*f), Element<2>::get(*f));
 
     int side = Element<1>::get(*f);
 
     // Dune numbers the faces of several elements differently than UG.
     // The following switch does the transformation
-    side = UGGridRenumberer<dim>::facesUGtoDUNE(side, childElements[i].dereference().geometry().type());
+    side = UGGridRenumberer<dim>::facesUGtoDUNE(side, childElements[i]->geometry().type());
     childElementSides[i] = side;
 
   }
-- 
GitLab