dune-fem  2.4.1-rc
idgridpart/geometry.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_GRIDPART_IDGRIDPART_GEOMETRY_HH
2 #define DUNE_FEM_GRIDPART_IDGRIDPART_GEOMETRY_HH
3 
4 #include <type_traits>
5 
6 #include <dune/grid/common/geometry.hh>
7 
8 namespace 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 >
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  IdBasicGeometry ( const HostGeometryType &hostGeometry )
40  : hostGeometry_( hostGeometry )
41  {}
42 
43  operator bool () const { return bool( hostGeometry_ ); }
44 
45  GeometryType type () const { return hostGeometry_.type(); }
46  bool affine () const { return hostGeometry_.affine(); }
47 
48  int corners () const { return hostGeometry_.corners(); }
49  GlobalVector corner ( const int i ) const { return hostGeometry_.corner( i ); }
50  GlobalVector center () const { return hostGeometry_.center(); }
51 
52  GlobalVector global ( const LocalVector &local ) const { return hostGeometry_.global( local ); }
53  LocalVector local ( const GlobalVector &global ) const { return hostGeometry_.local( global ); }
54 
55  ctype integrationElement ( const LocalVector &local ) const { return hostGeometry_.integrationElement( local ); }
56  ctype volume () const { return hostGeometry_.volume(); }
57 
58  JacobianTransposed jacobianTransposed ( const LocalVector &local ) const
59  {
60  return hostGeometry_.jacobianTransposed( local );
61  }
62 
63  JacobianInverseTransposed jacobianInverseTransposed ( const LocalVector &local ) const
64  {
65  return hostGeometry_.jacobianInverseTransposed( local );
66  }
67 
68  private:
69  HostGeometryType hostGeometry_;
70  };
71 
72 
73 
74  // IdGeometryTraits
75  // ----------------
76 
77  template< int mydim, class GridFamily >
79  {
80  typedef typename std::remove_const< GridFamily >::type::Traits::HostGridPartType HostGridPartType;
81 
82  static const int dimension = HostGridPartType::dimension;
83  static const int mydimension = mydim;
84  static const int codimension = dimension - mydimension;
85 
86  typedef typename HostGridPartType::template Codim< codimension >::GeometryType HostGeometryType;
87  };
88 
89 
90 
91  // IdGeometry
92  // ----------
93 
94  template< int mydim, int cdim, class GridFamily >
95  class IdGeometry
96  : public IdBasicGeometry< IdGeometryTraits< mydim, GridFamily > >
97  {
99 
100  public:
101  typedef typename Base::HostGeometryType HostGeometryType;
102 
104  {}
105 
106  IdGeometry ( const HostGeometryType &hostGeometry )
107  : Base( hostGeometry )
108  {}
109  };
110 
111 
112 
113  // IdLocalGeometryTraits
114  // ---------------------
115 
116  template< int mydim, class GridFamily >
118  {
119  typedef typename std::remove_const< GridFamily >::type::Traits::HostGridPartType HostGridPartType;
120 
121  static const int dimension = HostGridPartType::dimension;
122  static const int mydimension = mydim;
123  static const int codimension = dimension - mydimension;
124 
125  typedef typename HostGridPartType::template Codim< codimension >::LocalGeometryType HostGeometryType;
126  };
127 
128 
129 
130  // IdLocalGeometry
131  // -------------------
132 
133  template< int mydim, int cdim, class GridFamily >
134  class IdLocalGeometry
135  : public IdBasicGeometry< IdLocalGeometryTraits< mydim, GridFamily > >
136  {
138 
139  public:
140  typedef typename Base::HostGeometryType HostGeometryType;
141 
143  {}
144 
145  IdLocalGeometry ( const HostGeometryType &hostGeometry )
146  : Base( hostGeometry )
147  {}
148  };
149 
150  } // namespace Fem
151 
152 } // namespace Dune
153 
154 #endif // #ifndef DUNE_FEM_GRIDPART_IDGRIDPART_GEOMETRY_HH
Base::HostGeometryType HostGeometryType
Definition: idgridpart/geometry.hh:140
Traits::HostGeometryType HostGeometryType
Definition: idgridpart/geometry.hh:27
LocalVector local(const GlobalVector &global) const
Definition: idgridpart/geometry.hh:53
IdLocalGeometry(const HostGeometryType &hostGeometry)
Definition: idgridpart/geometry.hh:145
GlobalVector global(const LocalVector &local) const
Definition: idgridpart/geometry.hh:52
HostGridPartType::template Codim< codimension >::LocalGeometryType HostGeometryType
Definition: idgridpart/geometry.hh:125
bool affine() const
Definition: idgridpart/geometry.hh:46
JacobianTransposed jacobianTransposed(const LocalVector &local) const
Definition: idgridpart/geometry.hh:58
IdGeometry(const HostGeometryType &hostGeometry)
Definition: idgridpart/geometry.hh:106
GlobalVector center() const
Definition: idgridpart/geometry.hh:50
Definition: idgridpart/geometry.hh:78
HostGeometryType::JacobianInverseTransposed JacobianInverseTransposed
Definition: idgridpart/geometry.hh:37
GlobalVector corner(const int i) const
Definition: idgridpart/geometry.hh:49
FieldVector< ctype, coorddimension > GlobalVector
Definition: idgridpart/geometry.hh:34
Definition: idgridpart/geometry.hh:117
static const int mydimension
Definition: idgridpart/geometry.hh:29
Definition: idgridpart/geometry.hh:25
Definition: coordinate.hh:4
int corners() const
Definition: idgridpart/geometry.hh:48
Definition: idgridpart/geometry.hh:17
std::remove_const< GridFamily >::type::Traits::HostGridPartType HostGridPartType
Definition: idgridpart/geometry.hh:80
JacobianInverseTransposed jacobianInverseTransposed(const LocalVector &local) const
Definition: idgridpart/geometry.hh:63
IdLocalGeometry()
Definition: idgridpart/geometry.hh:142
HostGeometryType::ctype ctype
Definition: idgridpart/geometry.hh:32
ctype integrationElement(const LocalVector &local) const
Definition: idgridpart/geometry.hh:55
Definition: idgridpart/geometry.hh:18
static const int coorddimension
Definition: idgridpart/geometry.hh:30
HostGeometryType::JacobianTransposed JacobianTransposed
Definition: idgridpart/geometry.hh:36
IdGeometry()
Definition: idgridpart/geometry.hh:103
FieldVector< ctype, mydimension > LocalVector
Definition: idgridpart/geometry.hh:33
HostGridPartType::template Codim< codimension >::GeometryType HostGeometryType
Definition: idgridpart/geometry.hh:86
IdBasicGeometry(const HostGeometryType &hostGeometry)
Definition: idgridpart/geometry.hh:39
GeometryType type() const
Definition: idgridpart/geometry.hh:45
std::remove_const< GridFamily >::type::Traits::HostGridPartType HostGridPartType
Definition: idgridpart/geometry.hh:119
Base::HostGeometryType HostGeometryType
Definition: idgridpart/geometry.hh:101
ctype volume() const
Definition: idgridpart/geometry.hh:56