https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
ExtremeValueBase< T > Class Template Referenceabstract

#include <ExtremeValueBase.h>

Inheritance diagram for ExtremeValueBase< T >:
[legend]

Public Member Functions

 ExtremeValueBase (const InputParameters &parameters)
 
virtual void initialize () override
 
virtual libMesh::Real getValue () const override
 
virtual void finalize () override
 
virtual void threadJoin (const UserObject &y) override
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Types

enum class  ExtremeType { MAX , MIN , MAX_ABS }
 Type of extreme value we are going to compute. More...
 

Protected Member Functions

virtual std::pair< libMesh::Real, libMesh::RealgetProxyValuePair ()=0
 
virtual void computeExtremeValue ()
 Get the extreme value with a functor element argument.
 

Protected Attributes

enum ExtremeValueBase::ExtremeType _type
 
std::pair< libMesh::Real, libMesh::Real_proxy_value
 Extreme value and proxy value at the same point.
 

Detailed Description

template<class T>
class ExtremeValueBase< T >

Definition at line 19 of file ExtremeValueBase.h.

Member Enumeration Documentation

◆ ExtremeType

template<class T >
enum class ExtremeValueBase::ExtremeType
strongprotected

Type of extreme value we are going to compute.

Enumerator
MAX 
MIN 
MAX_ABS 

Definition at line 38 of file ExtremeValueBase.h.

Constructor & Destructor Documentation

◆ ExtremeValueBase()

template<class T >
ExtremeValueBase< T >::ExtremeValueBase ( const InputParameters parameters)

Definition at line 34 of file ExtremeValueBase.C.

35 : T(parameters), _type(parameters.get<MooseEnum>("value_type").getEnum<ExtremeType>())
36{
37}
ExtremeType
Type of extreme value we are going to compute.
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition MooseEnum.h:55
T getEnum() const
get the current value cast to the enum type T
Definition MooseEnum.h:172

Member Function Documentation

◆ computeExtremeValue()

template<class T >
void ExtremeValueBase< T >::computeExtremeValue ( )
protectedvirtual

Get the extreme value with a functor element argument.

Definition at line 53 of file ExtremeValueBase.C.

54{
55 const auto pv = getProxyValuePair();
56
57 if ((_type == ExtremeType::MAX && pv > _proxy_value) ||
59 _proxy_value = pv;
60 else if (_type == ExtremeType::MAX_ABS && std::abs(pv.first) > _proxy_value.first)
61 _proxy_value = std::make_pair(std::abs(pv.first), pv.second);
62}
virtual std::pair< libMesh::Real, libMesh::Real > getProxyValuePair()=0
std::pair< libMesh::Real, libMesh::Real > _proxy_value
Extreme value and proxy value at the same point.

◆ finalize()

template<class T >
void ExtremeValueBase< T >::finalize ( )
overridevirtual

Definition at line 73 of file ExtremeValueBase.C.

74{
76 this->gatherProxyValueMax(_proxy_value.first, _proxy_value.second);
77 else if (_type == ExtremeType::MIN)
78 this->gatherProxyValueMin(_proxy_value.first, _proxy_value.second);
79}

◆ getProxyValuePair()

template<class T >
virtual std::pair< libMesh::Real, libMesh::Real > ExtremeValueBase< T >::getProxyValuePair ( )
protectedpure virtual

◆ getValue()

template<class T >
Real ExtremeValueBase< T >::getValue ( ) const
overridevirtual

Definition at line 66 of file ExtremeValueBase.C.

67{
68 return _proxy_value.second;
69}

◆ initialize()

template<class T >
void ExtremeValueBase< T >::initialize ( )
overridevirtual

Definition at line 41 of file ExtremeValueBase.C.

42{
45 std::make_pair(-std::numeric_limits<Real>::max(), -std::numeric_limits<Real>::max());
46 else if (_type == ExtremeType::MIN)
48 std::make_pair(std::numeric_limits<Real>::max(), std::numeric_limits<Real>::max());
49}

◆ threadJoin()

template<class T >
void ExtremeValueBase< T >::threadJoin ( const UserObject y)
overridevirtual

Definition at line 83 of file ExtremeValueBase.C.

84{
85 const auto & pps = static_cast<const ExtremeValueBase<T> &>(y);
86
88 pps._proxy_value > _proxy_value) ||
89 (_type == ExtremeType::MIN && pps._proxy_value < _proxy_value))
91}

◆ validParams()

template<class T >
InputParameters ExtremeValueBase< T >::validParams ( )
static

Definition at line 21 of file ExtremeValueBase.C.

22{
23 InputParameters params = T::validParams();
24 params.addParam<MooseEnum>(
25 "value_type",
26 MooseEnum("max=0 min=1 max_abs=2", "max"),
27 "Type of extreme value to return. 'max' "
28 "returns the maximum value. 'min' returns "
29 "the minimum value. 'max_abs' returns the maximum of the absolute value.");
30 return params;
31}
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.

Referenced by ElementExtremeFunctorValueTempl< is_ad >::validParams(), ElementExtremeValue::validParams(), NodalExtremeValue::validParams(), and SideExtremeValue::validParams().

Member Data Documentation

◆ _proxy_value

template<class T >
std::pair<libMesh::Real, libMesh::Real> ExtremeValueBase< T >::_proxy_value
protected

Extreme value and proxy value at the same point.

Definition at line 46 of file ExtremeValueBase.h.

Referenced by ExtremeValueBase< T >::threadJoin().

◆ _type

template<class T >
enum ExtremeValueBase::ExtremeType ExtremeValueBase< T >::_type
protected

The documentation for this class was generated from the following files: