[Dune] [Dune-Commit] dune-localfunctions r943 - trunk/dune/localfunctions/test

Martin Nolte nolte at mathematik.uni-freiburg.de
Sun Jan 2 11:58:15 CET 2011


Hi Oli,

the Problem is the Geometry< ... > interface. It requires a template argument
GridImp. The GridImp is used to obtain the following things:
- dimension
- dimensionworld
- ctype
Moreover, it is used to make the GridDefaultImplementation friend to implement
the getRealImplementation magic.

In order to avoid the MockGeometry, we could slightly change the interface and
replace GridImp by ctype and make the getRealImp method public.
In my opinion, dimension and dimensionworld are not really necessary; only
mydimension and coorddimension are needed for the interface.

If we decide in favor of such a change (which will have to be voted on), we will
be forced to make the template argument GeometryImp a non-template. Otherwise,
the implementer cannot pass additional, grid-specific information to the
geometry implementation. The new declaration would look as follows:

template< int mydim, int cdim, class ctype, class GeometryImp >
class Geometry;

Since we decided to move such geometry-specific stuff into a new module,
dune-geometry, a positive side effect is that the interface class Geometry could
then reside in dune-geometry instead of dune-grid. Of course, the latter change
will happen after the 2.0 release.

What are the opinions of the other developers?

A happy 2011,

Martin


