|
Intrepid
|
00001 // @HEADER 00002 // ************************************************************************ 00003 // 00004 // Intrepid Package 00005 // Copyright (2007) Sandia Corporation 00006 // 00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 // license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // Redistribution and use in source and binary forms, with or without 00011 // modification, are permitted provided that the following conditions are 00012 // met: 00013 // 00014 // 1. Redistributions of source code must retain the above copyright 00015 // notice, this list of conditions and the following disclaimer. 00016 // 00017 // 2. Redistributions in binary form must reproduce the above copyright 00018 // notice, this list of conditions and the following disclaimer in the 00019 // documentation and/or other materials provided with the distribution. 00020 // 00021 // 3. Neither the name of the Corporation nor the names of the 00022 // contributors may be used to endorse or promote products derived from 00023 // this software without specific prior written permission. 00024 // 00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY 00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE 00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00036 // 00037 // Questions? Contact Pavel Bochev (pbboche@sandia.gov) 00038 // Denis Ridzal (dridzal@sandia.gov), or 00039 // Kara Peterson (kjpeter@sandia.gov) 00040 // 00041 // ************************************************************************ 00042 // @HEADER 00043 00051 #ifndef INTREPID_BURKARDTRULES_HPP 00052 #define INTREPID_BURKARDTRULES_HPP 00053 00054 #include "Intrepid_ConfigDefs.hpp" 00055 #include "Intrepid_Types.hpp" 00056 #include "Teuchos_Assert.hpp" 00057 //#include <fstream> 00058 //#include <string> 00059 00060 namespace Intrepid { 00061 00065 enum EIntrepidBurkardt { 00066 BURK_CHEBYSHEV1 = 0, 00067 BURK_CHEBYSHEV2, 00068 BURK_CLENSHAWCURTIS, 00069 BURK_FEJER2, 00070 BURK_LEGENDRE, 00071 BURK_PATTERSON, 00072 BURK_TRAPEZOIDAL, 00073 BURK_HERMITE, 00074 BURK_GENZKEISTER, 00075 BURK_LAGUERRE 00076 }; 00077 00078 inline std::string EIntrepidBurkardtToString(EIntrepidBurkardt rule) { 00079 std::string retString; 00080 switch(rule) { 00081 case BURK_CHEBYSHEV1: retString = "Gauss-Chebyshev Type 1"; break; 00082 case BURK_CHEBYSHEV2: retString = "Gauss-Chebyshev Type 2"; break; 00083 case BURK_CLENSHAWCURTIS: retString = "Clenshaw-Curtis"; break; 00084 case BURK_FEJER2: retString = "Fejer Type 2"; break; 00085 case BURK_LEGENDRE: retString = "Gauss-Legendre"; break; 00086 case BURK_PATTERSON: retString = "Gauss-Patterson"; break; 00087 case BURK_TRAPEZOIDAL: retString = "Trapezoidal Rule"; break; 00088 case BURK_HERMITE: retString = "Gauss-Hermite"; break; 00089 case BURK_GENZKEISTER: retString = "Hermite-Genz-Keister"; break; 00090 case BURK_LAGUERRE: retString = "Gauss-Laguerre"; break; 00091 default: retString = "INVALID EIntrepidBurkardt"; 00092 } 00093 return retString; 00094 } 00095 00096 inline EIntrepidBurkardt & operator++(EIntrepidBurkardt &type) { 00097 return type = static_cast<EIntrepidBurkardt>(type+1); 00098 } 00099 00100 inline EIntrepidBurkardt operator++(EIntrepidBurkardt &type, int) { 00101 EIntrepidBurkardt oldval = type; 00102 ++type; 00103 return oldval; 00104 } 00105 00115 class IntrepidBurkardtRules { 00116 00117 public: 00118 00119 /* HELPER FUNCTIONS */ 00120 template<class Scalar> 00121 static void imtqlx ( int n, Scalar d[], Scalar e[], Scalar z[] ); 00122 template<class Scalar> static Scalar r8_epsilon( Scalar one ); 00123 template<class Scalar> static Scalar r8_sign( Scalar x ); 00124 00125 /* COMPUTE CHEBYSHEV TYPE 1 NODES AND WEIGHTS */ 00126 /* Integrates functions on [-1,1] weighted by w(x) = 1/sqrt(1-x^2) */ 00129 template<class Scalar> 00130 static void chebyshev1_compute ( int order, Scalar x[], Scalar w[] ); 00133 template<class Scalar> 00134 static void chebyshev1_compute_points ( int order, Scalar x[] ); 00137 template<class Scalar> 00138 static void chebyshev1_compute_weights ( int order, Scalar w[] ); 00139 00140 /* COMPUTE CHEBYSHEV TYPE 2 NODES AND WEIGHTS */ 00141 /* Integrates functions on [-1,1] weighted by w(x) = sqrt(1-x^2) */ 00144 template<class Scalar> 00145 static void chebyshev2_compute ( int order, Scalar x[], Scalar w[] ); 00148 template<class Scalar> 00149 static void chebyshev2_compute_points ( int order, Scalar x[] ); 00152 template<class Scalar> 00153 static void chebyshev2_compute_weights ( int order, Scalar w[] ); 00154 00155 /* COMPUTE CLENSHAW CURTIS NODES AND WEIGHTS */ 00156 /* Integrates functions on [-1,1] weighted by w(x) = 1 */ 00159 template<class Scalar> 00160 static void clenshaw_curtis_compute ( int order, Scalar x[], Scalar w[] ); 00163 template<class Scalar> 00164 static void clenshaw_curtis_compute_points ( int order, Scalar x[] ); 00167 template<class Scalar> 00168 static void clenshaw_curtis_compute_weights ( int order, Scalar w[] ); 00169 00170 /* COMPUTE FEJER TYPE 2 NODES AND WEIGHTS */ 00171 /* Integrates functions on [-1,1] weighted by w(x) = 1 */ 00174 template<class Scalar> 00175 static void fejer2_compute ( int order, Scalar x[], Scalar w[] ); 00178 template<class Scalar> 00179 static void fejer2_compute_points ( int order, Scalar x[] ); 00182 template<class Scalar> 00183 static void fejer2_compute_weights ( int order, Scalar w[] ); 00184 00185 /* COMPUTE GAUSS HERMITE NODES AND WEIGHTS */ 00186 /* Integrates functions on (-oo,oo) weighted by w(x) = exp(-x^2) */ 00189 template<class Scalar> 00190 static void hermite_compute ( int order, Scalar x[], Scalar w[] ); 00193 template<class Scalar> 00194 static void hermite_compute_points ( int order, Scalar x[] ); 00197 template<class Scalar> 00198 static void hermite_compute_weights ( int order, Scalar w[] ); 00199 00202 template<class Scalar> 00203 static void hermite_lookup ( int n, Scalar x[], Scalar w[] ); 00206 template<class Scalar> 00207 static void hermite_lookup_points ( int n, Scalar x[] ); 00210 template<class Scalar> 00211 static void hermite_lookup_weights ( int n, Scalar w[] ); 00212 00213 /* COMPUTE GENZ KEISTER NODES AND WEIGHTS */ 00214 /* Integrates functions on (-oo,oo) weighted by w(x) = exp(-x^2) */ 00217 template<class Scalar> 00218 static void hermite_genz_keister_lookup ( int n, Scalar x[], Scalar w[] ); 00221 template<class Scalar> 00222 static void hermite_genz_keister_lookup_points ( int n, Scalar x[] ); 00225 template<class Scalar> 00226 static void hermite_genz_keister_lookup_weights ( int n, Scalar w[] ); 00227 00228 /* COMPUTE GAUSS LAGUERRE NODES AND WEIGHTS */ 00229 /* Integrates functons on [0,oo) weighted by w(x) = exp(-x) */ 00232 template<class Scalar> 00233 static void laguerre_compute ( int n, Scalar x[], Scalar w[] ); 00236 template<class Scalar> 00237 static void laguerre_compute_points ( int order, Scalar x[] ); 00240 template<class Scalar> 00241 static void laguerre_compute_weights ( int order, Scalar w[] ); 00242 00245 template<class Scalar> 00246 static void laguerre_lookup ( int n, Scalar x[], Scalar w[] ); 00249 template<class Scalar> 00250 static void laguerre_lookup_points ( int n, Scalar x[] ); 00253 template<class Scalar> 00254 static void laguerre_lookup_weights ( int n, Scalar w[] ); 00255 00256 /* COMPUTE GAUSS LEGENDRE NODES AND WEIGHTS */ 00257 /* Integrates functions on [-1,1] weighted by w(x) = 1 */ 00260 template<class Scalar> 00261 static void legendre_compute ( int n, Scalar x[], Scalar w[] ); 00264 template<class Scalar> 00265 static void legendre_compute_points ( int order, Scalar x[] ); 00268 template<class Scalar> 00269 static void legendre_compute_weights ( int order, Scalar w[] ); 00270 00273 template<class Scalar> 00274 static void legendre_lookup ( int n, Scalar x[], Scalar w[] ); 00277 template<class Scalar> 00278 static void legendre_lookup_points ( int n, Scalar x[] ); 00281 template<class Scalar> 00282 static void legendre_lookup_weights ( int n, Scalar w[] ); 00283 00284 /* COMPUTE GAUSS PATTERSON NODES AND WEIGHTS */ 00285 /* Integrates functions on [-1,1] weighted by w(x) = 1 */ 00288 template<class Scalar> 00289 static void patterson_lookup ( int n, Scalar x[], Scalar w[] ); 00292 template<class Scalar> 00293 static void patterson_lookup_points ( int n, Scalar x[] ); 00296 template<class Scalar> 00297 static void patterson_lookup_weights ( int n, Scalar w[] ); 00298 00299 /* COMPUTE TRAPEZOIDAL RULE NODES AND WEIGHTS */ 00300 /* Integrates functions on [-1,1] weighted by w(x) = 1 */ 00303 template<class Scalar> 00304 static void trapezoidal_compute ( int n, Scalar x[], Scalar w[] ); 00307 template<class Scalar> 00308 static void trapezoidal_compute_points ( int order, Scalar x[] ); 00311 template<class Scalar> 00312 static void trapezoidal_compute_weights ( int order, Scalar w[] ); 00313 00314 }; // class IntrepidBurkardtRules 00315 00316 } // end Intrepid namespace 00317 00318 // include templated definitions 00319 #include "Intrepid_BurkardtRulesDef.hpp" 00320 00321 #endif
1.7.6.1