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 
17 {
19  params.addClassDescription("Performs a spatial integration");
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 void
42 {
44 }
45 
46 Real
48 {
49  return _integral_value;
50 }
51 
52 void
54 {
55  const auto & pps = static_cast<const ElementIntegralUserObject &>(y);
56  _integral_value += pps._integral_value;
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 }
virtual Real computeQpIntegral()=0
This postprocessor computes a volume integral of the specified variable.
const MooseArray< Real > & _coord
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
static InputParameters validParams()
virtual void finalize() override
Finalize.
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)
static InputParameters validParams()
void gatherSum(T &value)
Gather the parallel sum of the variable passed in.
Definition: UserObject.h:125
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const QBase *const & _qrule
const MooseArray< Real > & _JxW
virtual Real getValue() const
Returns the integral value.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
Base class for user-specific data.
Definition: UserObject.h:39
virtual void threadJoin(const UserObject &y) override
Must override.