https://mooseframework.inl.gov
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Moose::Kokkos::Reporter Class Reference

#include <KokkosReporter.h>

Inheritance diagram for Moose::Kokkos::Reporter:
[legend]

Public Member Functions

 Reporter (const MooseObject *moose_object)
 
 Reporter (const Reporter &object)
 Copy constructor for parallel dispatch. More...
 
virtual void store (nlohmann::json &json) const
 
virtual bool shouldStore () const
 
virtual void declareLateValues ()
 Method that can be overriden to declare "late" Reporter values. More...
 
void buildOutputHideVariableList (std::set< std::string > variable_names)
 Builds hide lists for output objects NOT listed in the 'outputs' parameter. More...
 
const std::set< OutputName > & getOutputs ()
 Get the list of output objects that this class is restricted. More...
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Member Functions

template<typename T , typename... Args>
T & declareUnusedValue (Args &&... args)
 Declare a unused value with type T. More...
 
template<typename T , template< typename > class S = ReporterGeneralContext, typename... Args>
T & declareValue (const std::string &param_name, Args &&... args)
 Method to define a value that the Reporter object is to produced. More...
 
template<typename T , template< typename > class S = ReporterGeneralContext, typename... Args>
T & declareValue (const std::string &param_name, ReporterMode mode, Args &&... args)
 
template<typename T , typename S , typename... Args>
T & declareValue (const std::string &param_name, Args &&... args)
 
template<typename T , typename S , typename... Args>
T & declareValue (const std::string &param_name, ReporterMode mode, Args &&... args)
 
template<typename T , template< typename > class S = ReporterGeneralContext, typename... Args>
T & declareValueByName (const ReporterValueName &value_name, Args &&... args)
 
template<typename T , template< typename > class S = ReporterGeneralContext, typename... Args>
T & declareValueByName (const ReporterValueName &value_name, ReporterMode mode, Args &&... args)
 
template<typename T , typename S , typename... Args>
T & declareValueByName (const ReporterValueName &value_name, Args &&... args)
 
template<typename T , typename S , typename... Args>
T & declareValueByName (const ReporterValueName &value_name, ReporterMode mode, Args &&... args)
 

Detailed Description

Definition at line 17 of file KokkosReporter.h.

Constructor & Destructor Documentation

◆ Reporter() [1/2]

Moose::Kokkos::Reporter::Reporter ( const MooseObject moose_object)

◆ Reporter() [2/2]

Moose::Kokkos::Reporter::Reporter ( const Reporter object)

Copy constructor for parallel dispatch.

Member Function Documentation

◆ buildOutputHideVariableList()

void OutputInterface::buildOutputHideVariableList ( std::set< std::string >  variable_names)
inherited

Builds hide lists for output objects NOT listed in the 'outputs' parameter.

Parameters
variable_namesA set of variables for which the 'outputs' parameter controls

By default this is called by the constructor and passes the block name as the list of variables. This needs to be called explicitly if the build_list flag is set to False in the constructor. The latter cases is needed by the Material object to work correctly with the automatic material output capability.

Definition at line 68 of file OutputInterface.C.

Referenced by ReporterTransferInterface::hideVariableHelper(), and OutputInterface::OutputInterface().

69 {
70  // Set of available names
71  const std::set<OutputName> & avail = _oi_output_warehouse.getOutputNames();
72 
73  // Check for 'none'; hide variables on all outputs
74  if (_oi_outputs.find("none") != _oi_outputs.end())
75  for (const auto & name : avail)
76  _oi_output_warehouse.addInterfaceHideVariables(name, variable_names);
77 
78  // Check for empty and 'all' in 'outputs' parameter; do not perform any variable restrictions in
79  // these cases
80  else if (_oi_outputs.empty() || _oi_outputs.find("all") != _oi_outputs.end())
81  return;
82 
83  // Limit the variable output to Output objects listed
84  else
85  {
86  // Create a list of outputs where the variable should be hidden
87  std::set<OutputName> hide;
88  std::set_difference(avail.begin(),
89  avail.end(),
90  _oi_outputs.begin(),
91  _oi_outputs.end(),
92  std::inserter(hide, hide.begin()));
93 
94  // If 'outputs' is specified add the object name to the list of items to hide
95  for (const auto & name : hide)
96  _oi_output_warehouse.addInterfaceHideVariables(name, variable_names);
97  }
98 }
OutputWarehouse & _oi_output_warehouse
Reference to the OutputWarehouse for populating the Output object hide lists.
std::set< OutputName > _oi_outputs
The set of Output object names listed in the &#39;outputs&#39; parameter.
const std::set< OutputName > & getOutputNames()
Get a complete set of all output object names.
void addInterfaceHideVariables(const std::string &output_name, const std::set< std::string > &variable_names)
Insert variable names for hiding via the OutoutInterface.

◆ declareLateValues()

virtual void Reporter::declareLateValues ( )
inlinevirtualinherited

Method that can be overriden to declare "late" Reporter values.

Values are considered "late" when they need to be declared after all other Reporters have been instantiated. This is called by the "declare_late_reporters" task, which should be called right after the "add_reporters" task.

Reimplemented in AccumulateReporter.

Definition at line 79 of file Reporter.h.

79 {}

◆ declareUnusedValue()

template<typename T , typename... Args>
T & Reporter::declareUnusedValue ( Args &&...  args)
protectedinherited

Declare a unused value with type T.

This is useful when you have a reporter that has optional values. In this case, you want to create references to all reporter values. However, because some values are optional, you need something to fill into the reference. This helper will create a unused value. It also allows for the passing of arguments in the case that your value is not trivially default constructable (constructable by default without arguments).

Definition at line 278 of file Reporter.h.

