5#ifndef DUNE_GRID_ALBERTAGRID_GEOMETRYREFERENCE_HH
6#define DUNE_GRID_ALBERTAGRID_GEOMETRYREFERENCE_HH
24 template<
class Implementation >
25 class GeometryReference
27 typedef GeometryReference< Implementation > This;
30 static const int mydimension = Implementation::mydimension;
31 static const int coorddimension = Implementation::coorddimension;
33 typedef typename Implementation::ctype ctype;
35 typedef typename Implementation::LocalCoordinate LocalCoordinate;
36 typedef typename Implementation::GlobalCoordinate GlobalCoordinate;
38 typedef typename Implementation::JacobianInverseTransposed JacobianInverseTransposed;
39 typedef typename Implementation::JacobianTransposed JacobianTransposed;
43 template<
class Implementation_T>
44 using JacobianInverseOfImplementation =
decltype(
typename Implementation_T::JacobianInverse{std::declval<Implementation_T>().jacobianInverse(std::declval<LocalCoordinate>())});
46 using JacobianInverseDefault =
decltype(
transpose(std::declval<JacobianInverseTransposed>()));
48 template<
class Implementation_T>
49 using JacobianOfImplementation =
decltype(
typename Implementation_T::Jacobian{std::declval<Implementation_T>().jacobian(std::declval<LocalCoordinate>())});
51 using JacobianDefault =
decltype(
transpose(std::declval<JacobianTransposed>()));
54 template <
class I = Implementation>
55 [[deprecated(
"Geometry implementatons are required to provide a jacobian(local) method. The default implementation is deprecated and will be removed after release 2.9")]]
56 auto deprecatedDefaultJacobian (
const LocalCoordinate& local )
const {
57 return transpose(jacobianTransposed(local));
60 template <
class I = Implementation>
61 [[deprecated(
"Geometry implementatons are required to provide a jacobianInverse(local) method. The default implementation is deprecated and will be removed after release 2.9")]]
62 auto deprecatedDefaultJacobianInverse (
const LocalCoordinate& local )
const {
63 return transpose(jacobianInverseTransposed(local));
68 using Jacobian = Std::detected_or_t<JacobianDefault, JacobianOfImplementation, Implementation>;
69 using JacobianInverse = Std::detected_or_t<JacobianInverseDefault, JacobianInverseOfImplementation, Implementation>;
71 explicit GeometryReference (
const Implementation &impl )
77 bool affine()
const {
return impl().affine(); }
79 int corners ()
const {
return impl().corners(); }
80 GlobalCoordinate corner (
int i )
const {
return impl().corner( i ); }
81 GlobalCoordinate center ()
const {
return impl().center(); }
83 GlobalCoordinate global (
const LocalCoordinate &local )
const
85 return impl().global( local );
88 LocalCoordinate local (
const GlobalCoordinate &global )
const
90 return impl().local( global );
93 ctype integrationElement (
const LocalCoordinate &local )
const
95 return impl().integrationElement( local );
98 ctype volume ()
const {
return impl().volume(); }
100 JacobianTransposed jacobianTransposed (
const LocalCoordinate &local )
const
102 return impl().jacobianTransposed( local );
105 JacobianInverseTransposed jacobianInverseTransposed (
const LocalCoordinate &local )
const
107 return impl().jacobianInverseTransposed( local );
110 Jacobian jacobian (
const LocalCoordinate& local )
const
112 if constexpr(Std::is_detected_v<JacobianOfImplementation, Implementation>)
113 return impl().jacobian(local);
115 return deprecatedDefaultJacobian(local);
118 JacobianInverse jacobianInverse (
const LocalCoordinate &local )
const
120 if constexpr(Std::is_detected_v<JacobianInverseOfImplementation, Implementation>)
121 return impl().jacobianInverse(local);
123 return deprecatedDefaultJacobianInverse(local);
126 const Implementation &impl ()
const {
return *impl_; }
129 const Implementation *impl_;
136 template<
int mydim,
int cdim,
class Gr
id >
137 class LocalGeometryReference
138 :
public GeometryReference< typename std::remove_const< Grid >::type::Traits::template Codim< std::remove_const< Grid >::type::dimension - mydim >::LocalGeometryImpl >
140 typedef typename std::remove_const< Grid >::type::Traits::template Codim< std::remove_const< Grid >::type::dimension - mydim >::LocalGeometryImpl Implementation;
143 LocalGeometryReference (
const Implementation &impl )
144 : GeometryReference< Implementation >( impl )
153 template<
class Implementation >
154 const int GeometryReference< Implementation >::mydimension;
156 template<
class Implementation >
157 const int GeometryReference< Implementation >::coorddimension;
Traits for type conversions and type information.
Wrapper and interface classes for element geometries.
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
Dune namespace.
Definition: alignedallocator.hh:13
auto transpose(const Matrix &matrix)
Return the transposed of the given matrix.
Definition: transpose.hh:183
A unique label for each type of element that can occur in a grid.