dune-grid  2.11
concepts/geometry.hh
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
2 // SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
3 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
4 // vi: set et ts=4 sw=2 sts=2:
5 #ifndef DUNE_GRID_CONCEPTS_GEOMETRY_HH
6 #define DUNE_GRID_CONCEPTS_GEOMETRY_HH
7 
8 #include <concepts>
9 
10 #include <dune/common/fmatrix.hh>
11 #include <dune/common/fvector.hh>
12 #include <dune/geometry/type.hh>
14 
15 namespace Dune::Concept {
16 
17 template<class R>
18 concept ReferenceElement = true;
19 
20 static_assert(ReferenceElement< Archetypes::ReferenceElement >);
21 
22 
28 template<class G>
29 concept Geometry = requires(const G g, typename G::GlobalCoordinate global, typename G::LocalCoordinate local)
30 {
31  typename G::ctype;
32  { G::mydimension } -> std::convertible_to<int>;
33  { G::coorddimension } -> std::convertible_to<int>;
34  { g.type() } -> std::same_as<Dune::GeometryType>;
35  { g.affine() } -> std::convertible_to<bool>;
36  { g.corners() } -> std::convertible_to<int>;
37  { g.corner(/*i*/ int{}) } -> std::convertible_to<typename G::GlobalCoordinate>;
38  { g.global(local) } -> std::convertible_to<typename G::GlobalCoordinate>;
39  { g.local(global) } -> std::convertible_to<typename G::LocalCoordinate>;
40  { g.integrationElement(local) } -> std::convertible_to<typename G::Volume>;
41  { g.volume() } -> std::convertible_to<typename G::Volume>;
42  { g.center() } -> std::convertible_to<typename G::GlobalCoordinate>;
43  { g.jacobian(local) } -> std::convertible_to<typename G::Jacobian>;
44  { g.jacobianInverse(local) } -> std::convertible_to<typename G::JacobianInverse>;
45  { g.jacobianTransposed(local) } -> std::convertible_to<typename G::JacobianTransposed>;
46  { g.jacobianInverseTransposed(local) } -> std::convertible_to<typename G::JacobianInverseTransposed>;
48 };
49 
50 static_assert(Geometry< Archetypes::Geometry<2,3> >);
51 
52 } // end namespace Dune::Concept
53 
54 #endif // DUNE_GRID_CONCEPTS_GEOMETRY_HH
Wrapper class for geometries.
Definition: common/geometry.hh:70
GeometryType type() const
Return the type of the reference element. The type can be used to access the Dune::ReferenceElement.
Definition: common/geometry.hh:194
auto referenceElement(const Geometry< mydim, cdim, GridImp, GeometryImp > &geo) -> decltype(referenceElement(geo, geo.impl()))
Definition: common/geometry.hh:558
concept ReferenceElement
Definition: concepts/geometry.hh:18
Definition: concepts/datahandle.hh:14