On 01/02/2011 11:28 AM, Oliver Sander wrote:
> Hi Jö!
> In UGGrid I used Geometry<BasicGeometry> to get a fully interface-
> compliant geometry without a grid.  Is there something wrong with
> that approach?  If so, we should update the tests to find the problem.
> Otherwise your MockGeometry may not be necessary.
> 
> Best,
> Oliver
> 
> Am 01.01.2011 05:03, schrieb joe at dune-project.org:
>> Author: joe
>> Date: 2011-01-01 05:03:34 +0100 (Sat, 01 Jan 2011)
>> New Revision: 943
>>
>> Modified:
>>     trunk/dune/localfunctions/test/test-edges0.5.cc
>>     trunk/dune/localfunctions/test/test-pk2d.cc
>>     trunk/dune/localfunctions/test/test-q1.cc
>>     trunk/dune/localfunctions/test/test-q22d.cc
>> Log:
>> Replace uses of BasicGeometry with MockGeometry, which is closer to
>> Dune::Geometry.
>>
>> Modified: trunk/dune/localfunctions/test/test-edges0.5.cc
>> ===================================================================
>> --- trunk/dune/localfunctions/test/test-edges0.5.cc    2011-01-01 04:03:31 UTC
>> (rev 942)
>> +++ trunk/dune/localfunctions/test/test-edges0.5.cc    2011-01-01 04:03:34 UTC
>> (rev 943)
>> @@ -13,8 +13,7 @@
>>   #include<dune/common/fvector.hh>
>>   #include<dune/common/geometrytype.hh>
>>
>> -#include<dune/grid/genericgeometry/geometry.hh>
>> -#include<dune/grid/genericgeometry/geometrytraits.hh>
>> +#include<dune/grid/utility/mockgeometry.hh>
>>   #include<dune/grid/utility/vertexorder.hh>
>>
>>   #include<dune/localfunctions/whitney/edges0.5.hh>
>> @@ -41,9 +40,7 @@
>>         corners[0][0] = -.5; corners[0][1] = -.5;
>>         corners[1][0] =  .5; corners[1][1] = -.5;
>>         corners[2][0] = 0  ; corners[2][1] =  .5;
>> -      typedef Dune::GenericGeometry::BasicGeometry<
>> -        2, Dune::GenericGeometry::DefaultGeometryTraits<double, 2, 2>
>> ->  Geometry;
>> +      typedef Dune::MockGeometry<double, 2, 2>  Geometry;
>>         Geometry geo(gt, corners);
>>
>>         std::size_t vertexIds[] = {0, 1, 2};
>> @@ -71,9 +68,7 @@
>>         corners[1][0] =  .5; corners[1][1] = -.5; corners[1][2] = -.5;
>>         corners[2][0] = 0  ; corners[2][1] =  .5; corners[2][2] = -.5;
>>         corners[3][0] = 0  ; corners[3][1] =  0 ; corners[3][2] =  .5;
>> -      typedef Dune::GenericGeometry::BasicGeometry<
>> -        3, Dune::GenericGeometry::DefaultGeometryTraits<double, 3, 3>
>> ->  Geometry;
>> +      typedef Dune::MockGeometry<double, 3, 3>  Geometry;
>>         Geometry geo(gt, corners);
>>
>>         std::size_t vertexIds[] = {0, 1, 2, 3};
>>
>> Modified: trunk/dune/localfunctions/test/test-pk2d.cc
>> ===================================================================
>> --- trunk/dune/localfunctions/test/test-pk2d.cc    2011-01-01 04:03:31 UTC
>> (rev 942)
>> +++ trunk/dune/localfunctions/test/test-pk2d.cc    2011-01-01 04:03:34 UTC
>> (rev 943)
>> @@ -14,8 +14,7 @@
>>   #include<dune/common/fvector.hh>
>>   #include<dune/common/geometrytype.hh>
>>
>> -#include<dune/grid/genericgeometry/geometry.hh>
>> -#include<dune/grid/genericgeometry/geometrytraits.hh>
>> +#include<dune/grid/utility/mockgeometry.hh>
>>   #include<dune/grid/utility/vertexorder.hh>
>>
>>   #include<dune/localfunctions/lagrange/pk2d.hh>
>> @@ -40,9 +39,7 @@
>>       corners[0][0] = -.5; corners[0][1] = -.5;
>>       corners[1][0] =  .5; corners[1][1] = -.5;
>>       corners[2][0] = 0  ; corners[2][1] =  .5;
>> -    typedef Dune::GenericGeometry::BasicGeometry<
>> -      2, Dune::GenericGeometry::DefaultGeometryTraits<double, 2, 2>
>> ->  Geometry;
>> +    typedef Dune::MockGeometry<double, 2, 2>  Geometry;
>>       Geometry geo(gt, corners);
>>
>>       std::size_t vertexIds[] = {0, 1, 2};
>>
>> Modified: trunk/dune/localfunctions/test/test-q1.cc
>> ===================================================================
>> --- trunk/dune/localfunctions/test/test-q1.cc    2011-01-01 04:03:31 UTC (rev
>> 942)
>> +++ trunk/dune/localfunctions/test/test-q1.cc    2011-01-01 04:03:34 UTC (rev
>> 943)
>> @@ -13,8 +13,7 @@
>>   #include<dune/common/fvector.hh>
>>   #include<dune/common/geometrytype.hh>
>>
>> -#include<dune/grid/genericgeometry/geometry.hh>
>> -#include<dune/grid/genericgeometry/geometrytraits.hh>
>> +#include<dune/grid/utility/mockgeometry.hh>
>>
>>   #include<dune/localfunctions/lagrange/q1.hh>
>>
>> @@ -39,9 +38,7 @@
>>         Dune::FieldVector<double, 1>  corners[2];
>>         corners[0][0] = -.5;
>>         corners[1][0] =  .5;
>> -      typedef Dune::GenericGeometry::BasicGeometry<
>> -        1, Dune::GenericGeometry::DefaultGeometryTraits<double, 1, 1>
>> ->  Geometry;
>> +      typedef Dune::MockGeometry<double, 1, 1>  Geometry;
>>         Geometry geo(gt, corners);
>>
>>         Dune::Q1FiniteElementFactory<Geometry, double>  feFactory;
>> @@ -65,9 +62,7 @@
>>         corners[1][0] = 0  ; corners[1][1] = -.5;
>>         corners[2][0] =  .5; corners[2][1] = 0;
>>         corners[3][0] = 0  ; corners[3][1] =  .5;
>> -      typedef Dune::GenericGeometry::BasicGeometry<
>> -        2, Dune::GenericGeometry::DefaultGeometryTraits<double, 2, 2>
>> ->  Geometry;
>> +      typedef Dune::MockGeometry<double, 2, 2>  Geometry;
>>         Geometry geo(gt, corners);
>>
>>         Dune::Q1FiniteElementFactory<Geometry, double>  feFactory;
>> @@ -95,9 +90,7 @@
>>         corners[5][0] =  .7; corners[5][1] = -.6; corners[5][2] =  .5;
>>         corners[6][0] = -.4; corners[6][1] =  .3; corners[6][2] =  .7;
>>         corners[7][0] =  .6; corners[7][1] =  .5; corners[7][2] =  .4;
>> -      typedef Dune::GenericGeometry::BasicGeometry<
>> -        3, Dune::GenericGeometry::DefaultGeometryTraits<double, 3, 3>
>> ->  Geometry;
>> +      typedef Dune::MockGeometry<double, 3, 3>  Geometry;
>>         Geometry geo(gt, corners);
>>
>>         Dune::Q1FiniteElementFactory<Geometry, double>  feFactory;
>>
>> Modified: trunk/dune/localfunctions/test/test-q22d.cc
>> ===================================================================
>> --- trunk/dune/localfunctions/test/test-q22d.cc    2011-01-01 04:03:31 UTC
>> (rev 942)
>> +++ trunk/dune/localfunctions/test/test-q22d.cc    2011-01-01 04:03:34 UTC
>> (rev 943)
>> @@ -13,8 +13,7 @@
>>   #include<dune/common/fvector.hh>
>>   #include<dune/common/geometrytype.hh>
>>
>> -#include<dune/grid/genericgeometry/geometry.hh>
>> -#include<dune/grid/genericgeometry/geometrytraits.hh>
>> +#include<dune/grid/utility/mockgeometry.hh>
>>
>>   #include<dune/localfunctions/lagrange/q22d.hh>
>>
>> @@ -40,9 +39,7 @@
>>         corners[1][0] = 0  ; corners[1][1] = -.5;
>>         corners[2][0] =  .5; corners[2][1] = 0;
>>         corners[3][0] = 0  ; corners[3][1] =  .5;
>> -      typedef Dune::GenericGeometry::BasicGeometry<
>> -        2, Dune::GenericGeometry::DefaultGeometryTraits<double, 2, 2>
>> ->  Geometry;
>> +      typedef Dune::MockGeometry<double, 2, 2>  Geometry;
>>         Geometry geo(gt, corners);
>>
>>         Dune::Q22DFiniteElementFactory<Geometry, double>  feFactory;
>>
>>
>> _______________________________________________
>> 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

-- 
Martin Nolte <nolte at mathematik.uni-freiburg.de>

Universität Freiburg                                   phone: +49-761-203-5642
Abteilung für angewandte Mathematik                    fax:   +49-761-203-5632
Hermann-Herder-Straße 10
79104 Freiburg, Germany




More information about the Dune mailing list