https://mooseframework.inl.gov
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"
12 #include "RestartableDataWriter.h"
13 
14 registerMooseObject("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 
33 void
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 }
static InputParameters validParams()
Definition: MappingOutput.C:17
void write(std::ostream &header_stream, std::ostream &data_stream)
virtual std::string filename()
MappingOutput(const InputParameters &parameters)
Definition: MappingOutput.C:26
virtual void output() override
Definition: MappingOutput.C:34
const std::vector< std::string > & _mappings
List of supplied Mapping objects.
Definition: MappingOutput.h:30
RestartableDataMap & getRestartableDataMap(const RestartableDataMapName &name)
void addRequiredParam(const std::string &name, const std::string &doc_string)
VariableMappingBase & getMappingByName(const UserObjectName &name) const
Get the mapping by supplying the name of the object in the warehouse.
static InputParameters validParams()
static std::filesystem::path restartableDataFolder(const std::filesystem::path &folder_base)
An interface class that helps getting access to Mapping objects.
const std::string & modelMetaDataName() const
Accessor for the name of the model meta data.
MooseApp & _app
void addClassDescription(const std::string &doc_string)
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
registerMooseObject("StochasticToolsApp", MappingOutput)
Class which is used to output valuable data in binary format from Mapping objects.
Definition: MappingOutput.h:19