LCOV - code coverage report
Current view: top level - src/vectorpostprocessors - SideValueSampler.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 31 32 96.9 %
Date: 2025-07-17 01:28:37 Functions: 6 6 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 "SideValueSampler.h"
      11             : 
      12             : // MOOSE includes
      13             : #include "MooseVariableFE.h"
      14             : 
      15             : #include "libmesh/quadrature.h"
      16             : 
      17             : registerMooseObject("MooseApp", SideValueSampler);
      18             : 
      19             : InputParameters
      20       14415 : SideValueSampler::validParams()
      21             : {
      22       14415 :   InputParameters params = SideVectorPostprocessor::validParams();
      23       14415 :   params += SamplerBase::validParams();
      24       14415 :   params.addClassDescription("Sample variable(s) along a sideset, internal or external.");
      25       14415 :   params.addRequiredCoupledVar(
      26             :       "variable", "The names of the variables that this VectorPostprocessor operates on");
      27             : 
      28       14415 :   return params;
      29           0 : }
      30             : 
      31          78 : SideValueSampler::SideValueSampler(const InputParameters & parameters)
      32          78 :   : SideVectorPostprocessor(parameters), SamplerBase(parameters, this, _communicator)
      33             : {
      34          78 :   std::vector<std::string> var_names(_coupled_moose_vars.size());
      35          78 :   _values.resize(_coupled_moose_vars.size());
      36             : 
      37         182 :   for (unsigned int i = 0; i < _coupled_moose_vars.size(); i++)
      38             :   {
      39         104 :     var_names[i] = _coupled_moose_vars[i]->name();
      40         104 :     SamplerBase::checkForStandardFieldVariableType(_coupled_moose_vars[i]);
      41             :   }
      42             : 
      43             :   // Initialize the data structures in SamplerBase
      44          78 :   SamplerBase::setupVariables(var_names);
      45          78 : }
      46             : 
      47             : void
      48          72 : SideValueSampler::initialize()
      49             : {
      50          72 :   SamplerBase::initialize();
      51          72 : }
      52             : 
      53             : void
      54       25696 : SideValueSampler::execute()
      55             : {
      56       51488 :   for (unsigned int _qp = 0; _qp < _qrule->n_points(); _qp++)
      57             :   {
      58       51776 :     for (unsigned int i = 0; i < _coupled_moose_vars.size(); i++)
      59       25984 :       _values[i] = (dynamic_cast<MooseVariable *>(_coupled_moose_vars[i]))->sln()[_qp];
      60             : 
      61       25792 :     SamplerBase::addSample(_q_point[_qp], _current_elem->id(), _values);
      62             :   }
      63       25696 : }
      64             : 
      65             : void
      66          66 : SideValueSampler::finalize()
      67             : {
      68          66 :   SamplerBase::finalize();
      69          66 : }
      70             : 
      71             : void
      72           6 : SideValueSampler::threadJoin(const UserObject & y)
      73             : {
      74           6 :   const auto & vpp = static_cast<const SideValueSampler &>(y);
      75             : 
      76           6 :   SamplerBase::threadJoin(vpp);
      77           6 : }

Generated by: LCOV version 1.14