Loading [MathJax]/extensions/tex2jax.js
https://mooseframework.inl.gov
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
MeshDivisionAux.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 #include "MeshDivisionAux.h"
11 #include "MeshDivision.h"
12 
14 
17 {
19  params.addClassDescription(
20  "Returns the value of the mesh division index for each element / node");
21  params.addRequiredParam<MeshDivisionName>("mesh_division",
22  "The mesh division providing the value");
23  params.addParam<int>(
24  "output_invalid_value_as", -1, "Convert the invalid value index for output purposes");
25  return params;
26 }
27 
29  : AuxKernel(parameters),
30  _mesh_division(
31  _c_fe_problem.getMeshDivision(getParam<MeshDivisionName>("mesh_division"), _tid)),
32  _invalid_bin_value(getParam<int>("output_invalid_value_as"))
33 {
34  // Check family types for reasonable choices
35  if (!_var.isNodal() && _var.feType().order != CONSTANT)
36  paramError("Variable order " + Moose::stringify(_var.feType().order) + " unsupported");
37 }
38 
39 Real
41 {
45  return _invalid_bin_value;
46  else
47  return value;
48 }
virtual bool isNodal() const
Is this variable nodal.
const libMesh::FEType & feType() const
Get the type of finite element object.
virtual unsigned int divisionIndex(const Point &pt) const =0
Return the index of the division to which the point belongs.
Returns the index of the mesh division for each element / node.
const int _invalid_bin_value
Number to use for the invalid value.
const Node *const & _current_node
Current node (valid only for nodal kernels)
Definition: AuxKernel.h:214
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
OrderWrapper order
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
const MeshDivision & _mesh_division
Mesh division to evaluate.
CONSTANT
registerMooseObject("MooseApp", MeshDivisionAux)
virtual Real computeValue() override
Compute and return the value of the aux variable.
MeshDivisionAux(const InputParameters &parameters)
virtual const OutputTools< Real >::VariableValue & value()
The value of the variable this object is operating on.
void paramError(const std::string &param, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
std::string stringify(const T &t)
conversion to string
Definition: Conversion.h:62
unsigned int INVALID_DIVISION_INDEX
Invalid subdomain id to return when outside the mesh division.
Definition: MeshDivision.h:28
MooseVariableField< Real > & _var
This is a regular kernel so we cast to a regular MooseVariable.
Definition: AuxKernel.h:174
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Elem *const & _current_elem
Current element (valid only for elemental kernels)
Definition: AuxKernel.h:204
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 optional parameter and a documentation string to the InputParameters object...
static InputParameters validParams()
Definition: AuxKernel.C:27
Base class for creating new auxiliary kernels and auxiliary boundary conditions.
Definition: AuxKernel.h:36
static InputParameters validParams()
void ErrorVector unsigned int
bool isNodal() const
Nodal or elemental kernel?
Definition: AuxKernel.h:86