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 
14 
15 template <bool is_ad>
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 
32 template <bool is_ad>
34  : MaterialStdVectorAuxBaseTempl<Real, is_ad>(parameters),
35  _has_selected_qp(this->isParamValid("selected_qp")),
36  _selected_qp(_has_selected_qp ? this->template getParam<unsigned int>("selected_qp") : 0)
37 {
38 }
39 
40 template <bool is_ad>
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 ",
50  _selected_qp,
51  " but there are only ",
52  _q_point.size(),
53  " quadpoints in the element");
54  }
55  return MetaPhysicL::raw_value(_prop[_selected_qp][_index]);
56  }
57  return MetaPhysicL::raw_value(_prop[_qp][_index]);
58 }
59 
61 template class MaterialStdVectorAuxTempl<true>;
static InputParameters validParams()
registerMooseObject("MooseApp", MaterialStdVectorAux)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
auto raw_value(const Eigen::Map< T > &in)
Definition: ADReal.h:73
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
static InputParameters validParams()
A base class for the various Material related AuxKernal objects.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
MaterialStdVectorAuxTempl(const InputParameters &parameters)
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...
AuxKernel for outputting a std::vector material-property component to an AuxVariable.
virtual Real getRealValue() override
Returns material property values at quadrature points.
void ErrorVector unsigned int
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...