[Dune] [Dune-Commit] dune-grid r7830 - trunk/dune/grid/uggrid
Christian Engwer
christian.engwer at uni-muenster.de
Wed Jan 11 10:21:08 CET 2012
On Wed, Jan 11, 2012 at 10:00:18AM +0100, Oliver Sander wrote:
> On second thoughts, why does the variable I write to have to be a member
> of a base class? Just to avoid name conflicts? It seems overly complicated
> to add an extra base class for UG_NS just to get a static variable.
>
> I am not sure we need this in dune-common. Most set-but-unused warnings
> can probably be fixed, instead of needing a workaround.
perhaps you are right... dune-common might be a little bit too much...
Cheers
Christian
> cheers,
> Oliver
>
> Am 11.01.2012 09:48, schrieb Christian Engwer:
> >Hi Jö,
> >
> >seems like this is trick that might come handy in many places. Perhaps
> >we should move it dune-common?
> >
> >Christian
> >
> >On Wed, Jan 11, 2012 at 12:44:15AM +0100, joe at dune-project.org wrote:
> >>Author: joe
> >>Date: 2012-01-11 00:44:14 +0100 (Wed, 11 Jan 2012)
> >>New Revision: 7830
> >>
> >>Modified:
> >> trunk/dune/grid/uggrid/uggrid.cc
> >> trunk/dune/grid/uggrid/ugwrapper.hh
> >>Log:
> >>[UGGrid] Fix warnings about unused variables.
> >>
> >>Modified: trunk/dune/grid/uggrid/uggrid.cc
> >>===================================================================
> >>--- trunk/dune/grid/uggrid/uggrid.cc 2012-01-10 23:44:10 UTC (rev 7829)
> >>+++ trunk/dune/grid/uggrid/uggrid.cc 2012-01-10 23:44:14 UTC (rev 7830)
> >>@@ -21,6 +21,8 @@
> >> //
> >> //***********************************************************************
> >>
> >>+const UG_NS_Base::IgnoreType UG_NS_Base::ignore = UG_NS_Base::IgnoreType();
> >>+
> >> template<> int Dune::UGGrid<2>::numOfUGGrids = 0;
> >> template<> int Dune::UGGrid<3>::numOfUGGrids = 0;
> >>
> >>
> >>Modified: trunk/dune/grid/uggrid/ugwrapper.hh
> >>===================================================================
> >>--- trunk/dune/grid/uggrid/ugwrapper.hh 2012-01-10 23:44:10 UTC (rev 7829)
> >>+++ trunk/dune/grid/uggrid/ugwrapper.hh 2012-01-10 23:44:14 UTC (rev 7830)
> >>@@ -7,6 +7,17 @@
> >>
> >> namespace Dune {
> >>
> >>+#if UG_DIM == 2
> >>+ /* Define stuff that is needed by the UG wrapper */
> >>+ struct UG_NS_Base {
> >>+ // class to ignore assigned values
> >>+ // avoids unused-variable warnings by the compiler (which you may run into
> >>+ // when using a dummy variable)
> >>+ struct IgnoreType { template<class T> void operator=(const T&) const { } };
> >>+ static const IgnoreType ignore;
> >>+ };
> >>+#endif
> >>+
> >> /** \brief Encapsulates a few UG methods and macros
> >> *
> >> * This class provides a wrapper to several methods and macros from
> >>@@ -22,7 +33,7 @@
> >> #endif
> >>
> >> template<>
> >>-class UG_NS< UG_DIM> {
> >>+class UG_NS< UG_DIM> : public UG_NS_Base {
> >> public:
> >>
> >> // //////////////////////////////////////////////
> >>@@ -383,8 +394,7 @@
> >> using UG_NAMESPACE ::PRISM;
> >> using UG_NAMESPACE ::n_offset;
> >> using UG::UINT;
> >>- int n; // Dummy variable just to please the macro
> >>- CORNER_COORDINATES(theElement, n, x);
> >>+ CORNER_COORDINATES(theElement, ignore, x);
> >> }
> >>
> >> /** \brief Returns pointers to the coordinate arrays of an UG node */
> >>
> >>
> >>_______________________________________________
> >>Dune-Commit mailing list
> >>Dune-Commit at dune-project.org
> >>http://lists.dune-project.org/mailman/listinfo/dune-commit
> >>
> >
> >_______________________________________________
> >Dune mailing list
> >Dune at dune-project.org
> >http://lists.dune-project.org/mailman/listinfo/dune
>
> _______________________________________________
> Dune mailing list
> Dune at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune
>
More information about the Dune
mailing list