dune-localfunctions  2.2.1
refinedp0localbasis.hh
Go to the documentation of this file.
1 // -*- tab-width: 8; indent-tabs-mode: nil -*-
2 // vi: set ts=8 sw=2 et sts=2:
3 #ifndef DUNE_REFINED_P0_LOCALBASIS_HH
4 #define DUNE_REFINED_P0_LOCALBASIS_HH
5 
6 #include <dune/common/fvector.hh>
7 #include <dune/common/fmatrix.hh>
8 
11 
12 namespace Dune
13 {
14 
33  template<class D, class R, int dim>
35  : public RefinedSimplexLocalBasis<D,dim>
36  {
37  // 2 to the k-th power
38  enum {N = 1<<dim};
39  public:
41  typedef LocalBasisTraits<D,dim,Dune::FieldVector<D,dim>,R,1,Dune::FieldVector<R,1>, Dune::FieldMatrix<R,1,dim> > Traits;
42 
44  unsigned int size () const
45  {
46  return N;
47  }
48 
50  inline void evaluateFunction (const typename Traits::DomainType& in,
51  std::vector<typename Traits::RangeType>& out) const
52  {
53  int subElement = this->getSubElement(in);
54  out.resize(N);
55  for(int i=0; i<N; ++i)
56  out[i] = (i==subElement)? 1 : 0;
57  }
58 
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(N);
64  for(int i=0; i<N; ++i)
65  out[i][0] = 0;
66  }
67 
72  unsigned int order () const
73  {
74  return 0;
75  }
76 
77  };
78 
79 }
80 #endif