https://mooseframework.inl.gov
src
postprocessors
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
15
registerMooseObject
(
"MooseApp"
,
NumElements
);
16
registerMooseObjectRenamed
(
"MooseApp"
, NumElems,
"04/01/2025 00:00"
,
NumElements
);
17
18
InputParameters
19
NumElements::validParams
()
20
{
21
InputParameters
params =
GeneralPostprocessor::validParams
();
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
32
NumElements::NumElements
(
const
InputParameters
& parameters)
33
:
GeneralPostprocessor
(parameters),
34
_filt(parameters.
get
<
MooseEnum
>(
"elem_filter"
).getEnum<
ElemFilter
>()),
35
_mesh(_subproblem.
mesh
().getMesh())
36
{
37
}
38
39
Real
40
NumElements::getValue
()
const
41
{
42
if
(
_filt
==
ElemFilter::ACTIVE
)
43
return
_mesh
.n_active_elem();
44
return
_mesh
.n_elem();
45
}
NumElements::ElemFilter::ACTIVE
SubProblem.h
MooseUtils::get
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:1155
NumElements::NumElements
NumElements(const InputParameters ¶meters)
Definition:
NumElements.C:32
mesh
MeshBase & mesh
InputParameters
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
Definition:
InputParameters.h:66
NumElements::_mesh
const MeshBase & _mesh
Mesh to act on.
Definition:
NumElements.h:40
GeneralPostprocessor
This class is here to combine the Postprocessor interface and the base class Postprocessor object alo...
Definition:
GeneralPostprocessor.h:21
registerMooseObjectRenamed
registerMooseObjectRenamed("MooseApp", NumElems, "04/01/2025 00:00", NumElements)
GeneralPostprocessor::validParams
static InputParameters validParams()
Definition:
GeneralPostprocessor.C:13
NumElements::ElemFilter
ElemFilter
Definition:
NumElements.h:30
MooseEnum
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition:
MooseEnum.h:33
registerMooseObject
registerMooseObject("MooseApp", NumElements)
Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
NumElements
Counts the number of elements in the entire mesh.
Definition:
NumElements.h:17
NumElements::getValue
virtual Real getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.
Definition:
NumElements.C:40
InputParameters::addClassDescription
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...
Definition:
InputParameters.C:82
InputParameters::addParam
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...
Definition:
InputParameters.h:1654
NumElements::_filt
const ElemFilter _filt
Whether to count all elements or only the active ones.
Definition:
NumElements.h:37
NumElements::validParams
static InputParameters validParams()
Definition:
NumElements.C:19
MooseMesh.h
NumElements.h
Generated on Thu Jul 17 2025 01:32:15 for https://mooseframework.inl.gov by
1.8.14