BEM++  2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
raviart_thomas_0_shapeset.hpp
1 // Copyright (C) 2011-2012 by the BEM++ Authors
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a copy
4 // of this software and associated documentation files (the "Software"), to deal
5 // in the Software without restriction, including without limitation the rights
6 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 // copies of the Software, and to permit persons to whom the Software is
8 // furnished to do so, subject to the following conditions:
9 //
10 // The above copyright notice and this permission notice shall be included in
11 // all copies or substantial portions of the Software.
12 //
13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 // THE SOFTWARE.
20 
21 #ifndef fiber_raviart_thomas_0_shapeset_hpp
22 #define fiber_raviart_thomas_0_shapeset_hpp
23 
24 #include "../common/common.hpp"
25 
26 #include "basis.hpp"
27 
28 #include "basis_data.hpp"
29 #include "dune_basis_helper.hpp"
30 
31 //#include <dune/localfunctions/raviartthomas.hh> ///raviartthomas0q2d.hh>
32 #include <dune/localfunctions/raviartthomas/raviartthomas02d/raviartthomas02dlocalbasis.hh>
33 
34 namespace Fiber
35 {
36 
37 template <int elementVertexCount, typename CoordinateType, typename ValueType>
39 {
40 };
41 
42 // Triangle
43 template <typename CoordinateType, typename ValueType>
44 struct RaviartThomas0BasisTraits<3, CoordinateType, ValueType>
45 {
46 public:
47  typedef Dune::RT02DLocalBasis<CoordinateType, ValueType> DuneBasis;
48 };
49 
50 // // Quadrilateral
51 // template <typename CoordinateType, typename ValueType>
52 // struct RaviartThomasOrder0BasisTraits<4, CoordinateType, ValueType>
53 // {
54 // public:
55 // typedef Dune::Q1LocalBasis<CoordinateType, ValueType, 2> DuneBasis;
56 // };
57 
59 template <int elementVertexCount, typename ValueType>
60 class RaviartThomas0Shapeset : public Basis<ValueType>
61 {
62 public:
63  typedef typename Basis<ValueType>::CoordinateType CoordinateType;
64 
65 private:
66  typedef typename RaviartThomas0BasisTraits
67  <elementVertexCount, CoordinateType, ValueType>::DuneBasis DuneBasis;
68 
69 public:
70  virtual int size() const {
71  DuneBasis basis;
72  return basis.size();
73  }
74 
75  virtual int order() const {
76  return 1;
77  }
78 
79  virtual void evaluate(size_t what,
80  const arma::Mat<CoordinateType>& points,
81  LocalDofIndex localDofIndex,
82  BasisData<ValueType>& data) const {
83  if (localDofIndex != ALL_DOFS &&
84  (localDofIndex < 0 || size() <= localDofIndex))
85  throw std::invalid_argument("RaviartThomas0Basis::"
86  "evaluate(): Invalid localDofIndex");
87 
88  if (what & VALUES)
89  evaluateShapeFunctionsWithDune<CoordinateType, ValueType, DuneBasis>(
90  points, localDofIndex, data.values);
91  if (what & DERIVATIVES)
92  evaluateShapeFunctionDerivativesWithDune<
93  CoordinateType, ValueType, DuneBasis>(
94  points, localDofIndex, data.derivatives);
95  }
96 };
97 
98 } // namespace Fiber
99 
100 #endif
Shapeset composed of the lowest-order Raviart-Thomas functions.
Definition: raviart_thomas_0_shapeset.hpp:60
_4dArray< ValueType > derivatives
Derivatives of shape functions.
Definition: basis_data.hpp:59
virtual int size() const
Return the number of shape functions.
Definition: raviart_thomas_0_shapeset.hpp:70
Definition: raviart_thomas_0_shapeset.hpp:38
_3dArray< ValueType > values
Values of shape functions.
Definition: basis_data.hpp:51
virtual int order() const
Return the maximum polynomial order of shape functions.
Definition: raviart_thomas_0_shapeset.hpp:75
Collection of shape functions defined on a reference element.
Definition: basis.hpp:36
Storage of values and/or derivatives of shape functions.
Definition: basis_data.hpp:44
virtual void evaluate(size_t what, const arma::Mat< CoordinateType > &points, LocalDofIndex localDofIndex, BasisData< ValueType > &data) const
Evaluate the shape functions making up this shapeset and/or their derivatives at specified points...
Definition: raviart_thomas_0_shapeset.hpp:79