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 
15 template <>
18 {
19  // Get the parameters from the parent object
21  params.addClassDescription("Output for postprocessors and scalar variables in GNU plot format.");
22 
23  // Set an enum for the possible file extensions
24  MooseEnum ext("png ps gif", "png", true);
25  params.addParam<MooseEnum>("extension", ext, "GNU plot file extension");
26 
27  return params;
28 }
29 
30 Gnuplot::Gnuplot(const InputParameters & parameters)
31  : TableOutput(parameters), _extension(getParam<MooseEnum>("extension"))
32 {
33 }
34 
35 std::string
37 {
38  return _file_base;
39 }
40 
41 void
43 {
44  // Call the base class output (populates tables)
46 
47  // Print the table containing all the data to a file
48  if (!_all_data_table.empty())
50 
51  // Update the file number
52  _file_num++;
53 }
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:81
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:26
const std::string & type() const
Get the type of this object.
Definition: MooseObject.h:53
virtual std::string filename() override
The filename for the output file.
Definition: Gnuplot.C:36
virtual void output(const ExecFlagType &type)
A single call to this function should output all the necessary data for a single timestep.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:31
virtual void output(const ExecFlagType &type) override
Output the table to a *.csv file.
Definition: Gnuplot.C:42
FormattedTable & _all_data_table
Table containing postprocessor values and scalar aux variables.
Definition: TableOutput.h:78
registerMooseObject("MooseApp", Gnuplot)
MatType type
Class for containing MooseEnum item information.
Definition: MooseEnumItem.h:21
InputParameters validParams< Gnuplot >()
Definition: Gnuplot.C:17
Base class for scalar variables and postprocessors output objects.
Definition: TableOutput.h:33
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:84
std::string _extension
Desired file extension.
Definition: Gnuplot.h:52
InputParameters validParams< TableOutput >()
Definition: TableOutput.C:27
Gnuplot(const InputParameters &parameters)
Class constructor.
Definition: Gnuplot.C:30