https://mooseframework.inl.gov
VectorComponentFunctor.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>
22 {
23 public:
24  using typename FunctorBase<T>::ValueType;
25  using typename FunctorBase<T>::GradientType;
26  using typename FunctorBase<T>::DotType;
29 
30  VectorComponentFunctor(const VectorFunctor & vector, const unsigned int component)
31  : FunctorBase<T>(vector.functorName() + "_" + std::to_string(component)),
32  _vector(vector),
33  _component(component)
34  {
35  }
36 
37  bool isExtrapolatedBoundaryFace(const FaceInfo & fi,
38  const Elem * elem,
39  const Moose::StateArg & state) const override;
40  bool hasBlocks(SubdomainID sub_id) const override { return _vector.hasBlocks(sub_id); }
41 
42  bool supportsFaceArg() const override final { return _vector.supportsFaceArg(); }
43  bool supportsElemSideQpArg() const override final { return _vector.supportsElemSideQpArg(); }
44 
45 private:
48 
50  const unsigned int _component;
51 
52  ValueType evaluate(const ElemArg & elem, const StateArg & state) const override final
53  {
54  return _vector(elem, state)(_component);
55  }
56 
57  ValueType evaluate(const FaceArg & face, const StateArg & state) const override final
58  {
59  return _vector(face, state)(_component);
60  }
61 
62  ValueType evaluate(const ElemQpArg & elem_qp, const StateArg & state) const override final
63  {
64  return _vector(elem_qp, state)(_component);
65  }
66 
67  ValueType evaluate(const ElemSideQpArg & elem_side_qp,
68  const StateArg & state) const override final
69  {
70  return _vector(elem_side_qp, state)(_component);
71  }
72 
73  ValueType evaluate(const ElemPointArg & elem_point, const StateArg & state) const override final
74  {
75  return _vector(elem_point, state)(_component);
76  }
77 
78  ValueType evaluate(const NodeArg & node, const StateArg & state) const override final
79  {
80  return _vector(node, state)(_component);
81  }
82 
85  const StateArg & state) const override final
86  {
87  return _vector.gradient(elem_arg, state).row(_component);
88  }
89 
90  GradientType evaluateGradient(const FaceArg & face, const StateArg & state) const override final
91  {
92  return _vector.gradient(face, state).row(_component);
93  }
94 
97  const StateArg & state) const override final
98  {
99  return _vector.gradDot(elem_arg, state).row(_component);
100  }
101 
102  GradientType evaluateGradDot(const FaceArg & face, const StateArg & state) const override final
103  {
104  return _vector.gradDot(face, state).row(_component);
105  }
106 };
107 
108 template <typename T>
109 bool
111  const Elem * elem,
112  const Moose::StateArg & state) const
113 {
114  return _vector.isExtrapolatedBoundaryFace(fi, elem, state);
115 }
116 }
virtual bool hasBlocks(SubdomainID) const
Returns whether the functor is defined on this block.
Definition: MooseFunctor.h:237
const VectorFunctor & _vector
The parent vector functor.
GradientType evaluateGradDot(const ElemArg &elem_arg, const StateArg &state) const override final
Evaluate the functor gradient-dot with a given element.
GradientType evaluateGradient(const ElemArg &elem_arg, const StateArg &state) const override final
Evaluate the functor gradient with a given element.
ValueType evaluate(const ElemQpArg &elem_qp, const StateArg &state) const override final
Base class template for functor objects.
Definition: MooseFunctor.h:137
bool hasBlocks(SubdomainID sub_id) const override
Returns whether the functor is defined on this block.
typename libMesh::TensorTools::IncrementRank< T >::type VectorArg
A structure that is used to evaluate Moose functors at an arbitrary physical point contained within a...
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.
ValueType evaluate(const ElemSideQpArg &elem_side_qp, const StateArg &state) const override final
GradientType gradDot(const ElemArg &elem, const StateArg &state) const
Same as their evaluateGradDot overloads with the same arguments but allows for caching implementation...
Definition: MooseFunctor.h:933
ValueType evaluate(const FaceArg &face, const StateArg &state) const override final
This data structure is used to store geometric and variable related metadata about each cell face in ...
Definition: FaceInfo.h:36
virtual bool supportsElemSideQpArg() const =0
Whether this functor supports evaluation with ElemSideQpArg.
GradientType evaluateGradDot(const FaceArg &face, const StateArg &state) const override final
A structure defining a "face" evaluation calling argument for Moose functors.
ValueType evaluate(const ElemPointArg &elem_point, const StateArg &state) const override final
Evaluate the functor with a given element and point.
A structure that is used to evaluate Moose functors logically at an element/cell center.
bool supportsFaceArg() const override final
Whether this functor supports evaluation with FaceArg.
VectorComponentFunctor(const VectorFunctor &vector, const unsigned int component)
Argument for requesting functor evaluation at a quadrature point location in an element.
GradientType evaluateGradient(const FaceArg &face, const StateArg &state) const override final
const MooseFunctorName & functorName() const
Return the functor name.
Definition: MooseFunctor.h:170
virtual bool supportsFaceArg() const =0
Whether this functor supports evaluation with FaceArg.
const unsigned int _component
The component at which we&#39;ll index the parent vector functor evaluation result.
bool supportsElemSideQpArg() const override final
Whether this functor supports evaluation with ElemSideQpArg.
GradientType gradient(const ElemArg &elem, const StateArg &state) const
Same as their evaluateGradient overloads with the same arguments but allows for caching implementatio...
Definition: MooseFunctor.h:847
This is essentially a forwarding functor that forwards the spatial and temporal evaluation arguments ...
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...
ValueType evaluate(const ElemArg &elem, const StateArg &state) const override final
Evaluate the functor with a given element.
ValueType evaluate(const NodeArg &node, const StateArg &state) const override final