libMesh
meshfree_interpolation_function.C
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 // libMesh Includes
19 #include "libmesh/meshfree_interpolation_function.h"
20 
21 // C++ includes
22 #include <cstddef>
23 #include <memory>
24 #include <vector>
25 
26 namespace libMesh
27 {
28 
30  : _mfi(mfi), _mutex(mutex) {}
31 
33 {
34  _pts.clear();
35  _pts.push_back(p);
36  _vals.resize(1);
37 
38  Threads::spin_mutex::scoped_lock lock(_mutex);
39 
41 
42  return _vals.front();
43 }
44 
46 {
47  output.resize(1);
48  output(0) = (*this)(p, time);
49 }
50 
52 {
53  // Initialization logic if any
54 }
55 
57 {
58  _pts.clear();
59  _vals.clear();
60 }
61 
62 std::unique_ptr<FunctionBase<Number>> MeshfreeInterpolationFunction::clone() const
63 {
64  return std::make_unique<MeshfreeInterpolationFunction>(_mfi, _mutex);
65 }
66 
67 } // namespace libMesh
MeshfreeInterpolationFunction(const MeshfreeInterpolation &mfi, Threads::spin_mutex &mutex)
Constructor.
void init()
The actual initialization process.
const std::vector< std::string > & field_variables() const
void resize(const unsigned int n)
Resize the vector.
Definition: dense_vector.h:396
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.
virtual void interpolate_field_data(const std::vector< std::string > &field_names, const std::vector< Point > &tgt_pts, std::vector< Number > &tgt_vals) const =0
Interpolate source data at target points.
Base class to support various mesh-free interpolation methods.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:39