www.mooseframework.org
MaterialStdVectorAuxBase.h
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 #pragma once
11 
12 // MOOSE includes
13 #include "MaterialAuxBase.h"
14 
15 // Forward declarations
16 template <typename T = Real>
18 
19 template <>
20 InputParameters validParams<MaterialStdVectorAuxBase<>>();
24 template <typename T>
25 class MaterialStdVectorAuxBase : public MaterialAuxBase<std::vector<T>>
26 {
27 public:
29 
30 protected:
31  virtual Real computeValue() override;
32 
34  unsigned int _index;
35 
36  // Explicitly declare the origin of the following inherited members
37  // https://isocpp.org/wiki/faq/templates#nondependent-name-lookup-members
40 };
41 
42 template <typename T>
44  : MaterialAuxBase<std::vector<T>>(parameters),
45  _index(this->template getParam<unsigned int>("index"))
46 {
47 }
48 
49 template <typename T>
50 Real
52 {
53  mooseAssert(_prop[_qp].size() > _index,
54  "MaterialStdVectorRealGradientAux: You chose to extract component "
55  << _index
56  << " but your Material property only has size "
57  << _prop[_qp].size());
58  return MaterialAuxBase<std::vector<T>>::computeValue();
59 }
60 
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
MaterialStdVectorAuxBase(const InputParameters &parameters)
A base class for the various Material related AuxKernal objects.
const MaterialProperty< std::vector< T > > & _prop
Reference to the material property for this AuxKernel.
unsigned int _index
index of the vecor element
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseObject.h:65
unsigned int _qp
Quadrature point index.
Definition: AuxKernel.h:219
virtual Real computeValue() override
Compute and return the value of the aux variable.
A base class for the various Material related AuxKernal objects.