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 : #include "Reporter.h" 13 : #include "GeneralUserObject.h" 14 : 15 : /** 16 : * Reporter object that has a single execution of the "execute" method for for each execute flag. 17 : */ 18 : class GeneralReporter : public GeneralUserObject, public Reporter 19 : { 20 : public: 21 : static InputParameters validParams(); 22 : GeneralReporter(const InputParameters & parameters); 23 : 24 : // These objects are not threaded 25 0 : void threadJoin(const UserObject &) final {} 26 : 27 : /** 28 : * @returns Whether or not this Reporter should store its value at this specific time. 29 : * 30 : * If the private parameter '_always_store' is true, this will always return true. 31 : * Otherwise, it will return true if the current execute flag matches a flag 32 : * that this GeneralReporter has in its 'execute_on' parameter. Otherwise, it will 33 : * return false. 34 : * 35 : * This enables GeneralReporter objects that do not fill information ahead of time in 36 : * execute() but instead fill their information in the to_json implementation. 37 : * Without this, said GeneralReporters would always output their information even though 38 : * the user requested that they do not execute on a specific flag. 39 : */ 40 : bool shouldStore() const override final; 41 : 42 : private: 43 : /// Whether or not this GeneralReporter should always store its information; see shouldStore() 44 : const bool _always_store; 45 : };