16 #include "libmesh/elem.h" 18 #include <unordered_map> 39 template <
typename T,
typename Map>
43 const unsigned int num_int_recs,
44 const bool weight_with_sf,
45 const std::vector<const FaceInfo *> & faces,
51 std::unordered_map<dof_id_type, std::pair<T, Real>> elem_to_num_denom;
53 for (
const auto *
const face : faces)
55 mooseAssert(face,
"This must be non-null");
56 const Real weight = weight_with_sf ? face->faceArea() * face->faceCoord() : 1;
63 ? (input_functor.
hasFaceSide(*face,
false) ? nullptr : face->elemPtr())
64 : face->neighborPtr(),
66 auto face_value = input_functor(face_arg, time);
67 std::pair<T, Real> * neighbor_pair =
nullptr;
70 neighbor_pair = &elem_to_num_denom[face->neighbor().id()];
71 neighbor_pair->first += face_value *
weight;
72 neighbor_pair->second +=
weight;
74 auto & elem_pair = elem_to_num_denom[face->elem().id()];
75 elem_pair.first += std::move(face_value) *
weight;
76 elem_pair.second +=
weight;
79 for (
const auto & pair_ : elem_to_num_denom)
81 const auto & data_pair = pair_.second;
82 output_functor[pair_.first] = data_pair.first / data_pair.second;
86 output_functor, output_functor, num_int_recs - 1, weight_with_sf, faces, time);
void interpolateReconstruct(CellCenteredMapFunctor< T, Map > &output_functor, const Moose::FunctorBase< T > &input_functor, const unsigned int num_int_recs, const bool weight_with_sf, const std::vector< const FaceInfo *> &faces, const Moose::StateArg &time)
Takes an input functor that can be evaluated at faces, typically by linearly interpolating between ad...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
A functor whose evaluation relies on querying a map where the keys are element ids and the values cor...
virtual bool hasFaceSide(const FaceInfo &fi, const bool fi_elem_side) const override
const RemoteElem * remote_elem