LCOV - code coverage report
Current view: top level - src/outputs - GMVOutput.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 419b9d Lines: 21 22 95.5 %
Date: 2025-08-08 20:01:16 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.14