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

Generated by: LCOV version 1.14