Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef DUNE_GFE_FUNCTIONS_LOCALISOMETRYCOMPONENTFUNCTION_HH
#define DUNE_GFE_FUNCTIONS_LOCALISOMETRYCOMPONENTFUNCTION_HH
#include <dune/gfe/bendingisometryhelper.hh>
namespace Dune::GFE::Impl
{
/**
* \brief Local isometry component function that can be used as a Dune::Functions::DifferentiableFunction
*
* \tparam ctype Type used for coordinates on the reference element
* \tparam LocalInterpolation Local function mapping into a product manifold of type RealTuple x Rotations
*/
template<class ctype, class LocalInterpolation>
class LocalIsometryComponentFunction
{
public:
LocalIsometryComponentFunction(LocalInterpolation& localInterpolation,
const int component)
: localInterpolation_(localInterpolation),
component_(component)
{}
auto operator() (const Dune::FieldVector<ctype,2>& x) const
{
return localInterpolation_.evaluate(x)[Dune::Indices::_0].globalCoordinates()[component_];
}
/**
* \brief Obtain derivative function
*/
friend auto derivative(const LocalIsometryComponentFunction& p)
{
return [&p](const Dune::FieldVector<ctype,2>& x)
{
auto derivativeQuaternion = p.localInterpolation_.evaluate(x)[Dune::Indices::_1];
auto derivativeMatrix = Rotation<ctype,3>::quaternionToMatrix(derivativeQuaternion);
auto reducedDerivativeMatrix = cancelLastMatrixColumn(derivativeMatrix);
return reducedDerivativeMatrix[p.component_];
};
}
LocalInterpolation& localInterpolation_;
const int component_;
};
} // end namespace Dune::GFE::Impl
#endif //#ifndef DUNE_GFE_FUNCTIONS_LOCALISOMETRYCOMPONENTFUNCTION_HH