LCOV - code coverage report
Current view: top level - src/vectorpostprocessors - PointValueSampler.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 17 19 89.5 %
Date: 2025-07-17 01:28:37 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://mooseframework.inl.gov
       3             : //*
       4             : //* All rights reserved, see COPYRIGHT for full restrictions
       5             : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
       6             : //*
       7             : //* Licensed under LGPL 2.1, please see LICENSE for details
       8             : //* https://www.gnu.org/licenses/lgpl-2.1.html
       9             : 
      10             : #include "PointValueSampler.h"
      11             : 
      12             : #include <numeric>
      13             : 
      14             : registerMooseObject("MooseApp", PointValueSampler);
      15             : 
      16             : InputParameters
      17       14701 : PointValueSampler::validParams()
      18             : {
      19       14701 :   InputParameters params = PointVariableSamplerBase::validParams();
      20       14701 :   params.addClassDescription("Sample a variable at specific points.");
      21       14701 :   params.addRequiredParam<std::vector<Point>>(
      22             :       "points", "The points where you want to evaluate the variables");
      23             : 
      24       14701 :   return params;
      25           0 : }
      26             : 
      27         218 : PointValueSampler::PointValueSampler(const InputParameters & parameters)
      28         218 :   : PointVariableSamplerBase(parameters)
      29             : {
      30         218 :   _points = getParam<std::vector<Point>>("points");
      31         218 : }
      32             : 
      33             : void
      34         624 : PointValueSampler::initialize()
      35             : {
      36             :   // Generate new Ids if the point vector has grown (non-negative counting numbers)
      37         624 :   if (_points.size() > _ids.size())
      38             :   {
      39         206 :     auto old_size = _ids.size();
      40         206 :     _ids.resize(_points.size());
      41         206 :     std::iota(_ids.begin() + old_size, _ids.end(), old_size);
      42             :   }
      43             :   // Otherwise sync the ids array to be smaller if the point vector has been shrunk
      44         418 :   else if (_points.size() < _ids.size())
      45           0 :     _ids.resize(_points.size());
      46             : 
      47         624 :   PointVariableSamplerBase::initialize();
      48         624 : }

Generated by: LCOV version 1.14