Dune Core Modules (2.8.0)

emptypoints.hh
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_LAGRANGE_EMPTYPOINTS_HH
4#define DUNE_LAGRANGE_EMPTYPOINTS_HH
5
6#include <vector>
7
9#include <dune/localfunctions/common/localkey.hh>
10
11namespace Dune
12{
13
14 template< class F, unsigned int dim >
15 class LagrangePoint
16 {
17 typedef LagrangePoint< F, dim > This;
18
19 template< class, class >
20 friend class LagrangePointSetImpl;
21
22 public:
23 static const int dimension = dim;
24
25 typedef F Field;
26
28
29 const Vector &point () const
30 {
31 return point_;
32 }
33
34 const LocalKey &localKey () const
35 {
36 return localKey_;
37 }
38
39 const Field weight () const
40 {
41 return weight_;
42 }
43
44 Vector point_;
45 LocalKey localKey_;
46 Field weight_;
47 };
48
49 // EmptyPointSet
50 // --------------
51
52 template< class F, unsigned int dim >
53 class EmptyPointSet
54 {
55 typedef EmptyPointSet< F, dim > This;
56
57 public:
58 typedef F Field;
59
60 static const unsigned int dimension = dim;
61
62 typedef Dune::LagrangePoint< Field, dimension > LagrangePoint;
63
64 typedef typename std::vector< LagrangePoint >::const_iterator iterator;
65
66 protected:
67 EmptyPointSet ( const std::size_t order )
68 : order_( order )
69 {}
70
71 public:
72 const LagrangePoint &operator[] ( const unsigned int i ) const
73 {
74 assert( i < size() );
75 return points_[ i ];
76 }
77
78 iterator begin () const
79 {
80 return points_.begin();
81 }
82
83 iterator end () const
84 {
85 return points_.end();
86 }
87
88 const LocalKey &localKey ( const unsigned int i ) const
89 {
90 return (*this)[ i ].localKey();
91 }
92
93 std::size_t order () const
94 {
95 return order_;
96 }
97
98 std::size_t size () const
99 {
100 return points_.size();
101 }
102
103 protected:
104 std::size_t order_;
105 std::vector< LagrangePoint > points_;
106 };
107
108}
109
110#endif // DUNE_LAGRANGE_EMPTYPOINTS_HH
Implements a vector constructed from a given type representing a field and a compile-time given size.
Dune namespace.
Definition: alignedallocator.hh:11
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 22, 23:33, 2024)