www.mooseframework.org
src
postprocessors
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
17
InputParameters
18
NumElems::validParams
()
19
{
20
InputParameters
params =
GeneralPostprocessor::validParams
();
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
31
NumElems::NumElems
(
const
InputParameters
& parameters)
32
:
GeneralPostprocessor
(parameters),
33
_filt(parameters.
get
<
MooseEnum
>(
"elem_filter"
).getEnum<
ElemFilter
>()),
34
_mesh(_subproblem.
mesh
().getMesh())
35
{
36
}
37
38
Real
39
NumElems::getValue
()
const
40
{
41
if
(
_filt
==
ElemFilter::ACTIVE
)
42
return
_mesh
.n_active_elem();
43
return
_mesh
.n_elem();
44
}
NumElems::_filt
const ElemFilter _filt
Definition:
NumElems.h:33
NumElems::validParams
static InputParameters validParams()
Definition:
NumElems.C:18
NumElems::_mesh
const MeshBase & _mesh
Definition:
NumElems.h:35
NumElems::NumElems
NumElems(const InputParameters ¶meters)
Definition:
NumElems.C:31
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:1147
mesh
MeshBase & mesh
InputParameters
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
Definition:
InputParameters.h:63
NumElems.h
GeneralPostprocessor
This class is here to combine the Postprocessor interface and the base class Postprocessor object alo...
Definition:
GeneralPostprocessor.h:21
NumElems
Definition:
NumElems.h:14
GeneralPostprocessor::validParams
static InputParameters validParams()
Definition:
GeneralPostprocessor.C:13
NumElems::ElemFilter::ACTIVE
MooseEnum
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition:
MooseEnum.h:31
Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
NumElems::ElemFilter
ElemFilter
Definition:
NumElems.h:27
NumElems::getValue
virtual Real getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.
Definition:
NumElems.C:39
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 option parameter and a documentation string to the InputParameters object...
Definition:
InputParameters.h:1518
registerMooseObject
registerMooseObject("MooseApp", NumElems)
MooseMesh.h
Generated on Wed Mar 27 2024 17:44:45 for www.mooseframework.org by
1.8.14