[Dune-devel] The fate of UnitCube (was: Re: [Dune-Commit] [Commit] dune-grid-howto - fcb942c: [cleanup] Refactor the YaspGrid specialization of UnitCube

Oliver Sander sander at igpm.rwth-aachen.de
Wed Oct 9 13:58:38 CEST 2013


Be my guest.  I am no fan of this whole UnitCube mechanism at all.

My motivation for the patch was only to make UnitCube use the new YaspGrid
constructor.  The remaining cleanup was forced onto me by the differences
between array<int> and FieldVector<int>.

Best,
Oliver

Am 09.10.2013 13:53, schrieb Christian Engwer:
> 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
>>
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 551 bytes
Desc: OpenPGP digital signature
URL: <https://lists.dune-project.org/pipermail/dune-devel/attachments/20131009/1674c04e/attachment.sig>


More information about the Dune-devel mailing list