Make interface for vectors in interpolation more generic
In functionspacebases/interpolate.hpp
the vector types that are allowed as coeff in the method interpolate()
are restricted to vectors with a fixed interface, especially member functions like resize()
are expected to exist. This is not the case for all linear-algebra libraries that may be used with dune-functions, e.g.
- MTL4 implements a member function with the name
change_dim()
- Trilinos EPetra has an upper-case method named
Resize()
- Other libraries do not at all provide member functions for the task
Idea: member functions can not be changed in an external library and a wrapper class is not a nice workaround, thus instead of requiring member functions, just call free-functions that can be extended for all external libraries easily.
Instead of vector.resize(size)
call resize(vector, size)
. To allow for all vector classes with a resize member function to be called, a fallback implementation that is enabled if a member-function resize exists, can be provided.
An example implementation is given in the fork-branch https://gitlab.dune-project.org/simon.praetorius/dune-functions/tree/issue/non-intrusive-resize