dune-localfunctions  2.3.1-rc1
raviartthomas02dlocalbasis.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_RT0TRIANGLELOCALBASIS_HH
4 #define DUNE_RT0TRIANGLELOCALBASIS_HH
5 
6 #include <dune/common/fmatrix.hh>
7 
9 
10 namespace Dune
11 {
20  template<class D, class R>
22  {
23  public:
24  typedef LocalBasisTraits<D,2,Dune::FieldVector<D,2>,R,2,Dune::FieldVector<R,2>,
25  Dune::FieldMatrix<R,2,2> > Traits;
26 
29  {
30  sign0 = sign1 = sign2 = 1.0;
31  }
32 
34  RT02DLocalBasis (unsigned int s)
35  {
36  sign0 = sign1 = sign2 = 1.0;
37  if (s&1) sign0 = -1.0;
38  if (s&2) sign1 = -1.0;
39  if (s&4) sign2 = -1.0;
40  }
41 
43  unsigned int size () const
44  {
45  return 3;
46  }
47 
49  inline void evaluateFunction (const typename Traits::DomainType& in,
50  std::vector<typename Traits::RangeType>& out) const
51  {
52  out.resize(3);
53  out[0][0] = sign0*in[0]; out[0][1]=sign0*(in[1]-1.0);
54  out[1][0] = sign1*(in[0]-1.0); out[1][1]=sign1*in[1];
55  out[2][0] = sign2*in[0]; out[2][1]=sign2*in[1];
56  }
57 
59  inline void
60  evaluateJacobian (const typename Traits::DomainType& in, // position
61  std::vector<typename Traits::JacobianType>& out) const // return value
62  {
63  out.resize(3);
64  out[0][0][0] = sign0; out[0][0][1] = 0;
65  out[0][1][0] = 0; out[0][1][1] = sign0;
66  out[1][0][0] = sign1; out[1][0][1] = 0;
67  out[1][1][0] = 0; out[1][1][1] = sign1;
68  out[2][0][0] = sign2; out[2][0][1] = 0;
69  out[2][1][0] = 0; out[2][1][1] = sign2;
70  }
71 
73  unsigned int order () const
74  {
75  return 1;
76  }
77 
78  private:
79  R sign0, sign1, sign2;
80  };
81 }
82 #endif
Type traits for LocalBasisVirtualInterface.
Definition: localbasis.hh:39
Lowest order Raviart-Thomas shape functions on the reference triangle.
Definition: raviartthomas02dlocalbasis.hh:21
unsigned int order() const
Polynomial order of the shape functions.
Definition: raviartthomas02dlocalbasis.hh:73
unsigned int size() const
number of shape functions
Definition: raviartthomas02dlocalbasis.hh:43
RT02DLocalBasis(unsigned int s)
Make set numer s, where 0<=s<8.
Definition: raviartthomas02dlocalbasis.hh:34
void evaluateJacobian(const typename Traits::DomainType &in, std::vector< typename Traits::JacobianType > &out) const
Evaluate Jacobian of all shape functions.
Definition: raviartthomas02dlocalbasis.hh:60
void evaluateFunction(const typename Traits::DomainType &in, std::vector< typename Traits::RangeType > &out) const
Evaluate all shape functions.
Definition: raviartthomas02dlocalbasis.hh:49
RT02DLocalBasis()
Standard constructor.
Definition: raviartthomas02dlocalbasis.hh:28
LocalBasisTraits< D, 2, Dune::FieldVector< D, 2 >, R, 2, Dune::FieldVector< R, 2 >, Dune::FieldMatrix< R, 2, 2 > > Traits
Definition: raviartthomas02dlocalbasis.hh:25
D DomainType
domain type
Definition: localbasis.hh:51