[Dune-devel] [Dune-Commit] dune-localfunctions r1196 - in trunk/dune/localfunctions: refined refined/refinedp0 test

Carsten Gräser graeser at math.fu-berlin.de
Mon Feb 25 15:14:15 CET 2013


Am 25.02.2013 15:00, schrieb graeser at dune-project.org:
> Author: graeser
> Date: 2013-02-25 15:00:03 +0100 (Mon, 25 Feb 2013)
> New Revision: 1196
> 
> Modified:
>    trunk/dune/localfunctions/refined/refinedp0.hh
>    trunk/dune/localfunctions/refined/refinedp0/refinedp0localinterpolation.hh
>    trunk/dune/localfunctions/test/test-localfe.cc
> Log:
> Add RefindeP0LocalFiniteElement for dim=1 and test
I forgot to mention:

  This patch was provided by Guillaume Jouvet. Thanks

Carsten

> 
> 
> Modified: trunk/dune/localfunctions/refined/refinedp0/refinedp0localinterpolation.hh
> ===================================================================
> --- trunk/dune/localfunctions/refined/refinedp0/refinedp0localinterpolation.hh	2013-02-25 13:57:38 UTC (rev 1195)
> +++ trunk/dune/localfunctions/refined/refinedp0/refinedp0localinterpolation.hh	2013-02-25 14:00:03 UTC (rev 1196)
> @@ -12,6 +12,39 @@
>    {};
>  
>    template<class D, class R>
> +  class RefinedP0LocalInterpolation<RefinedP0LocalBasis<D,R,1> >
> +  {
> +    typedef RefinedP0LocalBasis<D,R,1> LB;
> +    typedef typename LB::Traits::DomainType DT;
> +
> +  public:
> +    RefinedP0LocalInterpolation() :
> +      interpolationPoints_(2)
> +    {
> +      // Interpolation is done by evaluating at the halved segments centers
> +      interpolationPoints_[0][0] = 1.0/4.0;
> +
> +      interpolationPoints_[1][0] = 3.0/4.0;
> +    }
> +
> +
> +    template<typename F, typename C>
> +    void interpolate (const F& f, std::vector<C>& out) const
> +    {
> +      typename LB::Traits::RangeType y;
> +      out.resize(interpolationPoints_.size());
> +      for (size_t i = 0; i < out.size(); ++i) 
> +      {
> +        f.evaluate(interpolationPoints_[i], y);
> +        out[i] = y;
> +      }
> +    }
> +
> +  private:
> +    std::vector<DT> interpolationPoints_;
> +  };
> +
> +  template<class D, class R>
>    class RefinedP0LocalInterpolation<RefinedP0LocalBasis<D,R,2> >
>    {
>      typedef RefinedP0LocalBasis<D,R,2> LB;
> 
> Modified: trunk/dune/localfunctions/refined/refinedp0.hh
> ===================================================================
> --- trunk/dune/localfunctions/refined/refinedp0.hh	2013-02-25 13:57:38 UTC (rev 1195)
> +++ trunk/dune/localfunctions/refined/refinedp0.hh	2013-02-25 14:00:03 UTC (rev 1196)
> @@ -34,6 +34,66 @@
>    /** \brief Local finite element that is piecewise P0 on a once uniformly refined reference geometry
>     */
>    template<class D, class R>
> +  class RefinedP0LocalFiniteElement<D,R,1>
> +  {
> +  public:
> +    /** \todo Please doc me !
> +     */
> +    typedef LocalFiniteElementTraits<
> +      RefinedP0LocalBasis<D,R,1>,
> +      RefinedP0LocalCoefficients<1>,
> +      RefinedP0LocalInterpolation<RefinedP0LocalBasis<D,R,1> > > Traits;
> +
> +    /** \todo Please doc me !
> +     */
> +    RefinedP0LocalFiniteElement ()
> +    {
> +      gt.makeLine();
> +    }
> +
> +    /** \todo Please doc me !
> +     */
> +    const typename Traits::LocalBasisType& localBasis () const
> +    {
> +      return basis_;
> +    }
> +
> +    /** \todo Please doc me !
> +     */
> +    const typename Traits::LocalCoefficientsType& localCoefficients () const
> +    {
> +      return coefficients_;
> +    }
> +
> +    /** \todo Please doc me !
> +     */
> +    const typename Traits::LocalInterpolationType& localInterpolation () const
> +    {
> +      return interpolation_;
> +    }
> +
> +    /** \todo Please doc me !
> +     */
> +    GeometryType type () const
> +    {
> +      return gt;
> +    }
> +
> +    RefinedP0LocalFiniteElement * clone () const
> +    {
> +      return new RefinedP0LocalFiniteElement(*this);
> +    }
> +
> +  private:
> +    RefinedP0LocalBasis<D,R,1> basis_;
> +    RefinedP0LocalCoefficients<1> coefficients_;
> +    RefinedP0LocalInterpolation<RefinedP0LocalBasis<D,R,1> > interpolation_;
> +    GeometryType gt;
> +  };
> +
> +  /** \brief Local finite element that is piecewise P0 on a once uniformly refined reference geometry
> +   */
> +  template<class D, class R>
>    class RefinedP0LocalFiniteElement<D,R,2>
>    {
>    public:
> 
> Modified: trunk/dune/localfunctions/test/test-localfe.cc
> ===================================================================
> --- trunk/dune/localfunctions/test/test-localfe.cc	2013-02-25 13:57:38 UTC (rev 1195)
> +++ trunk/dune/localfunctions/test/test-localfe.cc	2013-02-25 14:00:03 UTC (rev 1196)
> @@ -134,6 +134,9 @@
>      Dune::RefinedP1LocalFiniteElement<double,double,3> refp13dlfem;
>      success = testFE(refp13dlfem) and success;
>  
> +    Dune::RefinedP0LocalFiniteElement<double,double,1> refp01dlfem;
> +    success = testFE(refp01dlfem) and success;
> +
>      Dune::RefinedP0LocalFiniteElement<double,double,2> refp02dlfem;
>      success = testFE(refp02dlfem) and success;
>  
> 
> 
> _______________________________________________
> Dune-Commit mailing list
> Dune-Commit at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-commit
> 


-- 
----------------------------------------------------------------------
Dr. Carsten Gräser       | phone: +49-30 / 838-75349
Freie Universität Berlin | fax  : +49-30 / 838-54977
Institut für Mathematik  | email: graeser at math.fu-berlin.de
Arnimallee 6             |
14195 Berlin, Germany    | URL  : http://page.mi.fu-berlin.de/graeser
----------------------------------------------------------------------




More information about the Dune-devel mailing list