libMesh
meshfree_interpolation_function.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2025 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 #ifndef MESHFREE_INTERPOLATION_FUNCTION_H
19 #define MESHFREE_INTERPOLATION_FUNCTION_H
20 
21 // libMesh Includes
22 #include "libmesh/function_base.h"
23 #include "libmesh/meshfree_interpolation.h"
24 #include "libmesh/threads.h"
25 
26 // C++ includes
27 #include <cstddef>
28 #include <memory>
29 #include <vector>
30 
31 namespace libMesh
32 {
33 
34 // Forward Declarations
35 template <typename T> class DenseVector;
36 
37 // ------------------------------------------------------------
38 // MeshfreeInterpolationFunction class definition
40 {
41 public:
46  Threads::spin_mutex & mutex);
47 
53 
57  virtual ~MeshfreeInterpolationFunction() = default;
58 
64 
68  void init();
69 
73  void clear();
74 
78  virtual std::unique_ptr<FunctionBase<Number>> clone() const;
79 
84  Number operator()(const Point & p, const Real time = 0.);
85 
90  void operator()(const Point & p, const Real time, DenseVector<Number> & output);
91 
92 private:
94  mutable std::vector<Point> _pts;
95  mutable std::vector<Number> _vals;
97 };
98 
99 } // namespace libMesh
100 
101 #endif // MESHFREE_INTERPOLATION_FUNCTION_H
MeshfreeInterpolationFunction(const MeshfreeInterpolation &mfi, Threads::spin_mutex &mutex)
Constructor.
void init()
The actual initialization process.
Number operator()(const Point &p, const Real time=0.)
The libMesh namespace provides an interface to certain functionality in the library.
virtual std::unique_ptr< FunctionBase< Number > > clone() const
Returns a new deep copy of the function.
Base class to support various mesh-free interpolation methods.
virtual ~MeshfreeInterpolationFunction()=default
Destructor.
MeshfreeInterpolationFunction & operator=(const MeshfreeInterpolationFunction &)=delete
Delete assignment operators.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Base class for functors that can be evaluated at a point and (optionally) time.
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:39