[Dune-devel] [Dune-Commit] [Commit] dune-grid - c3fa28f: [YaspGrid] Help GCC 4.5 by disambiguating bitset constructor calls

Markus Blatt markus at dr-blatt.de
Mon Jul 21 10:32:54 CEST 2014


Hi,

IMHO te code after this  change is rather unintuitive. Personally, I
would prefer using the default constructor, which naturally
initializes non-POD types with zero. I think this worked quite well on
older compilers for std::bitset (at least the last time that I checked
it. 

Is there maybe another special reason to use std::bitset<dim> ovlp_up(0ULL)?

Markus

On Thu, Jul 17, 2014 at 05:45:52PM +0200, Steffen Müthing wrote:
> New commit, appeared at Thu Jul 17 17:45:52 2014 +0200
> as part of the following ref changes:
> 
>     branch refs/heads/feature/fs1042-proposal-nolte    updated from 603daa6 -> c3fa28f
> 
> Browsable version: http://cgit.dune-project.org/repositories/dune-grid/commit/?id=c3fa28f53c79c05baa8c369ad4b4aa6369e5e41f
> 
> ======================================================================
> 
> commit c3fa28f53c79c05baa8c369ad4b4aa6369e5e41f
> Author: Steffen Müthing <muething at dune-project.org>
> Date:   Thu Jul 17 17:44:08 2014 +0200
> 
>     [YaspGrid] Help GCC 4.5 by disambiguating bitset constructor calls
>     
>     GCC 4.5's standard library is broken and fails when calling the bitset
>     constructor with an int. Fix by switching to an unsigned long long.
> 
>  dune/grid/yaspgrid.hh       | 10 +++++-----
>  dune/grid/yaspgrid/ygrid.hh |  2 +-
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> 
> 
> diff --git a/dune/grid/yaspgrid.hh b/dune/grid/yaspgrid.hh
> index ba47750..f44ab0a 100644
> --- a/dune/grid/yaspgrid.hh
> +++ b/dune/grid/yaspgrid.hh
> @@ -334,8 +334,8 @@ namespace Dune {
>        r.set();
>  
>        // determine origin of the grid with overlap and store whether an overlap area exists in direction i.
> -      std::bitset<dim> ovlp_low(0);
> -      std::bitset<dim> ovlp_up(0);
> +      std::bitset<dim> ovlp_low(0ULL);
> +      std::bitset<dim> ovlp_up(0ULL);
>  
>        iTupel o_overlap;
>        iTupel s_overlap;
> @@ -849,7 +849,7 @@ namespace Dune {
>          leafIndexSet_(*this),
>          keep_ovlp(true), adaptRefCount(0), adaptActive(false)
>      {
> -      EquidistantSetup(L,elements,std::bitset<dim>(0),0,defaultLoadbalancer());
> +      EquidistantSetup(L,elements,std::bitset<dim>(0ULL),0,defaultLoadbalancer());
>        init();
>      }
>  
> @@ -875,7 +875,7 @@ namespace Dune {
>      {
>        if (!checkIfMonotonous(coords))
>          DUNE_THROW(Dune::GridError,"Setup of a tensorproduct grid requires monotonous sequences of coordinates.");
> -      TensorProductSetup(coords, std::bitset<dim>(0),0,defaultLoadbalancer());
> +      TensorProductSetup(coords, std::bitset<dim>(0ULL),0,defaultLoadbalancer());
>        init();
>      }
>  
> @@ -978,7 +978,7 @@ namespace Dune {
>          // access to coarser grid level
>          YGridLevel& cg = _levels[maxLevel()];
>  
> -        std::bitset<dim> ovlp_low(0), ovlp_up(0);
> +        std::bitset<dim> ovlp_low(0ULL), ovlp_up(0ULL);
>          for (int i=0; i<dim; i++)
>          {
>            if (cg.cell_overlap.origin(i) > 0)
> diff --git a/dune/grid/yaspgrid/ygrid.hh b/dune/grid/yaspgrid/ygrid.hh
> index 50e44aa..0998d3d 100644
> --- a/dune/grid/yaspgrid/ygrid.hh
> +++ b/dune/grid/yaspgrid/ygrid.hh
> @@ -75,7 +75,7 @@ namespace Dune {
>      typedef FieldVector<ct,d> fTupel;
>  
>      //! make uninitialized ygrid
> -    YGrid () : _shift(0)
> +    YGrid () : _shift(0ULL)
>      {
>        std::fill(_origin.begin(), _origin.end(), 0);
>        std::fill(_offset.begin(), _offset.end(), 0);
> 
> _______________________________________________
> Dune-Commit mailing list
> Dune-Commit at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-commit

-- 
Do you need more support with DUNE or HPC in general? 

Dr. Markus Blatt - HPC-Simulation-Software & Services http://www.dr-blatt.de
Hans-Bunte-Str. 8-10, 69123 Heidelberg, Germany
Tel.: +49 (0) 160 97590858
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <https://lists.dune-project.org/pipermail/dune-devel/attachments/20140721/3511726a/attachment.sig>


More information about the Dune-devel mailing list