Commit 44a6af7c authored by Carsten Gräser's avatar Carsten Gräser

Update makeRefinedSimplexGeometry

* Add documentation
* Add support for operator() function interface
* Deprecate support for f.evaluate() function interface

The interface transition is done by borrowing
`Dune::Impl::makeFunctionWithCallOperator()`
from dune-localfunctions. This allows to support both interfaces
for transition while giving a deprecation warning only if you
pass an old style function.
parent 7a3c7508
......@@ -8,6 +8,10 @@
#include <dune/geometry/type.hh>
#include <dune/geometry/affinegeometry.hh>
// Borrow internal helper from dune-localfunctions
// for transition of function interface
#include <dune/localfunctions/common/localinterpolation.hh>
template <class ct, int localdim, int worlddim>
class RefinedSimplexGeometry {
public:
......@@ -258,12 +262,22 @@ class RefinedSimplexGeometry<ct,2,3> {
}
};
template <class Element, class Parameterization>
RefinedSimplexGeometry<typename Element::Geometry::ctype,2,3> makeRefinedSimplexGeometry(const Element& element, const Parameterization& parameterization)
/**
* \brief Create RefinedSimplexGeometry with transformed geometry
*
* \param element The element whose geometry should be transformed
* \param transform The transformation mapping global element coordinated to transformed global coordinates
*
* This will only transform edge mid points but leave the vertices in place.
*/
template <class Element, class Transformation>
RefinedSimplexGeometry<typename Element::Geometry::ctype,2,3> makeRefinedSimplexGeometry(const Element& element, const Transformation& transformation)
{
if(not element.type().isTriangle())
DUNE_THROW(Dune::NotImplemented, "Free method makeRefinedSimplexGeometry(.,.) is only implemented for 2D simplex elements");
using GlobalCoordinate = typename Element::Geometry::GlobalCoordinate;
auto&& transformationF = Dune::Impl::makeFunctionWithCallOperator<GlobalCoordinate>(transformation);
std::array<typename Element::Geometry::GlobalCoordinate,6> movedVirtualVertices;
typename Element::Geometry eltGeometry = element.geometry();
......@@ -273,8 +287,7 @@ RefinedSimplexGeometry<typename Element::Geometry::ctype,2,3> makeRefinedSimplex
for (std::size_t i=0; i<(std::size_t)element.subEntities(Element::dimension - 1); ++i)
{
typename Element::Geometry::GlobalCoordinate y;
parameterization.evaluate(element.template subEntity<Element::dimension -1>(i).geometry().center(), y);
auto y = transformationF(element.template subEntity<Element::dimension -1>(i).geometry().center());
movedVirtualVertices[eltGeometry.corners() + i] = y;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment