[Dune] [Dune-Commit] dune-grid r6138 - in trunk/dune/grid: . common

Christian Engwer christi at uni-hd.de
Fri Jan 15 14:34:07 CET 2010


> I have some question on this:
> - does the default implementation of Geometry< 0, ... > really use the 
> deprecated operator[] on the Geometry?

I'll check on this.

> - do the grid implementations really use the default implementations? I 
> thought we decided this was not necessary.

How should it work without?

Christian

> christi at dune-project.org wrote:
> > Author: christi
> > Date: 2010-01-15 12:50:34 +0100 (Fri, 15 Jan 2010)
> > New Revision: 6138
> > 
> > Modified:
> >    trunk/dune/grid/common/geometry.hh
> >    trunk/dune/grid/common/intersection.hh
> >    trunk/dune/grid/sgrid.hh
> >    trunk/dune/grid/yaspgrid.hh
> > Log:
> > * apply first implementaation of center and centerUnitOuterNormal
> > * credits go to Atgeirr
> > * sgrid and yaspgrid implement their own centerUnitOuterNormal
> >    all other grids should we working through the Default-Implementation
> > 
> > 
> > Modified: trunk/dune/grid/common/geometry.hh
> > ===================================================================
> > --- trunk/dune/grid/common/geometry.hh	2010-01-14 18:17:20 UTC (rev 6137)
> > +++ trunk/dune/grid/common/geometry.hh	2010-01-15 11:50:34 UTC (rev 6138)
> > @@ -216,6 +216,20 @@
> >      return realGeometry.volume();
> >    }
> >  
> > +  /** \brief return center of geometry 
> > +   *  Note that this method is still subject to a change of name and semantics.
> > +   *  At the moment, the center is not required to be the centroid of the
> > +   *  geometry, or even the centroid of its corners. This makes the current
> > +   *  default implementation acceptable, which maps the centroid of the
> > +   *  reference element to the geometry.
> > +   *  We may change the name (and semantic) of the method to centroid() if we
> > +   *  find reasonably efficient ways to implement it properly.
> > +   */
> > +  GlobalCoordinate center () const
> > +  {
> > +    return realGeometry.center();
> > +  }
> > +
> >    /** \brief Return the transposed of the Jacobian
> >     *
> >     *  The Jacobian is defined in the documentation of
> > @@ -315,6 +329,20 @@
> >      return refElement.volume() * asImp().integrationElement(localBaryCenter);
> >    }
> >    
> > +  //! return center of the geometry 
> > +  FieldVector<ctype, cdim> center () const 
> > +  {
> > +    GeometryType type = asImp().type();
> > +
> > +    // get corresponding reference element
> > +    const GenericReferenceElement< ctype , mydim > & refElement =
> > +      GenericReferenceElements< ctype, mydim >::general(type);
> > +
> > +    // center is (for now) the centroid of the reference element mapped to
> > +    // this geometry.
> > +    return asImp().global(refElement.position(0,0));
> > +  }
> > +  
> >  private:
> >    //!  Barton-Nackman trick 
> >    GeometryImp<mydim,cdim,GridImp>& asImp () {return static_cast<GeometryImp<mydim,cdim,GridImp>&>(*this);}
> > @@ -349,7 +377,16 @@
> >    }
> >   
> >    //! return volume of the geometry 
> > -  ctype volume () const { return 1.0; }
> > +  ctype volume () const
> > +  {
> > +    return 1.0;
> > +  }
> > +
> > +  //! return center of the geometry 
> > +  FieldVector<ctype, cdim> center () const 
> > +  {
> > +      return asImp()[0];
> > +  }
> >    
> >  private:
> >    //!  Barton-Nackman trick 
> > 
> > Modified: trunk/dune/grid/common/intersection.hh
> > ===================================================================
> > --- trunk/dune/grid/common/intersection.hh	2010-01-14 18:17:20 UTC (rev 6137)
> > +++ trunk/dune/grid/common/intersection.hh	2010-01-15 11:50:34 UTC (rev 6138)
> > @@ -436,6 +436,17 @@
> >        return this->real.unitOuterNormal(local);
> >      }
> >  
> > +  /*! @brief Return unit outer normal (length == 1)
> > +
> > +  The returned vector is the normal at the center() of the
> > +  intersection's geometry.
> > +  It is scaled to have unit length.
> > +  */
> > +  GlobalCoordinate centerUnitOuterNormal () const
> > +    {
> > +      return this->real.centerUnitOuterNormal();
> > +    }
> > +
> >    //===========================================================
> >    /** @name Implementor interface
> >     */
> > @@ -483,15 +494,17 @@
> >    enum { dimworld=GridImp::dimensionworld };
> >    typedef typename GridImp::ctype ct;
> >  public:
> > +    
> >    //! return unit outer normal, this should be dependent on
> >    //! local coordinates for higher order boundary
> >    //! the normal is scaled with the integration element of the intersection.
> >    FieldVector<ct, dimworld> integrationOuterNormal (const FieldVector<ct, dim-1>& local) const
> >      {
> > -        FieldVector<ct, dimworld> n = unitOuterNormal(local);
> > +        FieldVector<ct, dimworld> n = asImp().unitOuterNormal(local);
> >          n *= asImp().intersectionGlobal().integrationElement(local);
> >          return n;
> >      }
> > +    
> >    //! return unit outer normal
> >    FieldVector<ct, dimworld> unitOuterNormal (const FieldVector<ct, dim-1>& local) const
> >      {
> > @@ -499,6 +512,19 @@
> >        n /= n.two_norm();
> >        return n;
> >      }
> > +    
> > +  //! return unit outer normal at center of intersection geometry
> > +  FieldVector<ct, dimworld> centerUnitOuterNormal () const
> > +    {
> > +        // For now, we do this...
> > +        GeometryType type = asImp().geometry().type();
> > +        const GenericReferenceElement<ct, dim-1> & refElement =
> > +            GenericReferenceElements<ct, dim-1>::general(type);
> > +        return asImp().unitOuterNormal(refElement.position(0,0));
> > +        // But later, if we change the meaning of center(),
> > +        // we may have to change to this...
> > +        // return asImp().unitOuterNormal(asImp().local(asImp().center()));
> > +    }
> >  
> >  private:
> >    //!  Barton-Nackman trick
> > 
> > Modified: trunk/dune/grid/sgrid.hh
> > ===================================================================
> > --- trunk/dune/grid/sgrid.hh	2010-01-14 18:17:20 UTC (rev 6137)
> > +++ trunk/dune/grid/sgrid.hh	2010-01-15 11:50:34 UTC (rev 6138)
> > @@ -734,6 +734,11 @@
> >    //! return unit outer normal
> >    FieldVector<ctype, GridImp::dimensionworld> unitOuterNormal (const FieldVector<ctype, GridImp::dimension-1>& local) const
> >      {
> > +      return centerUnitOuterNormal();
> > +    }
> > +  //! return unit outer normal at center of intersection geometry
> > +  FieldVector<ctype, GridImp::dimensionworld> centerUnitOuterNormal () const
> > +    {
> >        // while we are at it, compute normal direction
> >        FieldVector<ctype, dimworld> normal(0.0);
> >        if (count%2)
> > 
> > Modified: trunk/dune/grid/yaspgrid.hh
> > ===================================================================
> > --- trunk/dune/grid/yaspgrid.hh	2010-01-14 18:17:20 UTC (rev 6137)
> > +++ trunk/dune/grid/yaspgrid.hh	2010-01-15 11:50:34 UTC (rev 6138)
> > @@ -1691,6 +1691,12 @@
> >          return _normal;
> >      }
> >  
> > +    //! return unit outer normal at center of intersection geometry
> > +    FieldVector<ctype, dimworld> centerUnitOuterNormal () const
> > +    {
> > +        return _normal;
> > +    }
> > +
> >      //! return unit outer normal, this should be dependent on
> >      //! local coordinates for higher order boundary
> >      //! the normal is scaled with the integration element of the intersection.
> > 
> > 
> > _______________________________________________
> > Dune-Commit mailing list
> > Dune-Commit at dune-project.org
> > http://lists.dune-project.org/mailman/listinfo/dune-commit
> 




More information about the Dune mailing list