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 // Keep the public evaluate(const FaceInfo *) from hiding the base class overloads
66 ValueType evaluate(const ElemArg &, const StateArg &) const override final;
67 ValueType evaluate(const FaceArg &, const StateArg &) const override final;
68 ValueType evaluate(const ElemPointArg &, const StateArg &) const override;
69 ValueType evaluate(const ElemQpArg &, const StateArg &) const override;
70 ValueType evaluate(const ElemSideQpArg &, const StateArg &) const override;
71 ValueType evaluate(const NodeArg &, const StateArg &) const override final;
72};
73
74template <typename T, typename Map>
76 const std::string & name)
77 : Moose::FunctorBase<T>(name), _mesh(mesh)
78{
79}
80
81template <typename T, typename Map>
83 const std::set<SubdomainID> & sub_ids,
84 const std::string & name)
85 : Moose::FunctorBase<T>(name),
86 _mesh(mesh),
87 _sub_ids(sub_ids == mesh.meshSubdomains() ? std::set<SubdomainID>() : sub_ids)
88{
89}
90
91template <typename T, typename Map>
92bool
94{
95 return _sub_ids.empty() || _sub_ids.count(sub_id);
96}
97
98template <typename T, typename Map>
101{
102 mooseError("not implemented");
103}
104
105template <typename T, typename Map>
108{
109 mooseError("not implemented");
110}
111
112template <typename T, typename Map>
115{
116 mooseError("not implemented");
117}
118
119template <typename T, typename Map>
122{
123 mooseError("not implemented");
124}
125
126extern template class FaceCenteredMapFunctor<ADRealVectorValue,
127 std::unordered_map<dof_id_type, ADRealVectorValue>>;
128extern template class FaceCenteredMapFunctor<RealVectorValue,
129 std::unordered_map<dof_id_type, RealVectorValue>>;
131
132template <typename T, typename Map>
133inline void
134dataStore(std::ostream & stream, FaceCenteredMapFunctor<T, Map> & m, void * context)
135{
136 Map & m_map = m;
137 dataStore(stream, m_map, context);
138}
139
140template <typename T, typename Map>
141inline void
142dataLoad(std::istream & stream, FaceCenteredMapFunctor<T, Map> & m, void * context)
143{
144 Map & m_map = m;
145 dataLoad(stream, m_map, context);
146}
subdomain_id_type SubdomainID
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