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 "ElementIntegralPostprocessor.h" 11 : 12 : #include "libmesh/quadrature.h" 13 : 14 : InputParameters 15 166990 : ElementIntegralPostprocessor::validParams() 16 : { 17 166990 : InputParameters params = ElementPostprocessor::validParams(); 18 166990 : return params; 19 : } 20 : 21 24534 : ElementIntegralPostprocessor::ElementIntegralPostprocessor(const InputParameters & parameters) 22 24534 : : ElementPostprocessor(parameters), _qp(0), _integral_value(0) 23 : { 24 24534 : } 25 : 26 : void 27 204686 : ElementIntegralPostprocessor::initialize() 28 : { 29 204686 : _integral_value = 0; 30 204686 : } 31 : 32 : void 33 13391113 : ElementIntegralPostprocessor::execute() 34 : { 35 13391113 : _integral_value += computeIntegral(); 36 13391110 : } 37 : 38 : Real 39 108193 : ElementIntegralPostprocessor::getValue() const 40 : { 41 108193 : return _integral_value; 42 : } 43 : 44 : void 45 16870 : ElementIntegralPostprocessor::threadJoin(const UserObject & y) 46 : { 47 16870 : const auto & pps = static_cast<const ElementIntegralPostprocessor &>(y); 48 16870 : _integral_value += pps._integral_value; 49 16870 : } 50 : 51 : Real 52 13391017 : ElementIntegralPostprocessor::computeIntegral() 53 : { 54 13391017 : Real sum = 0; 55 : 56 73451640 : for (_qp = 0; _qp < _qrule->n_points(); _qp++) 57 60060626 : sum += _JxW[_qp] * _coord[_qp] * computeQpIntegral(); 58 13391014 : return sum; 59 : } 60 : 61 : void 62 108227 : ElementIntegralPostprocessor::finalize() 63 : { 64 108227 : gatherSum(_integral_value); 65 108227 : }