https://mooseframework.inl.gov
Loading...
Searching...
No Matches
FaceCenteredMapFunctor.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#include "MooseMesh.h"
14#include "MooseError.h"
15
16#include <set>
17
24template <typename T, typename Map>
25class FaceCenteredMapFunctor : public Moose::FunctorBase<T>, public Map
26{
27public:
30 using typename Moose::FunctorBase<T>::DotType;
38
39 FaceCenteredMapFunctor(const MooseMesh & mesh, const std::string & name);
40
42 const std::set<SubdomainID> & sub_ids,
43 const std::string & name);
44
45 bool hasBlocks(SubdomainID sub_id) const override;
46
51 ValueType evaluate(const FaceInfo * const fi) const;
52
53 bool supportsFaceArg() const override final { return true; }
54 bool supportsElemSideQpArg() const override final { return false; }
55
56private:
59
62 const std::set<SubdomainID> _sub_ids;
63
64 ValueType evaluate(const ElemArg &, const StateArg &) const override final;
65 ValueType evaluate(const FaceArg &, const StateArg &) const override final;
66 ValueType evaluate(const ElemPointArg &, const StateArg &) const override;
67 ValueType evaluate(const ElemQpArg &, const StateArg &) const override;
68 ValueType evaluate(const ElemSideQpArg &, const StateArg &) const override;
69 ValueType evaluate(const NodeArg &, const StateArg &) const override final;
70};
71
72template <typename T, typename Map>
74 const std::string & name)
75 : Moose::FunctorBase<T>(name), _mesh(mesh)
76{
77}
78
79template <typename T, typename Map>
81 const std::set<SubdomainID> & sub_ids,
82 const std::string & name)
83 : Moose::FunctorBase<T>(name),
84 _mesh(mesh),
85 _sub_ids(sub_ids == mesh.meshSubdomains() ? std::set<SubdomainID>() : sub_ids)
86{
87}
88
89template <typename T, typename Map>
90bool
92{
93 return _sub_ids.empty() || _sub_ids.count(sub_id);
94}
95
96template <typename T, typename Map>
99{
100 mooseError("not implemented");
101}
102
103template <typename T, typename Map>
106{
107 mooseError("not implemented");
108}
109
110template <typename T, typename Map>
113{
114 mooseError("not implemented");
115}
116
117template <typename T, typename Map>
120{
121 mooseError("not implemented");
122}
123
124extern template class FaceCenteredMapFunctor<ADRealVectorValue,
125 std::unordered_map<dof_id_type, ADRealVectorValue>>;
126extern template class FaceCenteredMapFunctor<RealVectorValue,
127 std::unordered_map<dof_id_type, RealVectorValue>>;
129
130template <typename T, typename Map>
131inline void
132dataStore(std::ostream & stream, FaceCenteredMapFunctor<T, Map> & m, void * context)
133{
134 Map & m_map = m;
135 dataStore(stream, m_map, context);
136}
137
138template <typename T, typename Map>
139inline void
140dataLoad(std::istream & stream, FaceCenteredMapFunctor<T, Map> & m, void * context)
141{
142 Map & m_map = m;
143 dataLoad(stream, m_map, context);
144}
void dataStore(std::ostream &stream, FaceCenteredMapFunctor< T, Map > &m, void *context)
void dataLoad(std::istream &stream, FaceCenteredMapFunctor< T, Map > &m, void *context)
const double T
void mooseError(Args &&... args)
const std::string name
Definition Setup.h:21
A functor whose evaluation relies on querying a map where the keys are face info ids and the values c...
bool supportsFaceArg() const override final
ValueType evaluate(const NodeArg &, const StateArg &) const override final
ValueType evaluate(const ElemQpArg &, const StateArg &) const override
bool hasBlocks(SubdomainID sub_id) const override
ValueType evaluate(const FaceInfo *const fi) const
Evaluate the face functor using a FaceInfo argument.
ValueType evaluate(const ElemSideQpArg &, const StateArg &) const override
ValueType evaluate(const ElemPointArg &, const StateArg &) const override
FaceCenteredMapFunctor(const MooseMesh &mesh, const std::string &name)
const MooseMesh & _mesh
The mesh that this functor lives on.
bool supportsElemSideQpArg() const override final
FaceCenteredMapFunctor(const MooseMesh &mesh, const std::set< SubdomainID > &sub_ids, const std::string &name)
const std::set< SubdomainID > _sub_ids
The subdomain IDs that this functor lives on.
typename FunctorReturnType< T, FunctorEvaluationKind::Gradient >::type GradientType
MeshBase & mesh