[Dune-devel] [Dune-Commit] [Commit] dune-grid-howto - fcb942c: [cleanup] Refactor the YaspGrid specialization of UnitCube

Christian Engwer christian.engwer at uni-muenster.de
Wed Oct 9 13:53:32 CEST 2013


Hi Oli,

shouldn't we replace the whole UnitCube stuff by the structured grid
factory? Or at least, I think, we should rewrite teh UnitCube to use the
structured grid factory.

Christian

On Wed, Oct 09, 2013 at 12:19:43PM +0200, Oliver Sander wrote:
> New commit, appeared at Wed Oct  9 12:19:43 2013 +0200
> as part of the following ref changes:
> 
>     branch refs/heads/master    updated from d6ff025 -> fcb942c
> 
> Browsable version: http://cgit.dune-project.org/repositories/dune-grid-howto/commit/?id=fcb942cd6097750080bc6cf7d41fe6696ed3bbb6
> 
> ======================================================================
> 
> commit fcb942cd6097750080bc6cf7d41fe6696ed3bbb6
> Author: Oliver Sander <sander at igpm.rwth-aachen.de>
> Date:   Wed Oct 9 12:18:24 2013 +0200
> 
>     [cleanup] Refactor the YaspGrid specialization of UnitCube
>     
>     - Use array,bitset instead of FieldVector<int>, FieldVector<bool>
>     - Only store the grid as member variable
> 
>  unitcube_yaspgrid.hh | 23 +++++++++++++----------
>  1 file changed, 13 insertions(+), 10 deletions(-)
> 
> 
> 
> diff --git a/unitcube_yaspgrid.hh b/unitcube_yaspgrid.hh
> index e5d5bae..4ce3fb5 100644
> --- a/unitcube_yaspgrid.hh
> +++ b/unitcube_yaspgrid.hh
> @@ -14,24 +14,27 @@ class UnitCube<Dune::YaspGrid<dim>,size>
>  public:
>    typedef Dune::YaspGrid<dim> GridType;
>  
> -  UnitCube () : Len(1.0), s(size), p(false),
> +  UnitCube ()
> +  {
> +    Dune::FieldVector<double,dim> length(1.0);
> +    Dune::array<int,dim> elements;
> +    std::fill(elements.begin(), elements.end(), size);
> +    std::bitset<dim> periodicity(0);
> +
> +    grid_ = std::auto_ptr<Dune::YaspGrid<dim> >(new Dune::YaspGrid<dim>(
>  #if HAVE_MPI
> -                grid_(MPI_COMM_WORLD,Len,s,p,1)
> -#else
> -                grid_(Len,s,p,1)
> +                                                                        MPI_COMM_WORLD,
>  #endif
> -  {  }
> +                                                                        length,elements,periodicity,1));
> +  }
>  
>    Dune::YaspGrid<dim>& grid ()
>    {
> -    return grid_;
> +    return *grid_;
>    }
>  
>  private:
> -  Dune::FieldVector<double,dim> Len;
> -  Dune::FieldVector<int,dim> s;
> -  Dune::FieldVector<bool,dim> p;
> -  Dune::YaspGrid<dim> grid_;
> +  std::auto_ptr<Dune::YaspGrid<dim> > grid_;
>  };
>  
>  #endif
> 
> _______________________________________________
> Dune-Commit mailing list
> Dune-Commit at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-commit
> 

-- 
Prof. Dr. Christian Engwer 
Institut für Numerische und Angewandte Mathematik
Fachbereich Mathematik und Informatik der Universität Münster
Einsteinstrasse 62
48149 Münster

E-Mail	christian.engwer at uni-muenster.de
Telefon	+49 251 83-35067
FAX		+49 251 83-32729




More information about the Dune-devel mailing list