www.mooseframework.org
PerfGraphData.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
13 
16 {
18  params.addClassDescription(
19  "Retrieves performance information about a section from the PerfGraph.");
20 
21  params.addRequiredParam<std::string>("section_name", "The name of the section to get data for");
23  "data_type", PerfGraph::dataTypeEnum(), "The type of data to retrieve for the section_name");
24  params.addParam<bool>("must_exist",
25  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  return params;
30 }
31 
33  : GeneralPostprocessor(parameters),
34  _data_type(getParam<MooseEnum>("data_type")),
35  _section_name(getParam<std::string>("section_name")),
36  _must_exist(getParam<bool>("must_exist"))
37 {
38 }
39 
40 void
42 {
45  static_cast<PerfGraph::DataType>(_data_type), _section_name, _must_exist);
46 }
47 
48 Real
50 {
51  return _current_data;
52 }
static MooseEnum dataTypeEnum()
DataType in a MooseEnum for use in InputParameters in objects that query the PerfGraph with sectionDa...
Definition: PerfGraph.h:72
Real sectionData(const DataType type, const std::string &section_name, const bool must_exist=true)
Gets a PerfGraph result pertaining to a section.
Definition: PerfGraph.C:89
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual Real getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.
Definition: PerfGraphData.C:49
This class is here to combine the Postprocessor interface and the base class Postprocessor object alo...
static InputParameters validParams()
Definition: PerfGraphData.C:15
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
static InputParameters validParams()
virtual void finalize() override
This is called after execute() and after threadJoin()! This is probably where you want to do MPI comm...
Definition: PerfGraphData.C:41
Real _current_data
The current data.
Definition: PerfGraphData.h:38
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:31
const int _data_type
The data type to request in regards to the PerfGraph section.
Definition: PerfGraphData.h:28
PerfGraphData(const InputParameters &parameters)
Definition: PerfGraphData.C:32
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
FEProblemBase & _fe_problem
Reference to the FEProblemBase for this user object.
Definition: UserObject.h:210
PerfGraph & perfGraph()
Get the PerfGraph.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an option parameter and a documentation string to the InputParameters object...
const bool _must_exist
Whether or not the section must exist (if it does not, 0 is returned)
Definition: PerfGraphData.h:34
bool checkingUOAuxState() const
Return a flag to indicate whether we are executing user objects and auxliary kernels for state check ...
const std::string & _section_name
The section name in the PerfGraph to query.
Definition: PerfGraphData.h:31
registerMooseObject("MooseApp", PerfGraphData)