https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
14namespace Moose
15{
20template <typename T>
22{
23public:
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
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
45private:
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
108template <typename T>
109bool
111 const Elem * elem,
112 const Moose::StateArg & state) const
113{
114 return _vector.isExtrapolatedBoundaryFace(fi, elem, state);
115}
116}
This data structure is used to store geometric and variable related metadata about each cell face in ...
Definition FaceInfo.h:38
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,...
virtual bool supportsFaceArg() const =0
Whether this functor supports evaluation with FaceArg.
const MooseFunctorName & functorName() const
Return the functor name.
virtual bool hasBlocks(SubdomainID) const
Returns whether the functor is defined on this block.
virtual bool supportsElemSideQpArg() const =0
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...
GradientType gradDot(const ElemArg &elem, const StateArg &state) const
Same as their evaluateGradDot overloads with the same arguments but allows for caching implementation...
This is essentially a forwarding functor that forwards the spatial and temporal evaluation arguments ...
const VectorFunctor & _vector
The parent vector functor.
GradientType evaluateGradient(const FaceArg &face, const StateArg &state) const override final
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 evaluateGradDot(const FaceArg &face, const StateArg &state) const override final
GradientType evaluateGradient(const ElemArg &elem_arg, const StateArg &state) const override final
Evaluate the functor gradient with a given element.
ValueType evaluate(const ElemPointArg &elem_point, const StateArg &state) const override final
Evaluate the functor with a given element and point.
typename libMesh::TensorTools::IncrementRank< T >::type VectorArg
bool hasBlocks(SubdomainID sub_id) const override
Returns whether the functor is defined on this block.
VectorComponentFunctor(const VectorFunctor &vector, const unsigned int component)
const unsigned int _component
The component at which we'll index the parent vector functor evaluation result.
ValueType evaluate(const ElemQpArg &elem_qp, const StateArg &state) const override final
GradientType evaluateGradDot(const ElemArg &elem_arg, const StateArg &state) const override final
Evaluate the functor gradient-dot with a given element.
ValueType evaluate(const NodeArg &node, const StateArg &state) const override final
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 FaceArg &face, const StateArg &state) const override final
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
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.