[dune-pdelab] Compilation error for Dune::PDELab::FunctionToGridFunctionAdapter

Eike Mueller E.Mueller at bath.ac.uk
Tue Sep 27 18:30:16 CEST 2011


Dear all,

to compare to my numerical to the exact solution I'm trying to convert 
the following function

template <class DomainType, class RangeType>
class ExactSolution : public Dune::Function<DomainType,RangeType> {
   public:
     virtual void evaluate(const DomainType& x,
                           RangeType& y) const {
       y = 0.0;  // Change to correct expression
   }
   private:
     const DomainType L;
};

to a grid function as follows:

   typedef typename DGF::Traits::GridViewType GV;
   typedef typename DGF::Traits::DomainType DT;
   GV gv = udgf.getGridView();
   DT L;
   L[0] = model_parameters.grid.size.x;
   L[1] = model_parameters.grid.size.y;
   L[2] = model_parameters.grid.size.z;

   typedef ExactSolution<typename DGF::Traits::DomainType, typename 
DGF::Traits::RangeType> ES;
   ES exactsolution(L);
   typedef typename Dune::PDELab::FunctionToGridFunctionAdapter<GV, ES> 
   ExactGridSolution;
   ExactGridSolution uexactdgf(gv,exactsolution);

(udgf is the numerical solution, i.e. a grid function). Now, this does 
not compile because the Adapter tries to access 
ES::Traits::RangeFieldType, which does not exist because I derived my 
function from the Function class which only contains DomainType and 
RangeType in its Traits. Do I need to use a different base class or am I 
misreading the documentation 
(http://www.dune-project.org/doc-pdelab-2.1snapshot/doxygen/html/classDune_1_1PDELab_1_1FunctionToGridFunctionAdapter.html), 
which links to Function as defined in dune/common/function.hh?

Or is there a better way of doing this altogether?

Thanks a lot,

Eike




More information about the dune-pdelab mailing list