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 "GeneralReporter.h" 13 : 14 : /** 15 : * Reports restartable data and restartable meta data. 16 : */ 17 : class RestartableDataReporter : public GeneralReporter 18 : { 19 : public: 20 : static InputParameters validParams(); 21 : RestartableDataReporter(const InputParameters & parameters); 22 : 23 123 : virtual void initialize() override {} 24 119 : virtual void finalize() override {} 25 : virtual void execute() override; 26 : 27 : /** 28 : * Helper struct for storing a single piece of restartable data. 29 : * 30 : * This helper is needed in order to get the paramaters into 31 : * to_json for output, so that we can change how much we output 32 : * via the "entries" input parameter as deisred 33 : */ 34 : struct Value 35 : { 36 : const RestartableDataValue * value; 37 : RestartableDataValue::StoreJSONParams params; 38 : }; 39 : 40 : protected: 41 : /// The parameters to pass to the output of a single value 42 : const RestartableDataValue::StoreJSONParams _data_params; 43 : /// Whether or not to error on the output of types with unimplemented output methods 44 : const bool _allow_unimplemented; 45 : /// The include patterns to match 46 : const std::vector<std::string> _include; 47 : /// The exclude patterns to match 48 : const std::vector<std::string> _exclude; 49 : /// The values we are to output 50 : std::map<std::string, RestartableDataReporter::Value> & _values; 51 : /// The map of data that we're going to output 52 : const RestartableDataMap & _data_map; 53 : 54 : private: 55 : /// Internal method for setting _data_params 56 : RestartableDataValue::StoreJSONParams getDataParams() const; 57 : }; 58 : 59 : void to_json(nlohmann::json & json, const RestartableDataReporter::Value & value);