<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=windows-1252">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Dear Duners,<br>
     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<br>
    <br>
    <tt>typedef Dune :: GridSelector :: GridType G;</tt><br>
    <tt>bool cube = Dune::GenericGeometry::IsCube<</tt><tt><br>
    </tt><tt>                Dune::GenericGeometry::Topology<</tt><tt><br>
    </tt><tt>                   
Dune::Capabilities::hasSingleGeometryType<G>::topologyId,G::dimension</tt><tt><br>
    </tt><tt>                ></tt><tt><br>
    </tt><tt>            >::value ;<br>
    </tt><br>
    does not compile. For example if G is OneDGrid, the gcc error
    message reads<br>
    <br>
    <tt>In file included from
/home/matteo/software/dune/dune-geometry/dune/geometry/genericgeometry/cornermapping.hh:6:0,</tt><tt><br>
    </tt><tt>                 from
/home/matteo/software/dune/dune-geometry/dune/geometry/genericgeometry/geometrytraits.hh:8,</tt><tt><br>
    </tt><tt>                 from
/home/matteo/software/dune/dune-geometry/dune/geometry/affinegeometry.hh:15,</tt><tt><br>
    </tt><tt>                 from
/home/matteo/software/dune/dune-geometry/dune/geometry/referenceelements.hh:17,</tt><tt><br>
    </tt><tt>                 from
      /home/matteo/software/dune/dune-grid/dune/grid/common/geometry.hh:15,</tt><tt><br>
    </tt><tt>                 from
      /home/matteo/software/dune/dune-grid/dune/grid/common/grid.hh:1385,</tt><tt><br>
    </tt><tt>                 from
      /home/matteo/software/dune/dune-grid/dune/grid/onedgrid.hh:13,</tt><tt><br>
    </tt><tt>                 from ../config.h:787,</tt><tt><br>
    </tt><tt>                 from prova.cc:2:</tt><tt><br>
    </tt><tt>/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’:</tt><tt><br>
    </tt><tt>prova.cc:12:7:   instantiated from here</tt><tt><br>
    </tt><tt>/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</tt><tt><br>
    </tt><tt>/home/matteo/software/dune/dune-geometry/dune/geometry/genericgeometry/topologytypes.hh:99:86:
      error: within this context</tt><tt><br>
    </tt><tt>/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>’</tt><tt><br>
    </tt><tt>prova.cc: In function ‘int main()’:</tt><tt><br>
    </tt><br>
    On the other hand, the other code suggested to me by Jö, i.e.<br>
    <tt><br>
    </tt><tt><tt>bool cube =
        (Dune::Capabilities::hasSingleGeometryType<G>::topologyId
        ==</tt><tt><br>
      </tt><tt>            Dune :: GenericGeometry :: CubeTopology< 2
        > :: type :: id );</tt><tt><br>
      </tt></tt><br>
    <div class="moz-forward-container">does work and is enough for my
      work.<br>
      <br>
      Nevertheless, I thought I'd let you know... This is happening with
      release 2.3 from git. <br>
      <br>
      Best,<br>
         Matteo<br>
      <br>
      -------- Forwarded Message --------
      <table class="moz-email-headers-table" cellpadding="0"
        cellspacing="0" border="0">
        <tbody>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">Subject:
            </th>
            <td>Re: [Dune] specializing template classes for Dune::Grid</td>
          </tr>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">Date: </th>
            <td>Mon, 1 Sep 2014 23:14:22 +0200</td>
          </tr>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">From: </th>
            <td>Jö Fahlke <a class="moz-txt-link-rfc2396E" href="mailto:jorrit@jorrit.de"><jorrit@jorrit.de></a></td>
          </tr>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">To: </th>
            <td>Matteo Semplice <a class="moz-txt-link-rfc2396E" href="mailto:matteo.semplice@unito.it"><matteo.semplice@unito.it></a>, dune
              <a class="moz-txt-link-rfc2396E" href="mailto:dune@dune-project.org"><dune@dune-project.org></a></td>
          </tr>
        </tbody>
      </table>
      <br>
      <br>
      <pre>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
<a class="moz-txt-link-freetext" href="http://www.dune-project.org/doc/doxygen/html/topologytypes_8hh_source.html">http://www.dune-project.org/doc/doxygen/html/topologytypes_8hh_source.html</a>.


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

</pre>
      <br>
    </div>
    <br>
  </body>
</html>