www.mooseframework.org
Public Member Functions | Protected Attributes | List of all members
OutputOnWarehouse Class Reference

A helper warehouse class for storing the "execute_on" settings for the various output types. More...

#include <AdvancedOutputUtils.h>

Inheritance diagram for OutputOnWarehouse:
[legend]

Public Member Functions

 OutputOnWarehouse (const MultiMooseEnum &execute_on, const InputParameters &parameters)
 Constructor. More...
 
MultiMooseEnumoperator[] (const std::string &name)
 A map accessor that errors if the key is not found. More...
 
bool contains (const std::string &name)
 A method for testing of a key exists. More...
 
std::map< std::string, MultiMooseEnum >::iterator begin ()
 Provide iterator and find access to the underlying map data. More...
 
std::map< std::string, MultiMooseEnum >::const_iterator begin () const
 
std::map< std::string, MultiMooseEnum >::iterator end ()
 
std::map< std::string, MultiMooseEnum >::const_iterator end () const
 
std::map< std::string, MultiMooseEnum >::iterator find (const std::string &name)
 
const std::map< std::string, MultiMooseEnum >::const_iterator find (const std::string &name) const
 

Protected Attributes

std::map< std::string, MultiMooseEnum_map
 Data storage. More...
 

Detailed Description

A helper warehouse class for storing the "execute_on" settings for the various output types.

In order to allow for new output types to be defined and to minimize the number of member variables the "execute_on" parameter for each of the output types (e.g., execute_postprocessors_on) are stored in a map.

This allows for iterative access to these parameters, which makes creating generic code (e.g., AdvancedOutput::shouldOutput) possible. However, MultiMooseEnum has a private constructor, so calling operator[] on the map is a compile time error.

To get around this and to provide a more robust storage structure, one that will error if the wrong output name is given, this warehouse was created. For the purposes of the AdvancedOutput object this warehouse functions exactly like a std::map, but provides an operator[] that works with MultiMooseEnum and errors if called on an invalid key.

See also
OutputMapWrapper OutputDataWarehouse

Definition at line 130 of file AdvancedOutputUtils.h.

Constructor & Destructor Documentation

OutputOnWarehouse::OutputOnWarehouse ( const MultiMooseEnum execute_on,
const InputParameters parameters 
)

Constructor.

Parameters
execute_onThe general "execute_on" settings for the object.
parametersThe parameters object holding data for the class to use.

Definition at line 21 of file AdvancedOutputUtils.C.

24 {
25  // Initialize each of the 'execute_on' settings for the various types of outputs
26  if (parameters.have_parameter<MultiMooseEnum>("execute_nodal_on"))
27  _map.insert(std::make_pair("nodal", execute_on));
28 
29  if (parameters.have_parameter<MultiMooseEnum>("execute_elemental_on"))
30  _map.insert(std::make_pair("elemental", execute_on));
31 
32  if (parameters.have_parameter<MultiMooseEnum>("execute_scalars_on"))
33  _map.insert(std::make_pair("scalars", execute_on));
34 
35  if (parameters.have_parameter<MultiMooseEnum>("execute_postprocessors_on"))
36  _map.insert(std::make_pair("postprocessors", execute_on));
37 
38  if (parameters.have_parameter<MultiMooseEnum>("execute_vector_postprocessors_on"))
39  _map.insert(std::make_pair("vector_postprocessors", execute_on));
40 
41  if (parameters.have_parameter<MultiMooseEnum>("execute_input_on"))
42  _map.insert(std::make_pair("input", Output::getExecuteOptions()));
43 
44  if (parameters.have_parameter<MultiMooseEnum>("execute_system_information_on"))
45  _map.insert(std::make_pair("system_information", Output::getExecuteOptions("initial")));
46 }
std::map< std::string, MultiMooseEnum > _map
Data storage.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
static MultiMooseEnum getExecuteOptions()
Returns the available options for the &#39;execute_on&#39; input parameters.

Member Function Documentation

std::map<std::string, MultiMooseEnum >::iterator OutputMapWrapper< MultiMooseEnum >::begin ( )
inlineinherited

Provide iterator and find access to the underlying map data.

Definition at line 87 of file AdvancedOutputUtils.h.

87 { return _map.begin(); }
std::map< std::string, MultiMooseEnum > _map
Data storage.
std::map<std::string, MultiMooseEnum >::const_iterator OutputMapWrapper< MultiMooseEnum >::begin ( ) const
inlineinherited

Definition at line 93 of file AdvancedOutputUtils.h.

93 { return _map.begin(); }
std::map< std::string, MultiMooseEnum > _map
Data storage.
bool OutputMapWrapper< MultiMooseEnum >::contains ( const std::string &  name)
inlineinherited

A method for testing of a key exists.

Definition at line 104 of file AdvancedOutputUtils.h.

104 { return find(name) != end(); }
std::map< std::string, MultiMooseEnum >::iterator end()
std::map< std::string, MultiMooseEnum >::iterator find(const std::string &name)
std::map<std::string, MultiMooseEnum >::iterator OutputMapWrapper< MultiMooseEnum >::end ( )
inlineinherited

Definition at line 88 of file AdvancedOutputUtils.h.

88 { return _map.end(); }
std::map< std::string, MultiMooseEnum > _map
Data storage.
std::map<std::string, MultiMooseEnum >::const_iterator OutputMapWrapper< MultiMooseEnum >::end ( ) const
inlineinherited

Definition at line 94 of file AdvancedOutputUtils.h.

94 { return _map.end(); }
std::map< std::string, MultiMooseEnum > _map
Data storage.
std::map<std::string, MultiMooseEnum >::iterator OutputMapWrapper< MultiMooseEnum >::find ( const std::string &  name)
inlineinherited

Definition at line 89 of file AdvancedOutputUtils.h.

90  {
91  return _map.find(name);
92  }
std::map< std::string, MultiMooseEnum > _map
Data storage.
const std::map<std::string, MultiMooseEnum >::const_iterator OutputMapWrapper< MultiMooseEnum >::find ( const std::string &  name) const
inlineinherited

Definition at line 95 of file AdvancedOutputUtils.h.

96  {
97  return _map.find(name);
98  }
std::map< std::string, MultiMooseEnum > _map
Data storage.
MultiMooseEnum & OutputMapWrapper< MultiMooseEnum >::operator[] ( const std::string &  name)
inlineinherited

A map accessor that errors if the key is not found.

Definition at line 74 of file AdvancedOutputUtils.h.

75  {
76  // Locate the map entry, error if it is not found
77  typename std::map<std::string, T>::iterator iter = _map.find(name);
78  if (iter == _map.end())
79  mooseError("Unknown map key ", name);
80  return iter->second;
81  }
std::map< std::string, MultiMooseEnum > _map
Data storage.
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182

Member Data Documentation

std::map<std::string, MultiMooseEnum > OutputMapWrapper< MultiMooseEnum >::_map
protectedinherited

Data storage.

Definition at line 108 of file AdvancedOutputUtils.h.

Referenced by OutputOnWarehouse().


The documentation for this class was generated from the following files: