DUNE-FEM (unstable)

geometry.hh
1#ifndef DUNE_FEM_GRIDPART_IDGRIDPART_GEOMETRY_HH
2#define DUNE_FEM_GRIDPART_IDGRIDPART_GEOMETRY_HH
3
4#include <type_traits>
5
7
8namespace Dune
9{
10
11 namespace Fem
12 {
13
14 // Internal Forward Declarations
15 // -----------------------------
16
17 template< int, int, class > class IdGeometry;
18 template< int, int, class > class IdLocalGeometry;
19
20
21 // IdBasicGeometry
22 // ---------------
23
24 template< class Traits >
25 struct IdBasicGeometry
26 {
27 typedef typename Traits::HostGeometryType HostGeometryType;
28
29 static const int mydimension = HostGeometryType::mydimension;
30 static const int coorddimension = HostGeometryType::coorddimension;
31
32 typedef typename HostGeometryType::ctype ctype;
33 typedef FieldVector< ctype, mydimension > LocalVector;
34 typedef FieldVector< ctype, coorddimension > GlobalVector;
35
36 typedef typename HostGeometryType::JacobianTransposed JacobianTransposed;
37 typedef typename HostGeometryType::JacobianInverseTransposed JacobianInverseTransposed;
38
39 typedef typename HostGeometryType::Jacobian Jacobian;
40 typedef typename HostGeometryType::JacobianInverse JacobianInverse;
41
42 IdBasicGeometry ( const HostGeometryType &hostGeometry )
43 : hostGeometry_( hostGeometry )
44 {}
45
46 operator bool () const { return bool( hostGeometry_ ); }
47
48 GeometryType type () const { return hostGeometry_.type(); }
49 bool affine () const { return hostGeometry_.affine(); }
50
51 int corners () const { return hostGeometry_.corners(); }
52 GlobalVector corner ( const int i ) const { return hostGeometry_.corner( i ); }
53 GlobalVector center () const { return hostGeometry_.center(); }
54
55 GlobalVector global ( const LocalVector &local ) const { return hostGeometry_.global( local ); }
56 LocalVector local ( const GlobalVector &global ) const { return hostGeometry_.local( global ); }
57
58 ctype integrationElement ( const LocalVector &local ) const { return hostGeometry_.integrationElement( local ); }
59 ctype volume () const { return hostGeometry_.volume(); }
60
61 JacobianTransposed jacobianTransposed ( const LocalVector &local ) const
62 {
63 return hostGeometry_.jacobianTransposed( local );
64 }
65
66 JacobianInverseTransposed jacobianInverseTransposed ( const LocalVector &local ) const
67 {
68 return hostGeometry_.jacobianInverseTransposed( local );
69 }
70
71 Jacobian jacobian ( const LocalVector &local ) const
72 {
73 return hostGeometry_.jacobian( local );
74 }
75
76 JacobianInverse jacobianInverse ( const LocalVector &local ) const
77 {
78 return hostGeometry_.jacobianInverse( local );
79 }
80
81 private:
82 HostGeometryType hostGeometry_;
83 };
84
85
86
87 // IdGeometryTraits
88 // ----------------
89
90 template< int mydim, class GridFamily >
91 struct IdGeometryTraits
92 {
93 typedef typename std::remove_const< GridFamily >::type::Traits::HostGridPartType HostGridPartType;
94
95 static const int dimension = HostGridPartType::dimension;
96 static const int mydimension = mydim;
97 static const int codimension = dimension - mydimension;
98
99 typedef typename HostGridPartType::template Codim< codimension >::GeometryType HostGeometryType;
100 };
101
102
103
104 // IdGeometry
105 // ----------
106
107 template< int mydim, int cdim, class GridFamily >
108 class IdGeometry
109 : public IdBasicGeometry< IdGeometryTraits< mydim, GridFamily > >
110 {
111 typedef IdBasicGeometry< IdGeometryTraits< mydim, GridFamily > > Base;
112
113 public:
114 typedef typename Base::HostGeometryType HostGeometryType;
115
116 IdGeometry ()
117 {}
118
119 IdGeometry ( const HostGeometryType &hostGeometry )
120 : Base( hostGeometry )
121 {}
122 };
123
124
125
126 // IdLocalGeometryTraits
127 // ---------------------
128
129 template< int mydim, class GridFamily >
130 struct IdLocalGeometryTraits
131 {
132 typedef typename std::remove_const< GridFamily >::type::Traits::HostGridPartType HostGridPartType;
133
134 static const int dimension = HostGridPartType::dimension;
135 static const int mydimension = mydim;
136 static const int codimension = dimension - mydimension;
137
138 typedef typename HostGridPartType::template Codim< codimension >::LocalGeometryType HostGeometryType;
139 };
140
141
142
143 // IdLocalGeometry
144 // -------------------
145
146 template< int mydim, int cdim, class GridFamily >
147 class IdLocalGeometry
148 : public IdBasicGeometry< IdLocalGeometryTraits< mydim, GridFamily > >
149 {
150 typedef IdBasicGeometry< IdLocalGeometryTraits< mydim, GridFamily > > Base;
151
152 public:
153 typedef typename Base::HostGeometryType HostGeometryType;
154
155 IdLocalGeometry ()
156 {}
157
158 IdLocalGeometry ( const HostGeometryType &hostGeometry )
159 : Base( hostGeometry )
160 {}
161 };
162
163 } // namespace Fem
164
165} // namespace Dune
166
167#endif // #ifndef DUNE_FEM_GRIDPART_IDGRIDPART_GEOMETRY_HH
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
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 27, 22:29, 2024)