[Dune-devel] [Dune-Commit] [Commit] dune-grid - ba71203: Return to not using push_back as the same problem arises in intersections() where the correct level is unavailable

Oliver Sander sander at igpm.rwth-aachen.de
Wed Oct 23 13:35:35 CEST 2013


Hi Dominic,
out of curiosity, what does makelevel need the total number of levels for?
Since my cleanup patches went in it now knows the number of the level it is
creating.  Shouldn't that be enough?
Cheers,
Oliver

> 
>     Return to not using push_back as the same problem arises in intersections() where the correct level is unavailable
> 
>  dune/grid/yaspgrid.hh | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> 
> 
> diff --git a/dune/grid/yaspgrid.hh b/dune/grid/yaspgrid.hh
> index 8173cbe..f3c59a6 100644
> --- a/dune/grid/yaspgrid.hh
> +++ b/dune/grid/yaspgrid.hh
> @@ -406,7 +406,7 @@ namespace Dune {
>  
>            //check upper boundary
>            //globalSize may not be used here, as in some cases (push_back) the wrong level is taken
> -          if (o_overlap[i] + coords[i].size() - 1 < _coarseSize[i] * (1<<level))
> +          if (o_overlap[i] + coords[i].size() - 1 < globalSize<0>(i))
>              ovlp_up[i] = true;
>          }
>        }
> @@ -527,7 +527,7 @@ namespace Dune {
>      void intersections (const SubYGrid<dim,ctype>& sendgrid, const SubYGrid<dim,ctype>& recvgrid,
>                          std::deque<Intersection>& sendlist, std::deque<Intersection>& recvlist)
>      {
> -      iTupel size = this->template globalSize<0>();
> +      iTupel size = globalSize<0>();
>  
>        // the exchange buffers
>        std::vector<YGrid<dim,ctype> > send_recvgrid(_torus.neighbors());
> @@ -1255,7 +1255,9 @@ namespace Dune {
>            o_interior[i] = 2*cg.cell_interior.origin(i);
>  
>          // add level
> -        _levels.push_back(makelevel(_levels.size(),newcoords,_periodic,o_interior,overlap));
> +        // push_back() may not be used here, because makelevel relies on _levels to have specific size
> +        _levels.resize(_levels.size() + 1);
> +        _levels.back() = makelevel(_levels.size() - 1,newcoords,_periodic,o_interior,overlap);
>  
>          setsizes();
>          indexsets.push_back( make_shared<YaspIndexSet<const YaspGrid<dim>, false > >(*this,maxLevel()) );
> 
> _______________________________________________
> 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/20131023/980d7b24/attachment.sig>


More information about the Dune-devel mailing list