https://mooseframework.inl.gov
Loading...
Searching...
No Matches
StabilizationUtils.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#include "MooseTypes.h"
11
13{
14template <typename Functor>
15auto
16elementAverage(const Functor & f, const MooseArray<Real> & JxW, const MooseArray<Real> & coord)
17{
18 using ret_type = decltype(f(std::declval<unsigned int>()));
19 ret_type avg;
21 Real v = 0;
22 for (auto qp : make_range(JxW.size()))
23 {
24 avg += f(qp) * JxW[qp] * coord[qp];
25 v += JxW[qp] * coord[qp];
26 }
27 avg /= v;
28 return avg;
29}
30}
Real f(Real x)
Test function for Brents method.
const double v
unsigned int size() const
void mooseSetToZero(T &v)
auto elementAverage(const Functor &f, const MooseArray< Real > &JxW, const MooseArray< Real > &coord)