[Dune] [Dune-Commit] dune-grid r7578 - trunk/dune/grid/genericgeometry
Guillermo Montilla
montillaleon at gmail.com
Tue Mar 29 16:57:56 CEST 2011
Hi,
I'm working now migrating the HG version. When finished I will communicate.
Guillermo
2011/3/29 Christian Engwer <christi at uni-hd.de>
> Hi Martin,
>
> I don't quite undestand, what happend here. How is the new
> construction different from the previous one? Can you enlight me?
>
> Thanks
> Christian
>
> On Tue, Mar 29, 2011 at 04:06:59PM +0200, mnolte at dune-project.org wrote:
> > Author: mnolte
> > Date: 2011-03-29 16:06:59 +0200 (Tue, 29 Mar 2011)
> > New Revision: 7578
> >
> > Modified:
> > trunk/dune/grid/genericgeometry/matrixhelper.hh
> > Log:
> > fix a problem with method overloading
> >
> >
> > Modified: trunk/dune/grid/genericgeometry/matrixhelper.hh
> > ===================================================================
> > --- trunk/dune/grid/genericgeometry/matrixhelper.hh 2011-03-21 23:22:41
> UTC (rev 7577)
> > +++ trunk/dune/grid/genericgeometry/matrixhelper.hh 2011-03-29 14:06:59
> UTC (rev 7578)
> > @@ -1,6 +1,8 @@
> > #ifndef DUNE_GENERICGEOMETRY_MATRIXHELPER_HH
> > #define DUNE_GENERICGEOMETRY_MATRIXHELPER_HH
> >
> > +#include <cmath>
> > +
> > #include <dune/common/fvector.hh>
> > #include <dune/common/fmatrix.hh>
> > #include <dune/common/static_assert.hh>
> > @@ -11,11 +13,31 @@
> > namespace GenericGeometry
> > {
> >
> > + // FieldHelper
> > + // -----------
> > +
> > + template< class Field >
> > + struct FieldHelper
> > + {
> > + static Field abs ( const Field &x ) { return std::abs( x ); }
> > + };
> > +
> > +
> > +
> > + // MatrixHelper
> > + // ------------
> > +
> > template< class Traits >
> > struct MatrixHelper
> > {
> > - typedef typename Traits :: ctype FieldType;
> > + typedef typename Traits::ctype FieldType;
> >
> > + static FieldType abs ( const FieldType &x )
> > + {
> > + //return std::abs( x );
> > + return FieldHelper< FieldType >::abs( x );
> > + }
> > +
> > template< int m, int n >
> > static void
> > Ax ( const typename Traits :: template Matrix< m, n > :: type &A,
> > @@ -373,7 +395,7 @@
> > if( (n == 2) && (m == 2) )
> > {
> > // Special implementation for 2x2 matrices: faster and more
> stable
> > - return std::abs( A[ 0 ][ 0 ]*A[ 1 ][ 1 ] - A[ 1 ][ 0 ]*A[ 0 ][
> 1 ] );
> > + return abs( A[ 0 ][ 0 ]*A[ 1 ][ 1 ] - A[ 1 ][ 0 ]*A[ 0 ][ 1 ]
> );
> > }
> > else if( (n == 3) && (m == 3) )
> > {
> > @@ -381,7 +403,7 @@
> > const FieldType v0 = A[ 0 ][ 1 ] * A[ 1 ][ 2 ] - A[ 1 ][ 1 ] *
> A[ 0 ][ 2 ];
> > const FieldType v1 = A[ 0 ][ 2 ] * A[ 1 ][ 0 ] - A[ 1 ][ 2 ] *
> A[ 0 ][ 0 ];
> > const FieldType v2 = A[ 0 ][ 0 ] * A[ 1 ][ 1 ] - A[ 1 ][ 0 ] *
> A[ 0 ][ 1 ];
> > - return std::abs( v0 * A[ 2 ][ 0 ] + v1 * A[ 2 ][ 1 ] + v2 * A[
> 2 ][ 2 ] );
> > + return abs( v0 * A[ 2 ][ 0 ] + v1 * A[ 2 ][ 1 ] + v2 * A[ 2 ][
> 2 ] );
> > }
> > else if( n >= m )
> > {
> > @@ -438,7 +460,7 @@
> > ret[ 1 ][ 1 ] = A[ 0 ][ 0 ] * detInv;
> > ret[ 1 ][ 0 ] = -A[ 1 ][ 0 ] * detInv;
> > ret[ 0 ][ 1 ] = -A[ 0 ][ 1 ] * detInv;
> > - return std::abs( det );
> > + return abs( det );
> > }
> > else
> > {
> > @@ -464,8 +486,8 @@
> > }
> > };
> >
> > - }
> > + } // namespace GenericGeometry
> >
> > -}
> > +} // namespace Dune
> >
> > #endif // #ifndef DUNE_GENERICGEOMETRY_MATRIXHELPER_HH
> >
> >
> > _______________________________________________
> > 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20110329/93e34603/attachment.htm>
More information about the Dune
mailing list