www.mooseframework.org
GMVOutput.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 // Moose includes
16 #include "GMVOutput.h"
17 
18 #include "libmesh/equation_systems.h"
19 #include "libmesh/gmv_io.h"
20 
21 template <>
24 {
25  // Get the base class parameters
27 
28  // Advanced file options
29  params.addParam<bool>("binary", true, "Output the file in binary format");
30  params.addParamNamesToGroup("binary", "Advanced");
31 
32  // Add description for the GMVOutput class
33  params.addClassDescription("Object for outputting data in the GMV format");
34 
35  // Return the InputParameters
36  return params;
37 }
38 
40  : OversampleOutput(parameters), _binary(getParam<bool>("binary"))
41 {
42 }
43 
44 void
46 {
47  GMVIO out(_es_ptr->get_mesh());
48  out.write_equation_systems(filename(), *_es_ptr);
49  _file_num++;
50 }
51 
52 std::string
54 {
55  // Append the padded time step to the file base
56  std::ostringstream output;
57  output << _file_base << "_" << std::setw(_padding) << std::setprecision(0) << std::setfill('0')
58  << std::right << _file_num;
59  return output.str() + ".gmv";
60 }
Based class for providing re-positioning and oversampling support to output objects.
InputParameters validParams< GMVOutput >()
Definition: GMVOutput.C:23
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:87
InputParameters validParams< OversampleOutput >()
virtual std::string filename() override
Returns the current filename, this method handles adding the timestep suffix.
Definition: GMVOutput.C:53
unsigned int _padding
Number of digits to pad the extensions.
Definition: FileOutput.h:93
virtual void output(const ExecFlagType &type) override
Overload the Output::output method, this is required for GMVOutput output due to the method utilized ...
Definition: GMVOutput.C:45
EquationSystems * _es_ptr
Reference the the libMesh::EquationSystems object that contains the data.
Definition: Output.h:180
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:90
ExecFlagType
Execution flags - when is the object executed/evaluated.
Definition: MooseTypes.h:90
GMVOutput(const InputParameters &parameters)
Class constructor.
Definition: GMVOutput.C:39
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)
This method takes a space delimited list of parameter names and adds them to the specified group name...