https://mooseframework.inl.gov
Loading...
Searching...
No Matches
FunctorMaterial.h
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
10#pragma once
11
12#include "Material.h"
13
18{
19public:
21
23 void computeProperties() override final {}
24
25 const std::set<std::string> & getSuppliedFunctors() const { return _supplied_functor_props; }
26
27protected:
28 void computeQpProperties() override final {}
29
33 template <typename T, typename PolymorphicLambda>
35 addFunctorProperty(const std::string & name,
36 PolymorphicLambda my_lammy,
37 const std::set<ExecFlagType> & clearance_schedule = {EXEC_ALWAYS});
38
42 template <typename T, typename PolymorphicLambda>
44 addFunctorPropertyByBlocks(const std::string & name,
45 PolymorphicLambda my_lammy,
46 const std::set<SubdomainID> & sub_ids,
47 const std::set<ExecFlagType> & clearance_schedule = {EXEC_ALWAYS});
48
49private:
51 std::set<std::string> _supplied_functor_props;
52};
53
54template <typename T, typename PolymorphicLambda>
56FunctorMaterial::addFunctorProperty(const std::string & name,
57 PolymorphicLambda my_lammy,
58 const std::set<ExecFlagType> & clearance_schedule)
59{
60 return addFunctorPropertyByBlocks<T>(name, my_lammy, blockIDs(), clearance_schedule);
61}
62
63template <typename T, typename PolymorphicLambda>
66 PolymorphicLambda my_lammy,
67 const std::set<SubdomainID> & sub_ids,
68 const std::set<ExecFlagType> & clearance_schedule)
69{
70 // Check if the supplied parameter is a valid input parameter key
71 std::string prop_name = name;
73 {
74 if (_pars.have_parameter<MaterialPropertyName>(name))
75 prop_name = _pars.get<MaterialPropertyName>(name);
76 if (_pars.have_parameter<MooseFunctorName>(name))
77 prop_name = _pars.get<MooseFunctorName>(name);
78 }
79
80 _supplied_functor_props.insert(prop_name +
81 (_declare_suffix.empty() ? "" : ("_" + _declare_suffix)));
83 prop_name + (_declare_suffix.empty() ? "" : ("_" + _declare_suffix)),
84 my_lammy,
85 clearance_schedule,
86 _mesh,
87 sub_ids,
88 _tid);
89}
const ExecFlagType EXEC_ALWAYS
Definition Moose.C:53
virtual const std::set< SubdomainID > & blockIDs() const
Return the block subdomain ids for this object Note, if this is not block restricted,...
FunctorMaterials compute functor material properties.
std::set< std::string > _supplied_functor_props
List of the properties supplied.
const Moose::FunctorBase< T > & addFunctorProperty(const std::string &name, PolymorphicLambda my_lammy, const std::set< ExecFlagType > &clearance_schedule={EXEC_ALWAYS})
Declare a functor material property.
static InputParameters validParams()
const Moose::FunctorBase< T > & addFunctorPropertyByBlocks(const std::string &name, PolymorphicLambda my_lammy, const std::set< SubdomainID > &sub_ids, const std::set< ExecFlagType > &clearance_schedule={EXEC_ALWAYS})
Declare a functor material property with specified subdomain ids.
void computeProperties() override final
Performs the quadrature point loop, calling computeQpProperties.
const std::set< std::string > & getSuppliedFunctors() const
void computeQpProperties() override final
Users must override this method.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
bool have_parameter(std::string_view name) const
A wrapper around the Parameters base class method.
bool isParamValid(const std::string &name) const
This method returns parameters that have been initialized in one fashion or another,...
THREAD_ID _tid
SubProblem & _subproblem
MooseMesh & _mesh
const MaterialPropertyName _declare_suffix
Suffix to append to the name of the material property/ies when declaring it/them.
Materials compute MaterialProperties.
Definition Material.h:36
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103
const InputParameters & _pars
The object's parameters.
Definition MooseBase.h:384
Base class template for functor objects.
const Moose::FunctorBase< T > & addPiecewiseByBlockLambdaFunctor(const std::string &name, PolymorphicLambda my_lammy, const std::set< ExecFlagType > &clearance_schedule, const MooseMesh &mesh, const std::set< SubdomainID > &block_ids, const THREAD_ID tid)
Add a functor that has block-wise lambda definitions, e.g.