www.mooseframework.org
MaterialStdVectorAux.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 #include "MaterialStdVectorAux.h"
11 
13 
15 
18 {
20  params.addClassDescription("Extracts a component of a material type std::vector<Real> to an aux "
21  "variable. If the std::vector is not of sufficient size then zero is "
22  "returned");
23  params.addParam<unsigned int>(
24  "selected_qp",
25  "Evaluate the std::vector<Real> at this quadpoint. This only needs to be "
26  "used if you are interested in a particular quadpoint in each element: "
27  "otherwise do not include this parameter in your input file");
28  params.addParamNamesToGroup("selected_qp", "Advanced");
29  return params;
30 }
31 
33  : MaterialStdVectorAuxBase<Real>(parameters),
34  _has_selected_qp(isParamValid("selected_qp")),
35  _selected_qp(_has_selected_qp ? getParam<unsigned int>("selected_qp") : 0)
36 {
37 }
38 
39 Real
41 {
42  if (_has_selected_qp)
43  {
44  if (_selected_qp >= _q_point.size())
45  {
46  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
47  mooseError("MaterialStdVectorAux. selected_qp specified as ",
49  " but there are only ",
50  _q_point.size(),
51  " quadpoints in the element");
52  }
53 
54  return _prop[_selected_qp][_index];
55  }
56  return _prop[_qp][_index];
57 }
MaterialStdVectorAux::_selected_qp
const unsigned int _selected_qp
The std::vector will be evaluated at this quadpoint only.
Definition: MaterialStdVectorAux.h:41
MaterialStdVectorAuxBase
A base class for the various Material related AuxKernal objects.
Definition: MaterialStdVectorAuxBase.h:17
MaterialAuxBase< std::vector< Real > >::_prop
const MaterialProperty< std::vector< Real > > & _prop
Reference to the material property for this AuxKernel.
Definition: MaterialAuxBase.h:44
MooseObject::mooseError
void mooseError(Args &&... args) const
Definition: MooseObject.h:141
defineLegacyParams
defineLegacyParams(MaterialStdVectorAux)
MaterialStdVectorAux::validParams
static InputParameters validParams()
Definition: MaterialStdVectorAux.C:17
MaterialStdVectorAux
AuxKernel for outputting a std::vector material-property component to an AuxVariable.
Definition: MaterialStdVectorAux.h:23
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:1198
MaterialStdVectorAux::getRealValue
virtual Real getRealValue() override
Returns material property values at quadrature points.
Definition: MaterialStdVectorAux.C:40
InputParameters
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
Definition: InputParameters.h:53
AuxKernelTempl::_q_point
const MooseArray< Point > & _q_point
Dimension of the problem being solved.
Definition: AuxKernel.h:200
MaterialStdVectorAux::MaterialStdVectorAux
MaterialStdVectorAux(const InputParameters &parameters)
Class constructor.
Definition: MaterialStdVectorAux.C:32
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:70
MaterialStdVectorAuxBase< Real >::_index
unsigned int _index
index of the vecor element
Definition: MaterialStdVectorAuxBase.h:36
registerMooseObject
registerMooseObject("MooseApp", MaterialStdVectorAux)
InputParameters::addParamNamesToGroup
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...
Definition: InputParameters.C:590
MaterialStdVectorAux.h
MaterialStdVectorAuxBase::validParams
static InputParameters validParams()
Definition: MaterialStdVectorAuxBase.h:46
AuxKernelTempl::_qp
unsigned int _qp
Quadrature point index.
Definition: AuxKernel.h:227
MaterialStdVectorAux::_has_selected_qp
const bool _has_selected_qp
whether or not selected_qp has been set
Definition: MaterialStdVectorAux.h:38
MooseArray::size
unsigned int size() const
The number of elements that can currently be stored in the array.
Definition: MooseArray.h:259