www.mooseframework.org
ElementIntegralUserObject.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 // MOOSE includes
17 
18 #include "libmesh/quadrature.h"
19 
20 template <>
23 {
25  return params;
26 }
27 
29  : ElementUserObject(parameters), _qp(0), _integral_value(0)
30 {
31 }
32 
33 void
35 {
36  _integral_value = 0;
37 }
38 
39 void
41 {
43 }
44 
45 Real
47 {
49  return _integral_value;
50 }
51 
52 void
54 {
55  const ElementIntegralUserObject & pps = static_cast<const ElementIntegralUserObject &>(y);
57 }
58 
59 Real
61 {
62  Real sum = 0;
63 
64  for (_qp = 0; _qp < _qrule->n_points(); _qp++)
65  sum += _JxW[_qp] * _coord[_qp] * computeQpIntegral();
66  return sum;
67 }
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:119
const MooseArray< Real > & _JxW
virtual Real getValue()
Returns the integral value.
Base class for user-specific data.
Definition: UserObject.h:42
virtual void threadJoin(const UserObject &y) override
Must override.