Intrepid
Intrepid_BurkardtRules.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ************************************************************************
3 //
4 // Intrepid Package
5 // Copyright (2007) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Pavel Bochev (pbboche@sandia.gov)
38 // Denis Ridzal (dridzal@sandia.gov), or
39 // Kara Peterson (kjpeter@sandia.gov)
40 //
41 // ************************************************************************
42 // @HEADER
43 
51 #ifndef INTREPID_BURKARDTRULES_HPP
52 #define INTREPID_BURKARDTRULES_HPP
53 
54 #include "Intrepid_ConfigDefs.hpp"
55 #include "Intrepid_Types.hpp"
56 #include "Teuchos_Assert.hpp"
57 //#include <fstream>
58 //#include <string>
59 
60 namespace Intrepid {
61 
65  enum EIntrepidBurkardt {
66  BURK_CHEBYSHEV1 = 0,
67  BURK_CHEBYSHEV2,
68  BURK_CLENSHAWCURTIS,
69  BURK_FEJER2,
70  BURK_LEGENDRE,
71  BURK_PATTERSON,
72  BURK_TRAPEZOIDAL,
73  BURK_HERMITE,
74  BURK_GENZKEISTER,
75  BURK_LAGUERRE
76  };
77 
78  inline std::string EIntrepidBurkardtToString(EIntrepidBurkardt rule) {
79  std::string retString;
80  switch(rule) {
81  case BURK_CHEBYSHEV1: retString = "Gauss-Chebyshev Type 1"; break;
82  case BURK_CHEBYSHEV2: retString = "Gauss-Chebyshev Type 2"; break;
83  case BURK_CLENSHAWCURTIS: retString = "Clenshaw-Curtis"; break;
84  case BURK_FEJER2: retString = "Fejer Type 2"; break;
85  case BURK_LEGENDRE: retString = "Gauss-Legendre"; break;
86  case BURK_PATTERSON: retString = "Gauss-Patterson"; break;
87  case BURK_TRAPEZOIDAL: retString = "Trapezoidal Rule"; break;
88  case BURK_HERMITE: retString = "Gauss-Hermite"; break;
89  case BURK_GENZKEISTER: retString = "Hermite-Genz-Keister"; break;
90  case BURK_LAGUERRE: retString = "Gauss-Laguerre"; break;
91  default: retString = "INVALID EIntrepidBurkardt";
92  }
93  return retString;
94  }
95 
96  inline EIntrepidBurkardt & operator++(EIntrepidBurkardt &type) {
97  return type = static_cast<EIntrepidBurkardt>(type+1);
98  }
99 
100  inline EIntrepidBurkardt operator++(EIntrepidBurkardt &type, int) {
101  EIntrepidBurkardt oldval = type;
102  ++type;
103  return oldval;
104  }
105 
116 
117  public:
118 
119  /* HELPER FUNCTIONS */
120  template<class Scalar>
121  static void imtqlx ( int n, Scalar d[], Scalar e[], Scalar z[] );
122  template<class Scalar> static Scalar r8_epsilon( Scalar one );
123  template<class Scalar> static Scalar r8_sign( Scalar x );
124 
125  /* COMPUTE CHEBYSHEV TYPE 1 NODES AND WEIGHTS */
126  /* Integrates functions on [-1,1] weighted by w(x) = 1/sqrt(1-x^2) */
129  template<class Scalar>
130  static void chebyshev1_compute ( int order, Scalar x[], Scalar w[] );
133  template<class Scalar>
134  static void chebyshev1_compute_points ( int order, Scalar x[] );
137  template<class Scalar>
138  static void chebyshev1_compute_weights ( int order, Scalar w[] );
139 
140  /* COMPUTE CHEBYSHEV TYPE 2 NODES AND WEIGHTS */
141  /* Integrates functions on [-1,1] weighted by w(x) = sqrt(1-x^2) */
144  template<class Scalar>
145  static void chebyshev2_compute ( int order, Scalar x[], Scalar w[] );
148  template<class Scalar>
149  static void chebyshev2_compute_points ( int order, Scalar x[] );
152  template<class Scalar>
153  static void chebyshev2_compute_weights ( int order, Scalar w[] );
154 
155  /* COMPUTE CLENSHAW CURTIS NODES AND WEIGHTS */
156  /* Integrates functions on [-1,1] weighted by w(x) = 1 */
159  template<class Scalar>
160  static void clenshaw_curtis_compute ( int order, Scalar x[], Scalar w[] );
163  template<class Scalar>
164  static void clenshaw_curtis_compute_points ( int order, Scalar x[] );
167  template<class Scalar>
168  static void clenshaw_curtis_compute_weights ( int order, Scalar w[] );
169 
170  /* COMPUTE FEJER TYPE 2 NODES AND WEIGHTS */
171  /* Integrates functions on [-1,1] weighted by w(x) = 1 */
174  template<class Scalar>
175  static void fejer2_compute ( int order, Scalar x[], Scalar w[] );
178  template<class Scalar>
179  static void fejer2_compute_points ( int order, Scalar x[] );
182  template<class Scalar>
183  static void fejer2_compute_weights ( int order, Scalar w[] );
184 
185  /* COMPUTE GAUSS HERMITE NODES AND WEIGHTS */
186  /* Integrates functions on (-oo,oo) weighted by w(x) = exp(-x^2) */
189  template<class Scalar>
190  static void hermite_compute ( int order, Scalar x[], Scalar w[] );
193  template<class Scalar>
194  static void hermite_compute_points ( int order, Scalar x[] );
197  template<class Scalar>
198  static void hermite_compute_weights ( int order, Scalar w[] );
199 
202  template<class Scalar>
203  static void hermite_lookup ( int n, Scalar x[], Scalar w[] );
206  template<class Scalar>
207  static void hermite_lookup_points ( int n, Scalar x[] );
210  template<class Scalar>
211  static void hermite_lookup_weights ( int n, Scalar w[] );
212 
213  /* COMPUTE GENZ KEISTER NODES AND WEIGHTS */
214  /* Integrates functions on (-oo,oo) weighted by w(x) = exp(-x^2) */
217  template<class Scalar>
218  static void hermite_genz_keister_lookup ( int n, Scalar x[], Scalar w[] );
221  template<class Scalar>
222  static void hermite_genz_keister_lookup_points ( int n, Scalar x[] );
225  template<class Scalar>
226  static void hermite_genz_keister_lookup_weights ( int n, Scalar w[] );
227 
228  /* COMPUTE GAUSS LAGUERRE NODES AND WEIGHTS */
229  /* Integrates functons on [0,oo) weighted by w(x) = exp(-x) */
232  template<class Scalar>
233  static void laguerre_compute ( int n, Scalar x[], Scalar w[] );
236  template<class Scalar>
237  static void laguerre_compute_points ( int order, Scalar x[] );
240  template<class Scalar>
241  static void laguerre_compute_weights ( int order, Scalar w[] );
242 
245  template<class Scalar>
246  static void laguerre_lookup ( int n, Scalar x[], Scalar w[] );
249  template<class Scalar>
250  static void laguerre_lookup_points ( int n, Scalar x[] );
253  template<class Scalar>
254  static void laguerre_lookup_weights ( int n, Scalar w[] );
255 
256  /* COMPUTE GAUSS LEGENDRE NODES AND WEIGHTS */
257  /* Integrates functions on [-1,1] weighted by w(x) = 1 */
260  template<class Scalar>
261  static void legendre_compute ( int n, Scalar x[], Scalar w[] );
264  template<class Scalar>
265  static void legendre_compute_points ( int order, Scalar x[] );
268  template<class Scalar>
269  static void legendre_compute_weights ( int order, Scalar w[] );
270 
273  template<class Scalar>
274  static void legendre_lookup ( int n, Scalar x[], Scalar w[] );
277  template<class Scalar>
278  static void legendre_lookup_points ( int n, Scalar x[] );
281  template<class Scalar>
282  static void legendre_lookup_weights ( int n, Scalar w[] );
283 
284  /* COMPUTE GAUSS PATTERSON NODES AND WEIGHTS */
285  /* Integrates functions on [-1,1] weighted by w(x) = 1 */
288  template<class Scalar>
289  static void patterson_lookup ( int n, Scalar x[], Scalar w[] );
292  template<class Scalar>
293  static void patterson_lookup_points ( int n, Scalar x[] );
296  template<class Scalar>
297  static void patterson_lookup_weights ( int n, Scalar w[] );
298 
299  /* COMPUTE TRAPEZOIDAL RULE NODES AND WEIGHTS */
300  /* Integrates functions on [-1,1] weighted by w(x) = 1 */
303  template<class Scalar>
304  static void trapezoidal_compute ( int n, Scalar x[], Scalar w[] );
307  template<class Scalar>
308  static void trapezoidal_compute_points ( int order, Scalar x[] );
311  template<class Scalar>
312  static void trapezoidal_compute_weights ( int order, Scalar w[] );
313 
314  }; // class IntrepidBurkardtRules
315 
316 } // end Intrepid namespace
317 
318 // include templated definitions
320 
321 #endif
static void chebyshev2_compute_weights(int order, Scalar w[])
Gauss-Chebyshev of Type 2; returns weights.
static void patterson_lookup_weights(int n, Scalar w[])
Gauss-Patterson; returns weights.
static void chebyshev1_compute(int order, Scalar x[], Scalar w[])
Gauss-Chebyshev of Type 1; returns points and weights.
static void laguerre_lookup_weights(int n, Scalar w[])
Gauss-Laguerre; returns weights.
static void chebyshev1_compute_weights(int order, Scalar w[])
Gauss-Chebyshev of Type 1; returns weights.
static void hermite_genz_keister_lookup_weights(int n, Scalar w[])
Hermite-Genz-Keister; returns weights.
static void clenshaw_curtis_compute_points(int order, Scalar x[])
Clenshaw-Curtis; returns points.
static void legendre_compute_weights(int order, Scalar w[])
Gauss-Legendre; returns weights.
static void hermite_lookup(int n, Scalar x[], Scalar w[])
Gauss-Hermite; returns points and weights.
static void laguerre_compute_points(int order, Scalar x[])
Gauss-Laguerre; returns points.
static void chebyshev2_compute_points(int order, Scalar x[])
Gauss-Chebyshev of Type 2; returns points.
static void patterson_lookup_points(int n, Scalar x[])
Gauss-Patterson; returns points.
Definition file for integration rules provided by John Burkardt. &lt;&gt;
static void fejer2_compute_weights(int order, Scalar w[])
Fejer type 2; returns weights.
Contains definitions of custom data types in Intrepid.
static void hermite_genz_keister_lookup_points(int n, Scalar x[])
Hermite-Genz-Keister; returns points.
static void trapezoidal_compute(int n, Scalar x[], Scalar w[])
Trapezoidal rule; returns points and weights.
static void trapezoidal_compute_points(int order, Scalar x[])
Trapezoidal rule; returns points.
static void trapezoidal_compute_weights(int order, Scalar w[])
Trapezoidal rule; returns weights.
static void legendre_lookup_weights(int n, Scalar w[])
Gauss-Legendre; returns weights.
static void legendre_lookup_points(int n, Scalar x[])
Gauss-Legendre; returns points.
static void patterson_lookup(int n, Scalar x[], Scalar w[])
Gauss-Patterson; returns points and weights.
static void hermite_compute_weights(int order, Scalar w[])
Gauss-Hermite; returns weights.
static void fejer2_compute_points(int order, Scalar x[])
Fejer type 2; returns points.
static void hermite_compute_points(int order, Scalar x[])
Gauss-Hermite; returns points.
static void laguerre_compute(int n, Scalar x[], Scalar w[])
Gauss-Laguerre; returns points and weights.
static void hermite_lookup_weights(int n, Scalar w[])
Gauss-Hermite; returns weights.
Providing integration rules, created by John Burkardt, Scientific Computing, Florida State University...
static void legendre_compute_points(int order, Scalar x[])
Gauss-Legendre; returns points.
static void clenshaw_curtis_compute_weights(int order, Scalar w[])
Clenshaw-Curtis; returns weights.
static void hermite_compute(int order, Scalar x[], Scalar w[])
Gauss-Hermite; returns points and weights.
static void chebyshev2_compute(int order, Scalar x[], Scalar w[])
Gauss-Chebyshev of Type 2; returns points and weights.
static void chebyshev1_compute_points(int order, Scalar x[])
Gauss-Chebyshev of Type 1; returns points.
static void legendre_lookup(int n, Scalar x[], Scalar w[])
Gauss-Legendre; returns points and weights.
static void hermite_lookup_points(int n, Scalar x[])
Gauss-Hermite; returns points.
static void laguerre_compute_weights(int order, Scalar w[])
Gauss-Laguerre; returns weights.
static void laguerre_lookup(int n, Scalar x[], Scalar w[])
Gauss-Laguerre; returns points and weights.
static void legendre_compute(int n, Scalar x[], Scalar w[])
Gauss-Legendre; returns points and weights.
static void hermite_genz_keister_lookup(int n, Scalar x[], Scalar w[])
Hermite-Genz-Keister; returns points and weights.
static void laguerre_lookup_points(int n, Scalar x[])
Gauss-Laguerre; returns points.
static void clenshaw_curtis_compute(int order, Scalar x[], Scalar w[])
Clenshaw-Curtis; returns points and weights.
static void fejer2_compute(int order, Scalar x[], Scalar w[])
Fejer type 2; returns points and weights.