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 "NodalMaxValueId.h" 11 : #include "MooseMesh.h" 12 : #include "SubProblem.h" 13 : // libMesh 14 : #include "libmesh/boundary_info.h" 15 : 16 : registerMooseObject("MooseApp", NodalMaxValueId); 17 : registerMooseObjectRenamed("MooseApp", NodalProxyMaxValue, "04/01/2022 00:00", NodalMaxValueId); 18 : 19 : InputParameters 20 28555 : NodalMaxValueId::validParams() 21 : { 22 28555 : InputParameters params = NodalVariablePostprocessor::validParams(); 23 28555 : params.addClassDescription( 24 : "Finds the node id with the maximum nodal value across all postprocessors."); 25 28555 : return params; 26 0 : } 27 : 28 13 : NodalMaxValueId::NodalMaxValueId(const InputParameters & parameters) 29 13 : : NodalVariablePostprocessor(parameters), _value(-std::numeric_limits<Real>::max()) 30 : { 31 13 : } 32 : 33 : void 34 72 : NodalMaxValueId::initialize() 35 : { 36 72 : _value = -std::numeric_limits<Real>::max(); 37 72 : } 38 : 39 : Real 40 25392 : NodalMaxValueId::computeValue() 41 : { 42 25392 : return _u[_qp]; 43 : } 44 : 45 : void 46 25392 : NodalMaxValueId::execute() 47 : { 48 25392 : Real val = computeValue(); 49 : 50 25392 : if (val > _value) 51 : { 52 444 : _value = val; 53 444 : _node_id = _current_node->id(); 54 : } 55 25392 : } 56 : 57 : Real 58 66 : NodalMaxValueId::getValue() const 59 : { 60 66 : return _node_id; 61 : } 62 : 63 : void 64 66 : NodalMaxValueId::finalize() 65 : { 66 66 : gatherProxyValueMax(_value, _node_id); 67 66 : } 68 : 69 : void 70 6 : NodalMaxValueId::threadJoin(const UserObject & y) 71 : { 72 6 : const auto & pps = static_cast<const NodalMaxValueId &>(y); 73 6 : if (pps._value > _value) 74 : { 75 0 : _value = pps._value; 76 0 : _node_id = pps._node_id; 77 : } 78 6 : }