radial_basis_functions.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_RADIAL_BASIS_FUNCTIONS_H
21 #define LIBMESH_RADIAL_BASIS_FUNCTIONS_H
22 
23 // C++ includes
24 #include <limits>
25 
26 // Local includes
27 #include "libmesh/libmesh_common.h"
28 #include "libmesh/utility.h"
29 
30 
31 
32 namespace libMesh
33 {
34 
35  // /**
36  // * Simple radial basis function.
37  // */
38  // class SimpleRBF
39  // {
40  // private:
41  // const Real _rcut;
42 
43  // public:
44 
45  // /**
46  // * Constructor.
47  // */
48  // SimpleRBF (const Real r_cut = 1.) :
49  // _rcut (r_cut)
50  // {}
51 
52  // /**
53  // * Evaluate the radial basis function at the reqested location.
54  // */
55  // Real operator()(Real rad) const
56  // {
57  // if (rad > _rcut) return 0.;
58 
59  // rad /= _rcut;
60 
61  // return std::sqrt( 1+ rad*rad );
62  // }
63  // };
64 
65 
66 
70  template <unsigned int SpaceDim, unsigned int Continuity>
72  {
73  private:
74  const Real _rcut;
75 
76  public:
77 
81  WendlandRBF (const Real r_cut = 1.) :
82  _rcut (r_cut)
83  { libmesh_experimental(); }
84 
88  Real operator()(Real /* rad */) const { libmesh_not_implemented(); return 0.; }
89  };
90 
91 
92 
93  //-------------------------------------------------------
94  // Explicit specializations
95  template<>
96  inline
98  {
99  if (rad > _rcut) return 0.;
100 
101  rad /= _rcut;
102 
103  return Utility::pow<2>(1.-rad);
104  }
105 
106  template<>
107  inline
109  {
110  if (rad > _rcut) return 0.;
111 
112  rad /= _rcut;
113 
114  return Utility::pow<4>(1.-rad)*(4.*rad + 1.);
115  }
116 
117  template<>
118  inline
120  {
121  if (rad > _rcut) return 0.;
122 
123  rad /= _rcut;
124 
125  return Utility::pow<6>(1.-rad)*((35.*rad + 18.)*rad + 3.);
126  }
127 
128  template<>
129  inline
131  {
132  if (rad > _rcut) return 0.;
133 
134  rad /= _rcut;
135 
136  return Utility::pow<8>(1.-rad)*(((32.*rad + 25.)*rad + 8.)*rad + 1.);
137  }
138 
139 
140 } // namespace libMesh
141 
142 
143 #endif // #define LIBMESH_RADIAL_BASIS_FUNCTIONS_H

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:07 UTC

Hosted By:
SourceForge.net Logo