Intrepid
http://trilinos.sandia.gov/packages/docs/r11.2/packages/intrepid/src/Shared/Intrepid_Polylib.hpp
Go to the documentation of this file.
00001 /*
00002 // @HEADER
00003 // ************************************************************************
00004 //
00005 //                           Intrepid Package
00006 //                 Copyright (2007) Sandia Corporation
00007 //
00008 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00009 // license for use of this work by or on behalf of the U.S. Government.
00010 //
00011 // Redistribution and use in source and binary forms, with or without
00012 // modification, are permitted provided that the following conditions are
00013 // met:
00014 //
00015 // 1. Redistributions of source code must retain the above copyright
00016 // notice, this list of conditions and the following disclaimer.
00017 //
00018 // 2. Redistributions in binary form must reproduce the above copyright
00019 // notice, this list of conditions and the following disclaimer in the
00020 // documentation and/or other materials provided with the distribution.
00021 //
00022 // 3. Neither the name of the Corporation nor the names of the
00023 // contributors may be used to endorse or promote products derived from
00024 // this software without specific prior written permission.
00025 //
00026 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00027 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00028 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00029 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00030 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00031 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00032 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00033 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00034 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00035 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00036 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00037 //
00038 // Questions? Contact Pavel Bochev  (pbboche@sandia.gov)
00039 //                    Denis Ridzal  (dridzal@sandia.gov), or
00040 //                    Kara Peterson (kjpeter@sandia.gov)
00041 //
00042 // ************************************************************************
00043 // @HEADER
00044 */
00045 
00047 //
00048 // File: Intrepid_Polylib.hpp
00049 //
00050 // For more information, please see: http://www.nektar.info
00051 //
00052 // The MIT License
00053 //
00054 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
00055 // Department of Aeronautics, Imperial College London (UK), and Scientific
00056 // Computing and Imaging Institute, University of Utah (USA).
00057 //
00058 // License for the specific language governing rights and limitations under
00059 // Permission is hereby granted, free of charge, to any person obtaining a
00060 // copy of this software and associated documentation files (the "Software"),
00061 // to deal in the Software without restriction, including without limitation
00062 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
00063 // and/or sell copies of the Software, and to permit persons to whom the
00064 // Software is furnished to do so, subject to the following conditions:
00065 //
00066 // The above copyright notice and this permission notice shall be included
00067 // in all copies or substantial portions of the Software.
00068 //
00069 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00070 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00071 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
00072 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00073 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00074 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00075 // DEALINGS IN THE SOFTWARE.
00076 //
00077 // Description:
00078 // This file is redistributed with the Intrepid package. It should be used
00079 // in accordance with the above MIT license, at the request of the authors.
00080 // This file is NOT covered by the usual Intrepid/Trilinos LGPL license.
00081 //
00082 // Origin: Nektar++ library, http://www.nektar.info, downloaded on
00083 //         March 10, 2009.
00084 //
00086 
00087 
00095 #ifndef INTREPID_POLYLIB_HPP
00096 #define INTREPID_POLYLIB_HPP
00097 
00098 #include "Intrepid_ConfigDefs.hpp"
00099 #include "Intrepid_Types.hpp"
00100 #include "Teuchos_Assert.hpp"
00101 
00102 namespace Intrepid {
00103 
00197   enum EIntrepidPLPoly {
00198     PL_GAUSS=0,
00199     PL_GAUSS_RADAU_LEFT,
00200     PL_GAUSS_RADAU_RIGHT,
00201     PL_GAUSS_LOBATTO,
00202     PL_MAX
00203   };
00204 
00205   inline EIntrepidPLPoly & operator++(EIntrepidPLPoly &type) {
00206     return type = static_cast<EIntrepidPLPoly>(type+1);
00207   }
00208 
00209   inline EIntrepidPLPoly operator++(EIntrepidPLPoly &type, int) {
00210     EIntrepidPLPoly oldval = type;
00211     ++type;
00212     return oldval;
00213   }
00214 
00215 
00223   class IntrepidPolylib {
00224 
00225     public:
00226 
00227     /* Points and weights */
00228 
00236     template<class Scalar>
00237     static void   zwgj   (Scalar *z, Scalar *w, const int np, const Scalar alpha, const Scalar beta);
00238 
00239 
00247     template<class Scalar>
00248     static void   zwgrjm (Scalar *z, Scalar *w, const int np, const Scalar alpha, const Scalar beta);
00249 
00250 
00258     template<class Scalar>
00259     static void   zwgrjp (Scalar *z, Scalar *w, const int np, const Scalar alpha, const Scalar beta);
00260 
00261 
00269     template<class Scalar>
00270     static void   zwglj  (Scalar *z, Scalar *w, const int np, const Scalar alpha, const Scalar beta);
00271 
00272 
00273 
00274     /* Derivative operators */
00275 
00284     template<class Scalar>
00285     static void   Dgj    (Scalar *D,  const Scalar *z, const int np, const Scalar alpha, const Scalar beta);
00286 
00287 
00296     template<class Scalar>
00297     static void   Dgrjm  (Scalar *D, const Scalar *z, const int np, const Scalar alpha, const Scalar beta);
00298 
00299 
00308     template<class Scalar>
00309     static void   Dgrjp  (Scalar *D, const Scalar *z, const int np, const Scalar alpha, const Scalar beta);
00310 
00311 
00320     template<class Scalar>
00321     static void   Dglj   (Scalar *D, const Scalar *z, const int np, const Scalar alpha, const Scalar beta);
00322 
00323 
00324 
00325     /* Lagrangian interpolants */
00326 
00346     template<class Scalar>
00347     static Scalar hgj     (const int i, const Scalar z, const Scalar *zgj,
00348                            const int np, const Scalar alpha, const Scalar beta);
00349 
00350 
00370     template<class Scalar>
00371     static Scalar hgrjm   (const int i, const Scalar z, const Scalar *zgrj,
00372                            const int np, const Scalar alpha, const Scalar beta);
00373 
00374 
00394     template<class Scalar>
00395     static Scalar hgrjp   (const int i, const Scalar z, const Scalar *zgrj,
00396                            const int np, const Scalar alpha, const Scalar beta);
00397 
00398 
00418     template<class Scalar>
00419     static Scalar hglj    (const int i, const Scalar z, const Scalar *zglj,
00420                            const int np, const Scalar alpha, const Scalar beta);
00421 
00422 
00423 
00424     /* Interpolation operators */
00425 
00436     template<class Scalar>
00437     static void  Imgj  (Scalar *im, const Scalar *zgj, const Scalar *zm, const int nz,
00438                         const int mz, const Scalar alpha, const Scalar beta);
00439 
00440 
00451     template<class Scalar>
00452     static void  Imgrjm(Scalar *im, const Scalar *zgrj, const Scalar *zm, const int nz,
00453                         const int mz, const Scalar alpha, const Scalar beta);
00454 
00455 
00466     template<class Scalar>
00467     static void  Imgrjp(Scalar *im, const Scalar *zgrj, const Scalar *zm, const int nz,
00468                         const int mz, const Scalar alpha, const Scalar beta);
00469 
00470 
00481     template<class Scalar>
00482     static void  Imglj (Scalar *im, const Scalar *zglj, const Scalar *zm, const int nz,
00483                         const int mz, const Scalar alpha, const Scalar beta);
00484 
00485 
00486     /* Polynomial functions */
00487 
00527     template<class Scalar>
00528     static void jacobfd (const int np, const Scalar *z, Scalar *poly_in, Scalar *polyd,
00529                          const int n, const Scalar alpha, const Scalar beta);
00530 
00531 
00545     template<class Scalar>
00546     static void jacobd  (const int np, const Scalar *z, Scalar *polyd, const int n,
00547                          const Scalar alpha, const Scalar beta);
00548 
00549 
00550 
00551     /* Helper functions. */
00552 
00559     template<class Scalar>
00560     static void   Jacobz (const int n, Scalar *z, const Scalar alpha, const Scalar beta);
00561 
00562 
00585     template<class Scalar>
00586     static void   JacZeros (const int n, Scalar *a, const Scalar alpha, const Scalar beta);
00587 
00588 
00612     template<class Scalar>
00613     static void   TriQL    (const int n, Scalar *d, Scalar *e);
00614 
00615 
00625     template<class Scalar>
00626     static Scalar gammaF (const Scalar x);
00627 
00628 
00629   }; // class IntrepidPolylib
00630 
00631 } // end of Intrepid namespace
00632 
00633 // include templated definitions
00634 #include <Intrepid_PolylibDef.hpp>
00635 
00636 #endif