Line data Source code
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 : 20 : InputParameters 21 14333 : GMVOutput::validParams() 22 : { 23 : // Get the base class parameters 24 14333 : InputParameters params = SampledOutput::validParams(); 25 : 26 : // Advanced file options 27 14333 : params.addParam<bool>("binary", true, "Output the file in binary format"); 28 14333 : params.addParamNamesToGroup("binary", "Advanced"); 29 : 30 : // Add description for the GMVOutput class 31 14333 : params.addClassDescription("Object for outputting data in the GMV format"); 32 : 33 : // Need a layer of geometric ghosting for mesh serialization 34 14333 : params.addRelationshipManager("ElementPointNeighborLayers", 35 : Moose::RelationshipManagerType::GEOMETRIC); 36 : 37 : // Return the InputParameters 38 14333 : return params; 39 0 : } 40 : 41 32 : GMVOutput::GMVOutput(const InputParameters & parameters) 42 32 : : SampledOutput(parameters), _binary(getParam<bool>("binary")) 43 : { 44 32 : } 45 : 46 : void 47 62 : GMVOutput::output() 48 : { 49 62 : GMVIO out(_es_ptr->get_mesh()); 50 62 : out.write_equation_systems(filename(), *_es_ptr); 51 62 : _file_num++; 52 62 : } 53 : 54 : std::string 55 94 : GMVOutput::filename() 56 : { 57 : // Append the padded time step to the file base 58 94 : std::ostringstream output; 59 94 : output << _file_base << "_" << std::setw(_padding) << std::setprecision(0) << std::setfill('0') 60 94 : << std::right << _file_num; 61 282 : return output.str() + ".gmv"; 62 94 : }