www.mooseframework.org
ElementIntegralPostprocessor.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 
11 
12 #include "libmesh/quadrature.h"
13 
16 {
18  return params;
19 }
20 
22  : ElementPostprocessor(parameters), _qp(0), _integral_value(0)
23 {
24 }
25 
26 void
28 {
29  _integral_value = 0;
30 }
31 
32 void
34 {
36 }
37 
38 Real
40 {
41  return _integral_value;
42 }
43 
44 void
46 {
47  const auto & pps = static_cast<const ElementIntegralPostprocessor &>(y);
48  _integral_value += pps._integral_value;
49 }
50 
51 Real
53 {
54  Real sum = 0;
55 
56  for (_qp = 0; _qp < _qrule->n_points(); _qp++)
57  sum += _JxW[_qp] * _coord[_qp] * computeQpIntegral();
58  return sum;
59 }
60 
61 void
63 {
65 }
This postprocessor computes a volume integral of the specified variable.
const MooseArray< Real > & _coord
static InputParameters validParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual Real computeQpIntegral()=0
virtual void threadJoin(const UserObject &y) override
Must override.
virtual void finalize() override
This is called after execute() and after threadJoin()! This is probably where you want to do MPI comm...
void gatherSum(T &value)
Gather the parallel sum of the variable passed in.
Definition: UserObject.h:125
virtual void execute() override
Execute method.
virtual Real getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const QBase *const & _qrule
const MooseArray< Real > & _JxW
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
Base class for user-specific data.
Definition: UserObject.h:39
ElementIntegralPostprocessor(const InputParameters &parameters)