dune-fem  2.4.1-rc
gausspoints.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_GAUSSPOINTS_HH
2 #define DUNE_FEM_GAUSSPOINTS_HH
3 
4 #include <cassert>
5 
6 namespace Dune
7 {
8 
9  namespace Fem
10  {
11 
22  class GaussPts
23  {
24  public:
26  enum { MAXP=10 };
27 
29  enum { highestOrder=19 };
30 
31  private:
32  double G[MAXP+1][MAXP]; // positions of Gauss points
33  double W[MAXP+1][MAXP]; // weights associated with points
34  int O[MAXP+1]; // order of the rule
35 
36  private:
39  GaussPts ();
40 
41  public:
46  inline static const GaussPts &instance()
47  {
48  static GaussPts gaussPts;
49  return gaussPts;
50  }
51 
59  double point ( int m, int i ) const
60  {
61  assert(m > 0 && i < m);
62  return G[m][i];
63  }
64 
72  double weight ( int m, int i ) const
73  {
74  assert(m > 0 && i < m);
75  return W[m][i];
76  }
77 
84  int order ( int m ) const
85  {
86  return O[m];
87  }
88 
98  int power ( int y, int d ) const
99  {
100  int m = 1;
101  for( int i = 0; i < d; ++i )
102  m *= y;
103  return m;
104  }
105  };
106 
107  } // namespace Fem
108 
109 } // namespace Dune
110 
112 #endif // #ifndef DUNE_FEM_GAUSSPOINTS_HH
int power(int y, int d) const
a simple power method
Definition: gausspoints.hh:98
double point(int m, int i) const
obtain the i-th point of the m-th quadratre
Definition: gausspoints.hh:59
static const GaussPts & instance()
obtain the singleton object
Definition: gausspoints.hh:46
Definition: coordinate.hh:4
one-dimensional Gauss points and their weights
Definition: gausspoints.hh:22
int order(int m) const
obtain the order of the m-th quadratre
Definition: gausspoints.hh:84
double weight(int m, int i) const
obtain the i-th weight of the m-th quadratre
Definition: gausspoints.hh:72
Definition: gausspoints.hh:26
Definition: gausspoints.hh:29