Dune Core Modules (2.6.0)

geometryreference.hh
Go to the documentation of this file.
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 #ifndef DUNE_GRID_ALBERTAGRID_GEOMETRYREFERENCE_HH
4 #define DUNE_GRID_ALBERTAGRID_GEOMETRYREFERENCE_HH
5 
11 
12 #include <dune/geometry/type.hh>
13 
15 
16 namespace Dune
17 {
18 
19  // GeometryReference
20  // -----------------
21 
22  template< class Implementation >
23  class GeometryReference
24  {
25  typedef GeometryReference< Implementation > This;
26 
27  public:
28  static const int mydimension = Implementation::mydimension;
29  static const int coorddimension = Implementation::coorddimension;
30 
31  typedef typename Implementation::ctype ctype;
32 
33  typedef typename Implementation::LocalCoordinate LocalCoordinate;
34  typedef typename Implementation::GlobalCoordinate GlobalCoordinate;
35 
36  typedef typename Implementation::JacobianInverseTransposed JacobianInverseTransposed;
37  typedef typename Implementation::JacobianTransposed JacobianTransposed;
38 
39  explicit GeometryReference ( const Implementation &impl )
40  : impl_( &impl )
41  {}
42 
43  GeometryType type () const { return impl().type(); }
44 
45  bool affine() const { return impl().affine(); }
46 
47  int corners () const { return impl().corners(); }
48  GlobalCoordinate corner ( int i ) const { return impl().corner( i ); }
49  GlobalCoordinate center () const { return impl().center(); }
50 
51  GlobalCoordinate global ( const LocalCoordinate &local ) const
52  {
53  return impl().global( local );
54  }
55 
56  LocalCoordinate local ( const GlobalCoordinate &global ) const
57  {
58  return impl().local( global );
59  }
60 
61  ctype integrationElement ( const LocalCoordinate &local ) const
62  {
63  return impl().integrationElement( local );
64  }
65 
66  ctype volume () const { return impl().volume(); }
67 
68  JacobianTransposed jacobianTransposed ( const LocalCoordinate &local ) const
69  {
70  return impl().jacobianTransposed( local );
71  }
72 
73  JacobianInverseTransposed jacobianInverseTransposed ( const LocalCoordinate &local ) const
74  {
75  return impl().jacobianInverseTransposed( local );
76  }
77 
78  const Implementation &impl () const { return *impl_; }
79 
80  private:
81  const Implementation *impl_;
82  };
83 
84 
85  // LocalGeometryReference
86  // -----------------------
87 
88  template< int mydim, int cdim, class Grid >
89  class LocalGeometryReference
90  : public GeometryReference< typename std::remove_const< Grid >::type::Traits::template Codim< std::remove_const< Grid >::type::dimension - mydim >::LocalGeometryImpl >
91  {
92  typedef typename std::remove_const< Grid >::type::Traits::template Codim< std::remove_const< Grid >::type::dimension - mydim >::LocalGeometryImpl Implementation;
93 
94  public:
95  LocalGeometryReference ( const Implementation &impl )
96  : GeometryReference< Implementation >( impl )
97  {}
98  };
99 
100 
101 
102  // Definitions of GeometryReference
103  // --------------------------------
104 
105  template< class Implementation >
106  const int GeometryReference< Implementation >::mydimension;
107 
108  template< class Implementation >
109  const int GeometryReference< Implementation >::coorddimension;
110 
111 } // namespace Dune
112 
113 #endif // #ifndef DUNE_GRID_ALBERTAGRID_GEOMETRYREFERENCE_HH
Wrapper and interface classes for element geometries.
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
Dune namespace.
Definition: alignedallocator.hh:10
A unique label for each type of element that can occur in a grid.
Traits for type conversions and type information.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (May 16, 22:29, 2024)