From d2580dc9859d621f1dee2ac3a8c2c88ae3601c21 Mon Sep 17 00:00:00 2001
From: Oliver Sander <sander@dune-project.org>
Date: Fri, 12 Mar 2004 10:31:26 +0000
Subject: [PATCH] * Untermodule in Grid eingebaut * enums des grid
 ausspezifiert * Installationshinweise fuer ALbert und UG

[[Imported from SVN: r388]]
---
 doc/Doxyfile                    |  4 +-
 doc/dune-doxy.css               |  1 +
 grid/albertgrid.hh              | 18 ++++++-
 grid/common/grid.hh             | 84 ++++++++++++++++++---------------
 grid/sgrid.hh                   |  3 +-
 grid/simplegrid.hh              |  3 +-
 grid/uggrid.hh                  | 14 +++++-
 grid/uggrid/uggridentity.cc     | 26 ++++++++--
 grid/uggrid/ugintersectionit.cc | 28 +++++++++--
 grid/uggrid/undefAllMacros.pl   |  2 +-
 grid/yaspgrid/grids.hh          |  1 +
 11 files changed, 134 insertions(+), 50 deletions(-)

diff --git a/doc/Doxyfile b/doc/Doxyfile
index 926b9c9a0..9333f3eeb 100644
--- a/doc/Doxyfile
+++ b/doc/Doxyfile
@@ -232,7 +232,7 @@ HIDE_IN_BODY_DOCS      = NO
 # to NO (the default) then the documentation will be excluded. 
 # Set it to YES to include the internal documentation.
 
-INTERNAL_DOCS          = NO
+INTERNAL_DOCS          = YES
 
 # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
 # file names in lower-case letters. If set to YES upper-case letters are also 
@@ -622,7 +622,7 @@ TREEVIEW_WIDTH         = 250
 # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
 # generate Latex output.
 
-GENERATE_LATEX         = YES
+GENERATE_LATEX         = NO
 
 # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
 # If a relative path is entered the value of OUTPUT_DIRECTORY will be 
