www.mooseframework.org
ElementIntegralUserObject.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 // MOOSE includes
12 
13 #include "libmesh/quadrature.h"
14 
15 template <>
18 {
20  return params;
21 }
22 
24  : ElementUserObject(parameters), _qp(0), _integral_value(0)
25 {
26 }
27 
28 void
30 {
31  _integral_value = 0;
32 }
33 
34 void
36 {
38 }
39 
40 Real
42 {
44  return _integral_value;
45 }
46 
47 void
49 {
50  const ElementIntegralUserObject & pps = static_cast<const ElementIntegralUserObject &>(y);
52 }
53 
54 Real
56 {
57  Real sum = 0;
58 
59  for (_qp = 0; _qp < _qrule->n_points(); _qp++)
60  sum += _JxW[_qp] * _coord[_qp] * computeQpIntegral();
61  return sum;
62 }
InputParameters validParams< ElementUserObject >()
virtual Real computeQpIntegral()=0
This postprocessor computes a volume integral of the specified variable.
const MooseArray< Real > & _coord
InputParameters validParams< ElementIntegralUserObject >()
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual void execute() override
Execute method.
ElementIntegralUserObject(const InputParameters &parameters)
void gatherSum(T &value)
Gather the parallel sum of the variable passed in.
Definition: UserObject.h:103
const QBase *const & _qrule
const MooseArray< Real > & _JxW
virtual Real getValue()
Returns the integral value.
Base class for user-specific data.
Definition: UserObject.h:37
virtual void threadJoin(const UserObject &y) override
Must override.