www.mooseframework.org
MaterialStdVectorAux.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #include "MaterialStdVectorAux.h"
16 
17 template <>
20 {
21  InputParameters params = validParams<MaterialStdVectorAuxBase<>>();
22  params.addClassDescription("Extracts a component of a material type std::vector<Real> to an aux "
23  "variable. If the std::vector is not of sufficient size then zero is "
24  "returned");
25  params.addParam<unsigned int>(
26  "selected_qp",
27  "Evaluate the std::vector<Real> at this quadpoint. This only needs to be "
28  "used if you are interested in a particular quadpoint in each element: "
29  "otherwise do not include this parameter in your input file");
30  params.addParamNamesToGroup("selected_qp", "Advanced");
31  return params;
32 }
33 
35  : MaterialStdVectorAuxBase<Real>(parameters),
36  _has_selected_qp(isParamValid("selected_qp")),
37  _selected_qp(_has_selected_qp ? getParam<unsigned int>("selected_qp") : 0)
38 {
39 }
40 
41 Real
43 {
44  if (_has_selected_qp)
45  {
46  if (_selected_qp >= _q_point.size())
47  {
48  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
49  mooseError("MaterialStdVectorAux. selected_qp specified as ",
51  " but there are only ",
52  _q_point.size(),
53  " quadpoints in the element");
54  }
55 
56  return _prop[_selected_qp][_index];
57  }
58  return _prop[_qp][_index];
59 }
MaterialStdVectorAux(const InputParameters &parameters)
Class constructor.
const MooseArray< Point > & _q_point
Dimension of the problem being solved.
Definition: AuxKernel.h:159
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const unsigned int _selected_qp
The std::vector will be evaluated at this quadpoint only.
InputParameters validParams< MaterialStdVectorAux >()
const MaterialProperty< std::vector< Real > > & _prop
Reference to the material property for this AuxKernel.
unsigned int _index
index of the vecor element
const bool _has_selected_qp
whether or not selected_qp has been set
virtual Real getRealValue() override
Returns material property values at quadrature points.
unsigned int _qp
Quadrature point index.
Definition: AuxKernel.h:192
unsigned int size() const
The number of elements that can currently be stored in the array.
Definition: MooseArray.h:250
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 option parameter and a documentation string to the InputParameters object...
void mooseError(Args &&...args) const
Definition: MooseObject.h:80
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)
This method takes a space delimited list of parameter names and adds them to the specified group name...
A base class for the various Material related AuxKernal objects.