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 "PerfGraphData.h" 11 : 12 : registerMooseObject("MooseApp", PerfGraphData); 13 : 14 : InputParameters 15 15161 : PerfGraphData::validParams() 16 : { 17 15161 : InputParameters params = GeneralPostprocessor::validParams(); 18 15161 : params.addClassDescription( 19 : "Retrieves performance information about a section from the PerfGraph."); 20 : 21 15161 : params.addRequiredParam<std::string>("section_name", "The name of the section to get data for"); 22 45483 : params.addRequiredParam<MooseEnum>( 23 30322 : "data_type", PerfGraph::dataTypeEnum(), "The type of data to retrieve for the section_name"); 24 45483 : params.addParam<bool>("must_exist", 25 30322 : true, 26 : "Whether or not the section must exist; if false and the section does not " 27 : "exist, the value is set to zero"); 28 : 29 15161 : return params; 30 0 : } 31 : 32 448 : PerfGraphData::PerfGraphData(const InputParameters & parameters) 33 : : GeneralPostprocessor(parameters), 34 448 : _data_type(getParam<MooseEnum>("data_type")), 35 448 : _section_name(getParam<std::string>("section_name")), 36 896 : _must_exist(getParam<bool>("must_exist")) 37 : { 38 448 : } 39 : 40 : void 41 647 : PerfGraphData::finalize() 42 : { 43 647 : if (!_fe_problem.checkingUOAuxState()) 44 1180 : _current_data = perfGraph().sectionData( 45 592 : static_cast<PerfGraph::DataType>(_data_type), _section_name, _must_exist); 46 643 : } 47 : 48 : Real 49 643 : PerfGraphData::getValue() const 50 : { 51 643 : return _current_data; 52 : }