https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ReporterName.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#pragma once
10
11#include <iostream>
12#include "MooseTypes.h"
13
31{
32public:
33 ReporterName(const std::string & object_name, const std::string & value_name);
34 ReporterName(const std::string & object_and_value_name);
35 ReporterName(const char * combined_name);
36 ReporterName() {} // empty constructor for InputParameters
37
45 static bool isValidName(const std::string & object_and_value_name);
46
50 const std::string & getObjectName() const;
51
55 const std::string & getValueName() const;
56
60 const std::string getCombinedName() const;
61
63 static const std::string REPORTER_RESTARTABLE_DATA_PREFIX;
64
68 std::string getRestartableName() const;
69
73 operator std::string() const;
74
78 bool operator==(const ReporterName & rhs) const;
79 bool operator==(const std::string & combined_name) const;
80
84 bool operator<(const ReporterName & rhs) const;
85
89 std::string specialTypeToName() const;
90
99
112
116 bool empty() const { return _object_name.empty() || _value_name.empty(); }
117
118private:
124 enum class SpecialType
125 {
126 ANY = 0,
127 POSTPROCESSOR = 1,
129 };
130
133
135 std::string _object_name;
137 std::string _value_name;
138};
139
144{
145public:
146 PostprocessorReporterName(const PostprocessorName & name);
147};
148
153{
154public:
155 VectorPostprocessorReporterName(const VectorPostprocessorName & name,
156 const std::string & vector_name);
157};
158
159// This with the operator== allow this to be used as a key in a std::unordered_map
160namespace std
161{
162template <>
163struct hash<ReporterName>
164{
165 size_t operator()(const ReporterName & other) const { return hash<string>{}(other); }
166};
167}
168
169// Support << output
170std::ostream & operator<<(std::ostream & os, const ReporterName & state);
std::ostream & operator<<(std::ostream &os, const ReporterName &state)
A ReporterName that represents a Postprocessor.
The Reporter system is comprised of objects that can contain any number of data values.
std::string specialTypeToName() const
Converts the special type to a usable name for error reporting.
static bool isValidName(const std::string &object_and_value_name)
Determines if the inputted string is convertible to a ReporterName.
void setIsVectorPostprocessor()
Sets the special type to a VectorPostprocessor.
std::string getRestartableName() const
Return the name used for registration of this Reporter in the restartable data system.
ReporterName::SpecialType _special_type
The "special" type for this Reporter, used for identifying Postprocesors and VectorPostprocessors.
bool operator<(const ReporterName &rhs) const
Less than operator.
bool isPostprocessor() const
bool operator==(const ReporterName &rhs) const
Compare with another object or string.
bool isVectorPostprocessor() const
const std::string & getObjectName() const
Return the object name that produces the Reporter value.
const std::string getCombinedName() const
Return the name of the object and data as object_name/data_name.
void setIsPostprocessor()
Sets the special type to a Postprocessor.
const std::string & getValueName() const
Return the data name for the Reporter value.
static const std::string REPORTER_RESTARTABLE_DATA_PREFIX
The prefix for reporter data in the restartable system.
bool empty() const
Whether or not the ReporterName is empty, similar to std::string::empty()
std::string _object_name
The object name.
std::string _value_name
The value name.
SpecialType
Enum for storing a "special" type for this Reporter.
A ReporterName that represents a VectorPostprocessor.
size_t operator()(const ReporterName &other) const