Dune Core Modules (2.3.1)

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_GEOMETRYREFERENCE_HH
4#define DUNE_GRID_GEOMETRYREFERENCE_HH
5
11
12#include <dune/geometry/type.hh>
13
15
16namespace Dune
17{
18
19 // Internal Forward Declarations
20 // -----------------------------
21
22 template< int mydim, int cdim, class Grid >
23 class GlobalGeometryReference;
24
25 template< int mydim, int cdim, class Grid >
26 class LocalGeometryReference;
27
28
29
30 // FacadeOptions
31 // -------------
32
33 namespace FacadeOptions
34 {
35
36 template< int mydim, int cdim, class GridImp, template< int, int, class > class GeometryImp >
37 struct StoreGeometryReference;
38
39 template< int mydim, int cdim, class Grid >
40 struct StoreGeometryReference< mydim, cdim, Grid, GlobalGeometryReference >
41 {
42 static const bool v = false;
43 };
44
45 template< int mydim, int cdim, class Grid >
46 struct StoreGeometryReference< mydim, cdim, Grid, LocalGeometryReference >
47 {
48 static const bool v = false;
49 };
50
51 } // namespace FacadeOptions
52
53
54
55 // GeometryReference
56 // -----------------
57
58 template< class Implementation >
59 class GeometryReference
60 {
61 typedef GeometryReference< Implementation > This;
62
63 public:
64 static const int mydimension = Implementation::mydimension;
65 static const int coorddimension = Implementation::coorddimension;
66
67 typedef typename Implementation::ctype ctype;
68
69 typedef typename Implementation::LocalCoordinate LocalCoordinate;
70 typedef typename Implementation::GlobalCoordinate GlobalCoordinate;
71
72 typedef typename Implementation::JacobianInverseTransposed JacobianInverseTransposed;
73 typedef typename Implementation::JacobianTransposed JacobianTransposed;
74
75 explicit GeometryReference ( const Implementation &impl )
76 : impl_( &impl )
77 {}
78
79 GeometryType type () const { return impl().type(); }
80
81 bool affine() const { return impl().affine(); }
82
83 int corners () const { return impl().corners(); }
84 GlobalCoordinate corner ( int i ) const { return impl().corner( i ); }
85 GlobalCoordinate center () const { return impl().center(); }
86
87 GlobalCoordinate global ( const LocalCoordinate &local ) const
88 {
89 return impl().global( local );
90 }
91
92 LocalCoordinate local ( const GlobalCoordinate &global ) const
93 {
94 return impl().local( global );
95 }
96
97 ctype integrationElement ( const LocalCoordinate &local ) const
98 {
99 return impl().integrationElement( local );
100 }
101
102 ctype volume () const { return impl().volume(); }
103
104 const JacobianTransposed &jacobianTransposed ( const LocalCoordinate &local ) const
105 {
106 return impl().jacobianTransposed( local );
107 }
108
109 const JacobianInverseTransposed &jacobianInverseTransposed ( const LocalCoordinate &local ) const
110 {
111 return impl().jacobianInverseTransposed( local );
112 }
113
114 const Implementation &impl () const { return *impl_; }
115
116 private:
117 const Implementation *impl_;
118 };
119
120
121
122 // GlobalGeometryReference
123 // -----------------------
124
125 template< int mydim, int cdim, class Grid >
126 class GlobalGeometryReference
127 : public GeometryReference< typename remove_const< Grid >::type::Traits::template Codim< remove_const< Grid >::type::dimension - mydim >::GeometryImpl >
128 {
129 typedef typename remove_const< Grid >::type::Traits::template Codim< remove_const< Grid >::type::dimension - mydim >::GeometryImpl Implementation;
130
131 public:
132 GlobalGeometryReference ( const Implementation &impl )
133 : GeometryReference< Implementation >( impl )
134 {}
135 };
136
137
138
139 // LocalGeometryReference
140 // -----------------------
141
142 template< int mydim, int cdim, class Grid >
143 class LocalGeometryReference
144 : public GeometryReference< typename remove_const< Grid >::type::Traits::template Codim< remove_const< Grid >::type::dimension - mydim >::LocalGeometryImpl >
145 {
146 typedef typename remove_const< Grid >::type::Traits::template Codim< remove_const< Grid >::type::dimension - mydim >::LocalGeometryImpl Implementation;
147
148 public:
149 LocalGeometryReference ( const Implementation &impl )
150 : GeometryReference< Implementation >( impl )
151 {}
152 };
153
154
155
156 // Definitions of GeometryReference
157 // --------------------------------
158
159 template< class Implementation >
160 const int GeometryReference< Implementation >::mydimension;
161
162 template< class Implementation >
163 const int GeometryReference< Implementation >::coorddimension;
164
165} // namespace Dune
166
167#endif // #ifndef DUNE_GRID_GEOMETRYREFERENCE_HH
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
Wrapper and interface classes for element geometries.
Dune namespace.
Definition: alignment.hh:14
static const bool v
Whether to store by reference.
Definition: geometry.hh:49
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.111.3 (Nov 12, 23:30, 2024)