$extrastylesheet
radial_basis_functions.h
Go to the documentation of this file.
00001 // The libMesh Finite Element Library.
00002 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
00003 
00004 // This library is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU Lesser General Public
00006 // License as published by the Free Software Foundation; either
00007 // version 2.1 of the License, or (at your option) any later version.
00008 
00009 // This library is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // Lesser General Public License for more details.
00013 
00014 // You should have received a copy of the GNU Lesser General Public
00015 // License along with this library; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 
00018 
00019 
00020 #ifndef LIBMESH_RADIAL_BASIS_FUNCTIONS_H
00021 #define LIBMESH_RADIAL_BASIS_FUNCTIONS_H
00022 
00023 // C++ includes
00024 #include <limits>
00025 
00026 // Local includes
00027 #include "libmesh/libmesh_common.h"
00028 #include "libmesh/utility.h"
00029 
00030 
00031 
00032 namespace libMesh
00033 {
00034 
00035 // /**
00036 //  * Simple radial basis function.
00037 //  */
00038 // class SimpleRBF
00039 // {
00040 // private:
00041 //   const Real _rcut;
00042 
00043 // public:
00044 
00045 //   /**
00046 //    * Constructor.
00047 //    */
00048 //   SimpleRBF (const Real r_cut = 1.) :
00049 //     _rcut (r_cut)
00050 //   {}
00051 
00052 //   /**
00053 //    * Evaluate the radial basis function at the reqested location.
00054 //    */
00055 //   Real operator()(Real rad) const
00056 //   {
00057 //     if (rad > _rcut) return 0.;
00058 
00059 //     rad /= _rcut;
00060 
00061 //     return std::sqrt( 1+ rad*rad );
00062 //   }
00063 // };
00064 
00065 
00066 
00070 template <unsigned int SpaceDim, unsigned int Continuity>
00071 class WendlandRBF
00072 {
00073 private:
00074   const Real _rcut;
00075 
00076 public:
00077 
00081   WendlandRBF (const Real r_cut = 1.) :
00082     _rcut (r_cut)
00083   { libmesh_experimental(); }
00084 
00088   Real operator()(Real /* rad */) const { libmesh_not_implemented(); return 0.; }
00089 };
00090 
00091 
00092 
00093 //-------------------------------------------------------
00094 // Explicit specializations
00095 template<>
00096 inline
00097 Real WendlandRBF<3,0>::operator()(Real rad) const
00098 {
00099   if (rad > _rcut) return 0.;
00100 
00101   rad /= _rcut;
00102 
00103   return Utility::pow<2>(1.-rad);
00104 }
00105 
00106 template<>
00107 inline
00108 Real WendlandRBF<3,2>::operator()(Real rad) const
00109 {
00110   if (rad > _rcut) return 0.;
00111 
00112   rad /= _rcut;
00113 
00114   return Utility::pow<4>(1.-rad)*(4.*rad + 1.);
00115 }
00116 
00117 template<>
00118 inline
00119 Real WendlandRBF<3,4>::operator()(Real rad) const
00120 {
00121   if (rad > _rcut) return 0.;
00122 
00123   rad /= _rcut;
00124 
00125   return Utility::pow<6>(1.-rad)*((35.*rad + 18.)*rad + 3.);
00126 }
00127 
00128 template<>
00129 inline
00130 Real WendlandRBF<3,8>::operator()(Real rad) const
00131 {
00132   if (rad > _rcut) return 0.;
00133 
00134   rad /= _rcut;
00135 
00136   return Utility::pow<8>(1.-rad)*(((32.*rad + 25.)*rad + 8.)*rad + 1.);
00137 }
00138 
00139 
00140 } // namespace libMesh
00141 
00142 
00143 #endif // #define LIBMESH_RADIAL_BASIS_FUNCTIONS_H