Line data Source code
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 "KokkosExtremeValueBase.h" 11 : 12 : #include "KokkosElementPostprocessor.h" 13 : #include "KokkosElementVariablePostprocessor.h" 14 : #include "KokkosNodalVariablePostprocessor.h" 15 : #include "KokkosSideVariablePostprocessor.h" 16 : 17 : template <typename Base> 18 : InputParameters 19 7042 : KokkosExtremeValueBase<Base>::validParams() 20 : { 21 7042 : InputParameters params = Base::validParams(); 22 15874 : params.addParam<MooseEnum>( 23 : "value_type", 24 33420 : MooseEnum("max=0 min=1 max_abs=2", "max"), 25 : "Type of extreme value to return. 'max' " 26 : "returns the maximum value. 'min' returns " 27 : "the minimum value. 'max_abs' returns the maximum of the absolute value."); 28 7042 : return params; 29 0 : } 30 : 31 : template <typename Base> 32 374 : KokkosExtremeValueBase<Base>::KokkosExtremeValueBase(const InputParameters & parameters) 33 198 : : Base(parameters), _type(parameters.get<MooseEnum>("value_type").getEnum<ExtremeType>()) 34 : { 35 374 : } 36 : 37 : template <typename Base> 38 : void 39 768 : KokkosExtremeValueBase<Base>::initialize() 40 : { 41 768 : this->allocateReductionBuffer(2); 42 768 : } 43 : 44 : template <typename Base> 45 : void 46 768 : KokkosExtremeValueBase<Base>::finalize() 47 : { 48 768 : if (_type == ExtremeType::MAX || _type == ExtremeType::MAX_ABS) 49 1626 : this->gatherProxyValueMax(this->_reduction_buffer(0), this->_reduction_buffer(1)); 50 226 : else if (_type == ExtremeType::MIN) 51 678 : this->gatherProxyValueMin(this->_reduction_buffer(0), this->_reduction_buffer(1)); 52 768 : } 53 : 54 : template <typename Base> 55 : Real 56 768 : KokkosExtremeValueBase<Base>::getValue() const 57 : { 58 1536 : return this->_reduction_buffer(1); 59 : } 60 : 61 : template class KokkosExtremeValueBase<Moose::Kokkos::ElementPostprocessor>; 62 : template class KokkosExtremeValueBase<KokkosElementVariablePostprocessor>; 63 : template class KokkosExtremeValueBase<KokkosNodalVariablePostprocessor>; 64 : template class KokkosExtremeValueBase<KokkosSideVariablePostprocessor>;