[Dune] bug in topologytypes.hh ?

Matteo Semplice matteo.semplice at unito.it
Tue Nov 25 15:59:05 CET 2014


Dear Duners,
  I am implementing Jö's suggestion to specialize classes based on grid 
capabilities, but run into some troubles that look like a bug in 
dune-geometry... Basically the first code

typedef Dune :: GridSelector :: GridType G;
bool cube = Dune::GenericGeometry::IsCube<
                 Dune::GenericGeometry::Topology<
Dune::Capabilities::hasSingleGeometryType<G>::topologyId,G::dimension
                 >
             >::value ;

does not compile. For example if G is OneDGrid, the gcc error message reads

In file included from 
/home/matteo/software/dune/dune-geometry/dune/geometry/genericgeometry/cornermapping.hh:6:0,
                  from 
/home/matteo/software/dune/dune-geometry/dune/geometry/genericgeometry/geometrytraits.hh:8,
                  from 
/home/matteo/software/dune/dune-geometry/dune/geometry/affinegeometry.hh:15,
                  from 
/home/matteo/software/dune/dune-geometry/dune/geometry/referenceelements.hh:17,
                  from 
/home/matteo/software/dune/dune-grid/dune/grid/common/geometry.hh:15,
                  from 
/home/matteo/software/dune/dune-grid/dune/grid/common/grid.hh:1385,
                  from 
/home/matteo/software/dune/dune-grid/dune/grid/onedgrid.hh:13,
                  from ../config.h:787,
                  from prova.cc:2:
/home/matteo/software/dune/dune-geometry/dune/geometry/genericgeometry/topologytypes.hh: 
In instantiation of ‘const bool 
Dune::GenericGeometry::IsCube<Dune::GenericGeometry::Topology<1u, 1u> 
 >::value’:
prova.cc:12:7:   instantiated from here
/home/matteo/software/dune/dune-geometry/dune/geometry/genericgeometry/topologytypes.hh:273:45: 
error: ‘const unsigned int Dune::GenericGeometry::Topology<1u, 
1u>::dimension’ is private
/home/matteo/software/dune/dune-geometry/dune/geometry/genericgeometry/topologytypes.hh:99:86: 
error: within this context
/home/matteo/software/dune/dune-geometry/dune/geometry/genericgeometry/topologytypes.hh:99:86: 
error: ‘id’ is not a member of ‘Dune::GenericGeometry::Topology<1u, 1u>’
prova.cc: In function ‘int main()’:

On the other hand, the other code suggested to me by Jö, i.e.

bool cube = (Dune::Capabilities::hasSingleGeometryType<G>::topologyId ==
             Dune :: GenericGeometry :: CubeTopology< 2 > :: type :: id );

does work and is enough for my work.

Nevertheless, I thought I'd let you know... This is happening with 
release 2.3 from git.

Best,
    Matteo

-------- Forwarded Message --------
Subject: 	Re: [Dune] specializing template classes for Dune::Grid
Date: 	Mon, 1 Sep 2014 23:14:22 +0200
From: 	Jö Fahlke <jorrit at jorrit.de>
To: 	Matteo Semplice <matteo.semplice at unito.it>, dune 
<dune at dune-project.org>



Am Mon,  1. Sep 2014, 23:01:03 +0200 schrieb Jö Fahlke:
> The other specialization can be done like this:
>
>   template<class G>
>   struct SomeClass<G, typename std::enable_if<
>      G::dimension == 2 &&
>      Dune::Capabilities::hasSingleGeometryType<G>::topologyId == topologyIdForQuad
>   >::type>
>   { /* specialization for dim==1 */ };

Oh, I forgot: The test for the topologyId is probably better written like this:

   template<class G>
   struct SomeClass<G, typename std::enable_if<
      G::dimension == 2 &&
      Dune::GenericGeometry::IsCube<
        Dune::GenericGeometry::Topology<
          Dune::Capabilities::hasSingleGeometryType<G>::topologyId,
          G::dimension
          >
        >::value
      >::type>
   { /* specialization for dim==1 */ };

See
http://www.dune-project.org/doc/doxygen/html/topologytypes_8hh_source.html.


Regards,
Jö.

-- 
Jorrit (Jö) Fahlke, Institute for Computational und Applied Mathematics,
University of Münster, Orleans-Ring 10, D-48149 Münster
Tel: +49 251 83 35146 Fax: +49 251 83 32729

If God had intended Man to Smoke, He would have set him on Fire.
-- fortune



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20141125/d6e7de6a/attachment.htm>


More information about the Dune mailing list