LCOV - code coverage report
Current view: top level - src/outputs - MappingOutput.C (source / functions) Hit Total Coverage
Test: idaholab/moose stochastic_tools: #31405 (292dce) with base fef103 Lines: 17 18 94.4 %
Date: 2025-09-04 07:57:52 Functions: 3 3 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 "MappingOutput.h"
      12             : #include "RestartableDataWriter.h"
      13             : 
      14             : registerMooseObject("StochasticToolsApp", MappingOutput);
      15             : 
      16             : InputParameters
      17          88 : MappingOutput::validParams()
      18             : {
      19          88 :   InputParameters params = FileOutput::validParams();
      20          88 :   params.addClassDescription("Output for mapping model data.");
      21         176 :   params.addRequiredParam<std::vector<std::string>>("mappings",
      22             :                                                     "A list of Mapping objects to output.");
      23          88 :   return params;
      24           0 : }
      25             : 
      26          44 : MappingOutput::MappingOutput(const InputParameters & parameters)
      27             :   : FileOutput(parameters),
      28             :     MappingInterface(this),
      29          88 :     _mappings(getParam<std::vector<std::string>>("mappings"))
      30             : {
      31          44 : }
      32             : 
      33             : void
      34          66 : MappingOutput::output()
      35             : {
      36          66 :   if (processor_id() == 0)
      37          66 :     for (const auto & map_name : _mappings)
      38             :     {
      39          33 :       const VariableMappingBase & map = getMappingByName(map_name);
      40             :       const auto filename =
      41          66 :           RestartableDataIO::restartableDataFolder(this->filename() + "_" + map_name);
      42          33 :       RestartableDataMap & meta_data = _app.getRestartableDataMap(map.modelMetaDataName());
      43             : 
      44          33 :       RestartableDataWriter writer(_app, meta_data);
      45          33 :       writer.write(filename);
      46             :     }
      47          66 : }

Generated by: LCOV version 1.14