https://mooseframework.inl.gov
Loading...
Searching...
No Matches
AdvancedOutputUtils.h
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#pragma once
11
12// MOOSE includes
13#include "MooseError.h"
14#include "ExecFlagEnum.h"
15
16// Forward declarations
17class InputParameters;
18
28{
30 std::set<std::string> available;
31
33 std::set<std::string> show;
34
36 std::set<std::string> hide;
37
39 std::set<std::string> output;
40
42 void reset();
43};
44
59template <typename T>
61{
62public:
67
71 T & operator[](const std::string & name)
72 {
73 // Locate the map entry, error if it is not found
74 typename std::map<std::string, T>::iterator iter = _map.find(name);
75 if (iter == _map.end())
76 mooseError("Unknown map key ", name);
77 return iter->second;
78 }
79
81
84 typename std::map<std::string, T>::iterator begin() { return _map.begin(); }
85 typename std::map<std::string, T>::iterator end() { return _map.end(); }
86 typename std::map<std::string, T>::iterator find(const std::string & name)
87 {
88 return _map.find(name);
89 }
90 typename std::map<std::string, T>::const_iterator begin() const { return _map.begin(); }
91 typename std::map<std::string, T>::const_iterator end() const { return _map.end(); }
92 const typename std::map<std::string, T>::const_iterator find(const std::string & name) const
93 {
94 return _map.find(name);
95 }
97
101 bool contains(const std::string & name) const { return find(name) != end(); }
102
103protected:
105 typename std::map<std::string, T> _map;
106};
107
127class OutputOnWarehouse : public OutputMapWrapper<ExecFlagEnum>
128{
129public:
135 OutputOnWarehouse(const ExecFlagEnum & execute_on, const InputParameters & parameters);
136};
137
146class OutputDataWarehouse : public OutputMapWrapper<OutputData>
147{
148public:
150
155
162 bool hasShowList() { return _has_show_list; }
163
170 void setHasShowList(bool value) { _has_show_list = value; }
171
175 void reset();
176
177private:
178 // True when the input file contains a show/hide list
180};
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
A MultiMooseEnum object to hold "execute_on" flags.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
A helper warehouse for storing OutputData objects for the various output types.
void reset()
Clear existing lists for re-initialization.
static InputParameters validParams()
bool hasShowList()
False when the show lists for all variables is empty.
void setHasShowList(bool value)
Set the show list bool.
OutputDataWarehouse()
Populate the OutputData structures for all output types that are 'variable' based.
In newer versions of Clang calling operator[] on a map with a component that has a default constructo...
std::map< std::string, T >::iterator end()
OutputMapWrapper()
Constructor.
std::map< std::string, T >::const_iterator end() const
std::map< std::string, T >::iterator begin()
Provide iterator and find access to the underlying map data.
const std::map< std::string, T >::const_iterator find(const std::string &name) const
T & operator[](const std::string &name)
A map accessor that errors if the key is not found.
bool contains(const std::string &name) const
A method for testing of a key exists.
std::map< std::string, T > _map
Data storage.
std::map< std::string, T >::iterator find(const std::string &name)
std::map< std::string, T >::const_iterator begin() const
A helper warehouse class for storing the "execute_on" settings for the various output types.
A structure for storing the various lists that contain the names of the items to be exported.
std::set< std::string > show
User-supplied list of outputs to display.
std::set< std::string > available
A list of all possible outputs.
std::set< std::string > output
A list of the outputs to write.
void reset()
Clear existing sets for re-initialization.
std::set< std::string > hide
User-supplied list of outputs to hide.