[Dune] [Dune-CVS] dune-grid r3135 - trunk/grid/utility (fwd)

Oliver Sander sander at mi.fu-berlin.de
Mon Oct 9 16:13:38 CEST 2006


Dear Dune!
Seeing this commit brings an issue to mind that I have been
wondering about for quite a while.  What is this TwistUtility
good for?  I thought it was needed to related quadrature
points on IntersectionNeighborLocal() with quad points on
IntersectionSelfLocal().  But AFAIK that has been solved
by the convention embodied in the test code at
checkintersectionit.cc, lines 124 and following.  So what
does the TwistUtility do?  Please could someone be so
kind and document it?

Thanks,
Oliver

************************************************************************
* Oliver Sander                ** email: sander at mi.fu-berlin.de        *
* Freie Universität Berlin     ** phone: + 49 (30) 838 75217           *
* Institut für Mathematik II   ** URL  : page.mi.fu-berlin.de/~sander  *
* Arnimallee 6                 ** -------------------------------------*
* 14195 Berlin, Germany        ** Member of MATHEON (www.matheon.de)   *
************************************************************************

---------- Forwarded message ----------
Date: Mon, 09 Oct 2006 16:04:04 +0200
From: Andreas Dedner <dedner at hal.iwr.uni-heidelberg.de>
To: dune-cvs at hal.iwr.uni-heidelberg.de
Subject: [Dune-CVS] dune-grid r3135 - trunk/grid/utility

Author: dedner
Date: 2006-10-09 16:04:03 +0200 (Mon, 09 Oct 2006)
New Revision: 3135

Modified:
    trunk/grid/utility/twistutility.hh
Log:
using ALUSimplexGrid...

Modified: trunk/grid/utility/twistutility.hh
===================================================================
--- trunk/grid/utility/twistutility.hh	2006-10-09 14:03:25 UTC (rev 3134)
+++ trunk/grid/utility/twistutility.hh	2006-10-09 14:04:03 UTC (rev 3135)
@@ -24,16 +24,19 @@
  #endif

  #include <dune/grid/sgrid.hh>
+#include <dune/grid/yaspgrid.hh>

  namespace Dune {

+  template <class GridImp>
+  class TwistUtility;
    // for structured grids, the twist is always zero
    // ? is this correct
-  template <class GridImp>
-  class TwistUtility
+  template <int dim,int dimw>
+  class TwistUtility<SGrid<dim,dimw> >
    {
    public:
-    typedef GridImp GridType;
+    typedef SGrid<dim,dimw> GridType;
    public:
      TwistUtility(const GridType& grid) :
        grid_(grid)
@@ -54,7 +57,31 @@
    private:
      const GridType& grid_;
    };
+  template <int dim,int dimw>
+  class TwistUtility<YaspGrid<dim,dimw> >
+  {
+  public:
+    typedef YaspGrid<dim,dimw> GridType;
+  public:
+    TwistUtility(const GridType& grid) :
+      grid_(grid)
+    {}

+    // default twist is zero
+    template <class IntersectionIterator>
+    int twistInSelf(const IntersectionIterator& it) const {
+      return 0;
+    }
+
+    // default twist is zero
+    template <class IntersectionIterator>
+    int twistInNeighbor(const IntersectionIterator& it) const {
+      return 0;
+    }
+
+  private:
+    const GridType& grid_;
+  };
  #if HAVE_ALBERTA_FOUND
    template <int dim, int dimW>
    class TwistUtility<AlbertaGrid<dim, dimW> >
@@ -90,13 +117,13 @@
  #endif

  #if HAVE_ALUGRID_FOUND
-  template <int dim, int dimW, ALU3dGridElementType elType>
-  class TwistUtility<ALU3dGrid<dim, dimW, elType>  >
+  template <>
+  class TwistUtility<ALUSimplexGrid<3,3>  >
    {
    public:
-    typedef ALU3dGrid<dim, dimW, elType> GridType;
-    typedef typename GridType::Traits::LeafIntersectionIterator LeafIntersectionIterator;
-    typedef typename GridType::Traits::LevelIntersectionIterator LevelIntersectionIterator;
+    typedef ALUSimplexGrid<3,3> GridType;
+    typedef GridType::Traits::LeafIntersectionIterator LeafIntersectionIterator;
+    typedef GridType::Traits::LevelIntersectionIterator LevelIntersectionIterator;
    public:
      TwistUtility(const GridType& grid) :
        grid_(grid)
@@ -125,6 +152,76 @@
    private:
      const GridType& grid_;
    };
+  template <>
+  class TwistUtility<ALUCubeGrid<3,3>  >
+  {
+  public:
+    typedef ALUCubeGrid<3,3> GridType;
+    typedef GridType::Traits::LeafIntersectionIterator LeafIntersectionIterator;
+    typedef GridType::Traits::LevelIntersectionIterator LevelIntersectionIterator;
+  public:
+    TwistUtility(const GridType& grid) :
+      grid_(grid)
+    {}
+
+    int twistInSelf(const LeafIntersectionIterator& it) const {
+      return grid_.getRealIntersectionIterator(it).twistInSelf();
+    }
+
+    int twistInSelf(const LevelIntersectionIterator& it) const {
+      return grid_.getRealIntersectionIterator(it).twistInSelf();
+    }
+
+    int twistInNeighbor(const LeafIntersectionIterator& it) const {
+      return grid_.getRealIntersectionIterator(it).twistInNeighbor();
+    }
+
+    int twistInNeighbor(const LevelIntersectionIterator& it) const {
+      return grid_.getRealIntersectionIterator(it).twistInNeighbor();
+    }
+
+  private:
+    TwistUtility(const TwistUtility&);
+    TwistUtility& operator=(const TwistUtility&);
+
+  private:
+    const GridType& grid_;
+  };
+  template <>
+  class TwistUtility<ALUSimplexGrid<2,2>  >
+  {
+  public:
+    typedef ALUSimplexGrid<2, 2> GridType;
+    typedef GridType::Traits::LeafIntersectionIterator LeafIntersectionIterator;
+    typedef GridType::Traits::LevelIntersectionIterator LevelIntersectionIterator;
+  public:
+    TwistUtility(const GridType& grid) :
+      grid_(grid)
+    {}
+
+    int twistInSelf(const LeafIntersectionIterator& it) const {
+      return 0;
+    }
+
+    int twistInSelf(const LevelIntersectionIterator& it) const {
+      return 0;
+    }
+
+    int twistInNeighbor(const LeafIntersectionIterator& it) const {
+      return 1;
+    }
+
+    int twistInNeighbor(const LevelIntersectionIterator& it) const {
+      return 1;
+    }
+
+  private:
+    TwistUtility(const TwistUtility&);
+    TwistUtility& operator=(const TwistUtility&);
+
+  private:
+    const GridType& grid_;
+  };
  #endif

  #undef HAVE_ALBERTA_FOUND


_______________________________________________
Dune-CVS mailing list
Dune-CVS at dune-project.org
http://www.dune-project.org/cgi-bin/mailman/listinfo/dune-cvs


More information about the Dune mailing list