https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MappingOutput.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 "MappingOutput.h"
13
14registerMooseObject("StochasticToolsApp", MappingOutput);
15
18{
20 params.addClassDescription("Output for mapping model data.");
21 params.addRequiredParam<std::vector<std::string>>("mappings",
22 "A list of Mapping objects to output.");
23 return params;
24}
25
27 : FileOutput(parameters),
28 MappingInterface(this),
29 _mappings(getParam<std::vector<std::string>>("mappings"))
30{
31}
32
33void
35{
36 if (processor_id() == 0)
37 for (const auto & map_name : _mappings)
38 {
39 const VariableMappingBase & map = getMappingByName(map_name);
40 const auto filename =
41 RestartableDataIO::restartableDataFolder(this->filename() + "_" + map_name);
43
44 RestartableDataWriter writer(_app, meta_data);
45 writer.write(filename);
46 }
47}
registerMooseObject("StochasticToolsApp", MappingOutput)
virtual std::string filename()
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
An interface class that helps getting access to Mapping objects.
VariableMappingBase & getMappingByName(const UserObjectName &name) const
Get the mapping by supplying the name of the object in the warehouse.
Class which is used to output valuable data in binary format from Mapping objects.
static InputParameters validParams()
const std::vector< std::string > & _mappings
List of supplied Mapping objects.
virtual void output() override
MappingOutput(const InputParameters &parameters)
RestartableDataMap & getRestartableDataMap(const RestartableDataMapName &name)
MooseApp & _app
static std::filesystem::path restartableDataFolder(const std::filesystem::path &folder_base)
void write(std::ostream &header_stream, std::ostream &data_stream)
const std::string & modelMetaDataName() const
Accessor for the name of the model meta data.
This is an abstract base class for objects that provide mapping between a full-order and a latent spa...
processor_id_type processor_id() const