https://mooseframework.inl.gov
JSONOutput.h
Go to the documentation of this file.
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 "nlohmann/json.h"
13 #include "AdvancedOutput.h"
14 
15 class JSONOutput : public AdvancedOutput
16 {
17 public:
20 
21 protected:
22  virtual void initialSetup() override;
23  virtual void output() override;
24  virtual void outputReporters() override;
25  virtual void outputSystemInformation() override;
26  virtual void timestepSetup() override;
27  virtual std::string filename() override;
29 
30 private:
33 
35  const std::vector<ReporterName> * const _reporters;
36 
38  nlohmann::json & _json;
39 
41  bool _has_distributed = false;
42 };
43 
44 template <>
45 void dataStore(std::ostream & stream, nlohmann::json & json, void * context);
46 template <>
47 void dataLoad(std::istream & stream, nlohmann::json & json, void * context);
virtual void outputSystemInformation() override
Definition: JSONOutput.C:81
const bool _one_file_per_timestep
Flag to create a file for each time step.
Definition: JSONOutput.h:32
void dataStore(std::ostream &stream, nlohmann::json &json, void *context)
Definition: JSONOutput.C:237
const ReporterData & _reporter_data
Definition: JSONOutput.h:28
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
bool _has_distributed
True when distributed data exists for output.
Definition: JSONOutput.h:41
virtual void timestepSetup() override
Gets called at the beginning of the timestep before this object is asked to do its job...
Definition: JSONOutput.C:87
static InputParameters validParams()
Definition: JSONOutput.C:22
const std::vector< ReporterName > *const _reporters
The names of the specific reporters to output (if any)
Definition: JSONOutput.h:35
virtual void outputReporters() override
Output Reporter values.
Definition: JSONOutput.C:95
virtual void initialSetup() override
Call init() method on setup.
Definition: JSONOutput.C:50
Based class for output objects.
void dataLoad(std::istream &stream, nlohmann::json &json, void *context)
Definition: JSONOutput.C:244
const InputParameters & parameters() const
Get the parameters of the object.
nlohmann::json & _json
The root JSON node for output.
Definition: JSONOutput.h:38
JSONOutput(const InputParameters &parameters)
Definition: JSONOutput.C:40
virtual std::string filename() override
The filename for the output file.
Definition: JSONOutput.C:59
virtual void output() override
A single call to this function should output all the necessary data for a single timestep.
Definition: JSONOutput.C:224
This is a helper class for managing the storage of declared Reporter object values.
Definition: ReporterData.h:48