19#include "libmesh/mesh_base.h"
27 params.
addClassDescription(
"Count number of DOFs of a non-linear variable that are greater than "
28 "or less than a given threshold");
30 "The name of the variable to conduct a comparison for");
31 params.
addParam<SubdomainName>(
"subdomain",
"The subdomain that the variable lives on");
32 params.
addParam<Real>(
"value", 0,
"The value to compare against");
33 MooseEnum comparator(
"greater less",
"greater");
37 "The comparison to perform between the variable and the provided value");
44 _var(_fe_problem.getVariable(_tid,
45 getParam<VariableName>(
"variable"),
46 Moose::VarKindType::VAR_SOLVER,
47 Moose::VarFieldType::VAR_FIELD_STANDARD)),
48 _mesh(_fe_problem.
mesh().getMesh()),
49 _subdomain_restricted(isParamValid(
"subdomain")),
50 _subdomain_id(_subdomain_restricted
51 ? _fe_problem.
mesh().getSubdomainID(getParam<SubdomainName>(
"subdomain"))
52 :
Moose::INVALID_BLOCK_ID),
53 _value(getParam<Real>(
"value")),
54 _comparator(getParam<
MooseEnum>(
"comparator"))
78 ConstElemRange range(
_mesh.active_local_elements_begin(),
_mesh.active_local_elements_end());
87 for (
auto dof : aldit.getDofIndices())
88 if (solution(dof) >
_value)
93 for (
auto dof : aldit.getDofIndices())
94 if (solution(dof) <
_value)
registerMooseObject("MooseApp", GreaterThanLessThanPostprocessor)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Real PostprocessorValue
various MOOSE typedefs
Grab all the (possibly semi)local dof indices for the variables passed in, in the system passed in.
NonlinearSystemBase & getNonlinearSystemBase(const unsigned int sys_num)
This class is here to combine the Postprocessor interface and the base class Postprocessor object alo...
static InputParameters validParams()
const MeshBase & _mesh
The libmesh mesh.
virtual PostprocessorValue getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.
static InputParameters validParams()
const SubdomainID _subdomain_id
An optional subdomain over which to query degrees of freedom.
const Real _value
The tolerance used to decide whether the variable indicates contact.
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
unsigned int _count
Represents the number of values in contact.
virtual void finalize() override
This is called after execute() and after threadJoin()! This is probably where you want to do MPI comm...
const MooseVariableFEBase & _var
MOOSE variable we compute the contact set from.
GreaterThanLessThanPostprocessor(const InputParameters ¶meters)
const bool _subdomain_restricted
Whether we are subdomain restricting the active set search.
const MooseEnum _comparator
The comparison to perform.
virtual void execute() override
Execute method.
const std::string & name() const
Get the name of the class.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
unsigned int number() const
Gets the number of this system.
NumericVector< Number > & solution()
void gatherSum(T &value)
Gather the parallel sum of the variable passed in.
FEProblemBase & _fe_problem
Reference to the FEProblemBase for this user object.
SystemBase & _sys
Reference to the system object for this user object.
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
void parallel_reduce(const Range &range, Body &body, unsigned int n_threads=libMesh::n_threads())