Explicit template instantiation fails
I just tried to make an explicit template instantiation of a foamgrid class, but I get lots of compiler errors, mostly of the form of a const-ness problem:
precompiled.hpp
#include <dune/foamgrid/foamgrid.hh>
namespace Dune {
extern template class FoamGrid<2,3>;
}
precompiled.cpp
#include <config.h>
#include "precompiled.hpp"
namespace Dune {
template class FoamGrid<2,3>;
}
e.g.
foamgrid/foamgrid.cc: In instantiation of ‘void Dune::FoamGrid<dimgrid, dimworld, ctype>::refineSimplexElement(Dune::FoamGridEntityImp<1, dimgrid, dimworld, ct>&, int) [with int dimgrid = 2; int dimworld = 3; ct = double]’:
precompiled.cpp:4:18: required from here
foamgrid/foamgrid.cc:820:36: error: assignment of read-only location ‘element.Dune::FoamGridEntityImp<1, 2, 3, double>::vertex_.std::array<const Dune::FoamGridEntityImp<0, 2, 3, double>*, 2>::operator[](((std::array<const Dune::FoamGridEntityImp<0, 2, 3, double>*, 2>::size_type)c))->Dune::FoamGridEntityImp<0, 2, 3, double>::sons_.std::array<Dune::FoamGridEntityImp<0, 2, 3, double>*, 1>::operator[](0)’
820 | element.vertex_[c]->sons_[0] = &newVertex;