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 
20 {
21  // Get the base class parameters
23 
24  // Advanced file options
25  params.addParam<bool>("binary", true, "Output the file in binary format");
26  params.addParamNamesToGroup("binary", "Advanced");
27 
28  // Add description for the GMVOutput class
29  params.addClassDescription("Object for outputting data in the GMV format");
30 
31  // Need a layer of geometric ghosting for mesh serialization
32  params.addRelationshipManager("ElementPointNeighborLayers",
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.
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 std::string filename() override
Returns the current filename, this method handles adding the timestep suffix.
Definition: GMVOutput.C:53
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:83
static InputParameters validParams()
Definition: GMVOutput.C:19
EquationSystems * _es_ptr
Reference the the libMesh::EquationSystems object that contains the data.
Definition: Output.h:188
registerMooseObjectAliased("MooseApp", GMVOutput, "GMV")
virtual void output() override
Overload the Output::output method, this is required for GMVOutput output due to the method utilized ...
Definition: GMVOutput.C:45
OStreamProxy out
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
Class for output data to the GMVOutputII format.
Definition: GMVOutput.h:18
static InputParameters validParams()
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...