dune-localfunctions  2.8.0
refinedp0localinterpolation.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_REFINED_P0_LOCALINTERPOLATION_HH
4 #define DUNE_REFINED_P0_LOCALINTERPOLATION_HH
5 
8 
9 namespace Dune
10 {
11  template<class LB>
13  {};
14 
15  template<class D, class R>
17  {
19  typedef typename LB::Traits::DomainType DT;
20 
21  public:
23  interpolationPoints_(2)
24  {
25  // Interpolation is done by evaluating at the halved segments centers
26  interpolationPoints_[0][0] = 1.0/4.0;
27 
28  interpolationPoints_[1][0] = 3.0/4.0;
29  }
30 
31 
32  template<typename F, typename C>
33  void interpolate (const F& ff, std::vector<C>& out) const
34  {
35  auto&& f = Impl::makeFunctionWithCallOperator<DT>(ff);
36 
37  out.resize(interpolationPoints_.size());
38  for (size_t i = 0; i < out.size(); ++i)
39  {
40  out[i] = f(interpolationPoints_[i]);
41  }
42  }
43 
44  private:
45  std::vector<DT> interpolationPoints_;
46  };
47 
48  template<class D, class R>
50  {
52  typedef typename LB::Traits::DomainType DT;
53 
54  public:
56  interpolationPoints_(4)
57  {
58  // Interpolation is done by evaluating at the subtriangle centers
59  interpolationPoints_[0][0] = 1.0/6;
60  interpolationPoints_[0][1] = 1.0/6;
61 
62  interpolationPoints_[1][0] = 4.0/6;
63  interpolationPoints_[1][1] = 1.0/6;
64 
65  interpolationPoints_[2][0] = 1.0/6;
66  interpolationPoints_[2][1] = 4.0/6;
67 
68  interpolationPoints_[3][0] = 2.0/6;
69  interpolationPoints_[3][1] = 2.0/6;
70  }
71 
72 
73  template<typename F, typename C>
74  void interpolate (const F& ff, std::vector<C>& out) const
75  {
76  auto&& f = Impl::makeFunctionWithCallOperator<DT>(ff);
77 
78  out.resize(interpolationPoints_.size());
79  for (size_t i = 0; i < out.size(); ++i)
80  {
81  out[i] = f(interpolationPoints_[i]);
82  }
83  }
84 
85  private:
86  std::vector<DT> interpolationPoints_;
87  };
88 
89  template<class D, class R>
91  {
93  typedef typename LB::Traits::DomainType DT;
94 
95  public:
97  interpolationPoints_(8)
98  {
99  // Interpolation is done by evaluating at the subtriangle centers
100  interpolationPoints_[0][0] = 1.0/8;
101  interpolationPoints_[0][1] = 1.0/8;
102  interpolationPoints_[0][2] = 1.0/8;
103 
104  interpolationPoints_[1][0] = 5.0/8;
105  interpolationPoints_[1][1] = 1.0/8;
106  interpolationPoints_[1][2] = 1.0/8;
107 
108  interpolationPoints_[2][0] = 1.0/8;
109  interpolationPoints_[2][1] = 5.0/8;
110  interpolationPoints_[2][2] = 1.0/8;
111 
112  interpolationPoints_[3][0] = 1.0/8;
113  interpolationPoints_[3][1] = 1.0/8;
114  interpolationPoints_[3][2] = 5.0/8;
115 
116  interpolationPoints_[4][0] = 1.0/4;
117  interpolationPoints_[4][1] = 1.0/8;
118  interpolationPoints_[4][2] = 1.0/4;
119 
120  interpolationPoints_[5][0] = 3.0/8;
121  interpolationPoints_[5][1] = 1.0/4;
122  interpolationPoints_[5][2] = 1.0/8;
123 
124  interpolationPoints_[6][0] = 1.0/8;
125  interpolationPoints_[6][1] = 1.0/4;
126  interpolationPoints_[6][2] = 3.0/8;
127 
128  interpolationPoints_[7][0] = 1.0/4;
129  interpolationPoints_[7][1] = 3.0/8;
130  interpolationPoints_[7][2] = 1.0/4;
131  }
132 
133 
134  template<typename F, typename C>
135  void interpolate (const F& ff, std::vector<C>& out) const
136  {
137  auto&& f = Impl::makeFunctionWithCallOperator<DT>(ff);
138 
139  out.resize(interpolationPoints_.size());
140  for (size_t i = 0; i < out.size(); ++i)
141  {
142  out[i] = f(interpolationPoints_[i]);
143  }
144  }
145 
146  private:
147  std::vector<DT> interpolationPoints_;
148  };
149 }
150 
151 #endif
Definition: bdfmcube.hh:16
Uniformly refined constant shape functions on a unit simplex in R^dim.
Definition: refinedp0localbasis.hh:38
Definition: refinedp0localinterpolation.hh:13
RefinedP0LocalInterpolation()
Definition: refinedp0localinterpolation.hh:22
void interpolate(const F &ff, std::vector< C > &out) const
Definition: refinedp0localinterpolation.hh:33
RefinedP0LocalInterpolation()
Definition: refinedp0localinterpolation.hh:55
void interpolate(const F &ff, std::vector< C > &out) const
Definition: refinedp0localinterpolation.hh:74
void interpolate(const F &ff, std::vector< C > &out) const
Definition: refinedp0localinterpolation.hh:135
RefinedP0LocalInterpolation()
Definition: refinedp0localinterpolation.hh:96