dune-grid  2.9.0
identitygridgeometry.hh
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 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_IDENTITYGRIDGEOMETRY_HH
6 #define DUNE_IDENTITYGRIDGEOMETRY_HH
7 
12 #include <dune/common/fmatrix.hh>
13 #include <dune/common/typetraits.hh>
15 
16 namespace Dune {
17 
18  template<int mydim, int coorddim, class GridImp>
20  public GeometryDefaultImplementation <mydim, coorddim, GridImp, IdentityGridGeometry>
21  {
22  private:
23 
24  typedef typename GridImp::ctype ctype;
25 
26 
27  public:
28 
29  // The codimension of this entitypointer wrt the host grid
30  constexpr static int CodimInHostGrid = GridImp::HostGridType::dimension - mydim;
31  constexpr static int DimensionWorld = GridImp::HostGridType::dimensionworld;
32 
33  // select appropriate hostgrid geometry via typeswitch
34  typedef typename GridImp::HostGridType::Traits::template Codim<CodimInHostGrid>::Geometry HostGridGeometryType;
35  typedef typename GridImp::HostGridType::Traits::template Codim<CodimInHostGrid>::Geometry HostGridLocalGeometryType;
36 
37  typedef typename std::conditional<coorddim==DimensionWorld, HostGridGeometryType, HostGridLocalGeometryType>::type HostGridGeometry;
38 
40  typedef typename HostGridGeometryType::JacobianInverseTransposed JacobianInverseTransposed;
41  typedef typename HostGridGeometryType::JacobianTransposed JacobianTransposed;
42 
43 
47  : hostGeometry_(hostGeometry)
48  {}
49 
50 
53  GeometryType type () const {
54  return hostGeometry_.type();
55  }
56 
57  // return wether we have an affine mapping
58  bool affine() const {
59  return hostGeometry_.affine();
60  }
61 
63  int corners () const {
64  return hostGeometry_.corners();
65  }
66 
67 
69  const FieldVector<ctype, coorddim> corner (int i) const {
70  return hostGeometry_.corner(i);
71  }
72 
73 
76  FieldVector<ctype, coorddim> global (const FieldVector<ctype, mydim>& local) const {
77  return hostGeometry_.global(local);
78  }
79 
83  jacobianTransposed ( const FieldVector<ctype, mydim>& local ) const {
84  return hostGeometry_.jacobianTransposed(local);
85  }
86 
89  FieldVector<ctype, mydim> local (const FieldVector<ctype, coorddim>& global) const {
90  return hostGeometry_.local(global);
91  }
92 
93 
95  bool checkInside(const FieldVector<ctype, mydim> &local) const {
96  return hostGeometry_.checkInside(local);
97  }
98 
99 
102  ctype integrationElement (const FieldVector<ctype, mydim>& local) const {
103  return hostGeometry_.integrationElement(local);
104  }
105 
106 
108  JacobianInverseTransposed jacobianInverseTransposed (const FieldVector<ctype, mydim>& local) const {
109  return hostGeometry_.jacobianInverseTransposed(local);
110  }
111 
112 
114 
115  };
116 
117 } // namespace Dune
118 
119 #endif
Include standard header files.
Definition: agrid.hh:60
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
Default implementation for class Geometry.
Definition: common/geometry.hh:406
Definition: identitygridgeometry.hh:21
bool checkInside(const FieldVector< ctype, mydim > &local) const
Returns true if the point is in the current element.
Definition: identitygridgeometry.hh:95
JacobianInverseTransposed jacobianInverseTransposed(const FieldVector< ctype, mydim > &local) const
The Jacobian matrix of the mapping from the reference element to this element.
Definition: identitygridgeometry.hh:108
JacobianTransposed jacobianTransposed(const FieldVector< ctype, mydim > &local) const
Return the transposed of the Jacobian.
Definition: identitygridgeometry.hh:83
bool affine() const
Definition: identitygridgeometry.hh:58
constexpr static int DimensionWorld
Definition: identitygridgeometry.hh:31
IdentityGridGeometry(const HostGridGeometry &hostGeometry)
Definition: identitygridgeometry.hh:46
GeometryType type() const
Return the element type identifier.
Definition: identitygridgeometry.hh:53
FieldVector< ctype, coorddim > global(const FieldVector< ctype, mydim > &local) const
Maps a local coordinate within reference element to global coordinate in element
Definition: identitygridgeometry.hh:76
HostGridGeometryType::JacobianTransposed JacobianTransposed
Definition: identitygridgeometry.hh:41
const FieldVector< ctype, coorddim > corner(int i) const
access to coordinates of corners. Index is the number of the corner
Definition: identitygridgeometry.hh:69
ctype integrationElement(const FieldVector< ctype, mydim > &local) const
Definition: identitygridgeometry.hh:102
HostGridGeometry hostGeometry_
Definition: identitygridgeometry.hh:113
GridImp::HostGridType::Traits::template Codim< CodimInHostGrid >::Geometry HostGridLocalGeometryType
Definition: identitygridgeometry.hh:35
std::conditional< coorddim==DimensionWorld, HostGridGeometryType, HostGridLocalGeometryType >::type HostGridGeometry
Definition: identitygridgeometry.hh:37
GridImp::HostGridType::Traits::template Codim< CodimInHostGrid >::Geometry HostGridGeometryType
Definition: identitygridgeometry.hh:34
HostGridGeometryType::JacobianInverseTransposed JacobianInverseTransposed
type of jacobian transposed
Definition: identitygridgeometry.hh:40
int corners() const
return the number of corners of this element. Corners are numbered 0...n-1
Definition: identitygridgeometry.hh:63
constexpr static int CodimInHostGrid
Definition: identitygridgeometry.hh:30
Wrapper and interface classes for element geometries.