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 14292 : FunctionLayeredIntegral::validParams() 16 : { 17 : InputParameters params = 18 14292 : SpatialUserObjectFunctor<FunctionElementIntegralUserObject>::validParams(); 19 14292 : params += LayeredBase::validParams(); 20 14292 : params.addClassDescription("Integrates a function in layers"); 21 14292 : return params; 22 0 : } 23 : 24 14 : FunctionLayeredIntegral::FunctionLayeredIntegral(const InputParameters & parameters) 25 14 : : SpatialUserObjectFunctor<FunctionElementIntegralUserObject>(parameters), LayeredBase(parameters) 26 : { 27 14 : } 28 : 29 : void 30 13 : FunctionLayeredIntegral::initialize() 31 : { 32 13 : SpatialUserObjectFunctor<FunctionElementIntegralUserObject>::initialize(); 33 13 : LayeredBase::initialize(); 34 13 : } 35 : 36 : void 37 360 : FunctionLayeredIntegral::execute() 38 : { 39 360 : Real integral_value = computeIntegral(); 40 : 41 360 : unsigned int layer = getLayer(_current_elem->vertex_average()); 42 : 43 360 : setLayerValue(layer, getLayerValue(layer) + integral_value); 44 360 : } 45 : 46 : void 47 12 : FunctionLayeredIntegral::finalize() 48 : { 49 12 : LayeredBase::finalize(); 50 12 : } 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 13 : FunctionLayeredIntegral::spatialPoints() const 61 : { 62 13 : std::vector<Point> points; 63 : 64 273 : for (const auto & l : _layer_centers) 65 : { 66 260 : Point pt(0.0, 0.0, 0.0); 67 260 : pt(_direction) = l; 68 260 : points.push_back(pt); 69 : } 70 : 71 13 : return points; 72 0 : }