https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ReporterContext.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#include "ReporterContext.h"
11
12#include "ReporterData.h"
13
15 const MooseObject & producer)
16 : libMesh::ParallelObject(other), _producer(producer)
17{
18}
19
20void
22{
23 if (mode != REPORTER_MODE_UNSET)
25}
26
32
33void
35 const std::set<ReporterMode> & modes) const
36{
37 for (const auto & mode_object_pair : state.getConsumers())
38 if (!modes.count(mode_object_pair.first))
39 {
40 std::stringstream oss;
41 std::copy(modes.begin(), modes.end(), std::ostream_iterator<ReporterMode>(oss, " "));
42
43 mooseError("The Reporter value '",
44 name(),
45 "' is being produced in ",
47 " mode, but ",
48 mode_object_pair.second->typeAndName(),
49 " is requesting to consume it in ",
50 mode_object_pair.first,
51 " mode, which is not supported.\n\nThe mode must be { ",
52 oss.str(),
53 " }.\n\n",
55 }
56}
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
const ReporterMode REPORTER_MODE_UNSET
void assign(const std::string &name, const std::optional< std::string > &context={})
Definition MooseEnum.C:60
Every object that can be built by the factory should be derived from this class.
Definition MooseObject.h:31
virtual const ReporterName & name() const =0
Return the ReporterName that the context is associated.
void requiresConsumerModes(const ReporterStateBase &state, const std::set< ReporterMode > &modes) const
Helper for checking whether or not the state state has only the modes modes.
ReporterProducerEnum _producer_enum
Defines how the Reporter value can be produced and how it is being produced.
ReporterContextBase(const libMesh::ParallelObject &other, const MooseObject &producer)
const ReporterProducerEnum & getProducerModeEnum() const
Return the Reporter value produced mode.
void init(const ReporterMode &mode)
Initialize the producer mode.
std::string getReporterInfo() const
Gets information about all declared/requested Reporters.
MooseEnumItem that automatically creates the ID and doesn't allow the ID to be assigned.
MooseEnum designed for the ReporterContext objects to define how a ReporterValue can and is being pro...
The base class for storing a Reporter's state.
const std::set< std::pair< ReporterMode, const MooseObject * > > & getConsumers() const
Returns the consumers for this state; a pair that consists of the mode that the state is being consum...
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...