Loading [MathJax]/extensions/tex2jax.js
https://mooseframework.inl.gov
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
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 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  ExtremeType { ExtremeType::MAX, ExtremeType::MIN, ExtremeType::MAX_ABS }
 Type of extreme value we are going to compute. More...
 

Protected Member Functions

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

Protected Attributes

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

Detailed Description

template<class T>
class ExtremeValueBase< T >

Definition at line 15 of file ExtremeValueBase.h.

Member Enumeration Documentation

◆ ExtremeType

template<class T>
enum ExtremeValueBase::ExtremeType
strongprotected

Type of extreme value we are going to compute.

Enumerator
MAX 
MIN 
MAX_ABS 

Definition at line 34 of file ExtremeValueBase.h.

35  {
36  MAX,
37  MIN,
38  MAX_ABS
39  } _type;
enum ExtremeValueBase::ExtremeType _type

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 }
enum ExtremeValueBase::ExtremeType _type
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.
T getEnum() const
get the current value cast to the enum type T
Definition: MooseEnum.h:151
ExtremeType
Type of extreme value we are going to compute.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:33

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) ||
58  (_type == ExtremeType::MIN && 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 }
MetaPhysicL::DualNumber< V, D, asd > abs(const MetaPhysicL::DualNumber< V, D, asd > &a)
Definition: EigenADReal.h:42
enum ExtremeValueBase::ExtremeType _type
virtual std::pair< Real, Real > getProxyValuePair()=0
std::pair< Real, 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 }
enum ExtremeValueBase::ExtremeType _type
std::pair< Real, Real > _proxy_value
Extreme value and proxy value at the same point.

◆ getProxyValuePair()

template<class T>
virtual std::pair<Real, 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 }
std::pair< Real, Real > _proxy_value
Extreme value and proxy value at the same point.

◆ initialize()

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

Definition at line 41 of file ExtremeValueBase.C.

42 {
44  _proxy_value =
46  else if (_type == ExtremeType::MIN)
47  _proxy_value =
49 }
enum ExtremeValueBase::ExtremeType _type
auto max(const L &left, const R &right)
std::pair< Real, Real > _proxy_value
Extreme value and proxy value at the same point.

◆ 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))
90  _proxy_value = pps._proxy_value;
91 }
enum ExtremeValueBase::ExtremeType _type
std::pair< Real, Real > _proxy_value
Extreme value and proxy value at the same point.

◆ validParams()

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

Definition at line 21 of file ExtremeValueBase.C.

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

22 {
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...
InputParameters validParams()
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:33
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...

Member Data Documentation

◆ _proxy_value

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

Extreme value and proxy value at the same point.

Definition at line 42 of file ExtremeValueBase.h.

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

◆ _type

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

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