diff --git a/doc/dune-doxy.css b/doc/dune-doxy.css
index 2bbd89b6d..a662fb2ed 100644
--- a/doc/dune-doxy.css
+++ b/doc/dune-doxy.css
@@ -3,6 +3,7 @@
 body {
   padding: 0px;
   margin: 0px;
+  background-color: #ffffff;
 }
 
 div.header { 
diff --git a/grid/albertgrid.hh b/grid/albertgrid.hh
index 62d9e56a6..b713f10ee 100644
--- a/grid/albertgrid.hh
+++ b/grid/albertgrid.hh
@@ -65,10 +65,26 @@ namespace Albert
   {
     /** @defgroup AlbertGrid AlbertGrid
        @ingroup GridCommon
+
        This is one implementation of the grid interface providing 2d triangle
        and 3d tetrahedra grids by using the FE Box ALBERT ( ALBERT
        was written by Kunibert Siebert
-       and Alfred Schmidt).
+       and Alfred Schmidt)
+       (http://mathematik.uni-freiburg.de/IAM/Research/projectsdz/albert/).
+
+       Get a copy of the lib and albert.h.
+       Now you must take care to have the two directories
+       PATH_TO_ALBERT/lib and PATH_TO_ALBERT/include. Otherwise %Dune can't
+       find ALBERT.
+
+       Then you must tell %Dune where to find ALBERT, which
+       dimension to use and which dimension your world should have:
+
+       <tt> ./autogen.sh [OPTIONS] --with-albert=PATH_TO_ALBERT --with-problem-dim=DIM --with-world-dim=DIMWORLD
+       </tt>
+
+       Now you must use the AlbertGrid with DIM and DIMWORLD, otherwise
+       unpredictable results may occur.
 
        @{
      */
diff --git a/grid/common/grid.hh b/grid/common/grid.hh
index 83bc6c050..3f855a119 100644
--- a/grid/common/grid.hh
+++ b/grid/common/grid.hh
@@ -1,13 +1,14 @@
 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 // vi: set et ts=4 sw=2 sts=2:
-#ifndef __GRID_HH__
-#define __GRID_HH__
+#ifndef __DUNE_GRID_HH__
+#define __DUNE_GRID_HH__
 
 #include <dune/common/matvec.hh>
 
 namespace Dune {
 
-  /** @defgroup GridCommon Grid
+  /** @defgroup GridCommon Dune Grid
+
      The Dune Grid module defines a general interface to a hierarchical finite element mesh.
      The interface is independent of dimension and element type. Various implementations
      of this interface exits:
@@ -37,7 +38,7 @@ namespace Dune {
    */
 
   //************************************************************************
-  /*! \enum ElementType
+  /*!
       Enum that declares identifiers for different element types. This
       list can be extended in the future. Not all meshes need to implement
       all element types.
@@ -46,13 +47,21 @@ namespace Dune {
   enum ElementType {unknown,vertex,line, triangle, quadrilateral, tetrahedron, pyramid, prism, hexahedron,
                     iso_triangle, iso_quadrilateral};
 
+  /*! \internal
+     Used for grid I/O
+   */
   enum GridIdentifier { SGrid_Id, AlbertGrid_Id , SimpleGrid_Id, Ug_Grid_Id };
 
   enum IteratorType { Master, Interior, Border, Ghost, InteriorBorder, All };
 
-  enum FileFormatType { ascii , xdr , USPM , pgm };
-
-  enum BoundaryType { Neumann , Dirichlet };
+  /*!
+     Specify the format to store grid and vector data
+   */
+  enum FileFormatType { ascii ,   //!< store data in a human readable form
+                        xdr ,   //!< store data in SUN's library routines
+                                //!< for external data representation (xdr)
+                        USPM ,   //!< strange format ... ask Robert Kloefkorn
+                        pgm };   //!< store data in portable graymap file format (pgm)
 
   //************************************************************************
   // E L E M E N T
@@ -158,13 +167,14 @@ namespace Dune {
     //! can only be called for dim=dimworld!
     Mat<dim,dim>& Jacobian_inverse (const Vec<dim,ct>& local);
 
-    /*! Checking presence and format of all interface functions. With
+    /*! \internal
+       Checking presence and format of all interface functions. With
        this method all derived classes can check their correct definition.
      */
     void checkIF ();
 
   private:
-    //! Barton-Nackman trick
+    //! \internal Barton-Nackman trick
     ElementImp<dim,dimworld>& asImp () {return static_cast<ElementImp<dim,dimworld>&>(*this);}
   };
 
@@ -182,7 +192,7 @@ namespace Dune {
   protected:
 
   private:
-    //! Barton-Nackman trick
+    //! \internal Barton-Nackman trick
     ElementImp<dim,dimworld>& asImp () {return static_cast<ElementImp<dim,dimworld>&>(*this);}
   }; // end ElementDefault
      //************************************************************
@@ -216,13 +226,13 @@ namespace Dune {
     //! access to coordinates of corners. Index is the number of the corner
     Vec<dimworld,ct>& operator[] (int i);
 
-    /*! Checking presence and format of all interface functions. With
+    /*! \internal Checking presence and format of all interface functions. With
        this method all derived classes can check their correct definition.
      */
     void checkIF ();
 
   private:
-    //! Barton-Nackman trick
+    //! \internal Barton-Nackman trick
     ElementImp<0,dimworld>& asImp () {return static_cast<ElementImp<0,dimworld>&>(*this);}
   };
 
@@ -256,7 +266,7 @@ namespace Dune {
     //! define type used for coordinates in grid module
     typedef ct ctype;
   private:
-    //! Barton-Nackman trick
+    //! \internal Barton-Nackman trick
     ElementImp<0,dimworld>& asImp () {return static_cast<ElementImp<0,dimworld>&>(*this);}
   }; // end ElementDefault, dim = 0
      //****************************************************************************
@@ -289,7 +299,7 @@ namespace Dune {
     Vec<dimworld,ct>& outerPoint ();
 
   private:
-    //! Barton-Nackman trick
+    //! \internal Barton-Nackman trick
     BoundaryEntityImp<dim,dimworld> & asImp ()
     {return static_cast<BoundaryEntityImp<dim,dimworld>&>(*this);}
   };
@@ -310,7 +320,7 @@ namespace Dune {
   public:
 
   private:
-    //! Barton-Nackman trick
+    //! \internal Barton-Nackman trick
     BoundaryEntityImp<dim,dimworld> & asImp ()
     {return static_cast<BoundaryEntityImp<dim,dimworld>&>(*this);}
   };
@@ -410,13 +420,13 @@ namespace Dune {
     //! local number of codim 1 entity in neighbor where intersection is contained in
     int number_in_neighbor ();
 
-    /*! Checking presence and format of all interface functions. With
+    /*! \internal Checking presence and format of all interface functions. With
        this method all derived classes can check their correct definition.
      */
     void checkIF ();
 
   private:
-    //! Barton-Nackman trick
+    //! \internal Barton-Nackman trick
     IntersectionIteratorImp<dim,dimworld>& asImp ()
     {return static_cast<IntersectionIteratorImp<dim,dimworld>&>(*this);}
     const IntersectionIteratorImp<dim,dimworld>& asImp () const
@@ -457,7 +467,7 @@ namespace Dune {
     Vec<dim-1,ct> tmp_;
 
   private:
-    //! Barton-Nackman trick
+    //! \internal Barton-Nackman trick
     IntersectionIteratorImp<dim,dimworld>& asImp ()
     {return static_cast<IntersectionIteratorImp<dim,dimworld>&>(*this);}
     const IntersectionIteratorImp<dim,dimworld>& asImp () const
@@ -514,13 +524,13 @@ namespace Dune {
     //! arrow
     EntityImp<0,dim,dimworld>* operator->();
 
-    /*! Checking presence and format of all interface functions. With
+    /*! \internal Checking presence and format of all interface functions. With
        this method all derived classes can check their correct definition.
      */
     void checkIF ();
 
   private:
-    //! Barton-Nackman trick
+    //! \internal Barton-Nackman trick
     HierarchicIteratorImp<dim,dimworld>& asImp ()
     {return static_cast<HierarchicIteratorImp<dim,dimworld>&>(*this);}
     const HierarchicIteratorImp<dim,dimworld>& asImp () const
@@ -563,7 +573,7 @@ namespace Dune {
     typedef ct ctype;
 
   private:
-    //! Barton-Nackman trick
+    //! \internal Barton-Nackman trick
     HierarchicIteratorImp<dim,dimworld>& asImp ()
     {return static_cast<HierarchicIteratorImp<dim,dimworld>&>(*this);}
     const HierarchicIteratorImp<dim,dimworld>& asImp () const
@@ -621,13 +631,13 @@ namespace Dune {
     //! geometry of this entity
     ElementImp<dim-codim,dimworld>& geometry ();
 
-    /*! Checking presence and format of all interface functions. With
+    /*! \internal Checking presence and format of all interface functions. With
        this method all derived classes can check their correct definition.
      */
     void checkIF ();
 
   private:
-    //! Barton-Nackman trick
+    //! \internal Barton-Nackman trick
     EntityImp<codim,dim,dimworld>& asImp () {return static_cast<EntityImp<codim,dim,dimworld>&>(*this);}
   };
 
@@ -653,7 +663,7 @@ namespace Dune {
   public:
     // at this moment no default implementation
   private:
-    //! Barton-Nackman trick
+    //! \internal Barton-Nackman trick
     EntityImp<codim,dim,dimworld>& asImp () {return static_cast<EntityImp<codim,dim,dimworld>&>(*this);}
 
   }; // end EntityDefault
@@ -760,13 +770,13 @@ namespace Dune {
     //! Returns iterator to one past the last son
     HierarchicIteratorImp<dim,dimworld> hend (int maxlevel);
 
-    /*! Checking presence and format of all interface functions. With
+    /*! \internal Checking presence and format of all interface functions. With
        this method all derived classes can check their correct definition.
      */
     void checkIF ();
 
   private:
-    //! Barton-Nackman trick
+    //! \internal Barton-Nackman trick
     EntityImp<0,dim,dimworld>& asImp () {return static_cast<EntityImp<0,dim,dimworld>&>(*this);}
   };
 
@@ -820,7 +830,7 @@ namespace Dune {
     template <int cc> int subIndex ( int i );
 
   private:
-    //! Barton-Nackman trick
+    //! \internal Barton-Nackman trick
     EntityImp<0,dim,dimworld>& asImp () {return static_cast<EntityImp<0,dim,dimworld>&>(*this);}
   };
   // end EntityDefault
@@ -883,13 +893,13 @@ namespace Dune {
     //! local coordinates within father
     Vec<dim,ct>& local ();
 
-    /*! Checking presence and format of all interface functions. With
+    /*! \internal Checking presence and format of all interface functions. With
        this method all derived classes can check their correct definition.
      */
     void checkIF ();
 
   private:
-    //! Barton-Nackman trick
+    //! \internal Barton-Nackman trick
     EntityImp<dim,dim,dimworld>& asImp () {return static_cast<EntityImp<dim,dim,dimworld>&>(*this);}
   };
 
@@ -906,7 +916,7 @@ namespace Dune {
   public:
     // no default implementation at the moment
   private:
-    //! Barton-Nackman trick
+    //! \internal Barton-Nackman trick
     EntityImp<dim,dim,dimworld>& asImp () {return static_cast<EntityImp<dim,dim,dimworld>&>(*this);}
   };
 
@@ -969,13 +979,13 @@ namespace Dune {
     //! ask for level of entity
     int level ();
 
-    /*! Checking presence and format of all interface functions. With
+    /*! \internal Checking presence and format of all interface functions. With
        this method all derived classes can check their correct definition.
      */
     void checkIF ();
 
   private:
-    //! Barton-Nackman trick
+    //! \internal Barton-Nackman trick
     LevelIteratorImp<codim,dim,dimworld>& asImp ()
     {return static_cast<LevelIteratorImp<codim,dim,dimworld>&>(*this);}
     const LevelIteratorImp<codim,dim,dimworld>& asImp () const
@@ -999,7 +1009,7 @@ namespace Dune {
   public:
 
   private:
-    //! Barton-Nackman trick
+    //! \internal Barton-Nackman trick
     LevelIteratorImp<codim,dim,dimworld>& asImp () {
       return static_cast<LevelIteratorImp<codim,dim,dimworld>&>(*this);
     }
@@ -1089,15 +1099,15 @@ namespace Dune {
     template <FileFormatType ftype>
     bool readGrid ( const char * filename , ctype &time );
 
-    /*! Checking presence and format of all interface functions. With
+    /*! \internal Checking presence and format of all interface functions. With
        this method all derived classes can check their correct definition.
      */
     void checkIF ();
 
   private:
-    //! Barton-Nackman trick
+    //! \internal Barton-Nackman trick
     GridImp<dim,dimworld>& asImp () {return static_cast<GridImp<dim,dimworld>&>(*this);}
-    //! Barton-Nackman trick
+    //! \internal Barton-Nackman trick
     const GridImp<dim,dimworld>& asImp () const {return static_cast<const GridImp<dim,dimworld>&>(*this);}
   };
 
@@ -1164,7 +1174,7 @@ namespace Dune {
                 bool adaptive= false, int processor=0 );
 
   protected:
-    //! Barton-Nackman trick
+    //! \internal Barton-Nackman trick
     GridImp<dim,dimworld>& asImp () {return static_cast<GridImp<dim,dimworld>&>(*this);}
   };
 
diff --git a/grid/sgrid.hh b/grid/sgrid.hh
index 49dea6cb4..43c9355a9 100644
--- a/grid/sgrid.hh
+++ b/grid/sgrid.hh
@@ -15,7 +15,8 @@
 
 namespace Dune {
 
-  /** @defgroup SGrid Structured Grid Module
+  /** @defgroup SGrid Structured Grid
+      \ingroup GridCommon
 
           This module describes the pilot implementation of the Dune grid interface.
           It implements the grid interface for simple structured meshes.
diff --git a/grid/simplegrid.hh b/grid/simplegrid.hh
index 0caff1a07..1642393c0 100644
--- a/grid/simplegrid.hh
+++ b/grid/simplegrid.hh
@@ -11,7 +11,7 @@
 
 /*! \file simplegrid.hh
    This is the implementation of the grid interface for a structured grid
-   supporting only elements (codim=0) and vertices (codim=0).
+   supporting only elements (codim=0) and vertices (codim=dim).
    Most functions are defined through template specialization to get
    a maximum of performance.
  */
@@ -20,6 +20,7 @@ namespace Dune {
 
   /** @defgroup SimpleGrid SimpleGrid
       @ingroup GridCommon
+
           This module describes the pilot implementation of the Dune grid interface.
           It implements the grid interface for simple structured meshes.
 
diff --git a/grid/uggrid.hh b/grid/uggrid.hh
index 8c2dc8ebe..d6399c442 100644
--- a/grid/uggrid.hh
+++ b/grid/uggrid.hh
@@ -19,11 +19,23 @@
 
 namespace Dune
 {
-  /** @defgroup UGGrid UGGrid Module
+  /** @defgroup UGGrid UGGrid
+      \ingroup GridCommon
 
      This is the implementation of the grid interface
      using the UG grid management system.
 
+     To use this module you need UG (the tool from second floor -
+     http://cox.iwr.uni-heidelberg.de/~ug).
+
+     After compiling UG you must tell %Dune where to find UG, which
+     dimension to use and which dimension your world should have:
+     <tt> ./autogen.sh [OPTIONS] --with-ug=PATH_TO_UG --with-problem-dim=DIM --with-world-dim=DIMWORLD
+     </tt>
+
+     Now you must use the UGGrid with DIM and DIMWORLD, otherwise
+     unpredictable results may occur.
+
      @{
    */
 
diff --git a/grid/uggrid/uggridentity.cc b/grid/uggrid/uggridentity.cc
index 4e009ea29..a0b869574 100644
--- a/grid/uggrid/uggridentity.cc
+++ b/grid/uggrid/uggridentity.cc
@@ -97,6 +97,13 @@ index()
   return elNum_;
 }
 
+template<>
+inline int UGGridEntity < 0, 3 ,3 >::
+index()
+{
+  return ((UG3d::element*)target_)->ge.id;
+}
+
 template< int codim, int dim, int dimworld>
 inline UGGridElement<dim-codim,dimworld>&
 UGGridEntity < codim, dim ,dimworld >::
@@ -398,7 +405,21 @@ UGGridEntity < codim, dim ,dimworld >::ibegin()
   UGGridIntersectionIterator<dim,dimworld> it;
 
   if (codim==0) {
-    it.setToTarget((UG3d::element*)target_, 0);
+    int i;
+#define TAG(p) ReadCW(p, UG3d::TAG_CE)
+#define NBELEM(p,i) ((UG3d::ELEMENT *) (p)->ge.refs[UG3d::nb_offset[TAG(p)]+(i)])
+#define SIDES_OF_ELEM(p) (UG3d::element_descriptors[TAG(p)]->sides_of_elem)
+    for (i=0; i<SIDES_OF_ELEM((UG3d::element*)target_); i++) {
+      if (NBELEM(((UG3d::element*)target_), i) != NULL)
+        break;
+    }
+    it.setToTarget((UG3d::element*)target_, i);
+    //         printf("element has %d neighbors:\n", SIDES_OF_ELEM(((UG3d::element*)target_)));
+    //         for (i=0; i<4; i++)
+    //             printf("Neighbor %d:  %d\n", i, NBELEM(((UG3d::element*)target_), i));
+#undef TAG
+#undef NBELEM
+#undef SIDES_OF_ELEM
   } else
     printf("UGGridEntity <%d, %d, %d>::ibegin() not implemented\n", codim, dim, dimworld);
 
@@ -413,8 +434,7 @@ UGGridEntity < codim, dim ,dimworld >::iend()
   UGGridIntersectionIterator<dim,dimworld> it;
 
   if (codim==0) {
-    //printf("This is ibegin\n");
-    //printf("This is ib2egin\n");
+    it.setToTarget(NULL, -1);
   } else
     printf("UGGridEntity <%d, %d, %d>::iend() not implemented\n", codim, dim, dimworld);
 
diff --git a/grid/uggrid/ugintersectionit.cc b/grid/uggrid/ugintersectionit.cc
index 61f94a812..40e76c093 100644
--- a/grid/uggrid/ugintersectionit.cc
+++ b/grid/uggrid/ugintersectionit.cc
@@ -30,8 +30,10 @@ template< int dim, int dimworld>
 inline void UGGridIntersectionIterator<dim,dimworld>::
 setToTarget(UG3d::element* center, int nb)
 {
+  //printf("entering II::setToTarget %d %d\n", center, nb);
   center_ = center;
   neighborCount_ = nb;
+  virtualEntity_.setToTarget(target());
 }
 
 template< int dim, int dimworld>
@@ -45,7 +47,7 @@ template< int dim, int dimworld>
 inline bool UGGridIntersectionIterator<dim,dimworld>::
 operator !=(const UGGridIntersectionIterator& I) const
 {
-  return (target() != I.target());
+  return target()!=I.target();
 }
 
 template<int dim, int dimworld>
@@ -55,14 +57,34 @@ UGGridIntersectionIterator< dim,dimworld >::operator ->()
   return &virtualEntity_;
 }
 
+template<int dim, int dimworld>
+inline UGGridEntity< 0,dim,dimworld >&
+UGGridIntersectionIterator< dim,dimworld >::operator *()
+{
+  return virtualEntity_;
+}
+
 template<>
 inline UGGridIntersectionIterator < 3,3 >&
 UGGridIntersectionIterator < 3,3 >::operator++()
 {
+  //printf("This is II::operator++\n");
   if (!target())
     return (*this);
 
-  neighborCount_++;
-  virtualEntity_.setToTarget(target());
+  int i;
+#define TAG(p) ReadCW(p, UG3d::TAG_CE)
+#define NBELEM(p,i) ((UG3d::ELEMENT *) (p)->ge.refs[UG3d::nb_offset[TAG(p)]+(i)])
+#define SIDES_OF_ELEM(p) (UG3d::element_descriptors[TAG(p)]->sides_of_elem)
+  for (i=neighborCount_+1; i<SIDES_OF_ELEM(center_); i++) {
+    if (NBELEM(center_, i) != NULL)
+      break;
+  }
+#undef TAG
+#undef NBELEM
+#undef SIDES_OF_ELEM
+  setToTarget(center_, i);
+
+  //virtualEntity_.setToTarget(target());
   return (*this);
 }
diff --git a/grid/uggrid/undefAllMacros.pl b/grid/uggrid/undefAllMacros.pl
index cb0c15ae3..7e61b6ac8 100755
--- a/grid/uggrid/undefAllMacros.pl
+++ b/grid/uggrid/undefAllMacros.pl
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 
 # TODO: Detect location of UG from the DUNE build system
-$UGROOT = "../../../UG-4.0/UG/ug";
+$UGROOT = "../../../UG/ug";
 
 # Counts the total number of #undefs emitted
 $counter = 0;
diff --git a/grid/yaspgrid/grids.hh b/grid/yaspgrid/grids.hh
index 7cc4a5be7..d143fb263 100644
--- a/grid/yaspgrid/grids.hh
+++ b/grid/yaspgrid/grids.hh
@@ -21,6 +21,7 @@
 namespace Dune {
 
   /** @defgroup yaspgrid Yet Another Structured Parallel Grid
+      \ingroup GridCommon
 
      This is the basis of a parallel implementation of the dune grid interface
      supporting codim 0 and dim.
-- 
GitLab