[Dune] [Dune-Commit] dune-localfunctions r718 - in trunk: . dune/localfunctions dune/localfunctions/generic dune/localfunctions/generic/lagrangebasis dune/localfunctions/generic/orthonormalbasis dune/localfunctions/generic/quadrature dune/localfunctions/generic/raviartthomasbasis dune/localfunctions/test dune/localfunctions/utility

Martin Nolte nolte at mathematik.uni-freiburg.de
Mon Jan 18 14:43:12 CET 2010


Hi Oliver,

since you were all unhappy with the generic subdirectory, we started removing 
it. Please keep in mind that we are not at all happy about this decision.

In our opinion, the stuff in the old generic/common directory does not belong 
into the common directory, as it is not related to all implementations (and is 
hence not common). Therefore we thought it best to use a utilities directory 
(i.e., implementor's utilities). I agree, though, that there might be some 
files that could be moved to the common directory (or even to dune-common). 
But we will have to see that in futher cleanup steps.

As for documentation: Where is the right place to document such stuff anyway?

Yours,

Martin




Oliver Sander wrote:
> Hi Martin!
> 
> Could you please document the rules about what goes into common/ and 
> what goes into utility/?
> Apology if you already have and I just can't find it.
> 
> Thnx,
> Oliver
> 
> mnolte at dune-project.org schrieb:
>> Author: mnolte
>> Date: 2010-01-18 14:25:13 +0100 (Mon, 18 Jan 2010)
>> New Revision: 718
>>
>> Added:
>>    trunk/dune/localfunctions/utility/
>>    trunk/dune/localfunctions/utility/field.hh
>>    trunk/dune/localfunctions/utility/gmpfield.hh
>>    trunk/dune/localfunctions/utility/matrix.hh
>> Removed:
>>    trunk/dune/localfunctions/generic/common/
>>    trunk/dune/localfunctions/generic/math/
>> Modified:
>>    trunk/configure.ac
>>    trunk/dune/localfunctions/Makefile.am
>>    trunk/dune/localfunctions/generic/Makefile.am
>>    trunk/dune/localfunctions/generic/dglagrangefiniteelement.hh
>>    trunk/dune/localfunctions/generic/lagrangebasis/equidistantpoints.hh
>>    trunk/dune/localfunctions/generic/lagrangebasis/interpolation.hh
>>    trunk/dune/localfunctions/generic/lagrangebasis/lagrangebasis.hh
>>    trunk/dune/localfunctions/generic/lagrangebasis/lagrangecoefficients.hh
>>    trunk/dune/localfunctions/generic/lagrangebasis/lobattopoints.hh
>>    trunk/dune/localfunctions/generic/lagrangebasis/test.cc
>>    trunk/dune/localfunctions/generic/lagrangefiniteelement.hh
>>    trunk/dune/localfunctions/generic/orthonormalbasis/orthonormalbasis.hh
>>    trunk/dune/localfunctions/generic/orthonormalbasis/orthonormalcompute.hh
>>    trunk/dune/localfunctions/generic/orthonormalbasis/test.cc
>>    trunk/dune/localfunctions/generic/orthonormalfiniteelement.hh
>>    trunk/dune/localfunctions/generic/quadrature/gaussquadrature.hh
>>    trunk/dune/localfunctions/generic/quadrature/genericquadrature.hh
>>    trunk/dune/localfunctions/generic/quadrature/lobattoquadrature.hh
>>    trunk/dune/localfunctions/generic/quadrature/quadrature.hh
>>    trunk/dune/localfunctions/generic/raviartthomasbasis/interpolation.hh
>>    trunk/dune/localfunctions/generic/raviartthomasbasis/raviartthomasbasis.hh
>>    trunk/dune/localfunctions/generic/raviartthomasbasis/raviartthomasprebasis.hh
>>    trunk/dune/localfunctions/generic/raviartthomasbasis/test.cc
>>    trunk/dune/localfunctions/generic/raviartthomasfiniteelement.hh
>>    trunk/dune/localfunctions/test/testgenericfem.cc
>>    trunk/dune/localfunctions/utility/Makefile.am
>>    trunk/dune/localfunctions/utility/basisevaluator.hh
>>    trunk/dune/localfunctions/utility/basismatrix.hh
>>    trunk/dune/localfunctions/utility/basisprint.hh
>>    trunk/dune/localfunctions/utility/coeffmatrix.hh
>>    trunk/dune/localfunctions/utility/defaultbasisfactory.hh
>>    trunk/dune/localfunctions/utility/dglocalcoefficients.hh
>>    trunk/dune/localfunctions/utility/interpolationhelper.hh
>>    trunk/dune/localfunctions/utility/l2interpolation.hh
>>    trunk/dune/localfunctions/utility/monomialbasis.hh
>>    trunk/dune/localfunctions/utility/multiindex.hh
>>    trunk/dune/localfunctions/utility/polynomialbasis.hh
>>    trunk/dune/localfunctions/utility/tensor.hh
>> Log:
>> move generic/common + generic/math to utility
>>
>>
>> Modified: trunk/configure.ac
>> ===================================================================
>> --- trunk/configure.ac	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/configure.ac	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -51,8 +51,7 @@
>>                  dune/localfunctions/raviartthomas/raviartthomas0q3d/Makefile
>>                  dune/localfunctions/test/Makefile
>>                  dune/localfunctions/generic/Makefile
>> -                dune/localfunctions/generic/common/Makefile         
>> -                dune/localfunctions/generic/math/Makefile           
>> +                dune/localfunctions/utility/Makefile
>>                  dune/localfunctions/generic/quadrature/Makefile
>>                  dune/localfunctions/generic/orthonormalbasis/Makefile
>>                  dune/localfunctions/generic/lagrangebasis/Makefile  
>>
>> Modified: trunk/dune/localfunctions/Makefile.am
>> ===================================================================
>> --- trunk/dune/localfunctions/Makefile.am	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/Makefile.am	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -7,7 +7,7 @@
>>  	pk2d.hh q22d.hh q1.hh \
>>  	pq22d.hh refinedp0.hh
>>  
>> -SUBDIRS = common generic test \
>> +SUBDIRS = common generic utility test \
>>            p0 p1 pk2d pk3d q1 q22d raviartthomas edger02d edges02d \
>>   	  edges03d rannacher_turek2d refinedp1 monom mimetic \
>>            prismp1 prismp2 hierarchicalprismp2 refinedp0
>>
>> Modified: trunk/dune/localfunctions/generic/Makefile.am
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/Makefile.am	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/generic/Makefile.am	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -3,7 +3,7 @@
>>                    dglagrangefiniteelement.hh \
>>                    orthonormalfiniteelement.hh \
>>                    raviartthomasfiniteelement.hh
>> -SUBDIRS = common orthonormalbasis lagrangebasis raviartthomasbasis math quadrature
>> +SUBDIRS = orthonormalbasis lagrangebasis raviartthomasbasis quadrature
>>  AM_CPPFLAGS = $(DUNE_CPPFLAGS)
>>  
>>  include $(top_srcdir)/am/global-rules
>>
>> Modified: trunk/dune/localfunctions/generic/dglagrangefiniteelement.hh
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/dglagrangefiniteelement.hh	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/generic/dglagrangefiniteelement.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -1,8 +1,8 @@
>>  #ifndef DUNE_DGLAGRANGEFINITEELEMENT_HH
>>  #define DUNE_DGLAGRANGEFINITEELEMENT_HH
>>  
>> -#include <dune/localfunctions/generic/common/localfiniteelement.hh>
>> -#include <dune/localfunctions/generic/common/dglocalcoefficients.hh>
>> +#include <dune/localfunctions/utility/localfiniteelement.hh>
>> +#include <dune/localfunctions/utility/dglocalcoefficients.hh>
>>  #include <dune/localfunctions/generic/lagrangebasis/lagrangecoefficients.hh>
>>  #include <dune/localfunctions/generic/lagrangebasis/interpolation.hh>
>>  #include <dune/localfunctions/generic/lagrangebasis/lagrangebasis.hh>
>>
>> Modified: trunk/dune/localfunctions/generic/lagrangebasis/equidistantpoints.hh
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/lagrangebasis/equidistantpoints.hh	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/generic/lagrangebasis/equidistantpoints.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -4,9 +4,9 @@
>>  #include <vector>
>>  
>>  #include <dune/common/fvector.hh>
>> -#include <dune/localfunctions/generic/math/field.hh>
>> +#include <dune/localfunctions/utility/field.hh>
>>  #include <dune/common/forloop.hh>
>> -#include <dune/localfunctions/generic/common/topologyfactory.hh>
>> +#include <dune/localfunctions/utility/topologyfactory.hh>
>>  #include <dune/grid/genericgeometry/topologytypes.hh>
>>  #include <dune/grid/genericgeometry/subtopologies.hh>
>>  
>>
>> Modified: trunk/dune/localfunctions/generic/lagrangebasis/interpolation.hh
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/lagrangebasis/interpolation.hh	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/generic/lagrangebasis/interpolation.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -2,7 +2,7 @@
>>  #define DUNE_LAGRANGEBASIS_INTERPOLATION_HH
>>  
>>  #include <vector>
>> -#include <dune/localfunctions/generic/common/topologyfactory.hh>
>> +#include <dune/localfunctions/utility/topologyfactory.hh>
>>  #include <dune/localfunctions/generic/lagrangebasis/lagrangecoefficients.hh>
>>  
>>  namespace Dune
>>
>> Modified: trunk/dune/localfunctions/generic/lagrangebasis/lagrangebasis.hh
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/lagrangebasis/lagrangebasis.hh	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/generic/lagrangebasis/lagrangebasis.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -4,9 +4,9 @@
>>  #include <fstream>
>>  #include <dune/common/exceptions.hh>
>>  
>> -#include <dune/localfunctions/generic/common/defaultbasisfactory.hh>
>> +#include <dune/localfunctions/utility/defaultbasisfactory.hh>
>>  
>> -#include <dune/localfunctions/generic/common/monomialbasis.hh>
>> +#include <dune/localfunctions/utility/monomialbasis.hh>
>>  #include <dune/localfunctions/generic/orthonormalbasis/orthonormalbasis.hh>
>>  #include <dune/localfunctions/generic/lagrangebasis/interpolation.hh>
>>  
>>
>> Modified: trunk/dune/localfunctions/generic/lagrangebasis/lagrangecoefficients.hh
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/lagrangebasis/lagrangecoefficients.hh	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/generic/lagrangebasis/lagrangecoefficients.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -4,9 +4,9 @@
>>  #include <vector>
>>  
>>  #include <dune/common/fvector.hh>
>> -#include <dune/localfunctions/generic/math/field.hh>
>> +#include <dune/localfunctions/utility/field.hh>
>>  #include <dune/common/forloop.hh>
>> -#include <dune/localfunctions/generic/common/topologyfactory.hh>
>> +#include <dune/localfunctions/utility/topologyfactory.hh>
>>  
>>  #include <dune/grid/genericgeometry/topologytypes.hh>
>>  #include <dune/grid/genericgeometry/subtopologies.hh>
>>
>> Modified: trunk/dune/localfunctions/generic/lagrangebasis/lobattopoints.hh
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/lagrangebasis/lobattopoints.hh	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/generic/lagrangebasis/lobattopoints.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -2,10 +2,10 @@
>>  #define DUNE_LOBATTOBASIS_HH
>>  
>>  #include <fstream>
>> -#include <dune/localfunctions/generic/math/matrix.hh>
>> -#include <dune/localfunctions/generic/math/field.hh>
>> +#include <dune/localfunctions/utility/matrix.hh>
>> +#include <dune/localfunctions/utility/field.hh>
>>  #include <dune/common/forloop.hh>
>> -#include <dune/localfunctions/generic/common/topologyfactory.hh>
>> +#include <dune/localfunctions/utility/topologyfactory.hh>
>>  #include <dune/grid/genericgeometry/referenceelements.hh>
>>  #include <dune/grid/genericgeometry/referencemappings.hh>
>>  
>>
>> Modified: trunk/dune/localfunctions/generic/lagrangebasis/test.cc
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/lagrangebasis/test.cc	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/generic/lagrangebasis/test.cc	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -1,6 +1,6 @@
>>  #include <config.h>
>>  
>> -#include <dune/localfunctions/generic/math/field.hh>
>> +#include <dune/localfunctions/utility/field.hh>
>>  
>>  #include <dune/localfunctions/generic/lagrangebasis/equidistantpoints.hh>
>>  
>> @@ -8,7 +8,7 @@
>>  
>>  #include <dune/localfunctions/generic/lagrangebasis/lagrangebasis.hh>
>>  #include <dune/localfunctions/generic/quadrature/genericquadrature.hh>
>> -#include <dune/localfunctions/generic/common/basisprint.hh>
>> +#include <dune/localfunctions/utility/basisprint.hh>
>>  
>>  #if HAVE_ALGLIB
>>    typedef amp::ampf< 128 > StorageField;
>>
>> Modified: trunk/dune/localfunctions/generic/lagrangefiniteelement.hh
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/lagrangefiniteelement.hh	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/generic/lagrangefiniteelement.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -1,7 +1,7 @@
>>  #ifndef DUNE_LAGRANGEFINITEELEMENT_HH
>>  #define DUNE_LAGRANGEFINITEELEMENT_HH
>>  
>> -#include <dune/localfunctions/generic/common/localfiniteelement.hh>
>> +#include <dune/localfunctions/utility/localfiniteelement.hh>
>>  #include <dune/localfunctions/generic/lagrangebasis/lagrangecoefficients.hh>
>>  #include <dune/localfunctions/generic/lagrangebasis/interpolation.hh>
>>  #include <dune/localfunctions/generic/lagrangebasis/lagrangebasis.hh>
>>
>> Modified: trunk/dune/localfunctions/generic/orthonormalbasis/orthonormalbasis.hh
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/orthonormalbasis/orthonormalbasis.hh	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/generic/orthonormalbasis/orthonormalbasis.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -3,9 +3,9 @@
>>  
>>  #include <sstream>
>>  
>> -#include <dune/localfunctions/generic/common/topologyfactory.hh>
>> +#include <dune/localfunctions/utility/topologyfactory.hh>
>>  
>> -#include <dune/localfunctions/generic/common/polynomialbasis.hh>
>> +#include <dune/localfunctions/utility/polynomialbasis.hh>
>>  #include <dune/localfunctions/generic/orthonormalbasis/orthonormalcompute.hh>
>>  
>>  namespace Dune
>>
>> Modified: trunk/dune/localfunctions/generic/orthonormalbasis/orthonormalcompute.hh
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/orthonormalbasis/orthonormalcompute.hh	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/generic/orthonormalbasis/orthonormalcompute.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -9,13 +9,13 @@
>>  
>>  #include <dune/common/fmatrix.hh>
>>  
>> -#include <dune/localfunctions/generic/math/field.hh>
>> -#include <dune/localfunctions/generic/math/matrix.hh>
>> +#include <dune/localfunctions/utility/field.hh>
>> +#include <dune/localfunctions/utility/matrix.hh>
>>  
>>  #include <dune/grid/genericgeometry/topologytypes.hh>
>>  
>> -#include <dune/localfunctions/generic/common/monomialbasis.hh>
>> -#include <dune/localfunctions/generic/common/multiindex.hh>
>> +#include <dune/localfunctions/utility/monomialbasis.hh>
>> +#include <dune/localfunctions/utility/multiindex.hh>
>>  
>>  namespace ONBCompute
>>  {
>>
>> Modified: trunk/dune/localfunctions/generic/orthonormalbasis/test.cc
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/orthonormalbasis/test.cc	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/generic/orthonormalbasis/test.cc	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -1,6 +1,6 @@
>>  #include <config.h>
>>  
>> -#include <dune/localfunctions/generic/math/field.hh>
>> +#include <dune/localfunctions/utility/field.hh>
>>  #include <dune/localfunctions/generic/orthonormalbasis/orthonormalbasis.hh>
>>  #include <dune/localfunctions/generic/quadrature/gaussquadrature.hh>
>>  
>>
>> Modified: trunk/dune/localfunctions/generic/orthonormalfiniteelement.hh
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/orthonormalfiniteelement.hh	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/generic/orthonormalfiniteelement.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -1,9 +1,9 @@
>>  #ifndef DUNE_ORTHONORMALFINITEELEMENT_HH
>>  #define DUNE_ORTHONORMALFINITEELEMENT_HH
>>  
>> -#include <dune/localfunctions/generic/common/localfiniteelement.hh>
>> -#include <dune/localfunctions/generic/common/dglocalcoefficients.hh>
>> -#include <dune/localfunctions/generic/common/l2interpolation.hh>
>> +#include <dune/localfunctions/utility/localfiniteelement.hh>
>> +#include <dune/localfunctions/utility/dglocalcoefficients.hh>
>> +#include <dune/localfunctions/utility/l2interpolation.hh>
>>  #include <dune/localfunctions/generic/orthonormalbasis/orthonormalbasis.hh>
>>  
>>  namespace Dune 
>>
>> Modified: trunk/dune/localfunctions/generic/quadrature/gaussquadrature.hh
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/quadrature/gaussquadrature.hh	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/generic/quadrature/gaussquadrature.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -5,7 +5,7 @@
>>  #include <alglib/gqgengauss.h>
>>  #endif
>>  
>> -#include <dune/localfunctions/generic/math/field.hh>
>> +#include <dune/localfunctions/utility/field.hh>
>>  
>>  #include <dune/grid/common/quadraturerules.hh>
>>  
>>
>> Modified: trunk/dune/localfunctions/generic/quadrature/genericquadrature.hh
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/quadrature/genericquadrature.hh	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/generic/quadrature/genericquadrature.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -5,7 +5,7 @@
>>  #include <dune/grid/genericgeometry/topologytypes.hh>
>>  
>>  #include <dune/localfunctions/generic/quadrature/quadrature.hh>
>> -#include <dune/localfunctions/generic/common/topologyfactory.hh>
>> +#include <dune/localfunctions/utility/topologyfactory.hh>
>>  
>>  namespace Dune
>>  {
>>
>> Modified: trunk/dune/localfunctions/generic/quadrature/lobattoquadrature.hh
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/quadrature/lobattoquadrature.hh	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/generic/quadrature/lobattoquadrature.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -9,7 +9,7 @@
>>  
>>  #include <dune/common/static_assert.hh>
>>  
>> -#include <dune/localfunctions/generic/math/field.hh>
>> +#include <dune/localfunctions/utility/field.hh>
>>  
>>  #include <dune/localfunctions/generic/quadrature/genericquadrature.hh>
>>  
>>
>> Modified: trunk/dune/localfunctions/generic/quadrature/quadrature.hh
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/quadrature/quadrature.hh	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/generic/quadrature/quadrature.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -5,7 +5,7 @@
>>  
>>  #include <dune/common/fvector.hh>
>>  #include <dune/common/geometrytype.hh>
>> -#include <dune/localfunctions/generic/math/field.hh>
>> +#include <dune/localfunctions/utility/field.hh>
>>  
>>  namespace Dune
>>  {
>>
>> Modified: trunk/dune/localfunctions/generic/raviartthomasbasis/interpolation.hh
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/raviartthomasbasis/interpolation.hh	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/generic/raviartthomasbasis/interpolation.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -9,14 +9,14 @@
>>  #include <dune/grid/genericgeometry/referencemappings.hh>
>>  #include <dune/grid/genericgeometry/referenceelements.hh>
>>  
>> -#include <dune/localfunctions/generic/common/topologyfactory.hh>
>> -#include <dune/localfunctions/generic/common/interpolationhelper.hh>
>> -#include <dune/localfunctions/generic/math/matrix.hh>
>> +#include <dune/localfunctions/utility/topologyfactory.hh>
>> +#include <dune/localfunctions/utility/interpolationhelper.hh>
>> +#include <dune/localfunctions/utility/matrix.hh>
>>  #include <dune/localfunctions/common/localkey.hh>
>>  
>>  #include <dune/localfunctions/generic/quadrature/gaussquadrature.hh>
>>  
>> -#include <dune/localfunctions/generic/common/polynomialbasis.hh>
>> +#include <dune/localfunctions/utility/polynomialbasis.hh>
>>  #include <dune/localfunctions/generic/orthonormalbasis/orthonormalbasis.hh>
>>  
>>  
>>
>> Modified: trunk/dune/localfunctions/generic/raviartthomasbasis/raviartthomasbasis.hh
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/raviartthomasbasis/raviartthomasbasis.hh	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/generic/raviartthomasbasis/raviartthomasbasis.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -4,7 +4,7 @@
>>  #include <fstream>
>>  #include <dune/common/exceptions.hh>
>>  
>> -#include <dune/localfunctions/generic/common/defaultbasisfactory.hh>
>> +#include <dune/localfunctions/utility/defaultbasisfactory.hh>
>>  #include <dune/localfunctions/generic/raviartthomasbasis/interpolation.hh>
>>  #include <dune/localfunctions/generic/raviartthomasbasis/raviartthomasprebasis.hh>
>>  
>>
>> Modified: trunk/dune/localfunctions/generic/raviartthomasbasis/raviartthomasprebasis.hh
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/raviartthomasbasis/raviartthomasprebasis.hh	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/generic/raviartthomasbasis/raviartthomasprebasis.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -3,10 +3,10 @@
>>  #include <fstream>
>>  #include <utility>
>>  
>> -#include <dune/localfunctions/generic/math/matrix.hh>
>> +#include <dune/localfunctions/utility/matrix.hh>
>>  #include <dune/grid/genericgeometry/topologytypes.hh>
>>  
>> -#include <dune/localfunctions/generic/common/polynomialbasis.hh>
>> +#include <dune/localfunctions/utility/polynomialbasis.hh>
>>  
>>  namespace Dune 
>>  {
>>
>> Modified: trunk/dune/localfunctions/generic/raviartthomasbasis/test.cc
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/raviartthomasbasis/test.cc	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/generic/raviartthomasbasis/test.cc	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -1,7 +1,7 @@
>>  #include <config.h>
>> -#include <dune/localfunctions/generic/math/field.hh>
>> +#include <dune/localfunctions/utility/field.hh>
>>  #include <dune/localfunctions/generic/raviartthomasbasis/raviartthomasbasis.hh>
>> -#include <dune/localfunctions/generic/common/basisprint.hh>
>> +#include <dune/localfunctions/utility/basisprint.hh>
>>  
>>  #if HAVE_ALGLIB
>>    typedef amp::ampf< 128 > StorageField;
>>
>> Modified: trunk/dune/localfunctions/generic/raviartthomasfiniteelement.hh
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/raviartthomasfiniteelement.hh	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/generic/raviartthomasfiniteelement.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -1,7 +1,7 @@
>>  #ifndef DUNE_RAVIARTTHOMASFINITEELEMENT_HH
>>  #define DUNE_RAVIARTTHOMASFINITEELEMENT_HH
>>  
>> -#include <dune/localfunctions/generic/common/localfiniteelement.hh>
>> +#include <dune/localfunctions/utility/localfiniteelement.hh>
>>  #include <dune/localfunctions/generic/raviartthomasbasis/raviartthomasbasis.hh>
>>  
>>  namespace Dune 
>>
>> Modified: trunk/dune/localfunctions/test/testgenericfem.cc
>> ===================================================================
>> --- trunk/dune/localfunctions/test/testgenericfem.cc	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/test/testgenericfem.cc	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -12,7 +12,7 @@
>>  
>>  #include <dune/common/function.hh>
>>  
>> -#include <dune/localfunctions/generic/math/gmpfield.hh>
>> +#include <dune/localfunctions/utility/gmpfield.hh>
>>  
>>  // Lagrange type elements
>>  #include <dune/localfunctions/generic/lagrangefiniteelement.hh>
>>
>> Copied: trunk/dune/localfunctions/utility (from rev 717, trunk/dune/localfunctions/generic/common)
>>
>> Modified: trunk/dune/localfunctions/utility/Makefile.am
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/common/Makefile.am	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/utility/Makefile.am	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -1,11 +1,12 @@
>> -commondir = $(includedir)/dune/localfunctions/generic/common
>> +utilitydir = $(includedir)/dune/localfunctions/generic/utility
>>  
>> -common_HEADERS = basisevaluator.hh       localfiniteelement.hh  \
>> -                 basismatrix.hh          monomialbasis.hh       \
>> -                 basisprint.hh           multiindex.hh          \
>> -                 coeffmatrix.hh          polynomialbasis.hh     \
>> -                 defaultbasisfactory.hh  tensor.hh              \
>> -                 dglocalcoefficients.hh  topologyfactory.hh     \
>> -                 interpolationhelper.hh  l2interpolation.hh
>> +utility_HEADERS = basisevaluator.hh       localfiniteelement.hh  \
>> +                  basismatrix.hh          monomialbasis.hh       \
>> +                  basisprint.hh           multiindex.hh          \
>> +                  coeffmatrix.hh          polynomialbasis.hh     \
>> +                  defaultbasisfactory.hh  tensor.hh              \
>> +                  dglocalcoefficients.hh  topologyfactory.hh     \
>> +                  interpolationhelper.hh  l2interpolation.hh     \
>> +                  field.hh gmpfield.hh matrix.hh
>>  
>>  include $(top_srcdir)/am/global-rules
>>
>> Modified: trunk/dune/localfunctions/utility/basisevaluator.hh
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/common/basisevaluator.hh	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/utility/basisevaluator.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -8,11 +8,11 @@
>>  
>>  #include <dune/grid/genericgeometry/topologytypes.hh>
>>  
>> -#include <dune/localfunctions/generic/math/field.hh>
>> +#include <dune/localfunctions/utility/field.hh>
>>  
>> -#include <dune/localfunctions/generic/common/multiindex.hh>
>> +#include <dune/localfunctions/utility/multiindex.hh>
>>  
>> -#include <dune/localfunctions/generic/common/tensor.hh>
>> +#include <dune/localfunctions/utility/tensor.hh>
>>  
>>  namespace Dune
>>  {
>>
>> Modified: trunk/dune/localfunctions/utility/basismatrix.hh
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/common/basismatrix.hh	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/utility/basismatrix.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -4,9 +4,9 @@
>>  #include <fstream>
>>  #include <dune/common/exceptions.hh>
>>  
>> -#include <dune/localfunctions/generic/math/matrix.hh>
>> -#include <dune/localfunctions/generic/common/monomialbasis.hh>
>> -#include <dune/localfunctions/generic/common/polynomialbasis.hh>
>> +#include <dune/localfunctions/utility/matrix.hh>
>> +#include <dune/localfunctions/utility/monomialbasis.hh>
>> +#include <dune/localfunctions/utility/polynomialbasis.hh>
>>  
>>  namespace Dune
>>  {
>>
>> Modified: trunk/dune/localfunctions/utility/basisprint.hh
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/common/basisprint.hh	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/utility/basisprint.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -1,7 +1,7 @@
>>  #ifndef BASISPRINT
>>  #define BASISPRINT
>> -#include <dune/localfunctions/generic/common/multiindex.hh>
>> -#include <dune/localfunctions/generic/common/polynomialbasis.hh>
>> +#include <dune/localfunctions/utility/multiindex.hh>
>> +#include <dune/localfunctions/utility/polynomialbasis.hh>
>>  namespace Dune {
>>    /**********************************************
>>     * Methods for printing a PolynomialBasis.
>>
>> Modified: trunk/dune/localfunctions/utility/coeffmatrix.hh
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/common/coeffmatrix.hh	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/utility/coeffmatrix.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -4,8 +4,8 @@
>>  #include <iostream>
>>  #include <vector>
>>  #include <dune/common/fvector.hh>
>> -#include <dune/localfunctions/generic/math/field.hh>
>> -#include <dune/localfunctions/generic/common/tensor.hh>
>> +#include <dune/localfunctions/utility/field.hh>
>> +#include <dune/localfunctions/utility/tensor.hh>
>>  
>>  namespace Dune 
>>  {
>>
>> Modified: trunk/dune/localfunctions/utility/defaultbasisfactory.hh
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/common/defaultbasisfactory.hh	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/utility/defaultbasisfactory.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -4,8 +4,8 @@
>>  #include <fstream>
>>  #include <dune/common/exceptions.hh>
>>  
>> -#include <dune/localfunctions/generic/common/basismatrix.hh>
>> -#include <dune/localfunctions/generic/common/topologyfactory.hh>
>> +#include <dune/localfunctions/utility/basismatrix.hh>
>> +#include <dune/localfunctions/utility/topologyfactory.hh>
>>  
>>  namespace Dune
>>  {
>>
>> Modified: trunk/dune/localfunctions/utility/dglocalcoefficients.hh
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/common/dglocalcoefficients.hh	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/utility/dglocalcoefficients.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -4,7 +4,7 @@
>>  #include <cassert>
>>  #include <vector>
>>  
>> -#include <dune/localfunctions/generic/common/topologyfactory.hh>
>> +#include <dune/localfunctions/utility/topologyfactory.hh>
>>  #include <dune/localfunctions/common/localkey.hh>
>>  
>>  namespace Dune
>>
>> Copied: trunk/dune/localfunctions/utility/field.hh (from rev 717, trunk/dune/localfunctions/generic/math/field.hh)
>> ===================================================================
>> --- trunk/dune/localfunctions/utility/field.hh	                        (rev 0)
>> +++ trunk/dune/localfunctions/utility/field.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -0,0 +1,395 @@
>> +#ifndef DUNE_FIELD_HH
>> +#define DUNE_FIELD_HH
>> +
>> +#if HAVE_ALGLIB
>> +#include <alglib/amp.h>
>> +#endif
>> +#if HAVE_GMP
>> +#include <dune/localfunctions/utility/gmpfield.hh>
>> +#endif
>> +
>> +#include <dune/common/fvector.hh>
>> +
>> +namespace Dune
>> +{
>> +
>> +  // Unity
>> +  // -----
>> +
>> +  /** 
>> +   * @brief A class representing the unit of a given Field
>> +   *
>> +   * This class can be used to assign the unit element to an
>> +   * instance of a given Field also operators for +/- with
>> +   * unit element are provided. Also 1/f can be evaluated.
>> +   * Through specialization this class can be used also in the case that the
>> +   * integer 1 is not automatically converted to the unit
>> +   * element of the Field - the default implementation
>> +   **/
>> +  template< class Field >
>> +  struct Unity
>> +  {
>> +    operator Field () const
>> +    {
>> +      return Field( 1 );
>> +    }
>> +  };
>> +
>> +  template< class Field >
>> +  Field operator+ ( const Unity< Field > &u, const Field &f )
>> +  {
>> +    return (Field)u + f;
>> +  }
>> +
>> +  template< class Field >
>> +  Field operator- ( const Unity< Field > &u, const Field &f )
>> +  {
>> +    return (Field)u - f;
>> +  }
>> +
>> +  template< class Field >
>> +  Field operator* ( const Unity< Field > &u, const Field &f )
>> +  {
>> +    return f;
>> +  }
>> +
>> +  template< class Field >
>> +  Field operator/ ( const Unity< Field > &u, const Field &f )
>> +  {
>> +    return (Field)u / f;
>> +  }
>> +
>> +
>> +
>> +  // Zero
>> +  // ----
>> +
>> +  /** 
>> +   * @brief A class representing the zero of a given Field
>> +   *
>> +   * This class can be used to assign the zero element to an
>> +   * instance of a given Field. An epsilon is also
>> +   * provided for the comparison operators.
>> +   * This class can be used also in the case that the
>> +   * integer 0 is not automatically converted to the zero
>> +   * element of the Field and the epsilon can be changed
>> +   * depending on the accuracy of the Field type.
>> +   **/
>> +  template< class Field >
>> +  struct Zero
>> +  {
>> +    operator Field () const
>> +    {
>> +      return Field( 0 );
>> +    }
>> +    static const Field epsilon()
>> +    {
>> +      return Field(1e-12);
>> +    }
>> +  };
>> +#if HAVE_ALGLIB
>> +  template< unsigned int precision >
>> +  struct Zero< amp::ampf< precision > >
>> +  {
>> +    typedef amp::ampf< precision > Field;
>> +    operator Field () const
>> +    {
>> +      return Field( 0 );
>> +    }
>> +    static const Field epsilon()
>> +    {
>> +      return Field(1e-20);
>> +    }
>> +  };
>> +#endif
>> +#if HAVE_GMP
>> +  template< unsigned int precision >
>> +  struct Zero< GMPField< precision > >
>> +  {
>> +    typedef GMPField< precision > Field;
>> +    operator Field () const
>> +    {
>> +      return Field( 0 );
>> +    }
>> +    static const Field epsilon()
>> +    {
>> +      return Field(1e-20);
>> +    }
>> +  };
>> +#endif
>> +
>> +  template< class Field >
>> +  inline bool operator == ( const Zero< Field > &, const Field &f )
>> +  {
>> +    return ( f < Zero<Field>::epsilon() && f > -Zero<Field>::epsilon() );
>> +  }
>> +
>> +  template< class Field >
>> +  inline bool operator == ( const Field &f, const Zero< Field > &z)
>> +  {
>> +    return ( z == f );
>> +  }
>> +
>> +  template< class Field >
>> +  inline bool operator< ( const Zero< Field > &, const Field &f )
>> +  {
>> +    return f > Zero<Field>::epsilon();
>> +  }
>> +
>> +  template< class Field >
>> +  inline bool operator< ( const Field &f, const Zero< Field > & )
>> +  {
>> +    return f < -Zero<Field>::epsilon();
>> +  }
>> +
>> +  template< class Field >
>> +  inline bool operator> ( const Zero< Field > &z, const Field &f )
>> +  {
>> +    return f < z;
>> +  }
>> +
>> +  template< class Field >
>> +  inline bool operator> ( const Field &f, const Zero< Field > &z )
>> +  {
>> +    return z < f;
>> +  }
>> +
>> +
>> +  // field_cast
>> +  // ----------
>> +
>> +  /**
>> +   * @brief a helper class to cast from one field
>> +   *        to another
>> +   *
>> +   * This cast can be used for assignement between
>> +   * different field types, including for example
>> +   * between FieldVectors with different fields.
>> +   * Specially the conversion from a special type
>> +   * e.g. gmp to build in types are provided, the 
>> +   * other direction can be more easily handled by
>> +   * the special field type implementation.
>> +   **/
>> +  template< class F2, class F1 >
>> +  inline void field_cast ( const F1 &f1, F2 &f2 )
>> +  {
>> +    f2 = f1;
>> +  }
>> +
>> +#if HAVE_ALGLIB
>> +  template< unsigned int precision >
>> +  inline void field_cast ( const amp::ampf< precision > &f1, double &f2 )
>> +  {
>> +    f2 = f1.toDouble();
>> +  }
>> +
>> +  template< unsigned int precision >
>> +  inline void field_cast ( const amp::ampf< precision > &f1, long double &f2 )
>> +  {
>> +    f2 = f1.toDouble();
>> +  }
>> +#endif
>> +
>> +#if HAVE_GMP
>> +  template< unsigned int precision >
>> +  inline void field_cast ( const Dune::GMPField< precision > &f1, double &f2 )
>> +  {
>> +    f2 = f1.get_d();
>> +  }
>> +
>> +  template< unsigned int precision >
>> +  inline void field_cast ( const Dune::GMPField< precision > &f1, long double &f2 )
>> +  {
>> +    f2 = f1.get_d();
>> +  }
>> +#endif
>> +
>> +  template< class F2, class F1, int dim >
>> +  inline void field_cast ( const Dune::FieldVector< F1, dim > &f1, Dune::FieldVector< F2, dim > &f2 )
>> +  {
>> +    for( int d = 0; d < dim; ++d )
>> +      field_cast( f1[ d ], f2[ d ] );
>> +  }
>> +  template< class F2, class F1 >
>> +  inline void field_cast ( const Dune::FieldVector< F1, 1 > &f1, F2 &f2 )
>> +  {
>> +    field_cast( f1[ 0 ], f2 );
>> +  }
>> +  template< class F2, class F1 >
>> +  inline void field_cast ( const F1 &f1, Dune::FieldVector< F2, 1 > &f2 )
>> +  {
>> +    field_cast( f1, f2[ 0 ] );
>> +  }
>> +
>> +  template< class F2, class F1, int rdim, int cdim >
>> +  inline void field_cast ( const Dune::FieldMatrix< F1, rdim, cdim > &f1, Dune::FieldMatrix< F2, rdim, cdim > &f2 )
>> +  {
>> +    for( int r = 0; r < rdim; ++r )
>> +      field_cast( f1[ r ], f2[ r ] );
>> +  }
>> +  template< class F2, class F1 >
>> +  inline void field_cast ( const Dune::FieldMatrix<F1,1,1> &f1, Dune::FieldMatrix< F2, 1,1 > &f2 )
>> +  {
>> +    field_cast( f1[ 0 ][ 0 ], f2[ 0 ][ 0 ] );
>> +  }
>> +  template< class F2, class F1 >
>> +  inline void field_cast ( const Dune::FieldMatrix< F1, 1,1 > &f1, F2 &f2 )
>> +  {
>> +    field_cast( f1[ 0 ][ 0 ], f2 );
>> +  }
>> +  template< class F2, class F1 >
>> +  inline void field_cast ( const F1 &f1, Dune::FieldMatrix< F2, 1,1 > &f2 )
>> +  {
>> +    field_cast( f1, f2[ 0 ][ 0 ] );
>> +  }
>> +  template< class F2, class F1 >
>> +  inline void field_cast ( const Dune::FieldVector<F1,1> &f1, Dune::FieldMatrix< F2, 1,1 > &f2 )
>> +  {
>> +    field_cast( f1[ 0 ], f2[ 0 ][ 0 ] );
>> +  }
>> +  template< class F2, class F1 >
>> +  inline void field_cast ( const Dune::FieldMatrix<F1,1,1> &f1, Dune::FieldVector< F2, 1 > &f2 )
>> +  {
>> +    field_cast( f1[ 0 ][ 0 ], f2[ 0 ] );
>> +  }
>> +
>> +  template< class F2, class F1 >
>> +  inline void field_cast ( const Dune::FieldVector< F1, 1 > &f1, Dune::FieldVector<F2, 1> &f2 )
>> +  {
>> +    field_cast( f1[ 0 ], f2[ 0 ] );
>> +  }
>> +
>> +
>> +  template< class F2,class F1 > 
>> +  inline F2 field_cast ( const F1 &f1 )
>> +  {
>> +    F2 f2;
>> +    field_cast( f1, f2 );
>> +    return f2;
>> +  }
>> +
>> +  template< class F2,class F1,int dim > 
>> +  inline Dune::FieldVector<F2,dim> field_cast ( const Dune::FieldVector<F1,dim> &f1 )
>> +  {
>> +    Dune::FieldVector<F2,dim> f2;
>> +    field_cast( f1, f2 );
>> +    return f2;
>> +  }
>> +
>> +  template< class F2,class F1,int dim1, int dim2> 
>> +  inline Dune::FieldMatrix<F2,dim1,dim2> field_cast ( const Dune::FieldMatrix<F1,dim1,dim2> &f1 )
>> +  {
>> +    Dune::FieldMatrix<F2,dim1,dim2> f2;
>> +    field_cast( f1, f2 );
>> +    return f2;
>> +  }
>> +
>> +  // Precision
>> +  // this is not a perfect solution to obtain the
>> +  // precision of a field - definition is not clear
>> +  // to be removed
>> +  // ---------
>> +
>> +  template <class Field>
>> +  struct Precision;
>> +
>> +  template<>
>> +  struct Precision< double >
>> +  {
>> +    static const unsigned int value = 64;
>> +  };
>> +
>> +  template<>
>> +  struct Precision< long double >
>> +  {
>> +    static const unsigned int value = 80;
>> +  };
>> +
>> +  template<>
>> +  struct Precision< float >
>> +  {
>> +    static const unsigned int value = 32;
>> +  };
>> +
>> +#if HAVE_ALGLIB
>> +  template< unsigned int precision >
>> +  struct Precision< amp::ampf< precision > >
>> +  {
>> +    static const unsigned int value = precision;
>> +  };
>> +#endif
>> +#if HAVE_GMP
>> +  template< unsigned int precision >
>> +  struct Precision< GMPField< precision > >
>> +  {
>> +    static const unsigned int value = precision;
>> +  };
>> +#endif
>> +
>> +  // ComputeField
>> +  // ------------
>> +
>> +  template <class Field,unsigned int sum>
>> +  struct ComputeField 
>> +  {
>> +    typedef Field Type;
>> +  };
>> +
>> +#if HAVE_ALGLIB
>> +  template< unsigned int precision, unsigned int sum >
>> +  struct ComputeField< amp::ampf< precision >, sum >
>> +  {
>> +    typedef amp::ampf<precision+sum> Type;
>> +  };
>> +#endif
>> +#if HAVE_GMP
>> +  template< unsigned int precision, unsigned int sum >
>> +  struct ComputeField< GMPField< precision >, sum >
>> +  {
>> +    typedef GMPField<precision+sum> Type;
>> +  };
>> +#endif
>> +}
>> +
>> +// to be moved to different location...
>> +namespace std
>> +{
>> +
>> +#if HAVE_ALGLIB
>> +  template< unsigned int precision >
>> +  inline ostream &
>> +  operator<< ( ostream &out, 
>> +               const amp::ampf< precision > &value )
>> +  {
>> +    return out << value.toDec();
>> +  }
>> +
>> +  template< unsigned int precision >
>> +  inline amp::ampf< precision > sqrt ( const amp::ampf< precision > &a )
>> +  {
>> +    return amp::sqrt( a );
>> +  }
>> +
>> +  template< unsigned int precision >
>> +  inline amp::ampf< precision > abs ( const amp::ampf< precision > &a )
>> +  {
>> +    return amp::abs( a );
>> +  }
>> +#endif
>> +
>> +#if HAVE_GMP
>> +  template< unsigned int precision >
>> +  inline Dune::GMPField< precision > sqrt ( const Dune::GMPField< precision > &a )
>> +  {
>> +    return ::sqrt( a );
>> +  }
>> +
>> +  template< unsigned int precision >
>> +  inline Dune::GMPField< precision > abs ( const Dune::GMPField< precision > &a )
>> +  {
>> +    return ::abs( a );
>> +  }
>> +#endif
>> +}
>> +
>> +#endif // #ifndef DUNE_FIELD_HH
>>
>> Copied: trunk/dune/localfunctions/utility/gmpfield.hh (from rev 717, trunk/dune/localfunctions/generic/math/gmpfield.hh)
>> ===================================================================
>> --- trunk/dune/localfunctions/utility/gmpfield.hh	                        (rev 0)
>> +++ trunk/dune/localfunctions/utility/gmpfield.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -0,0 +1,93 @@
>> +#ifndef DUNE_GMPFIELD_HH
>> +#define DUNE_GMPFIELD_HH
>> +
>> +#if HAVE_GMP
>> +
>> +#include <gmpxx.h>
>> +
>> +namespace Dune
>> +{
>> +
>> +  template< unsigned int precision >
>> +  class GMPField
>> +  : public mpf_class
>> +  {
>> +    typedef mpf_class Base;
>> +
>> +  public:
>> +    GMPField ()
>> +    : Base(0,precision)
>> +    {}
>> +
>> +    template< class T >
>> +    GMPField ( const T &v )
>> +    : Base( v,precision )
>> +    {}
>> +
>> +    /*
>> +    GMPField &operator=(const GMPField &other)
>> +    {
>> +      Base(*this) = Base(other);
>> +      return *this;
>> +    }
>> +    */
>> +  };
>> +
>> +
>> +
>> +  template< unsigned int precision >
>> +  inline GMPField< precision >
>> +  operator+ ( const GMPField< precision > &a, const GMPField< precision > &b )
>> +  {
>> +    typedef mpf_class F;
>> +    return ((const F &)a + (const F &)b);
>> +  }
>> +
>> +  template< unsigned int precision >
>> +  inline GMPField< precision >
>> +  operator- ( const GMPField< precision > &a, const GMPField< precision > &b )
>> +  {
>> +    typedef mpf_class F;
>> +    return ((const F &)a - (const F &)b);
>> +  }
>> +
>> +  template< unsigned int precision >
>> +  inline GMPField< precision >
>> +  operator- ( const GMPField< precision > &a )
>> +  {
>> +    typedef mpf_class F;
>> +    return -((const F &)a);
>> +  }
>> +
>> +  template< unsigned int precision >
>> +  inline GMPField< precision >
>> +  operator* ( const GMPField< precision > &a, const GMPField< precision > &b )
>> +  {
>> +    typedef mpf_class F;
>> +    return ((const F &)a * (const F &)b);
>> +  }
>> +
>> +  template< unsigned int precision >
>> +  inline GMPField< precision >
>> +  operator/ ( const GMPField< precision > &a, const GMPField< precision > &b )
>> +  {
>> +    typedef mpf_class F;
>> +    return ((const F &)a / (const F &)b);
>> +  }
>> +
>> +
>> +
>> +  template< unsigned int precision >
>> +  inline std::ostream &
>> +  operator<< ( std::ostream &out, const GMPField< precision > &value )
>> +  {
>> +    return out << value.get_d();
>> +  }
>> +
>> +
>> +}
>> +
>> +#endif // HAVE_GMP
>> +
>> +
>> +#endif // #ifndef DUNE_MULTIPRECISION_HH
>>
>> Modified: trunk/dune/localfunctions/utility/interpolationhelper.hh
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/common/interpolationhelper.hh	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/utility/interpolationhelper.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -2,7 +2,7 @@
>>  #define GENERIC_INTERPOLATIONHELPER_HH
>>  
>>  #include <dune/common/fvector.hh>
>> -#include <dune/localfunctions/generic/math/field.hh>
>> +#include <dune/localfunctions/utility/field.hh>
>>  
>>  namespace Dune 
>>  {
>>
>> Modified: trunk/dune/localfunctions/utility/l2interpolation.hh
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/common/l2interpolation.hh	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/utility/l2interpolation.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -1,8 +1,8 @@
>>  #ifndef DUNE_L2INTERPOLATION_HH
>>  #define DUNE_L2INTERPOLATION_HH
>>  
>> -#include <dune/localfunctions/generic/common/topologyfactory.hh>
>> -#include <dune/localfunctions/generic/math/matrix.hh>
>> +#include <dune/localfunctions/utility/topologyfactory.hh>
>> +#include <dune/localfunctions/utility/matrix.hh>
>>  
>>  #include <dune/localfunctions/generic/quadrature/gaussquadrature.hh>
>>  
>>
>> Copied: trunk/dune/localfunctions/utility/matrix.hh (from rev 717, trunk/dune/localfunctions/generic/math/matrix.hh)
>> ===================================================================
>> --- trunk/dune/localfunctions/utility/matrix.hh	                        (rev 0)
>> +++ trunk/dune/localfunctions/utility/matrix.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -0,0 +1,260 @@
>> +#ifndef DUNE_ALGLIB_MATRIX_HH
>> +#define DUNE_ALGLIB_MATRIX_HH
>> +
>> +#include <cassert>
>> +#include <vector>
>> +
>> +#include <dune/localfunctions/utility/field.hh>
>> +// #include <dune/localfunctions/utility/vector.hh>
>> +
>> +#if HAVE_ALGLIB
>> +#include <alglib/amp.h>
>> +#include <alglib/inv.h>
>> +#endif
>> +
>> +namespace Dune
>> +{
>> +
>> +  template< class F, bool aligned = false >
>> +  class LFEMatrix;
>> +
>> +
>> +  template< class F, bool aligned >
>> +  class LFEMatrix
>> +  {
>> +    typedef LFEMatrix< F, aligned > This;
>> +    // typedef LFEVector< F > Row;
>> +    typedef std::vector< F > Row;
>> +    typedef std::vector<Row> RealMatrix;
>> +
>> +  public:
>> +    typedef F Field;
>> +
>> +    operator const RealMatrix & () const
>> +    {
>> +      return matrix_;
>> +    }
>> +
>> +    operator RealMatrix & ()
>> +    {
>> +      return matrix_;
>> +    }
>> +
>> +    template <class Vector>
>> +    void row( const unsigned int row, Vector &vec ) const
>> +    {
>> +      assert(row<rows());
>> +      for (int i=0;i<cols();++i)
>> +        field_cast(matrix_[row][i], vec[i]);
>> +    }
>> +
>> +    const Field &operator() ( const unsigned int row, const unsigned int col ) const
>> +    {
>> +      assert(row<rows());
>> +      assert(col<cols());
>> +      return matrix_[ row ][ col ];
>> +    }
>> +
>> +    Field &operator() ( const unsigned int row, const unsigned int col )
>> +    {
>> +      assert(row<rows());
>> +      assert(col<cols());
>> +      return matrix_[ row ][ col ];
>> +    }
>> +
>> +    unsigned int rows () const
>> +    {
>> +      return rows_;
>> +    }
>> +
>> +    unsigned int cols () const
>> +    {
>> +      return cols_;
>> +    }
>> +
>> +    const Field *rowPtr ( const unsigned int row ) const
>> +    {
>> +      assert(row<rows());
>> +      return &(matrix_[row][0]);
>> +    }
>> +
>> +    Field *rowPtr ( const unsigned int row )
>> +    {
>> +      assert(row<rows());
>> +      return &(matrix_[row][0]);
>> +    }
>> +
>> +    void resize ( const unsigned int rows, const unsigned int cols )
>> +    {
>> +      matrix_.resize(rows);
>> +      for (unsigned int i=0;i<rows;++i)
>> +        matrix_[i].resize(cols);
>> +      rows_ = rows;
>> +      cols_ = cols;
>> +    }
>> +
>> +    bool invert ()
>> +    {
>> +      assert( rows() == cols() );
>> +      std::vector<unsigned int> p(rows());
>> +      for (unsigned int j=0;j<rows();++j)
>> +        p[j] = j;
>> +      for (unsigned int j=0;j<rows();++j)
>> +      {
>> +        // pivot search
>> +        unsigned int r = j;
>> +        Field max = std::abs( (*this)(j,j) ); 
>> +        for (unsigned int i=j+1;i<rows();++i)
>> +        {
>> +          if ( std::abs( (*this)(i,j) ) > max )
>> +          {
>> +            max = std::abs( (*this)(i,j) ); 
>> +            r = i;
>> +          }
>> +        }
>> +        if (max == 0)
>> +          return false;
>> +        // row swap
>> +        if (r > j) 
>> +        {
>> +          for (unsigned int k=0;k<rows();++k)
>> +            std::swap( (*this)(j,k), (*this)(r,k) );
>> +          std::swap( p[j], p[r] );
>> +        }
>> +        // transformation
>> +        Field hr = Unity<Field>()/(*this)(j,j);
>> +        for (unsigned int i=0;i<rows();++i) 
>> +          (*this)(i,j) *= hr;
>> +        (*this)(j,j) = hr;
>> +        for (unsigned int k=0;k<rows();++k) 
>> +        {
>> +          if (k==j) continue;
>> +          for (unsigned int i=0;i<rows();++i)
>> +          {
>> +            if (i==j) continue;
>> +            (*this)(i,k) -= (*this)(i,j)*(*this)(j,k);
>> +          }
>> +          (*this)(j,k) *= -hr;
>> +        }
>> +      }
>> +      // column exchange
>> +      Row hv(rows());
>> +      for (unsigned int i=0;i<rows();++i)
>> +      {
>> +        for (unsigned int k=0;k<rows();++k)
>> +          hv[ p[k] ] = (*this)(i,k);
>> +        for (unsigned int k=0;k<rows();++k)
>> +          (*this)(i,k) = hv[k];
>> +      }
>> +      return true;
>> +    }
>> +
>> +  private:
>> +    RealMatrix matrix_;
>> +    unsigned int cols_,rows_;
>> +  };
>> +
>> +#if HAVE_ALGLIB
>> +  template< unsigned int precision, bool aligned >
>> +  class LFEMatrix< amp::ampf< precision >, aligned >
>> +  {
>> +  public:
>> +    typedef amp::ampf< precision > Field;
>> +  private:
>> +    typedef LFEMatrix< amp::ampf< precision >, aligned > This;
>> +    typedef ap::template_2d_array< Field, aligned > RealMatrix;
>> +
>> +  public:
>> +    operator const RealMatrix & () const
>> +    {
>> +      return matrix_;
>> +    }
>> +
>> +    operator RealMatrix & ()
>> +    {
>> +      return matrix_;
>> +    }
>> +
>> +    template <class Vector>
>> +    void row( const unsigned int row, Vector &vec ) const
>> +    {
>> +      assert(row<rows());
>> +      for (unsigned int i=0;i<cols();++i)
>> +        field_cast(matrix_(row,i), vec[i]);
>> +    }
>> +
>> +    const Field &operator() ( const unsigned int row, const unsigned int col ) const
>> +    {
>> +      assert(row<rows());
>> +      assert(col<cols());
>> +      return matrix_( row, col );
>> +    }
>> +
>> +    Field &operator() ( const unsigned int row, const unsigned int col )
>> +    {
>> +      assert(row<rows());
>> +      assert(col<cols());
>> +      return matrix_( row, col );
>> +    }
>> +
>> +    unsigned int rows () const
>> +    {
>> +      return matrix_.gethighbound( 1 )+1;
>> +    }
>> +
>> +    unsigned int cols () const
>> +    {
>> +      return matrix_.gethighbound( 2 )+1;
>> +    }
>> +
>> +    const Field *rowPtr ( const unsigned int row ) const
>> +    {
>> +      assert(row<rows());
>> +      const int lastCol = matrix_.gethighbound( 2 );
>> +      ap::const_raw_vector< Field > rowVector = matrix_.getrow( row, 0, lastCol );
>> +      assert( (rowVector.GetStep() == 1) && (rowVector.GetLength() == lastCol+1) );
>> +      return rowVector.GetData();
>> +    }
>> +
>> +    Field *rowPtr ( const unsigned int row )
>> +    {
>> +      assert(row<rows());
>> +      const int lastCol = matrix_.gethighbound( 2 );
>> +      ap::raw_vector< Field > rowVector = matrix_.getrow( row, 0, lastCol );
>> +      assert( (rowVector.GetStep() == 1) && (rowVector.GetLength() == lastCol+1) );
>> +      return rowVector.GetData();
>> +    }
>> +
>> +    void resize ( const unsigned int rows, const unsigned int cols )
>> +    {
>> +      matrix_.setbounds( 0, rows-1, 0, cols-1 );
>> +    }
>> +
>> +    bool invert ()
>> +    {
>> +      assert( rows() == cols() );
>> +      return inv::rmatrixinverse< precision >( matrix_, rows() );
>> +    }
>> +
>> +  private:
>> +    RealMatrix matrix_;
>> +  };
>> +#endif
>> +
>> +  template< class Field, bool aligned >
>> +  inline std::ostream &operator<<(std::ostream &out, const LFEMatrix<Field,aligned> &mat) 
>> +  {
>> +    for (unsigned int r=0;r<mat.rows();++r)
>> +    {
>> +      out << field_cast<double>(mat(r,0));
>> +      for (unsigned int c=1;c<mat.cols();++c) 
>> +      {
>> +        out << " , " << field_cast<double>(mat(r,c));
>> +      }
>> +      out << std::endl;
>> +    }
>> +    return out;
>> +  }
>> +}
>> +
>> +#endif // #ifndef DUNE_ALGLIB_MATRIX_HH
>>
>> Modified: trunk/dune/localfunctions/utility/monomialbasis.hh
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/common/monomialbasis.hh	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/utility/monomialbasis.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -8,11 +8,11 @@
>>  
>>  #include <dune/grid/genericgeometry/topologytypes.hh>
>>  
>> -#include <dune/localfunctions/generic/math/field.hh>
>> +#include <dune/localfunctions/utility/field.hh>
>>  
>> -#include <dune/localfunctions/generic/common/topologyfactory.hh>
>> -#include <dune/localfunctions/generic/common/multiindex.hh>
>> -#include <dune/localfunctions/generic/common/tensor.hh>
>> +#include <dune/localfunctions/utility/topologyfactory.hh>
>> +#include <dune/localfunctions/utility/multiindex.hh>
>> +#include <dune/localfunctions/utility/tensor.hh>
>>  
>>  namespace Dune
>>  {
>>
>> Modified: trunk/dune/localfunctions/utility/multiindex.hh
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/common/multiindex.hh	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/utility/multiindex.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -6,7 +6,7 @@
>>  
>>  #include <dune/common/fvector.hh>
>>  
>> -#include <dune/localfunctions/generic/math/field.hh>
>> +#include <dune/localfunctions/utility/field.hh>
>>  
>>  namespace Dune
>>  {
>>
>> Modified: trunk/dune/localfunctions/utility/polynomialbasis.hh
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/common/polynomialbasis.hh	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/utility/polynomialbasis.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -7,10 +7,10 @@
>>  
>>  #include <dune/localfunctions/common/localbasis.hh>
>>  
>> -#include <dune/localfunctions/generic/common/coeffmatrix.hh>
>> -#include <dune/localfunctions/generic/common/monomialbasis.hh>
>> -#include <dune/localfunctions/generic/common/multiindex.hh>
>> -#include <dune/localfunctions/generic/common/basisevaluator.hh>
>> +#include <dune/localfunctions/utility/coeffmatrix.hh>
>> +#include <dune/localfunctions/utility/monomialbasis.hh>
>> +#include <dune/localfunctions/utility/multiindex.hh>
>> +#include <dune/localfunctions/utility/basisevaluator.hh>
>>  
>>  namespace Dune
>>  {
>>
>> Modified: trunk/dune/localfunctions/utility/tensor.hh
>> ===================================================================
>> --- trunk/dune/localfunctions/generic/common/tensor.hh	2010-01-18 10:53:34 UTC (rev 717)
>> +++ trunk/dune/localfunctions/utility/tensor.hh	2010-01-18 13:25:13 UTC (rev 718)
>> @@ -4,7 +4,7 @@
>>  #include <vector>
>>  #include <ostream>
>>  
>> -#include <dune/localfunctions/generic/math/field.hh>
>> +#include <dune/localfunctions/utility/field.hh>
>>  #include <dune/common/fvector.hh>
>>  #include <dune/common/misc.hh>
>>  
>>
>>
>> _______________________________________________
>> Dune-Commit mailing list
>> Dune-Commit at dune-project.org
>> http://lists.dune-project.org/mailman/listinfo/dune-commit
>>   
> 
> 

-- 
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