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 : #pragma once 11 : 12 : // MOOSE includes 13 : #include "Action.h" 14 : #include "ReporterName.h" 15 : 16 : #include <optional> 17 : 18 : /** 19 : * Meta-action for creating common output object parameters 20 : * This action serves two purpose, first it adds common output object 21 : * parameters. Second, it creates the action (AddOutputAction) short-cuts 22 : * such as 'exodus=true' that result in the default output object of that 23 : * type to be created. 24 : * */ 25 : class CommonOutputAction : public Action 26 : { 27 : public: 28 : static InputParameters validParams(); 29 : 30 : CommonOutputAction(const InputParameters & params); 31 : 32 : virtual void act() override; 33 : 34 : /** 35 : * Get the specific reporter names that we do not want to include 36 : * in general JSON output 37 : * 38 : * Whenever we create an additional JSON output for a specific reporter 39 : * value (the perf graph output for example), we do not want to output 40 : * those values in the standard JSON output 41 : */ 42 2638 : const std::vector<ReporterName> & getCommonReporterNames() const 43 : { 44 2638 : return _common_reporter_names; 45 : } 46 : 47 : static const ReporterName perf_graph_json_reporter; 48 : 49 : private: 50 : /** 51 : * Helper method for creating the short-cut actions 52 : * @param object_type String of the object type, i.e., the value of 'type=' in the input file 53 : * @param param_name The name of the input parameter that is responsible for creating, if any 54 : * @param from_params The parameters that are responsible for creating, if any 55 : * @param apply_params Additional parameters to apply, if any 56 : * @param object_name Override for the object name, if any (defaults to object type lowercased) 57 : */ 58 : void create(const std::string & object_type, 59 : const std::optional<std::string> & param_name, 60 : const InputParameters * const from_params = nullptr, 61 : const InputParameters * const apply_params = nullptr, 62 : const std::optional<std::string> & object_name = {}); 63 : 64 : /** 65 : * Check if a Console object that outputs to the screen has been defined 66 : * @return True if the a screen outputting Console objects 67 : */ 68 : bool hasConsole(); 69 : 70 : /// Parameters from the action being created (AddOutputAction) 71 : InputParameters _action_params; 72 : 73 : /// The reporter names that we do not want to include in general JSON output 74 : std::vector<ReporterName> _common_reporter_names; 75 : };