www.mooseframework.org
MaterialStdVectorAuxBase.h
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 #ifndef MATERIALSTDVECTORAUXBASE_H
16 #define MATERIALSTDVECTORAUXBASE_H
17 
18 // MOOSE includes
19 #include "MaterialAuxBase.h"
20 
21 // Forward declarations
22 template <typename T = Real>
24 
25 template <>
26 InputParameters validParams<MaterialStdVectorAuxBase<>>();
30 template <typename T>
31 class MaterialStdVectorAuxBase : public MaterialAuxBase<std::vector<T>>
32 {
33 public:
35 
36 protected:
37  virtual Real computeValue() override;
38 
40  unsigned int _index;
41 
42  // Explicitly declare the origin of the following inherited members
43  // https://isocpp.org/wiki/faq/templates#nondependent-name-lookup-members
46 };
47 
48 template <typename T>
50  : MaterialAuxBase<std::vector<T>>(parameters),
51  _index(this->template getParam<unsigned int>("index"))
52 {
53 }
54 
55 template <typename T>
56 Real
58 {
59  mooseAssert(_prop[_qp].size() > _index,
60  "MaterialStdVectorRealGradientAux: You chose to extract component "
61  << _index
62  << " but your Material property only has size "
63  << _prop[_qp].size());
65 }
66 
67 #endif // MATERIALSTDVECTORAUXBASE_H
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
unsigned int _qp
Quadrature point index.
Definition: AuxKernel.h:192
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
Definition: MooseObject.h:122
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseObject.h:53
virtual Real computeValue() override
A base class for the various Material related AuxKernal objects.