www.mooseframework.org
NumElems.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
16 #include "NumElems.h"
17 #include "SubProblem.h"
18 #include "MooseMesh.h"
19 
20 template <>
23 {
25  MooseEnum filt("active total", "active");
26  params.addParam<MooseEnum>(
27  "elem_filter",
28  filt,
29  "The type of elements to include in the count (active, total). Default == active");
30  return params;
31 }
32 
34  : GeneralPostprocessor(parameters),
35  _filt(parameters.get<MooseEnum>("elem_filter").getEnum<ElemFilter>())
36 {
37 }
38 
39 Real
41 {
43  return _subproblem.mesh().getMesh().n_active_elem();
44  return _subproblem.mesh().nElem();
45 }
virtual MooseMesh & mesh()=0
const ElemFilter _filt
Definition: NumElems.h:42
NumElems(const InputParameters &parameters)
Definition: NumElems.C:33
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
InputParameters validParams< GeneralPostprocessor >()
This class is here to combine the Postprocessor interface and the base class Postprocessor object alo...
SubProblem & _subproblem
Reference to the Subproblem for this user object.
Definition: UserObject.h:146
InputParameters validParams< NumElems >()
Definition: NumElems.C:22
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition: MooseMesh.C:2355
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:37
ElemFilter
Definition: NumElems.h:37
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an option parameter and a documentation string to the InputParameters object...
virtual dof_id_type nElem() const
Definition: MooseMesh.C:2030
virtual Real getValue() override
This will get called to actually grab the final value the postprocessor has calculated.
Definition: NumElems.C:40