[Dune] GridFunctionGlobalEvalDefault is no GridFunction ?!

Uli Sack usack at math.fu-berlin.de
Thu Sep 11 16:54:14 CEST 2008


Hi Dune-community!

I have a method that takes a GridFunction as parameter. The compiler 
throws an error if I try to plug in a LeafP1Function or an object of a 
class I derived from GridFunctionGlobalEvalDefault. Also dynamic_casts 
of objects of either class to a GridFunction fail.
I hope that someone can explain these things to me. I am at a loss. The 
following gives the details of my problem.

I wrote a class that implements the composition of two functions 
deriving from FunctionBase (ComposedFunction). Now if the inner function 
is a GridFunction I want to be able to use the composition as a 
GridFunction as well. Therefore I wrote ComposedGridFunction deriving 
from ComposedFunction AND GridFunction(Default). It's constructor takes 
a FunctionBase for the outer function and a GridFunction for the inner 
function and then calls the constructor of ComposedFunction with these 
two arguments in the initializer list. Now if I try to compose an 
arbitrary outer function (let's say TestFunction (see attachment)) with 
a LeafP1Function as a ComposedFunction it works as expected. But trying 
to create a ComposedGridFunction with the same two function-objects 
gives the compiler error:

test.cc:453: error: no matching function for call to 
‘ComposedGridFunction<Dune::ALUSimplexGrid<2, 2>, double, double, 1, 
1>::ComposedGridFunction(TestFunction<double, double, 1, 1>&, 
Dune::LeafP1Function<Dune::ALUSimplexGrid<2, 2>, double, 1>&)’
/home/cocktail/usack/entwicklung/dune/ag-common/dune/ag-common/composedgridfunction.hh:32: 
note: candidates are: ComposedGridFunction<GridType, BT, CT, Bdim, 
Cdim>::ComposedGridFunction(Dune::FunctionBase<BT, CT, Bdim, Cdim>&, 
Dune::GridFunction<GridType, BT, Bdim>&) [with GridType = 
Dune::ALUSimplexGrid<2, 2>, BT = double, CT = double, int Bdim = 1, int 
Cdim = 1]
/home/cocktail/usack/entwicklung/dune/ag-common/dune/ag-common/composedgridfunction.hh:21: 
note:                 ComposedGridFunction<Dune::ALUSimplexGrid<2, 2>, 
double, double, 1, 1>::ComposedGridFunction(const 
ComposedGridFunction<Dune::ALUSimplexGrid<2, 2>, double, double, 1, 1>&)


The same thing happens if I plug in a TestGridFunction2 object that 
derives from GridFunctionGlobalEvalDefault whereas it works well with a 
TestGridFunction that derives from GridFunctionDefault.

Hope someone out there has the necessary insight into c++ to give a 
logical explanation why these things don't work so I can fix the code in 
order that they do.

Tnx loads in advance,
Uli
-- 
************************************************************************
* Uli Sack                     ** email: usack at math.fu-berlin.de       *
* Freie Universität Berlin     ** phone: + 49 (30) 838 75250           *
* Institut für Mathematik      **                                      *
* Arnimallee 6                 ** -------------------------------------*
* 14195 Berlin, Germany        ** Member of MATHEON (www.matheon.de)   *
************************************************************************
-------------- next part --------------
A non-text attachment was scrubbed...
Name: composedfunction.hh
Type: text/x-c++hdr
Size: 1926 bytes
Desc: not available
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20080911/422d71bd/attachment.hh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: composedgridfunction.hh
Type: text/x-c++hdr
Size: 2338 bytes
Desc: not available
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20080911/422d71bd/attachment-0001.hh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testfunction.hh
Type: text/x-c++hdr
Size: 555 bytes
Desc: not available
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20080911/422d71bd/attachment-0002.hh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testgridfunction.hh
Type: text/x-c++hdr
Size: 784 bytes
Desc: not available
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20080911/422d71bd/attachment-0003.hh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testgridfunction2.hh
Type: text/x-c++hdr
Size: 910 bytes
Desc: not available
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20080911/422d71bd/attachment-0004.hh>


More information about the Dune mailing list