#1653 Cannot access second shape function derivatives through the virtual interface
Metadata
Property | Value |
---|---|
Reported by | Oliver Sander (oliver.sander@tu-dresden.de) |
Reported at | May 18, 2015 21:10 |
Type | Bug Report |
Version | Git (pre2.4) [cmake] |
Operating System | Unspecified / All |
Description
I am trying to access second order derivatives of a Pk2DLocalFiniteElement
. This works nicely when using that class directly, but it fails to build when I try to wrap the class in the virtual interface. Here is a small test program and the compiler error it triggers.
#include <config.h>
#include <dune/localfunctions/lagrange/pqkfactory.hh>
using namespace Dune;
int main()
{
const int dim = 2;
const int k = 2;
typedef typename Dune::PQkLocalFiniteElementCache<double, double, dim, k> FiniteElementCache;
typedef typename FiniteElementCache::FiniteElementType FiniteElement;
FiniteElementCache feFactory;
const FiniteElement* finiteElement;
GeometryType triangle;
triangle.makeTriangle();
finiteElement = &(feFactory.get(triangle));
const FieldVector<double,dim> pos = {0,0};
std::array<int, 2> directions = {1,0};
std::vector<FieldVector<double,1> > out;
finiteElement->localBasis().template evaluate<2>(directions, pos, out);
}
Error:
[100%] Building CXX object examples/CMakeFiles/test_functions_evaluate2.dir/test_functions_evaluate2.cc.o
In file included from /home/sander/dune/dune-localfunctions/dune/localfunctions/lagrange/pqkfactory.hh:10:0,
from /home/sander/dune/dune-functions/examples/test_functions_evaluate2.cc:3:
/home/sander/dune/dune-localfunctions/dune/localfunctions/common/virtualinterface.hh: In instantiation of ‘void Dune::LocalBasisVirtualInterface<T>::evaluate(const std::array<int, k>&, const typename Dune::LocalBasisVirtualInterface<T>::Traits::DomainType&, std::vector<typename T::RangeType>&) const [with int k = 2; T = Dune::LocalBasisTraits<double, 2, Dune::FieldVector<double, 2>, double, 1, Dune::FieldVector<double, 1>, Dune::FieldMatrix<double, 1, 2>, 0>; typename Dune::LocalBasisVirtualInterface<T>::Traits::DomainType = Dune::FieldVector<double, 2>; typename T::RangeType = Dune::FieldVector<double, 1>]’:
/home/sander/dune/dune-functions/examples/test_functions_evaluate2.cc:24:72: required from here
/home/sander/dune/dune-localfunctions/dune/localfunctions/common/virtualinterface.hh:211:44: error: invalid initialization of reference of type ‘const OrderKBaseInterface& {aka const Dune::LocalBasisVirtualInterfaceBase<Dune::LocalBasisTraits<double, 2, Dune::FieldVector<double, 2>, double, 1, Dune::FieldVector<double, 1>, Dune::FieldMatrix<double, 1, 2>, 2> >&}’ from expression of type ‘const Dune::LocalBasisVirtualInterface<Dune::LocalBasisTraits<double, 2, Dune::FieldVector<double, 2>, double, 1, Dune::FieldVector<double, 1>, Dune::FieldMatrix<double, 1, 2>, 0> >’
const OrderKBaseInterface& asBase = *this;