https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MooseFunctor.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 <tuple>
13
14#include "MooseFunctorForward.h"
16#include "FaceArgInterface.h"
17#include "MooseMesh.h"
18#include "MooseTypes.h"
19#include "MooseError.h"
20#include "MooseUtils.h"
21
22#include "libmesh/remote_elem.h"
23#include "libmesh/tensor_tools.h"
24
25#include "metaphysicl/ct_types.h"
26
27#include <unordered_map>
28#include <functional>
29
30namespace Moose
31{
37{
38 Value,
40 Dot,
42};
43
48template <typename, FunctorEvaluationKind>
50
54template <typename T>
56{
57 typedef T type;
58};
59
66template <typename T>
68{
69 typedef typename MetaPhysicL::ReplaceAlgebraicType<
70 T,
72 typename MetaPhysicL::ValueType<T>::type>::type>::type type;
73};
74
78template <typename T>
80{
81 typedef T type;
82};
83
87template <typename T>
92
97template <FunctorEvaluationKind>
99
103template <>
108
112template <>
117
122{
123public:
124 virtual void residualSetup() = 0;
125 virtual void jacobianSetup() = 0;
126 virtual void timestepSetup() = 0;
127 virtual void customSetup(const ExecFlagType & exec_type) = 0;
128};
129
136template <typename T>
138{
139public:
141 using ValueType = T;
151
152 virtual ~FunctorBase() = default;
153 FunctorBase(const MooseFunctorName & name,
154 const std::set<ExecFlagType> & clearance_schedule = {EXEC_ALWAYS})
155 : _always_evaluate(true), _functor_name(name)
156 {
157 setCacheClearanceSchedule(clearance_schedule);
158 }
159
160#ifdef MOOSE_KOKKOS_ENABLED
165#endif
166
171 template <FunctorEvaluationKind FET, typename Space, typename State>
173 const State & state) const;
174
176 const MooseFunctorName & functorName() const { return _functor_name; }
177
179
183 ValueType operator()(const ElemArg & elem, const StateArg & state) const;
184 ValueType operator()(const FaceArg & face, const StateArg & state) const;
185 ValueType operator()(const ElemQpArg & qp, const StateArg & state) const;
186 ValueType operator()(const ElemSideQpArg & qp, const StateArg & state) const;
187 ValueType operator()(const ElemPointArg & elem_point, const StateArg & state) const;
188 ValueType operator()(const NodeArg & node, const StateArg & state) const;
190
192
196 GradientType gradient(const ElemArg & elem, const StateArg & state) const;
197 GradientType gradient(const FaceArg & face, const StateArg & state) const;
198 GradientType gradient(const ElemQpArg & qp, const StateArg & state) const;
199 GradientType gradient(const ElemSideQpArg & qp, const StateArg & state) const;
200 GradientType gradient(const ElemPointArg & elem_point, const StateArg & state) const;
201 GradientType gradient(const NodeArg & node, const StateArg & state) const;
203
205
209 DotType dot(const ElemArg & elem, const StateArg & state) const;
210 DotType dot(const FaceArg & face, const StateArg & state) const;
211 DotType dot(const ElemQpArg & qp, const StateArg & state) const;
212 DotType dot(const ElemSideQpArg & qp, const StateArg & state) const;
213 DotType dot(const ElemPointArg & elem_point, const StateArg & state) const;
214 DotType dot(const NodeArg & node, const StateArg & state) const;
216
218
222 GradientType gradDot(const ElemArg & elem, const StateArg & state) const;
223 GradientType gradDot(const FaceArg & face, const StateArg & state) const;
224 GradientType gradDot(const ElemQpArg & qp, const StateArg & state) const;
225 GradientType gradDot(const ElemSideQpArg & qp, const StateArg & state) const;
226 GradientType gradDot(const ElemPointArg & elem_point, const StateArg & state) const;
227 GradientType gradDot(const NodeArg & node, const StateArg & state) const;
229
230 virtual void residualSetup() override;
231 virtual void jacobianSetup() override;
232 virtual void timestepSetup() override;
233 virtual void customSetup(const ExecFlagType & exec_type) override;
234
238 void setCacheClearanceSchedule(const std::set<ExecFlagType> & clearance_schedule);
239
243 virtual bool hasBlocks(SubdomainID /* id */) const
244 {
245 mooseError("Block restriction has not been implemented for functor " + functorName());
246 return false;
247 }
248
253 virtual bool isExtrapolatedBoundaryFace(const FaceInfo &, const Elem *, const StateArg &) const
254 {
255 mooseError("not implemented");
256 }
257
261 bool isInternalFace(const FaceInfo &) const;
262
266 virtual bool isConstant() const { return false; }
267
268 virtual bool hasFaceSide(const FaceInfo & fi, const bool fi_elem_side) const override;
269
280 void checkFace(const Moose::FaceArg & face) const;
281
285 virtual bool supportsFaceArg() const = 0;
286
290 virtual bool supportsElemSideQpArg() const = 0;
291
292protected:
299
303 virtual ValueType evaluate(const ElemArg & elem, const StateArg & state) const = 0;
304
310 virtual ValueType evaluate(const FaceArg & face, const StateArg & state) const = 0;
311
317 virtual ValueType evaluate(const ElemQpArg & qp, const StateArg & state) const = 0;
318
324 virtual ValueType evaluate(const ElemSideQpArg & side_qp, const StateArg & state) const = 0;
325
330 virtual ValueType evaluate(const ElemPointArg & elem_point, const StateArg & state) const = 0;
331
332 virtual ValueType evaluate(const NodeArg & node, const StateArg & state) const = 0;
333
338 virtual GradientType evaluateGradient(const ElemArg &, const StateArg &) const
339 {
340 mooseError("Element gradient not implemented for functor " + functorName());
341 }
342
348 virtual GradientType evaluateGradient(const FaceArg &, const StateArg &) const
349 {
350 mooseError("Face gradient not implemented for functor " + functorName());
351 }
352
358 virtual GradientType evaluateGradient(const ElemQpArg &, const StateArg &) const
359 {
360 mooseError("Element quadrature point gradient not implemented for functor " + functorName());
361 }
362
368 virtual GradientType evaluateGradient(const ElemSideQpArg &, const StateArg &) const
369 {
370 mooseError("Element side quadrature point gradient not implemented for functor " +
371 functorName());
372 }
373
377 virtual GradientType evaluateGradient(const ElemPointArg &, const StateArg &) const
378 {
379 mooseError("Element-point gradient not implemented for functor " + functorName());
380 }
381
382 virtual GradientType evaluateGradient(const NodeArg &, const StateArg &) const
383 {
384 mooseError("Gradient at node not implemented for functor " + functorName());
385 }
386
391 virtual DotType evaluateDot(const ElemArg &, const StateArg &) const
392 {
393 mooseError("Element time derivative not implemented for functor " + functorName());
394 }
395
401 virtual DotType evaluateDot(const FaceArg &, const StateArg &) const
402 {
403 mooseError("Face time derivative not implemented for functor " + functorName());
404 }
405
411 virtual DotType evaluateDot(const ElemQpArg &, const StateArg &) const
412 {
413 mooseError("Element quadrature point time derivative not implemented for functor " +
414 functorName());
415 }
416
422 virtual DotType evaluateDot(const ElemSideQpArg &, const StateArg &) const
423 {
424 mooseError("Element side quadrature point time derivative not implemented for functor " +
425 functorName());
426 }
427
431 virtual DotType evaluateDot(const ElemPointArg &, const StateArg &) const
432 {
433 mooseError("Element-point time derivative not implemented for functor " + functorName());
434 }
435
436 virtual DotType evaluateDot(const NodeArg &, const StateArg &) const
437 {
438 mooseError("Time derivative at node not implemented for functor " + functorName());
439 }
440
445 virtual GradientType evaluateGradDot(const ElemArg &, const StateArg &) const
446 {
447 mooseError("Element gradient-dot not implemented for functor " + functorName());
448 }
449
455 virtual GradientType evaluateGradDot(const FaceArg &, const StateArg &) const
456 {
457 mooseError("Face gradient-dot not implemented for functor " + functorName());
458 }
459
465 virtual GradientType evaluateGradDot(const ElemQpArg &, const StateArg &) const
466 {
467 mooseError("Element quadrature point gradient-dot not implemented for functor " +
468 functorName());
469 }
470
476 virtual GradientType evaluateGradDot(const ElemSideQpArg &, const StateArg &) const
477 {
478 mooseError("Element side quadrature point gradient-dot not implemented for functor " +
479 functorName());
480 }
481
485 virtual GradientType evaluateGradDot(const ElemPointArg &, const StateArg &) const
486 {
487 mooseError("Element-point gradient-dot not implemented for functor " + functorName());
488 }
489
490 virtual GradientType evaluateGradDot(const NodeArg &, const StateArg &) const
491 {
492 mooseError("Gradient-dot at node not implemented for functor " + functorName());
493 }
495
496private:
501
505 template <typename SpaceArg, typename StateArg>
506 ValueType queryQpCache(unsigned int qp,
507 const libMesh::QBase & qrule,
508 std::vector<std::pair<bool, T>> & qp_cache_data,
509 const SpaceArg & space,
510 const StateArg & state) const;
511
515 template <typename SpaceArg>
516 ValueType queryFVArgCache(std::map<SpaceArg, ValueType> & cache_data,
517 const SpaceArg & space) const;
518
520 std::set<ExecFlagType> _clearance_schedule;
521
524
525 // Data for traditional element-quadrature point property evaluations which are useful for
526 // caching implementation
527
530
532 mutable std::vector<std::pair<bool, ValueType>> * _current_qp_map_value = nullptr;
533
539 mutable std::unordered_map<dof_id_type, std::vector<std::pair<bool, ValueType>>> _qp_to_value;
540
541 // Data for traditional element-side-quadrature point property evaluations which are useful for
542 // caching implementation
543
546
548 mutable std::vector<std::vector<std::pair<bool, ValueType>>> * _current_side_qp_map_value =
549 nullptr;
550
557 mutable std::unordered_map<dof_id_type, std::vector<std::vector<std::pair<bool, ValueType>>>>
559
561 mutable std::map<ElemArg, ValueType> _elem_arg_to_value;
562
564 mutable std::map<FaceArg, ValueType> _face_arg_to_value;
565
567 mutable std::map<NodeArg, ValueType> _node_arg_to_value;
568
570 MooseFunctorName _functor_name;
571};
572
573template <typename T>
574bool
576{
577 if (!fi.neighborPtr())
578 return false;
579
580 return hasBlocks(fi.elem().subdomain_id()) && hasBlocks(fi.neighborPtr()->subdomain_id());
581}
582
583template <typename T>
584template <typename SpaceArg>
586FunctorBase<T>::queryFVArgCache(std::map<SpaceArg, ValueType> & cache_data,
587 const SpaceArg & space) const
588{
589 // We don't want to evaluate if the key already exists, so instead we value initialize
590 auto [it, inserted] = cache_data.try_emplace(space, ValueType());
591 auto & value = it->second;
592
593 if (inserted)
594 // value not ready to go
595 // this function is only called from functions that assert we are in the current time state
596 value = evaluate(space, currentState());
597
598 return value;
599}
600
601template <typename T>
603FunctorBase<T>::operator()(const ElemArg & elem, const StateArg & state) const
604{
605 if (_always_evaluate)
606 return evaluate(elem, state);
607
608 mooseAssert(state.state == 0,
609 "Cached evaluations are only currently supported for the current state.");
610
611 return queryFVArgCache(_elem_arg_to_value, elem);
612}
613
614template <typename T>
616FunctorBase<T>::operator()(const FaceArg & face_in, const StateArg & state) const
617{
618 checkFace(face_in);
619
620 if (_always_evaluate)
621 return evaluate(face_in, state);
622
623 mooseAssert(state.state == 0,
624 "Cached evaluations are only currently supported for the current state.");
625
626 return queryFVArgCache(_face_arg_to_value, face_in);
627}
628
629template <typename T>
630template <typename SpaceArg, typename StateArg>
632FunctorBase<T>::queryQpCache(const unsigned int qp,
633 const libMesh::QBase & qrule,
634 std::vector<std::pair<bool, ValueType>> & qp_cache_data,
635 const SpaceArg & space,
636 const StateArg & state) const
637{
638 // Check and see whether we even have sized for this quadrature point. If we haven't then we
639 // must evaluate
640 if (qp >= qp_cache_data.size())
641 {
642 qp_cache_data.resize(qrule.n_points(), std::make_pair(false, ValueType()));
643 auto & pr = qp_cache_data[qp];
644 pr.second = evaluate(space, state);
645 pr.first = true;
646 return pr.second;
647 }
648
649 // We've already sized for this qp, so let's see whether we have a valid cache value
650 auto & pr = qp_cache_data[qp];
651 if (pr.first)
652 return pr.second;
653
654 // No valid cache value so evaluate
655 pr.second = evaluate(space, state);
656 pr.first = true;
657 return pr.second;
658}
659
660template <typename T>
662FunctorBase<T>::operator()(const ElemQpArg & elem_qp, const StateArg & state) const
663{
664 if (_always_evaluate)
665 return evaluate(elem_qp, state);
666
667 const auto elem_id = elem_qp.elem->id();
668 if (elem_id != _current_qp_map_key)
669 {
670 _current_qp_map_key = elem_id;
671 _current_qp_map_value = &_qp_to_value[elem_id];
672 }
673 auto & qp_data = *_current_qp_map_value;
674 const auto qp = elem_qp.qp;
675 const auto * const qrule = elem_qp.qrule;
676 mooseAssert(qrule, "qrule must be non-null");
677
678 return queryQpCache(qp, *qrule, qp_data, elem_qp, state);
679}
680
681template <typename T>
683FunctorBase<T>::operator()(const ElemSideQpArg & elem_side_qp, const StateArg & state) const
684{
685 if (_always_evaluate)
686 return evaluate(elem_side_qp, state);
687
688 const Elem * const elem = elem_side_qp.elem;
689 mooseAssert(elem, "elem must be non-null");
690 const auto elem_id = elem->id();
691 if (elem_id != _current_side_qp_map_key)
692 {
693 _current_side_qp_map_key = elem_id;
694 _current_side_qp_map_value = &_side_qp_to_value[elem_id];
695 }
696 auto & side_qp_data = *_current_side_qp_map_value;
697 const auto side = elem_side_qp.side;
698 const auto qp = elem_side_qp.qp;
699 const auto * const qrule = elem_side_qp.qrule;
700 mooseAssert(qrule, "qrule must be non-null");
701
702 // Check and see whether we even have sized for this side
703 if (side >= side_qp_data.size())
704 side_qp_data.resize(elem->n_sides());
705
706 // Ok we were sized enough for our side
707 auto & qp_data = side_qp_data[side];
708 return queryQpCache(qp, *qrule, qp_data, elem_side_qp, state);
709}
710
711template <typename T>
713FunctorBase<T>::operator()(const ElemPointArg & elem_point, const StateArg & state) const
714{
715 return evaluate(elem_point, state);
716}
717
718template <typename T>
719void
720FunctorBase<T>::setCacheClearanceSchedule(const std::set<ExecFlagType> & clearance_schedule)
721{
722 if (clearance_schedule.count(EXEC_ALWAYS))
723 _always_evaluate = true;
724
725 _clearance_schedule = clearance_schedule;
726}
727
728template <typename T>
730FunctorBase<T>::operator()(const NodeArg & node, const StateArg & state) const
731{
732 mooseAssert(node.subdomain_ids, "Subdomain IDs must be supplied to the node argument");
733 return evaluate(node, state);
734}
735
736template <typename T>
737void
739#if DEBUG
740 face
741#endif
742) const
743{
744#if DEBUG
745 const Elem * const elem = face.face_side;
746 const FaceInfo * const fi = face.fi;
747 mooseAssert(fi, "face info should be non-null");
748 bool check_elem_def = false;
749 bool check_neighbor_def = false;
750 // We check if the functor is defined on both sides of the face
751 if (!elem)
752 {
753 if (!hasFaceSide(*fi, true))
754 check_neighbor_def = true;
755 else if (!hasFaceSide(*fi, false))
756 check_elem_def = true;
757 }
758 else if (elem == fi->elemPtr())
759 check_elem_def = true;
760 else
761 {
762 mooseAssert(elem == fi->neighborPtr(), "This has to match something");
763 check_neighbor_def = true;
764 }
765
766 if (check_elem_def && !hasFaceSide(*fi, true))
767 {
768 std::string additional_message = "It is not defined on the neighbor side either.";
769 if (hasFaceSide(*fi, false))
770 additional_message = "It is however defined on the neighbor side.";
771 additional_message += " Face centroid: " + Moose::stringify(fi->faceCentroid());
772 mooseError(_functor_name,
773 " is not defined on the element side of the face information, but a face argument "
774 "producer "
775 "(e.g. residual object, postprocessor, etc.) has requested evaluation there.\n",
776 additional_message);
777 }
778 if (check_neighbor_def && !hasFaceSide(*fi, false))
779 {
780 std::string additional_message = "It is not defined on the element side either.";
781 if (hasFaceSide(*fi, true))
782 additional_message = "It is however defined on the element side.";
783 additional_message += " Face centroid: " + Moose::stringify(fi->faceCentroid());
785 _functor_name,
786 " is not defined on the neighbor side of the face information, but a face argument "
787 "producer (e.g. residual object, postprocessor, etc.) has requested evaluation there.\n",
788 additional_message);
789 }
790#endif
791}
792
793template <typename T>
794void
796{
797 for (auto & map_pr : _qp_to_value)
798 for (auto & pr : map_pr.second)
799 pr.first = false;
800
801 for (auto & map_pr : _side_qp_to_value)
802 {
803 auto & side_vector = map_pr.second;
804 for (auto & qp_vector : side_vector)
805 for (auto & pr : qp_vector)
806 pr.first = false;
807 }
808
809 _current_qp_map_key = libMesh::DofObject::invalid_id;
810 _current_qp_map_value = nullptr;
811 _current_side_qp_map_key = libMesh::DofObject::invalid_id;
812 _current_side_qp_map_value = nullptr;
813
814 _elem_arg_to_value.clear();
815 _face_arg_to_value.clear();
816 _node_arg_to_value.clear();
817}
818
819template <typename T>
820void
822{
823 if (_clearance_schedule.count(EXEC_TIMESTEP_BEGIN))
824 clearCacheData();
825}
826
827template <typename T>
828void
830{
831 if (_clearance_schedule.count(EXEC_LINEAR))
832 clearCacheData();
833}
834
835template <typename T>
836void
838{
839 if (_clearance_schedule.count(EXEC_NONLINEAR))
840 clearCacheData();
841}
842
843template <typename T>
844void
846{
847 if (_clearance_schedule.count(exec_type))
848 clearCacheData();
849}
850
851template <typename T>
853FunctorBase<T>::gradient(const ElemArg & elem, const StateArg & state) const
854{
855 return evaluateGradient(elem, state);
856}
857
858template <typename T>
860FunctorBase<T>::gradient(const FaceArg & face, const StateArg & state) const
861{
862 checkFace(face);
863 return evaluateGradient(face, state);
864}
865
866template <typename T>
868FunctorBase<T>::gradient(const ElemQpArg & elem_qp, const StateArg & state) const
869{
870 return evaluateGradient(elem_qp, state);
871}
872
873template <typename T>
875FunctorBase<T>::gradient(const ElemSideQpArg & elem_side_qp, const StateArg & state) const
876{
877 return evaluateGradient(elem_side_qp, state);
878}
879
880template <typename T>
882FunctorBase<T>::gradient(const ElemPointArg & elem_point, const StateArg & state) const
883{
884 return evaluateGradient(elem_point, state);
885}
886
887template <typename T>
889FunctorBase<T>::gradient(const NodeArg & node, const StateArg & state) const
890{
891 return evaluateGradient(node, state);
892}
893
894template <typename T>
896FunctorBase<T>::dot(const ElemArg & elem, const StateArg & state) const
897{
898 return evaluateDot(elem, state);
899}
900
901template <typename T>
903FunctorBase<T>::dot(const FaceArg & face, const StateArg & state) const
904{
905 checkFace(face);
906 return evaluateDot(face, state);
907}
908
909template <typename T>
911FunctorBase<T>::dot(const ElemQpArg & elem_qp, const StateArg & state) const
912{
913 return evaluateDot(elem_qp, state);
914}
915
916template <typename T>
918FunctorBase<T>::dot(const ElemSideQpArg & elem_side_qp, const StateArg & state) const
919{
920 return evaluateDot(elem_side_qp, state);
921}
922
923template <typename T>
925FunctorBase<T>::dot(const ElemPointArg & elem_point, const StateArg & state) const
926{
927 return evaluateDot(elem_point, state);
928}
929
930template <typename T>
932FunctorBase<T>::dot(const NodeArg & node, const StateArg & state) const
933{
934 return evaluateDot(node, state);
935}
936
937template <typename T>
939FunctorBase<T>::gradDot(const ElemArg & elem, const StateArg & state) const
940{
941 return evaluateGradDot(elem, state);
942}
943
944template <typename T>
946FunctorBase<T>::gradDot(const FaceArg & face, const StateArg & state) const
947{
948 checkFace(face);
949 return evaluateGradDot(face, state);
950}
951
952template <typename T>
954FunctorBase<T>::gradDot(const ElemQpArg & elem_qp, const StateArg & state) const
955{
956 return evaluateGradDot(elem_qp, state);
957}
958
959template <typename T>
961FunctorBase<T>::gradDot(const ElemSideQpArg & elem_side_qp, const StateArg & state) const
962{
963 return evaluateGradDot(elem_side_qp, state);
964}
965
966template <typename T>
968FunctorBase<T>::gradDot(const ElemPointArg & elem_point, const StateArg & state) const
969{
970 return evaluateGradDot(elem_point, state);
971}
972
973template <typename T>
975FunctorBase<T>::gradDot(const NodeArg & node, const StateArg & state) const
976{
977 return evaluateGradDot(node, state);
978}
979
980template <typename T>
981bool
982FunctorBase<T>::hasFaceSide(const FaceInfo & fi, const bool fi_elem_side) const
983{
984 if (fi_elem_side)
985 return hasBlocks(fi.elem().subdomain_id());
986 else
987 return fi.neighborPtr() && hasBlocks(fi.neighbor().subdomain_id());
988}
989
990template <typename T>
991template <FunctorEvaluationKind FET, typename Space, typename State>
993FunctorBase<T>::genericEvaluate(const Space & r, const State & state) const
994{
995 if constexpr (FET == FunctorEvaluationKind::Value)
996 return (*this)(r, state);
997 else if constexpr (FET == FunctorEvaluationKind::Gradient)
998 return gradient(r, state);
999 else if constexpr (FET == FunctorEvaluationKind::Dot)
1000 return dot(r, state);
1001 else
1002 return gradDot(r, state);
1003}
1004
1010{
1011public:
1013 virtual ~FunctorEnvelopeBase() = default;
1014
1018 virtual bool wrapsNull() const = 0;
1019
1023 virtual std::string returnType() const = 0;
1024
1028 virtual bool isConstant() const = 0;
1029
1037 virtual bool ownsWrappedFunctor() const = 0;
1038};
1039
1045template <typename T>
1046class FunctorEnvelope final : public FunctorBase<T>, public FunctorEnvelopeBase
1047{
1048public:
1049 using typename Moose::FunctorBase<T>::ValueType;
1051 using typename Moose::FunctorBase<T>::DotType;
1052
1057 : FunctorBase<T>("wraps_" + wrapped.functorName()), FunctorEnvelopeBase(), _wrapped(&wrapped)
1058 {
1059 }
1060
1066 FunctorEnvelope(std::unique_ptr<FunctorBase<T>> && wrapped)
1067 : FunctorBase<T>("wraps_" + wrapped->functorName()),
1069 _owned(std::move(wrapped)),
1070 _wrapped(_owned.get())
1071 {
1072 }
1073
1079
1084 void assign(const FunctorBase<T> & wrapped)
1085 {
1086 _owned.reset();
1087 _wrapped = &wrapped;
1088 }
1089
1094 void assign(std::unique_ptr<FunctorBase<T>> && wrapped)
1095 {
1096 _owned = std::move(wrapped);
1097 _wrapped = _owned.get();
1098 }
1099
1104 void assign(FunctorBase<T> &&) = delete;
1105
1110
1111 virtual ~FunctorEnvelope() = default;
1112
1116 virtual bool wrapsNull() const override { return wrapsType<NullFunctor<T>>(); }
1117
1121 virtual std::string returnType() const override { return libMesh::demangle(typeid(T).name()); }
1122
1123 virtual bool ownsWrappedFunctor() const override { return _owned.get(); }
1124
1128 template <typename T2>
1129 bool wrapsType() const
1130 {
1131 return dynamic_cast<const T2 *>(_wrapped);
1132 }
1133
1134 virtual bool isExtrapolatedBoundaryFace(const FaceInfo & fi,
1135 const Elem * const elem,
1136 const StateArg & state) const override
1137 {
1138 return _wrapped->isExtrapolatedBoundaryFace(fi, elem, state);
1139 }
1140 virtual bool isConstant() const override { return _wrapped->isConstant(); }
1141 virtual bool hasBlocks(const SubdomainID id) const override { return _wrapped->hasBlocks(id); }
1142 virtual bool hasFaceSide(const FaceInfo & fi, const bool fi_elem_side) const override
1143 {
1144 return _wrapped->hasFaceSide(fi, fi_elem_side);
1145 }
1146
1147 bool supportsFaceArg() const override final { return true; }
1148 bool supportsElemSideQpArg() const override final { return true; }
1149
1150protected:
1152
1155 virtual ValueType evaluate(const ElemArg & elem, const StateArg & state) const override
1156 {
1157 return _wrapped->operator()(elem, state);
1158 }
1159 virtual ValueType evaluate(const FaceArg & face, const StateArg & state) const override
1160 {
1161 return _wrapped->operator()(face, state);
1162 }
1163 virtual ValueType evaluate(const ElemQpArg & qp, const StateArg & state) const override
1164 {
1165 return _wrapped->operator()(qp, state);
1166 }
1167 virtual ValueType evaluate(const ElemSideQpArg & qp, const StateArg & state) const override
1168 {
1169 return _wrapped->operator()(qp, state);
1170 }
1171 virtual ValueType evaluate(const ElemPointArg & elem_point, const StateArg & state) const override
1172 {
1173 return _wrapped->operator()(elem_point, state);
1174 }
1175 virtual ValueType evaluate(const NodeArg & node, const StateArg & state) const override
1176 {
1177 return _wrapped->operator()(node, state);
1178 }
1179
1180 virtual GradientType evaluateGradient(const ElemArg & elem, const StateArg & state) const override
1181 {
1182 return _wrapped->gradient(elem, state);
1183 }
1184 virtual GradientType evaluateGradient(const FaceArg & face, const StateArg & state) const override
1185 {
1186 return _wrapped->gradient(face, state);
1187 }
1188 virtual GradientType evaluateGradient(const ElemQpArg & qp, const StateArg & state) const override
1189 {
1190 return _wrapped->gradient(qp, state);
1191 }
1193 const StateArg & state) const override
1194 {
1195 return _wrapped->gradient(qp, state);
1196 }
1197 virtual GradientType evaluateGradient(const ElemPointArg & elem_point,
1198 const StateArg & state) const override
1199 {
1200 return _wrapped->gradient(elem_point, state);
1201 }
1202 virtual GradientType evaluateGradient(const NodeArg & node, const StateArg & state) const override
1203 {
1204 return _wrapped->gradient(node, state);
1205 }
1206
1207 virtual DotType evaluateDot(const ElemArg & elem, const StateArg & state) const override
1208 {
1209 return _wrapped->dot(elem, state);
1210 }
1211 virtual DotType evaluateDot(const FaceArg & face, const StateArg & state) const override
1212 {
1213 return _wrapped->dot(face, state);
1214 }
1215 virtual DotType evaluateDot(const ElemQpArg & qp, const StateArg & state) const override
1216 {
1217 return _wrapped->dot(qp, state);
1218 }
1219 virtual DotType evaluateDot(const ElemSideQpArg & qp, const StateArg & state) const override
1220 {
1221 return _wrapped->dot(qp, state);
1222 }
1223 virtual DotType evaluateDot(const ElemPointArg & elem_point,
1224 const StateArg & state) const override
1225 {
1226 return _wrapped->dot(elem_point, state);
1227 }
1228 virtual DotType evaluateDot(const NodeArg & node, const StateArg & state) const override
1229 {
1230 return _wrapped->dot(node, state);
1231 }
1232
1233 virtual GradientType evaluateGradDot(const ElemArg & elem, const StateArg & state) const override
1234 {
1235 return _wrapped->gradDot(elem, state);
1236 }
1237 virtual GradientType evaluateGradDot(const FaceArg & face, const StateArg & state) const override
1238 {
1239 return _wrapped->gradDot(face, state);
1240 }
1241 virtual GradientType evaluateGradDot(const ElemQpArg & qp, const StateArg & state) const override
1242 {
1243 return _wrapped->gradDot(qp, state);
1244 }
1246 const StateArg & state) const override
1247 {
1248 return _wrapped->gradDot(qp, state);
1249 }
1250 virtual GradientType evaluateGradDot(const ElemPointArg & elem_point,
1251 const StateArg & state) const override
1252 {
1253 return _wrapped->gradDot(elem_point, state);
1254 }
1255 virtual GradientType evaluateGradDot(const NodeArg & node, const StateArg & state) const override
1256 {
1257 return _wrapped->gradDot(node, state);
1258 }
1260
1261private:
1263 std::unique_ptr<FunctorBase<T>> _owned;
1265
1266 friend class ::SubProblem;
1267};
1268
1272template <typename T>
1273class ConstantFunctor final : public FunctorBase<T>
1274{
1275public:
1276 using typename FunctorBase<T>::FunctorType;
1277 using typename FunctorBase<T>::ValueType;
1278 using typename FunctorBase<T>::GradientType;
1279 using typename FunctorBase<T>::DotType;
1280
1282 : FunctorBase<T>("constant_" + std::to_string(value)), _value(value)
1283 {
1284 }
1286 : FunctorBase<T>("constant_" + std::to_string(MetaPhysicL::raw_value(value))), _value(value)
1287 {
1288 }
1289
1290 virtual bool isConstant() const override { return true; }
1291
1292 bool hasBlocks(SubdomainID /* id */) const override { return true; }
1293
1294 bool supportsFaceArg() const override final { return true; }
1295 bool supportsElemSideQpArg() const override final { return true; }
1296
1297private:
1298 ValueType evaluate(const ElemArg &, const StateArg &) const override { return _value; }
1299 ValueType evaluate(const FaceArg &, const StateArg &) const override { return _value; }
1300 ValueType evaluate(const ElemQpArg &, const StateArg &) const override { return _value; }
1301 ValueType evaluate(const ElemSideQpArg &, const StateArg &) const override { return _value; }
1302 ValueType evaluate(const ElemPointArg &, const StateArg &) const override { return _value; }
1303 ValueType evaluate(const NodeArg &, const StateArg &) const override { return _value; }
1304
1305 GradientType evaluateGradient(const ElemArg &, const StateArg &) const override { return 0; }
1306 GradientType evaluateGradient(const FaceArg &, const StateArg &) const override { return 0; }
1307 GradientType evaluateGradient(const ElemQpArg &, const StateArg &) const override { return 0; }
1308 GradientType evaluateGradient(const ElemSideQpArg &, const StateArg &) const override
1309 {
1310 return 0;
1311 }
1312 GradientType evaluateGradient(const ElemPointArg &, const StateArg &) const override { return 0; }
1313 GradientType evaluateGradient(const NodeArg &, const StateArg &) const override { return 0; }
1314
1315 DotType evaluateDot(const ElemArg &, const StateArg &) const override { return 0; }
1316 DotType evaluateDot(const FaceArg &, const StateArg &) const override { return 0; }
1317 DotType evaluateDot(const ElemQpArg &, const StateArg &) const override { return 0; }
1318 DotType evaluateDot(const ElemSideQpArg &, const StateArg &) const override { return 0; }
1319 DotType evaluateDot(const ElemPointArg &, const StateArg &) const override { return 0; }
1320 DotType evaluateDot(const NodeArg &, const StateArg &) const override { return 0; }
1321
1322 GradientType evaluateGradDot(const ElemArg &, const StateArg &) const override { return 0; }
1323 GradientType evaluateGradDot(const FaceArg &, const StateArg &) const override { return 0; }
1324 GradientType evaluateGradDot(const ElemQpArg &, const StateArg &) const override { return 0; }
1325 GradientType evaluateGradDot(const ElemSideQpArg &, const StateArg &) const override { return 0; }
1326 GradientType evaluateGradDot(const ElemPointArg &, const StateArg &) const override { return 0; }
1327 GradientType evaluateGradDot(const NodeArg &, const StateArg &) const override { return 0; }
1328
1329private:
1331};
1332
1337template <typename T>
1338class NullFunctor final : public FunctorBase<T>
1339{
1340public:
1341 using typename FunctorBase<T>::FunctorType;
1342 using typename FunctorBase<T>::ValueType;
1343 using typename FunctorBase<T>::GradientType;
1344 using typename FunctorBase<T>::DotType;
1345
1346 NullFunctor() : FunctorBase<T>("null") {}
1347
1348 // For backwards compatiblity of unit testing
1349 bool hasFaceSide(const FaceInfo & fi, bool) const override;
1350
1351 bool supportsFaceArg() const override final { return false; }
1352 bool supportsElemSideQpArg() const override final { return false; }
1353
1354private:
1355 ValueType evaluate(const ElemArg &, const StateArg &) const override
1356 {
1357 mooseError("We should never get here. If you have, contact a MOOSE developer and tell them "
1358 "they've written broken code");
1359 }
1360 ValueType evaluate(const FaceArg &, const StateArg &) const override
1361 {
1362 mooseError("We should never get here. If you have, contact a MOOSE developer and tell them "
1363 "they've written broken code");
1364 }
1365 ValueType evaluate(const ElemQpArg &, const StateArg &) const override
1366 {
1367 mooseError("We should never get here. If you have, contact a MOOSE developer and tell them "
1368 "they've written broken code");
1369 }
1370 ValueType evaluate(const ElemSideQpArg &, const StateArg &) const override
1371 {
1372 mooseError("We should never get here. If you have, contact a MOOSE developer and tell them "
1373 "they've written broken code");
1374 }
1375 ValueType evaluate(const ElemPointArg &, const StateArg &) const override
1376 {
1377 mooseError("We should never get here. If you have, contact a MOOSE developer and tell them "
1378 "they've written broken code");
1379 }
1380 ValueType evaluate(const NodeArg &, const StateArg &) const override
1381 {
1382 mooseError("We should never get here. If you have, contact a MOOSE developer and tell them "
1383 "they've written broken code");
1384 }
1385};
1386
1387template <typename T>
1388bool
1389NullFunctor<T>::hasFaceSide(const FaceInfo &, const bool) const
1390{
1391 // For backwards compatiblity of unit testing
1392 return true;
1393}
1394}
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
T evaluate(Real, const Point &)
The general evaluation method is not defined.
const ExecFlagType EXEC_TIMESTEP_BEGIN
Definition Moose.C:37
const ExecFlagType EXEC_ALWAYS
Definition Moose.C:53
const ExecFlagType EXEC_LINEAR
Definition Moose.C:31
const ExecFlagType EXEC_NONLINEAR
Definition Moose.C:33
A base class interface for both producers and consumers of functor face arguments,...
This data structure is used to store geometric and variable related metadata about each cell face in ...
Definition FaceInfo.h:38
const Elem & elem() const
Definition FaceInfo.h:85
const Elem * neighborPtr() const
Definition FaceInfo.h:88
const Elem * elemPtr() const
Definition FaceInfo.h:86
const Point & faceCentroid() const
Returns the coordinates of the face centroid.
Definition FaceInfo.h:75
const Elem & neighbor() const
Definition FaceInfo.h:220
Class for containing MooseEnum item information.
Class template for creating constant functors.
ValueType evaluate(const NodeArg &, const StateArg &) const override
GradientType evaluateGradDot(const ElemSideQpArg &, const StateArg &) const override
ConstantFunctor(ValueType &&value)
ConstantFunctor(const ValueType &value)
virtual bool isConstant() const override
Returns true if this functor is a constant.
bool supportsElemSideQpArg() const override final
Whether this functor supports evaluation with ElemSideQpArg.
GradientType evaluateGradient(const ElemPointArg &, const StateArg &) const override
Evaluate the functor gradient with a given element and point.
ValueType evaluate(const ElemQpArg &, const StateArg &) const override
DotType evaluateDot(const NodeArg &, const StateArg &) const override
GradientType evaluateGradient(const NodeArg &, const StateArg &) const override
GradientType evaluateGradDot(const NodeArg &, const StateArg &) const override
ValueType evaluate(const ElemArg &, const StateArg &) const override
Evaluate the functor with a given element.
GradientType evaluateGradient(const ElemSideQpArg &, const StateArg &) const override
GradientType evaluateGradient(const ElemQpArg &, const StateArg &) const override
DotType evaluateDot(const ElemPointArg &, const StateArg &) const override
Evaluate the functor time derivative with a given element and point.
DotType evaluateDot(const ElemQpArg &, const StateArg &) const override
DotType evaluateDot(const FaceArg &, const StateArg &) const override
DotType evaluateDot(const ElemArg &, const StateArg &) const override
Evaluate the functor time derivative with a given element.
GradientType evaluateGradDot(const ElemQpArg &, const StateArg &) const override
ValueType evaluate(const ElemPointArg &, const StateArg &) const override
Evaluate the functor with a given element and point.
GradientType evaluateGradDot(const ElemPointArg &, const StateArg &) const override
Evaluate the functor gradient-dot with a given element and point.
GradientType evaluateGradDot(const ElemArg &, const StateArg &) const override
Evaluate the functor gradient-dot with a given element.
bool supportsFaceArg() const override final
Whether this functor supports evaluation with FaceArg.
DotType evaluateDot(const ElemSideQpArg &, const StateArg &) const override
GradientType evaluateGradDot(const FaceArg &, const StateArg &) const override
GradientType evaluateGradient(const FaceArg &, const StateArg &) const override
GradientType evaluateGradient(const ElemArg &, const StateArg &) const override
Evaluate the functor gradient with a given element.
bool hasBlocks(SubdomainID) const override
Returns whether the functor is defined on this block.
ValueType evaluate(const ElemSideQpArg &, const StateArg &) const override
ValueType evaluate(const FaceArg &, const StateArg &) const override
Abstract base class that can be used to hold collections of functors.
virtual void residualSetup()=0
virtual void timestepSetup()=0
virtual void jacobianSetup()=0
virtual void customSetup(const ExecFlagType &exec_type)=0
Base class template for functor objects.
virtual DotType evaluateDot(const FaceArg &, const StateArg &) const
DotType dot(const ElemQpArg &qp, const StateArg &state) const
DotType dot(const ElemArg &elem, const StateArg &state) const
Same as their evaluateDot overloads with the same arguments but allows for caching implementation.
GradientType gradient(const NodeArg &node, const StateArg &state) const
GradientType gradient(const FaceArg &face, const StateArg &state) const
DotType dot(const NodeArg &node, const StateArg &state) const
virtual GradientType evaluateGradDot(const NodeArg &, const StateArg &) const
GradientType gradDot(const NodeArg &node, const StateArg &state) const
virtual bool isExtrapolatedBoundaryFace(const FaceInfo &, const Elem *, const StateArg &) const
Returns whether this (sided) face is an extrapolated boundary face for this functor.
GradientType gradient(const ElemSideQpArg &qp, const StateArg &state) const
virtual GradientType evaluateGradDot(const ElemQpArg &, const StateArg &) const
ValueType operator()(const ElemArg &elem, const StateArg &state) const
Same as their evaluate overloads with the same arguments but allows for caching implementation.
virtual GradientType evaluateGradient(const ElemPointArg &, const StateArg &) const
Evaluate the functor gradient with a given element and point.
FunctorReturnType< T, FET >::type genericEvaluate(const Space &r, const State &state) const
Perform a generic evaluation based on the supplied template argument FET and supplied spatial and tem...
void setCacheClearanceSchedule(const std::set< ExecFlagType > &clearance_schedule)
Set how often to clear the functor evaluation cache.
virtual GradientType evaluateGradDot(const ElemSideQpArg &, const StateArg &) const
virtual GradientType evaluateGradDot(const ElemArg &, const StateArg &) const
Evaluate the functor gradient-dot with a given element.
bool _always_evaluate
Boolean to check if we always need evaluation.
ValueType operator()(const NodeArg &node, const StateArg &state) const
void clearCacheData()
clear cache data
GradientType gradient(const ElemPointArg &elem_point, const StateArg &state) const
void checkFace(const Moose::FaceArg &face) const
Examines the incoming face argument.
typename FunctorReturnType< T, FunctorEvaluationKind::Gradient >::type GradientType
This rigmarole makes it so that a user can create functors that return containers (std::vector,...
dof_id_type _current_qp_map_key
Current key for qp map cache.
virtual bool supportsFaceArg() const =0
Whether this functor supports evaluation with FaceArg.
virtual DotType evaluateDot(const ElemSideQpArg &, const StateArg &) const
virtual GradientType evaluateGradDot(const ElemPointArg &, const StateArg &) const
Evaluate the functor gradient-dot with a given element and point.
virtual ValueType evaluate(const ElemArg &elem, const StateArg &state) const =0
Evaluate the functor with a given element.
ValueType operator()(const ElemSideQpArg &qp, const StateArg &state) const
const MooseFunctorName & functorName() const
Return the functor name.
virtual GradientType evaluateGradient(const ElemQpArg &, const StateArg &) const
virtual bool hasBlocks(SubdomainID) const
Returns whether the functor is defined on this block.
GradientType gradDot(const FaceArg &face, const StateArg &state) const
DotType dot(const FaceArg &face, const StateArg &state) const
std::map< ElemArg, ValueType > _elem_arg_to_value
Map from element arguments to their cached evaluations.
ValueType queryQpCache(unsigned int qp, const libMesh::QBase &qrule, std::vector< std::pair< bool, T > > &qp_cache_data, const SpaceArg &space, const StateArg &state) const
check a qp cache and if invalid then evaluate
virtual void residualSetup() override
virtual bool supportsElemSideQpArg() const =0
Whether this functor supports evaluation with ElemSideQpArg.
virtual DotType evaluateDot(const ElemArg &, const StateArg &) const
Evaluate the functor time derivative with a given element.
virtual ValueType evaluate(const NodeArg &node, const StateArg &state) const =0
std::unordered_map< dof_id_type, std::vector< std::pair< bool, ValueType > > > _qp_to_value
Cached element quadrature point functor property evaluations.
GradientType gradDot(const ElemSideQpArg &qp, const StateArg &state) const
virtual GradientType evaluateGradient(const NodeArg &, const StateArg &) const
bool isInternalFace(const FaceInfo &) const
Returns true if the face is an internal face.
virtual DotType evaluateDot(const ElemPointArg &, const StateArg &) const
Evaluate the functor time derivative with a given element and point.
virtual GradientType evaluateGradient(const ElemSideQpArg &, const StateArg &) const
GradientType gradDot(const ElemQpArg &qp, const StateArg &state) const
ValueType operator()(const ElemQpArg &qp, const StateArg &state) const
GradientType gradient(const ElemArg &elem, const StateArg &state) const
Same as their evaluateGradient overloads with the same arguments but allows for caching implementatio...
std::map< FaceArg, ValueType > _face_arg_to_value
Map from face arguments to their cached evaluations.
ValueType queryFVArgCache(std::map< SpaceArg, ValueType > &cache_data, const SpaceArg &space) const
check a finite volume spatial argument cache and if invalid then evaluate
virtual ValueType evaluate(const FaceArg &face, const StateArg &state) const =0
DotType dot(const ElemPointArg &elem_point, const StateArg &state) const
virtual void timestepSetup() override
virtual DotType evaluateDot(const NodeArg &, const StateArg &) const
ValueType operator()(const FaceArg &face, const StateArg &state) const
virtual GradientType evaluateGradDot(const FaceArg &, const StateArg &) const
virtual DotType evaluateDot(const ElemQpArg &, const StateArg &) const
FunctorBase(const FunctorBase< T > &, const Moose::Kokkos::FunctorCopy &)
Special constructor used for Kokkos functor copy during parallel dispatch.
GradientType gradient(const ElemQpArg &qp, const StateArg &state) const
virtual ValueType evaluate(const ElemQpArg &qp, const StateArg &state) const =0
std::vector< std::vector< std::pair< bool, ValueType > > > * _current_side_qp_map_value
Current value for side-qp map cache.
GradientType gradDot(const ElemArg &elem, const StateArg &state) const
Same as their evaluateGradDot overloads with the same arguments but allows for caching implementation...
std::map< NodeArg, ValueType > _node_arg_to_value
Map from nodal arguments to their cached evaluations.
virtual bool hasFaceSide(const FaceInfo &fi, const bool fi_elem_side) const override
std::vector< std::pair< bool, ValueType > > * _current_qp_map_value
Current value for qp map cache.
virtual void customSetup(const ExecFlagType &exec_type) override
DotType dot(const ElemSideQpArg &qp, const StateArg &state) const
std::set< ExecFlagType > _clearance_schedule
How often to clear the material property cache.
FunctorBase(const MooseFunctorName &name, const std::set< ExecFlagType > &clearance_schedule={EXEC_ALWAYS})
MooseFunctorName _functor_name
name of the functor
virtual ValueType evaluate(const ElemPointArg &elem_point, const StateArg &state) const =0
Evaluate the functor with a given element and point.
dof_id_type _current_side_qp_map_key
Current key for side-qp map cache.
virtual ~FunctorBase()=default
ValueType operator()(const ElemPointArg &elem_point, const StateArg &state) const
virtual void jacobianSetup() override
GradientType gradDot(const ElemPointArg &elem_point, const StateArg &state) const
std::unordered_map< dof_id_type, std::vector< std::vector< std::pair< bool, ValueType > > > > _side_qp_to_value
Cached element quadrature point functor property evaluations.
virtual ValueType evaluate(const ElemSideQpArg &side_qp, const StateArg &state) const =0
virtual GradientType evaluateGradient(const FaceArg &, const StateArg &) const
virtual bool isConstant() const
Returns true if this functor is a constant.
virtual GradientType evaluateGradient(const ElemArg &, const StateArg &) const
Evaluate the functor gradient with a given element.
A non-templated base class for functors that allow an owner object to hold different class template i...
virtual bool ownsWrappedFunctor() const =0
virtual ~FunctorEnvelopeBase()=default
virtual bool wrapsNull() const =0
virtual std::string returnType() const =0
virtual bool isConstant() const =0
This is a wrapper that forwards calls to the implementation, which can be switched out at any time wi...
virtual DotType evaluateDot(const FaceArg &face, const StateArg &state) const override
virtual ValueType evaluate(const FaceArg &face, const StateArg &state) const override
virtual bool wrapsNull() const override
virtual GradientType evaluateGradDot(const ElemSideQpArg &qp, const StateArg &state) const override
virtual bool isExtrapolatedBoundaryFace(const FaceInfo &fi, const Elem *const elem, const StateArg &state) const override
Returns whether this (sided) face is an extrapolated boundary face for this functor.
bool supportsElemSideQpArg() const override final
Whether this functor supports evaluation with ElemSideQpArg.
virtual ValueType evaluate(const ElemQpArg &qp, const StateArg &state) const override
virtual ValueType evaluate(const ElemPointArg &elem_point, const StateArg &state) const override
Evaluate the functor with a given element and point.
virtual GradientType evaluateGradDot(const ElemArg &elem, const StateArg &state) const override
Evaluate the functor gradient-dot with a given element.
virtual DotType evaluateDot(const ElemQpArg &qp, const StateArg &state) const override
virtual GradientType evaluateGradDot(const NodeArg &node, const StateArg &state) const override
virtual ~FunctorEnvelope()=default
virtual GradientType evaluateGradient(const ElemSideQpArg &qp, const StateArg &state) const override
void assign(const FunctorBase< T > &wrapped)
virtual bool isConstant() const override
Returns true if this functor is a constant.
FunctorEnvelope(FunctorEnvelope &&)=delete
virtual DotType evaluateDot(const ElemPointArg &elem_point, const StateArg &state) const override
Evaluate the functor time derivative with a given element and point.
virtual ValueType evaluate(const ElemSideQpArg &qp, const StateArg &state) const override
virtual GradientType evaluateGradDot(const ElemQpArg &qp, const StateArg &state) const override
const FunctorBase< T > * _wrapped
virtual bool ownsWrappedFunctor() const override
void assign(std::unique_ptr< FunctorBase< T > > &&wrapped)
virtual GradientType evaluateGradient(const NodeArg &node, const StateArg &state) const override
void assign(FunctorBase< T > &&)=delete
Prevent wrapping of a temporary object.
virtual GradientType evaluateGradDot(const ElemPointArg &elem_point, const StateArg &state) const override
Evaluate the functor gradient-dot with a given element and point.
virtual DotType evaluateDot(const NodeArg &node, const StateArg &state) const override
virtual ValueType evaluate(const NodeArg &node, const StateArg &state) const override
virtual bool hasBlocks(const SubdomainID id) const override
Returns whether the functor is defined on this block.
virtual GradientType evaluateGradient(const ElemQpArg &qp, const StateArg &state) const override
FunctorEnvelope(const FunctorEnvelope &)=delete
virtual DotType evaluateDot(const ElemArg &elem, const StateArg &state) const override
Evaluate the functor time derivative with a given element.
std::unique_ptr< FunctorBase< T > > _owned
Our wrapped object.
virtual GradientType evaluateGradDot(const FaceArg &face, const StateArg &state) const override
virtual GradientType evaluateGradient(const ElemArg &elem, const StateArg &state) const override
Evaluate the functor gradient with a given element.
FunctorEnvelope & operator=(FunctorEnvelope &&)=delete
FunctorEnvelope(FunctorBase< T > &&)=delete
Prevent wrapping of a temporary object.
virtual std::string returnType() const override
FunctorEnvelope(const FunctorBase< T > &wrapped)
FunctorEnvelope(std::unique_ptr< FunctorBase< T > > &&wrapped)
virtual bool hasFaceSide(const FaceInfo &fi, const bool fi_elem_side) const override
virtual ValueType evaluate(const ElemArg &elem, const StateArg &state) const override
Forward calls to wrapped object.
FunctorEnvelope & operator=(const FunctorEnvelope &)=delete
virtual GradientType evaluateGradient(const FaceArg &face, const StateArg &state) const override
bool supportsFaceArg() const override final
Whether this functor supports evaluation with FaceArg.
virtual DotType evaluateDot(const ElemSideQpArg &qp, const StateArg &state) const override
virtual GradientType evaluateGradient(const ElemPointArg &elem_point, const StateArg &state) const override
Evaluate the functor gradient with a given element and point.
A functor that serves as a placeholder during the simulation setup phase if a functor consumer reques...
ValueType evaluate(const FaceArg &, const StateArg &) const override
bool supportsElemSideQpArg() const override final
Whether this functor supports evaluation with ElemSideQpArg.
ValueType evaluate(const ElemQpArg &, const StateArg &) const override
bool supportsFaceArg() const override final
Whether this functor supports evaluation with FaceArg.
ValueType evaluate(const ElemSideQpArg &, const StateArg &) const override
ValueType evaluate(const ElemPointArg &, const StateArg &) const override
Evaluate the functor with a given element and point.
ValueType evaluate(const NodeArg &, const StateArg &) const override
bool hasFaceSide(const FaceInfo &fi, bool) const override
ValueType evaluate(const ElemArg &, const StateArg &) const override
Evaluate the functor with a given element.
static constexpr dof_id_type invalid_id
dof_id_type id() const
unsigned int n_points() const
We need to instantiate the following CompareTypes to tell the compiler that ADReal is a subtype of Ch...
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
std::string stringify(const T &t)
conversion to string
Definition Conversion.h:64
FunctorEvaluationKind
An enumeration of possible functor evaluation kinds.
StateArg currentState()
std::string demangle(const char *name)
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.
const libMesh::Elem * elem
The element.
const libMesh::QBase * qrule
The quadrature rule.
unsigned int qp
The quadrature point index.
Argument for requesting functor evaluation at quadrature point locations on an element side.
const libMesh::Elem * elem
The element.
unsigned int qp
The quadrature point index.
unsigned int side
The local side index.
const libMesh::QBase * qrule
The quadrature rule.
A structure defining a "face" evaluation calling argument for Moose functors.
This structure takes an evaluation kind as a template argument and defines a constant expression indi...
FunctorReturnType< T, FunctorEvaluationKind::Gradient >::type type
MetaPhysicL::ReplaceAlgebraicType< T, typenamelibMesh::TensorTools::IncrementRank< typenameMetaPhysicL::ValueType< T >::type >::type >::type type
A structure that defines the return type of a functor based on the type of the functor and the reques...
const std::set< SubdomainID > * subdomain_ids
Indicates what subdomains this argument should be associated with.
State argument for evaluating functors.
unsigned int state
The state.