LCOV - code coverage report
Current view: top level - src/solution_transfer - meshfree_interpolation_function.C (source / functions) Hit Total Coverage
Test: libMesh/libmesh: #4229 (6a9aeb) with base 727f46 Lines: 15 21 71.4 %
Date: 2025-08-19 19:27:09 Functions: 5 7 71.4 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : 
      29        1160 : MeshfreeInterpolationFunction::MeshfreeInterpolationFunction(const MeshfreeInterpolation & mfi, Threads::spin_mutex & mutex)
      30        1200 :     : _mfi(mfi), _mutex(mutex) {}
      31             : 
      32       73702 : Number MeshfreeInterpolationFunction::operator()(const Point & p, const Real /* time */)
      33             : {
      34       73702 :   _pts.clear();
      35       73702 :   _pts.push_back(p);
      36       73702 :   _vals.resize(1);
      37             : 
      38       73702 :   Threads::spin_mutex::scoped_lock lock(_mutex);
      39             : 
      40       79598 :   _mfi.interpolate_field_data(_mfi.field_variables(), _pts, _vals);
      41             : 
      42      147404 :   return _vals.front();
      43             : }
      44             : 
      45       73702 : void MeshfreeInterpolationFunction::operator()(const Point & p, const Real time, DenseVector<Number> & output)
      46             : {
      47       67806 :   output.resize(1);
      48       73702 :   output(0) = (*this)(p, time);
      49       73702 : }
      50             : 
      51           0 : void MeshfreeInterpolationFunction::init()
      52             : {
      53             :   // Initialization logic if any
      54           0 : }
      55             : 
      56           0 : void MeshfreeInterpolationFunction::clear()
      57             : {
      58           0 :   _pts.clear();
      59           0 :   _vals.clear();
      60           0 : }
      61             : 
      62        1018 : std::unique_ptr<FunctionBase<Number>> MeshfreeInterpolationFunction::clone() const
      63             : {
      64        1018 :   return std::make_unique<MeshfreeInterpolationFunction>(_mfi, _mutex);
      65             : }
      66             : 
      67             : } // namespace libMesh

Generated by: LCOV version 1.14