function.hh

Go to the documentation of this file.
1 
6 #ifndef hpFunction1d_hh
7 #define hpFunction1d_hh
8 
9 #include "basics/typedefs.hh"
10 #include "toolbox/array.hh"
11 #include "space/function.hh"
12 #include "element.hh"
13 #ifdef HAS_XERUS
14 #include "rysElement.hh"
15 #endif
16 
17 namespace hp1D {
18 
19  using concepts::Real;
20 
21  // ***************************************************************** Value **
22 
27  template<typename F = Real,
28  typename G = typename concepts::Realtype<F>::type>
29  class Value : public concepts::ElementFunction<F, G> {
30  public:
32  virtual uint n() const { return 1; }
33 
34  virtual void operator() (const concepts::Element<G>& elm,
35  const concepts::Array<F>& coeff,
36  concepts::Array<F>& val, const uint *i) const;
37  virtual void operator() (const concepts::Element<G>& elm, const uint* j,
38  concepts::Array<F>& val, const uint* i) const;
39  virtual void operator() (const concepts::Element<G>& elm,
40  const concepts::Array<F>& coeff,
41  concepts::Array<F>& val, const Real p,
42  const Real t = 0.0) const;
43  virtual void operator() (const concepts::Element<G>& elm,
44  const concepts::Array<F>& coeff,
45  concepts::Array<F>& val, const concepts::Real2d& p,
46  const Real t = 0.0) const;
47  virtual void operator() (const concepts::Element<G>& elm,
48  const concepts::Array<F>& coeff,
49  concepts::Array<F>& val, const concepts::Real3d& p,
50  const Real t = 0.0) const;
51 
52  virtual Value<F,G>* clone() const {
53  return new Value();
54  }
55  protected:
56  virtual std::ostream& info(std::ostream& os) const;
57  private:
58  bool compute_(const hp1D::Element<G>* elm,
59  const concepts::Array<F>& coeff,
60  F& val, const uint i) const;
61  bool compute_(const hp1D::Element<G>* elm, const uint j,
62  F& val, const uint i) const;
63  bool compute_(const hp1D::Element<G>* elm,
64  const concepts::Array<F>& coeff,
65  F& val, const Real p, const Real t = 0.0) const;
67  const concepts::Array<F>& coeff,
68  F& val, const Real p, const Real t = 0.0) const;
69 #ifdef HAS_XERUS
70  bool compute_(const hp1D::RysElement<G>* elm,
71  const concepts::Array<F>& coeff,
72  F& val, const Real p, const Real t = 0.0) const;
73 #endif // HAS_XERUS
74  };
75 
76  // ****************************************************************** Grad **
77 
82  template<typename F = Real,
83  typename G = typename concepts::Realtype<F>::type>
84  class Grad : public concepts::ElementFunction<F, G> {
85  public:
87  virtual uint n() const { return 1; }
88 
89  virtual void operator() (const concepts::Element<G>& elm,
90  const concepts::Array<F>& coeff,
91  concepts::Array<F>& val, const uint *i) const;
92  virtual void operator() (const concepts::Element<G>& elm, const uint* j,
93  concepts::Array<F>& val, const uint* i) const;
94  virtual void operator() (const concepts::Element<G>& elm,
95  const concepts::Array<F>& coeff,
96  concepts::Array<F>& val, const Real p,
97  const Real t = 0.0) const;
98  virtual void operator() (const concepts::Element<G>& elm,
99  const concepts::Array<F>& coeff,
100  concepts::Array<F>& val, const concepts::Real2d& p,
101  const Real t = 0.0) const;
102  virtual void operator() (const concepts::Element<G>& elm,
103  const concepts::Array<F>& coeff,
104  concepts::Array<F>& val, const concepts::Real3d& p,
105  const Real t = 0.0) const;
106 
107  virtual Grad<F,G>* clone() const {
108  return new Grad();
109  }
110  protected:
111  virtual std::ostream& info(std::ostream& os) const;
112  private:
113  bool compute_(const hp1D::Element<G>* elm,
114  const concepts::Array<F>& coeff,
115  F& val, const uint i) const;
116  bool compute_(const hp1D::Element<G>* elm, const uint j,
117  F& val, const uint i) const;
118  bool compute_(const hp1D::Element<G>* elm,
119  const concepts::Array<F>& coeff,
120  F& val, const Real p, const Real t = 0.0) const;
121  };
122 
123 } // namespace hp1D
124 
125 #endif // hpFunction1d_hh
An abstract class for a function in a FE space.
virtual std::ostream & info(std::ostream &os) const
bool compute_(const hp1D::Element< G > *elm, const concepts::Array< F > &coeff, F &val, const Real p, const Real t=0.0) const
bool compute_(const hp1D::Element< G > *elm, const uint j, F &val, const uint i) const
bool compute_(const hp1D::LegendreElement< G > *elm, const concepts::Array< F > &coeff, F &val, const Real p, const Real t=0.0) const
An array of objects.
Definition: bilinearForm.hh:23
virtual void operator()(const concepts::Element< G > &elm, const concepts::Array< F > &coeff, concepts::Array< F > &val, const uint *i) const
bool compute_(const hp1D::Element< G > *elm, const concepts::Array< F > &coeff, F &val, const uint i) const
virtual void operator()(const concepts::Element< G > &elm, const concepts::Array< F > &coeff, concepts::Array< F > &val, const uint *i) const
virtual uint n() const
Number of components.
Definition: function.hh:32
1D generic element.
Definition: element.hh:225
virtual std::ostream & info(std::ostream &os) const
bool compute_(const hp1D::Element< G > *elm, const uint j, F &val, const uint i) const
bool compute_(const hp1D::Element< G > *elm, const concepts::Array< F > &coeff, F &val, const Real p, const Real t=0.0) const
virtual uint n() const
Number of components.
Definition: function.hh:87
The approximated function in a FE space.
Definition: function.hh:29
bool compute_(const hp1D::Element< G > *elm, const concepts::Array< F > &coeff, F &val, const uint i) const
virtual Value< F, G > * clone() const
Definition: function.hh:52
virtual Grad< F, G > * clone() const
Definition: function.hh:107
The gradient of the approximated function in a FE space.
Definition: function.hh:84
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
1D hp-FEM
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich