LCOV - code coverage report
Current view: top level - include/userobjects - NearestPointReceiver.h (source / functions) Hit Total Coverage
Test: neams-th-coe/cardinal: be601f Lines: 3 3 100.0 %
Date: 2025-07-15 20:50:38 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /********************************************************************/
       2             : /*                  SOFTWARE COPYRIGHT NOTIFICATION                 */
       3             : /*                             Cardinal                             */
       4             : /*                                                                  */
       5             : /*                  (c) 2021 UChicago Argonne, LLC                  */
       6             : /*                        ALL RIGHTS RESERVED                       */
       7             : /*                                                                  */
       8             : /*                 Prepared by UChicago Argonne, LLC                */
       9             : /*               Under Contract No. DE-AC02-06CH11357               */
      10             : /*                With the U. S. Department of Energy               */
      11             : /*                                                                  */
      12             : /*             Prepared by Battelle Energy Alliance, LLC            */
      13             : /*               Under Contract No. DE-AC07-05ID14517               */
      14             : /*                With the U. S. Department of Energy               */
      15             : /*                                                                  */
      16             : /*                 See LICENSE for full restrictions                */
      17             : /********************************************************************/
      18             : 
      19             : #pragma once
      20             : 
      21             : #include "GeneralUserObject.h"
      22             : 
      23             : #include "libmesh/point.h"
      24             : 
      25             : /**
      26             :  * Allows for setting values that are associated with points in space.
      27             :  * The spatialValue() function will then return the nearest value.
      28             :  */
      29             : class NearestPointReceiver : public GeneralUserObject
      30             : {
      31             : public:
      32             :   NearestPointReceiver(const InputParameters & parameters);
      33             :   static InputParameters validParams();
      34             : 
      35             :   virtual ~NearestPointReceiver();
      36             : 
      37          90 :   virtual void initialize() override {}
      38             :   virtual void execute() override;
      39          90 :   virtual void finalize() override {}
      40             : 
      41             :   virtual Real spatialValue(const Point & p) const override;
      42             : 
      43          90 :   const std::vector<Point> & positions() { return _positions; }
      44             : 
      45             :   void setValues(const std::vector<Real> & values);
      46             : 
      47             : protected:
      48             :   /**
      49             :    * Find the position that is nearest to the point
      50             :    */
      51             :   unsigned int nearestPosition(const Point & p) const;
      52             : 
      53             :   const std::vector<Point> & _positions;
      54             : 
      55             :   std::vector<Real> _data;
      56             : };

Generated by: LCOV version 1.14