https://mooseframework.inl.gov
GMVOutput.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
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 using namespace libMesh;
17 
18 registerMooseObjectAliased("MooseApp", GMVOutput, "GMV");
19 
22 {
23  // Get the base class parameters
25 
26  // Advanced file options
27  params.addParam<bool>("binary", true, "Output the file in binary format");
28  params.addParamNamesToGroup("binary", "Advanced");
29 
30  // Add description for the GMVOutput class
31  params.addClassDescription("Object for outputting data in the GMV format");
32 
33  // Need a layer of geometric ghosting for mesh serialization
34  params.addRelationshipManager("ElementPointNeighborLayers",
36 
37  // Return the InputParameters
38  return params;
39 }
40 
42  : SampledOutput(parameters), _binary(getParam<bool>("binary"))
43 {
44 }
45 
46 void
48 {
50  out.write_equation_systems(filename(), *_es_ptr);
51  _file_num++;
52 }
53 
54 std::string
56 {
57  // Append the padded time step to the file base
58  std::ostringstream output;
59  output << _file_base << "_" << std::setw(_padding) << std::setprecision(0) << std::setfill('0')
60  << std::right << _file_num;
61  return output.str() + ".gmv";
62 }
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:55
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
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.
Based class for providing re-positioning and oversampling support to output objects.
Definition: SampledOutput.h:39
unsigned int _padding
Number of digits to pad the extensions.
Definition: FileOutput.h:83
static InputParameters validParams()
Definition: GMVOutput.C:21
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:47
OStreamProxy out
libMesh::EquationSystems * _es_ptr
Reference the the libMesh::EquationSystems object that contains the data.
Definition: Output.h:194
const MeshBase & get_mesh() const
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 optional 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()
Definition: SampledOutput.C:25
GMVOutput(const InputParameters &parameters)
Class constructor.
Definition: GMVOutput.C:41
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...