LCOV - code coverage report
Current view: top level - src/userobjects - FunctionLayeredIntegral.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 31 33 93.9 %
Date: 2025-07-17 01:28:37 Functions: 7 7 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 "FunctionLayeredIntegral.h"
      11             : 
      12             : registerMooseObject("MooseApp", FunctionLayeredIntegral);
      13             : 
      14             : InputParameters
      15       14290 : FunctionLayeredIntegral::validParams()
      16             : {
      17             :   InputParameters params =
      18       14290 :       SpatialUserObjectFunctor<FunctionElementIntegralUserObject>::validParams();
      19       14290 :   params += LayeredBase::validParams();
      20       14290 :   params.addClassDescription("Integrates a function in layers");
      21       14290 :   return params;
      22           0 : }
      23             : 
      24          13 : FunctionLayeredIntegral::FunctionLayeredIntegral(const InputParameters & parameters)
      25          13 :   : SpatialUserObjectFunctor<FunctionElementIntegralUserObject>(parameters), LayeredBase(parameters)
      26             : {
      27          13 : }
      28             : 
      29             : void
      30          12 : FunctionLayeredIntegral::initialize()
      31             : {
      32          12 :   SpatialUserObjectFunctor<FunctionElementIntegralUserObject>::initialize();
      33          12 :   LayeredBase::initialize();
      34          12 : }
      35             : 
      36             : void
      37         320 : FunctionLayeredIntegral::execute()
      38             : {
      39         320 :   Real integral_value = computeIntegral();
      40             : 
      41         320 :   unsigned int layer = getLayer(_current_elem->vertex_average());
      42             : 
      43         320 :   setLayerValue(layer, getLayerValue(layer) + integral_value);
      44         320 : }
      45             : 
      46             : void
      47          11 : FunctionLayeredIntegral::finalize()
      48             : {
      49          11 :   LayeredBase::finalize();
      50          11 : }
      51             : 
      52             : void
      53           1 : FunctionLayeredIntegral::threadJoin(const UserObject & y)
      54             : {
      55           1 :   SpatialUserObjectFunctor<FunctionElementIntegralUserObject>::threadJoin(y);
      56           1 :   LayeredBase::threadJoin(y);
      57           1 : }
      58             : 
      59             : const std::vector<Point>
      60          12 : FunctionLayeredIntegral::spatialPoints() const
      61             : {
      62          12 :   std::vector<Point> points;
      63             : 
      64         252 :   for (const auto & l : _layer_centers)
      65             :   {
      66         240 :     Point pt(0.0, 0.0, 0.0);
      67         240 :     pt(_direction) = l;
      68         240 :     points.push_back(pt);
      69             :   }
      70             : 
      71          12 :   return points;
      72           0 : }

Generated by: LCOV version 1.14