www.mooseframework.org
NumElems.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
11 #include "NumElems.h"
12 #include "SubProblem.h"
13 #include "MooseMesh.h"
14 
15 registerMooseObject("MooseApp", NumElems);
16 
19 {
21  MooseEnum filt("active total", "active");
22  params.addParam<MooseEnum>(
23  "elem_filter",
24  filt,
25  "The type of elements to include in the count (active, total). Default == active");
26 
27  params.addClassDescription("Return the number of active or total elements in the simulation.");
28  return params;
29 }
30 
32  : GeneralPostprocessor(parameters),
33  _filt(parameters.get<MooseEnum>("elem_filter").getEnum<ElemFilter>()),
34  _mesh(_subproblem.mesh().getMesh())
35 {
36 }
37 
38 Real
40 {
42  return _mesh.n_active_elem();
43  return _mesh.n_elem();
44 }
const ElemFilter _filt
Definition: NumElems.h:33
static InputParameters validParams()
Definition: NumElems.C:18
const MeshBase & _mesh
Definition: NumElems.h:35
NumElems(const InputParameters &parameters)
Definition: NumElems.C:31
T * get(const std::unique_ptr< T > &u)
The MooseUtils::get() specializations are used to support making forwards-compatible code changes fro...
Definition: MooseUtils.h:1147
MeshBase & mesh
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
This class is here to combine the Postprocessor interface and the base class Postprocessor object alo...
static InputParameters validParams()
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:31
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
ElemFilter
Definition: NumElems.h:27
virtual Real getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.
Definition: NumElems.C:39
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...
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...
registerMooseObject("MooseApp", NumElems)