dune-localfunctions  2.4.1-rc2
brezzidouglasmarini1cube3dlocalinterpolation.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_LOCALFUNCTIONS_BREZZIDOUGLASMARINI1_CUBE3D_LOCALINTERPOLATION_HH
4 #define DUNE_LOCALFUNCTIONS_BREZZIDOUGLASMARINI1_CUBE3D_LOCALINTERPOLATION_HH
5 
6 #include <vector>
7 
8 #include <dune/geometry/quadraturerules.hh>
9 
10 namespace Dune
11 {
12 
22  template<class LB>
24  {
25 
26  public:
29  {
30  sign0 = sign1 = sign2 = sign3 = sign4 = sign5 = 1.0;
31  }
32 
39  {
40  sign0 = sign1 = sign2 = sign3 = sign4 = sign5 = 1.0;
41  if (s & 1)
42  {
43  sign0 = -1.0;
44  }
45  if (s & 2)
46  {
47  sign1 = -1.0;
48  }
49  if (s & 4)
50  {
51  sign2 = -1.0;
52  }
53  if (s & 8)
54  {
55  sign3 = -1.0;
56  }
57  if (s & 16)
58  {
59  sign4 = -1.0;
60  }
61  if (s & 32)
62  {
63  sign5 = -1.0;
64  }
65 
66  n0[0] = -1.0;
67  n0[1] = 0.0;
68  n0[2] = 0.0;
69  n1[0] = 1.0;
70  n1[1] = 0.0;
71  n1[2] = 0.0;
72  n2[0] = 0.0;
73  n2[1] = -1.0;
74  n2[2] = 0.0;
75  n3[0] = 0.0;
76  n3[1] = 1.0;
77  n3[2] = 0.0;
78  n4[0] = 0.0;
79  n4[1] = 0.0;
80  n4[2] = -1.0;
81  n5[0] = 0.0;
82  n5[1] = 0.0;
83  n5[2] = 1.0;
84  }
85 
94  template<typename F, typename C>
95  void interpolate(const F& f, std::vector<C>& out) const
96  {
97  // f gives v*outer normal at a point on the edge!
98  typedef typename LB::Traits::RangeFieldType Scalar;
99  //typedef typename LB::Traits::DomainFieldType Vector;
100  typename F::Traits::RangeType y;
101 
102  out.resize(18);
103  fill(out.begin(), out.end(), 0.0);
104 
105  const int qOrder = 4;
106  const QuadratureRule<Scalar,1>& rule = QuadratureRules<Scalar,1>::rule(GeometryType(GeometryType::cube,1), qOrder);
107 
108  for (typename QuadratureRule<Scalar,1>::const_iterator it = rule.begin();
109  it != rule.end(); ++it)
110  {
111  // TODO: write interpolation
112  }
113  }
114 
115  private:
116  typename LB::Traits::RangeFieldType sign0, sign1, sign2, sign3, sign4, sign5;
117  typename LB::Traits::DomainType n0, n1, n2, n3, n4, n5;
118  };
119 } // end namespace Dune
120 #endif // DUNE_LOCALFUNCTIONS_BREZZIDOUGLASMARINI1_CUBE3D_LOCALINTERPOLATION_HH
BDM1Cube3DLocalInterpolation()
Standard constructor.
Definition: brezzidouglasmarini1cube3dlocalinterpolation.hh:28
void interpolate(const F &f, std::vector< C > &out) const
Interpolate a given function with shape functions.
Definition: brezzidouglasmarini1cube3dlocalinterpolation.hh:95
BDM1Cube3DLocalInterpolation(unsigned int s)
Make set number s, where 0 <= s < 64.
Definition: brezzidouglasmarini1cube3dlocalinterpolation.hh:38
First order Brezzi-Douglas-Marini shape functions on the reference hexahedron.
Definition: brezzidouglasmarini1cube3dlocalinterpolation.hh:23