www.mooseframework.org
GMVOutput.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 "GMVOutput.h"
12 
13 #include "libmesh/equation_systems.h"
14 #include "libmesh/gmv_io.h"
15 
16 registerMooseObjectAliased("MooseApp", GMVOutput, "GMV");
17 
18 template <>
21 {
22  // Get the base class parameters
24 
25  // Advanced file options
26  params.addParam<bool>("binary", true, "Output the file in binary format");
27  params.addParamNamesToGroup("binary", "Advanced");
28 
29  // Add description for the GMVOutput class
30  params.addClassDescription("Object for outputting data in the GMV format");
31 
32  // Need a layer of geometric ghosting for mesh serialization
33  params.addRelationshipManager("MooseGhostPointNeighbors",
35 
36  // Return the InputParameters
37  return params;
38 }
39 
41  : OversampleOutput(parameters), _binary(getParam<bool>("binary"))
42 {
43 }
44 
45 void
47 {
48  GMVIO out(_es_ptr->get_mesh());
49  out.write_equation_systems(filename(), *_es_ptr);
50  _file_num++;
51 }
52 
53 std::string
55 {
56  // Append the padded time step to the file base
57  std::ostringstream output;
58  output << _file_base << "_" << std::setw(_padding) << std::setprecision(0) << std::setfill('0')
59  << std::right << _file_num;
60  return output.str() + ".gmv";
61 }
Based class for providing re-positioning and oversampling support to output objects.
InputParameters validParams< GMVOutput >()
Definition: GMVOutput.C:20
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
InputParameters validParams< OversampleOutput >()
virtual std::string filename() override
Returns the current filename, this method handles adding the timestep suffix.
Definition: GMVOutput.C:54
void addRelationshipManager(const std::string &name, Moose::RelationshipManagerType rm_type, Moose::RelationshipManagerInputParameterCallback input_parameter_callback=nullptr)
Tells MOOSE about a RelationshipManager that this object needs.
unsigned int _padding
Number of digits to pad the extensions.
Definition: FileOutput.h:87
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:46
EquationSystems * _es_ptr
Reference the the libMesh::EquationSystems object that contains the data.
Definition: Output.h:176
registerMooseObjectAliased("MooseApp", GMVOutput, "GMV")
Class for containing MooseEnum item information.
Definition: MooseEnumItem.h:21
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
Class for output data to the GMVOutputII format.
Definition: GMVOutput.h:24
GMVOutput(const InputParameters &parameters)
Class constructor.
Definition: GMVOutput.C:40
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...