https://mooseframework.inl.gov
Loading...
Searching...
No Matches
GenericConstant2DArray.C
Go to the documentation of this file.
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
11
14
15template <bool is_ad>
18{
19
21 params.addRequiredParam<std::string>("prop_name",
22 "The names of the properties this material will have");
23 params.addRequiredParam<RealEigenMatrix>("prop_value",
24 "The values associated with the named properties");
25 params.declareControllable("prop_value");
27 "A material evaluating one material property in type of RealEigenMatrix");
28 params.set<MooseEnum>("constant_on") = "SUBDOMAIN";
29 return params;
30}
31
32template <bool is_ad>
34 : Material(parameters),
36 _prop_name(getParam<std::string>("prop_name")),
37 _prop_value(getParam<RealEigenMatrix>("prop_value")),
38 _property(declareGenericProperty<RealEigenMatrix, is_ad>(_prop_name))
39{
40}
41
42template <bool is_ad>
43std::pair<std::size_t, std::size_t>
45 const MaterialPropertyName & prop_name) const
46{
47 libmesh_ignore(prop_name);
48 mooseAssert(prop_name == _prop_name,
49 "Property '" + prop_name + "' is not declared by this material");
50 return {_prop_value.rows(), _prop_value.cols()};
51}
52
53template <bool is_ad>
54void
59
60template <bool is_ad>
61void
63{
64 auto & qp_prop = _property[_qp];
65 const auto m = _prop_value.rows(), n = _prop_value.cols();
66 qp_prop.resize(m, n);
67 for (const auto i : make_range(m))
68 for (const auto j : make_range(n))
69 qp_prop(i, j) = _prop_value(i, j);
70}
71
registerMooseObject("MooseApp", GenericConstant2DArray)
Template for defining a constant array material property, using automatic differentiation or not.
static InputParameters validParams()
GenericConstant2DArrayTempl(const InputParameters &parameters)
virtual void initQpStatefulProperties() override
Initialize stateful properties at quadrature points.
virtual std::pair< std::size_t, std::size_t > getMatrixPropertySize(const MaterialPropertyName &prop_name) const override
Return the number of rows and columns of the variable size matrix material property that the material...
virtual void computeQpProperties() override
Users must override this method.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void declareControllable(const std::string &name, std::set< ExecFlagType > execute_flags={})
Declare the given parameters as controllable.
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
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.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
Materials compute MaterialProperties.
Definition Material.h:36
static InputParameters validParams()
Definition Material.C:14
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition MooseEnum.h:55
Interface class to return the size of material properties that do not have a fixed size.