https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ArrayComponentFunctor.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 "MooseFunctor.h"
13
14namespace Moose
15{
20template <typename T, typename ArrayTypeFunctor>
22{
23public:
24 using typename FunctorBase<T>::ValueType;
25 using typename FunctorBase<T>::GradientType;
26 using typename FunctorBase<T>::DotType;
27
28 ArrayComponentFunctor(const ArrayTypeFunctor & array, const unsigned int component)
29 : FunctorBase<T>(array.functorName() + "_" + std::to_string(component)),
30 _array(array),
31 _component(component)
32 {
33 }
34
36 const Elem * elem,
37 const Moose::StateArg & state) const override;
38 bool hasBlocks(SubdomainID sub_id) const override { return _array.hasBlocks(sub_id); }
39
40 bool supportsFaceArg() const override final { return _array.supportsFaceArg(); }
41 bool supportsElemSideQpArg() const override final { return _array.supportsElemSideQpArg(); }
42
43private:
45 const ArrayTypeFunctor & _array;
46
48 const unsigned int _component;
49
50 ValueType evaluate(const ElemArg & elem, const StateArg & state) const override final
51 {
52 return _array(elem, state)[_component];
53 }
54
55 ValueType evaluate(const FaceArg & face, const StateArg & state) const override final
56 {
57 return _array(face, state)[_component];
58 }
59
60 ValueType evaluate(const ElemQpArg & elem_qp, const StateArg & state) const override final
61 {
62 return _array(elem_qp, state)[_component];
63 }
64
65 ValueType evaluate(const ElemSideQpArg & elem_side_qp,
66 const StateArg & state) const override final
67 {
68 return _array(elem_side_qp, state)[_component];
69 }
70
71 ValueType evaluate(const ElemPointArg & elem_point, const StateArg & state) const override final
72 {
73 return _array(elem_point, state)[_component];
74 }
75
76 ValueType evaluate(const NodeArg & node, const StateArg & state) const override final
77 {
78 return _array(node, state)[_component];
79 }
80
82 GradientType evaluateGradient(const ElemArg & elem, const StateArg & state) const override final
83 {
84 return _array.gradient(elem, state)[_component];
85 }
86 GradientType evaluateGradient(const NodeArg & node, const StateArg & state) const override final
87 {
88 return _array.gradient(node, state)[_component];
89 }
90};
91
92template <typename T, typename ArrayTypeFunctor>
93bool
95 const FaceInfo & fi, const Elem * const elem, const Moose::StateArg & state) const
96{
97 return _array.isExtrapolatedBoundaryFace(fi, elem, state);
98}
99}
This data structure is used to store geometric and variable related metadata about each cell face in ...
Definition FaceInfo.h:38
This is essentially a forwarding functor that forwards the spatial and temporal evaluation arguments ...
bool supportsElemSideQpArg() const override final
Whether this functor supports evaluation with ElemSideQpArg.
ValueType evaluate(const ElemArg &elem, const StateArg &state) const override final
Evaluate the functor with a given element.
GradientType evaluateGradient(const ElemArg &elem, const StateArg &state) const override final
Evaluate the functor gradient with a given element.
bool hasBlocks(SubdomainID sub_id) const override
Returns whether the functor is defined on this block.
const unsigned int _component
The component at which we'll index the parent array functor evaluation result.
bool isExtrapolatedBoundaryFace(const FaceInfo &fi, const Elem *elem, const Moose::StateArg &state) const override
Returns whether this (sided) face is an extrapolated boundary face for this functor.
ValueType evaluate(const ElemQpArg &elem_qp, const StateArg &state) const override final
ValueType evaluate(const ElemSideQpArg &elem_side_qp, const StateArg &state) const override final
ValueType evaluate(const ElemPointArg &elem_point, const StateArg &state) const override final
Evaluate the functor with a given element and point.
ValueType evaluate(const NodeArg &node, const StateArg &state) const override final
GradientType evaluateGradient(const NodeArg &node, const StateArg &state) const override final
const ArrayTypeFunctor & _array
The parent array functor.
ArrayComponentFunctor(const ArrayTypeFunctor &array, const unsigned int component)
ValueType evaluate(const FaceArg &face, const StateArg &state) const override final
bool supportsFaceArg() const override final
Whether this functor supports evaluation with FaceArg.
Base class template for functor objects.
typename FunctorReturnType< T, FunctorEvaluationKind::Gradient >::type GradientType
This rigmarole makes it so that a user can create functors that return containers (std::vector,...
const MooseFunctorName & functorName() const
Return the functor name.
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
A structure that is used to evaluate Moose functors logically at an element/cell center.
A structure that is used to evaluate Moose functors at an arbitrary physical point contained within a...
Argument for requesting functor evaluation at a quadrature point location in an element.
Argument for requesting functor evaluation at quadrature point locations on an element side.
A structure defining a "face" evaluation calling argument for Moose functors.
State argument for evaluating functors.