279 {
280  _unused_values.emplace_back(std::make_unique<UnusedWrapper<T>>(std::forward(args)...));
281  UnusedWrapper<T> * wrapper = dynamic_cast<UnusedWrapper<T> *>(_unused_values.back().get());
282  return wrapper->value;
283 }
std::vector< std::unique_ptr< UnusedWrapperBase > > _unused_values
Storage for unused values declared with declareUnusedValue().
Definition: Reporter.h:201

◆ declareValue() [1/4]

template<typename T , typename S , typename... Args>
T & Reporter::declareValue ( const std::string &  param_name,
Args &&...  args 
)
protectedinherited

Method to define a value that the Reporter object is to produced.

Template Parameters
TThe C++ type of the value to be produced
S(optional) Context type for performing special operations. For example using the ReporterBroadcastContext will automatically broadcast the produced value from the root processor.
Parameters
nameA unique name for the value to be produced.
mode(optional) The mode that indicates how the value produced is represented in parallel, there is more information about this below
args(optional) Any number of optional arguments passed into the ReporterContext given by the S template parameter. If S = ReporterContext then the first argument can be used as the default value (see ReporterContext.h).

The 'mode' indicates how the value that is produced is represented in parallel. It is the responsibility of the Reporter object to get it to that state. The ReporterContext objects are designed to help with this. The mode can be one of the following:

ReporterMode::ROOT Indicates that the value produced is complete/correct on the
                   root processor for the object.
ReporterMode::REPLICATED Indicates that the value produced is complete/correct on
                         all processors AND that the value is the same on all
                         processors
ReporterMode::DISTRIBUTED Indicates that the value produced is complete/correct on
                          all processors AND that the value is NOT the same on all
                          processors

WARNING! Using the "default value" in ReporterContext: The Reporter system, like the systems before it, allow for objects that consume values to be constructed prior to the produce objects. When a value is requested either by a producer (Reporter) or consumer (ReporterInterface) the data is allocated. As such the assigned default value from the producer should not be relied upon on the consumer side during object construction.

NOTE: The ReporterContext is just a mechanism to allow for handling of values in special ways. In practice it might be better to have specific methods for these special cases. For example, a declareBroadcastValue, etc. Please refer to the ReporterData object for more information on how the data system operates for Reporter values.

Definition at line 206 of file Reporter.h.

207 {
208  return declareValue<T, S<T>>(param_name, REPORTER_MODE_UNSET, args...);
209 }
const ReporterMode REPORTER_MODE_UNSET

◆ declareValue() [2/4]

template<typename T , typename S , typename... Args>
T & Reporter::declareValue ( const std::string &  param_name,
ReporterMode  mode,
Args &&...  args 
)
protectedinherited

Definition at line 213 of file Reporter.h.

214 {
215  return declareValue<T, S<T>>(param_name, mode, args...);
216 }

◆ declareValue() [3/4]

template<typename T , typename S , typename... Args>
T& Reporter::declareValue ( const std::string &  param_name,
Args &&...  args 
)
protectedinherited

◆ declareValue() [4/4]

template<typename T , typename S , typename... Args>
T& Reporter::declareValue ( const std::string &  param_name,
ReporterMode  mode,
Args &&...  args 
)
protectedinherited

◆ declareValueByName() [1/4]

template<typename T , typename S , typename... Args>
T & Reporter::declareValueByName ( const ReporterValueName &  value_name,
Args &&...  args 
)
protectedinherited

Definition at line 234 of file Reporter.h.

235 {
236  return declareValueByName<T, S<T>>(value_name, REPORTER_MODE_UNSET, args...);
237 }
const ReporterMode REPORTER_MODE_UNSET

◆ declareValueByName() [2/4]

template<typename T , typename S , typename... Args>
T & Reporter::declareValueByName ( const ReporterValueName &  value_name,
ReporterMode  mode,
Args &&...  args 
)
protectedinherited

Definition at line 241 of file Reporter.h.

244 {
245  return declareValueByName<T, S<T>>(value_name, mode, args...);
246 }

◆ declareValueByName() [3/4]

template<typename T , typename S , typename... Args>
T& Reporter::declareValueByName ( const ReporterValueName &  value_name,
Args &&...  args 
)
protectedinherited

◆ declareValueByName() [4/4]

template<typename T , typename S , typename... Args>
T& Reporter::declareValueByName ( const ReporterValueName &  value_name,
ReporterMode  mode,
Args &&...  args 
)
protectedinherited

◆ getOutputs()

const std::set< OutputName > & OutputInterface::getOutputs ( )
inherited

Get the list of output objects that this class is restricted.

Returns
A set of OutputNames

Definition at line 101 of file OutputInterface.C.

102 {
103  return _oi_outputs;
104 }
std::set< OutputName > _oi_outputs
The set of Output object names listed in the &#39;outputs&#39; parameter.

◆ shouldStore()

virtual bool Reporter::shouldStore ( ) const
inlinevirtualinherited
Returns
Whether or not this Reporter should store its value at this specific time.

Basic Reporters (those that are not GeneralReporters) will store at all times when requested.

Reimplemented in GeneralReporter, ElementReporter, and NodalReporter.

Definition at line 69 of file Reporter.h.

69 { return true; }

◆ store()

void Reporter::store ( nlohmann::json &  json) const
virtualinherited

Definition at line 55 of file Reporter.C.

56 {
57  json["type"] = _reporter_moose_object.type();
58 }
const std::string & type() const
Get the type of this class.
Definition: MooseBase.h:93
const MooseObject & _reporter_moose_object
The MooseObject creating this Reporter.
Definition: Reporter.h:186

◆ validParams()

static InputParameters Moose::Kokkos::Reporter::validParams ( )
static

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