https://mooseframework.inl.gov
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 
14 namespace Moose
15 {
20 template <typename T, typename ArrayTypeFunctor>
22 {
23 public:
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 
35  bool isExtrapolatedBoundaryFace(const FaceInfo & fi,
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 
43 private:
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 
92 template <typename T, typename ArrayTypeFunctor>
93 bool
95  const FaceInfo & fi, const Elem * const elem, const Moose::StateArg & state) const
96 {
97  return _array.isExtrapolatedBoundaryFace(fi, elem, state);
98 }
99 }
bool hasBlocks(SubdomainID sub_id) const override
Returns whether the functor is defined on this block.
Base class template for functor objects.
Definition: MooseFunctor.h:137
GradientType evaluateGradient(const ElemArg &elem, const StateArg &state) const override final
Evaluate the functor gradient with a given element.
A structure that is used to evaluate Moose functors at an arbitrary physical point contained within a...
ValueType evaluate(const ElemPointArg &elem_point, const StateArg &state) const override final
Evaluate the functor with a given element and point.
This is essentially a forwarding functor that forwards the spatial and temporal evaluation arguments ...
ValueType evaluate(const ElemArg &elem, const StateArg &state) const override final
Evaluate the functor with a given element.
typename FunctorReturnType< T, FunctorEvaluationKind::Gradient >::type GradientType
This rigmarole makes it so that a user can create functors that return containers (std::vector...
Definition: MooseFunctor.h:149
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.
This data structure is used to store geometric and variable related metadata about each cell face in ...
Definition: FaceInfo.h:36
const unsigned int _component
The component at which we&#39;ll index the parent array functor evaluation result.
bool supportsElemSideQpArg() const override final
Whether this functor supports evaluation with ElemSideQpArg.
const ArrayTypeFunctor & _array
The parent array functor.
A structure defining a "face" evaluation calling argument for Moose functors.
GradientType evaluateGradient(const NodeArg &node, const StateArg &state) const override final
ValueType evaluate(const FaceArg &face, const StateArg &state) const override final
ValueType evaluate(const NodeArg &node, const StateArg &state) const override final
A structure that is used to evaluate Moose functors logically at an element/cell center.
Argument for requesting functor evaluation at a quadrature point location in an element.
ValueType evaluate(const ElemQpArg &elem_qp, const StateArg &state) const override final
const MooseFunctorName & functorName() const
Return the functor name.
Definition: MooseFunctor.h:170
ArrayComponentFunctor(const ArrayTypeFunctor &array, const unsigned int component)
bool supportsFaceArg() const override final
Whether this functor supports evaluation with FaceArg.
ValueType evaluate(const ElemSideQpArg &elem_side_qp, const StateArg &state) const override final
State argument for evaluating functors.
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
Argument for requesting functor evaluation at quadrature point locations on an element side...