Line data Source code
1 : //* This file is part of the MOOSE framework
2 : //* https://mooseframework.inl.gov
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 "MaterialRealVectorValueAux.h"
11 : #include "metaphysicl/raw_type.h"
12 : #include <type_traits>
13 :
14 : registerMooseObject("MooseApp", MaterialRealVectorValueAux);
15 : registerMooseObject("MooseApp", ADMaterialRealVectorValueAux);
16 : registerMooseObject("MooseApp", FunctorMaterialRealVectorValueAux);
17 : registerMooseObject("MooseApp", ADFunctorMaterialRealVectorValueAux);
18 : registerMooseObject("MooseApp", MaterialSymmetricRankTwoTensorAux);
19 : registerMooseObject("MooseApp", ADMaterialSymmetricRankTwoTensorAux);
20 :
21 : template <typename T, bool is_ad, bool is_functor>
22 : InputParameters
23 90777 : MaterialRealVectorValueAuxTempl<T, is_ad, is_functor>::validParams()
24 : {
25 90777 : InputParameters params = MaterialAuxBaseTempl<T, is_ad, is_functor>::validParams();
26 90777 : params.addClassDescription(
27 : "Capture a component of a vector material property in an auxiliary variable.");
28 90777 : params.addParam<unsigned int>("component", 0, "The vector component to consider for this kernel");
29 :
30 90777 : return params;
31 0 : }
32 :
33 : template <typename T, bool is_ad, bool is_functor>
34 2709 : MaterialRealVectorValueAuxTempl<T, is_ad, is_functor>::MaterialRealVectorValueAuxTempl(
35 : const InputParameters & parameters)
36 : : MaterialAuxBaseTempl<T, is_ad, is_functor>(parameters),
37 2709 : _component(this->template getParam<unsigned int>("component"))
38 : {
39 : if constexpr (std::is_same_v<T, RealVectorValue>)
40 : {
41 1563 : if (_component > LIBMESH_DIM)
42 0 : this->mooseError("The component ",
43 0 : _component,
44 : " does not exist for ",
45 0 : LIBMESH_DIM,
46 : " dimensional problems");
47 : }
48 : else
49 : {
50 1146 : if (_component > T::N)
51 0 : this->mooseError("The component ", _component, " does not exist.");
52 : }
53 2709 : }
54 :
55 : template <typename T, bool is_ad, bool is_functor>
56 : Real
57 1564944 : MaterialRealVectorValueAuxTempl<T, is_ad, is_functor>::getRealValue()
58 : {
59 1564944 : return MetaPhysicL::raw_value(this->_full_value(_component));
60 : }
61 :
62 : template class MaterialRealVectorValueAuxTempl<RealVectorValue, false, false>;
63 : template class MaterialRealVectorValueAuxTempl<RealVectorValue, true, false>;
64 : template class MaterialRealVectorValueAuxTempl<RealVectorValue, false, true>;
65 : template class MaterialRealVectorValueAuxTempl<RealVectorValue, true, true>;
66 : template class MaterialRealVectorValueAuxTempl<SymmetricRankTwoTensor, false, false>;
67 : template class MaterialRealVectorValueAuxTempl<SymmetricRankTwoTensor, true, false>;
|