https://mooseframework.inl.gov
Loading...
Searching...
No Matches
NumElements.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
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 "NumElements.h"
12#include "SubProblem.h"
13#include "MooseMesh.h"
14
16registerMooseObjectRenamed("MooseApp", NumElems, "04/01/2025 00:00", NumElements);
17
20{
22 MooseEnum filt("active total", "active");
23 params.addParam<MooseEnum>(
24 "elem_filter",
25 filt,
26 "The type of elements to include in the count (active, total). Default == active");
27
28 params.addClassDescription("Return the number of active or total elements in the simulation.");
29 return params;
30}
31
33 : GeneralPostprocessor(parameters),
34 _filt(parameters.get<MooseEnum>("elem_filter").getEnum<ElemFilter>()),
35 _mesh(_subproblem.mesh().getMesh())
36{
37}
38
39Real
41{
43 return _mesh.n_active_elem();
44 return _mesh.n_elem();
45}
registerMooseObject("MooseApp", NumElements)
registerMooseObjectRenamed("MooseApp", NumElems, "04/01/2025 00:00", NumElements)
This class is here to combine the Postprocessor interface and the base class Postprocessor object alo...
static InputParameters validParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
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.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition MooseEnum.h:55
Counts the number of elements in the entire mesh.
Definition NumElements.h:18
const ElemFilter _filt
Whether to count all elements or only the active ones.
Definition NumElements.h:37
NumElements(const InputParameters &parameters)
Definition NumElements.C:32
static InputParameters validParams()
Definition NumElements.C:19
const MeshBase & _mesh
Mesh to act on.
Definition NumElements.h:40
virtual Real getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.
Definition NumElements.C:40
MeshBase & mesh