libMesh
radial_basis_functions.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2024 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 requested 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 
74 template <unsigned int SpaceDim, unsigned int Continuity>
76 {
77 private:
78  const Real _rcut;
79 
80 public:
81 
85  WendlandRBF (const Real r_cut = 1.) :
86  _rcut (r_cut)
87  { libmesh_experimental(); }
88 
92  Real operator()(Real /* rad */) const { libmesh_not_implemented(); return 0.; }
93 };
94 
95 
96 
97 //-------------------------------------------------------
98 // Explicit specializations
99 template<>
100 inline
102 {
103  if (rad > _rcut) return 0.;
104 
105  rad /= _rcut;
106 
107  return Utility::pow<2>(1.-rad);
108 }
109 
110 template<>
111 inline
113 {
114  if (rad > _rcut) return 0.;
115 
116  rad /= _rcut;
117 
118  return Utility::pow<4>(1.-rad)*(4.*rad + 1.);
119 }
120 
121 template<>
122 inline
124 {
125  if (rad > _rcut) return 0.;
126 
127  rad /= _rcut;
128 
129  return Utility::pow<6>(1.-rad)*((35.*rad + 18.)*rad + 3.);
130 }
131 
132 template<>
133 inline
135 {
136  if (rad > _rcut) return 0.;
137 
138  rad /= _rcut;
139 
140  return Utility::pow<8>(1.-rad)*(((32.*rad + 25.)*rad + 8.)*rad + 1.);
141 }
142 
143 
144 } // namespace libMesh
145 
146 
147 #endif // #define LIBMESH_RADIAL_BASIS_FUNCTIONS_H
Real operator()(Real) const
Evaluate the radial basis function at the requested location.
The libMesh namespace provides an interface to certain functionality in the library.
WendlandRBF(const Real r_cut=1.)
Constructor.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Simple radial basis function.