www.mooseframework.org
Gnuplot.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 // MOOSE includes
11 #include "Gnuplot.h"
12 
13 registerMooseObject("MooseApp", Gnuplot);
14 
17 {
18  // Get the parameters from the parent object
20  params.addClassDescription("Output for postprocessors and scalar variables in GNU plot format.");
21 
22  // Set an enum for the possible file extensions
23  MooseEnum ext("png ps gif", "png", true);
24  params.addParam<MooseEnum>("extension", ext, "GNU plot file extension");
25 
26  return params;
27 }
28 
29 Gnuplot::Gnuplot(const InputParameters & parameters)
30  : TableOutput(parameters), _extension(getParam<MooseEnum>("extension"))
31 {
32 }
33 
34 std::string
36 {
37  return _file_base;
38 }
39 
40 void
42 {
43  // Call the base class output (populates tables)
45 
46  // Print the table containing all the data to a file
47  if (!_all_data_table.empty())
49 
50  // Update the file number
51  _file_num++;
52 }
void makeGnuplot(const std::string &base_file, const std::string &format)
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
std::string _file_base
The base filename from the input paramaters.
Definition: FileOutput.h:89
virtual void output()
A single call to this function should output all the necessary data for a single timestep.
bool empty() const
Returns a boolean value based on whether the FormattedTable contains data or not. ...
Based class for adding basic filename support to output base class.
Definition: Gnuplot.h:20
virtual std::string filename() override
The filename for the output file.
Definition: Gnuplot.C:35
virtual void output() override
Output the table to a *.csv file.
Definition: Gnuplot.C:41
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:31
FormattedTable & _all_data_table
Table containing postprocessor values, scalar aux variables, and Real Reporters.
Definition: TableOutput.h:85
registerMooseObject("MooseApp", Gnuplot)
static InputParameters validParams()
Definition: Gnuplot.C:16
Base class for scalar variables and postprocessors output objects.
Definition: TableOutput.h:28
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...
unsigned int & _file_num
A file number counter, initialized to 0 (this must be controlled by the child class, see Exodus)
Definition: FileOutput.h:80
std::string _extension
Desired file extension.
Definition: Gnuplot.h:48
Gnuplot(const InputParameters &parameters)
Class constructor.
Definition: Gnuplot.C:29
static InputParameters validParams()
Definition: TableOutput.C:26