https://mooseframework.inl.gov
VectorPostprocessor.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 "MooseTypes.h"
14 #include "OutputInterface.h"
15 #include "MooseEnum.h"
16 #include "ReporterContext.h"
17 #include "NonADFunctorInterface.h"
18 
19 // libMesh
20 #include "libmesh/parallel.h"
21 
22 // Forward declarations
23 class FEProblemBase;
24 class InputParameters;
25 class SamplerBase;
26 class VectorPostprocessorData;
27 
28 template <typename T>
30 
35 {
36 public:
38 
39  VectorPostprocessor(const MooseObject * moose_object);
40 
41  virtual ~VectorPostprocessor() = default;
42 
43 #ifdef MOOSE_KOKKOS_ENABLED
44 
48 #endif
49 
53  std::string PPName() const { return _vpp_name; }
54 
59 
63  bool isDistributed() const { return _is_distributed; }
64 
68  const std::set<std::string> & getVectorNames() const;
69 
70 protected:
74  VectorPostprocessorValue & declareVector(const std::string & vector_name);
75 
77  const std::string _vpp_name;
78 
81 
84 
85  friend class SamplerBase;
86 
87 private:
89 
91 
93 
94  const bool _is_distributed;
95 
96  const bool _is_broadcast;
97 
98  std::map<std::string, VectorPostprocessorValue> _thread_local_vectors;
99 
100  std::set<std::string> _vector_names;
101 };
102 
104 // The following items were created to maintain the various getScatter methods in the
105 // VectorPostprocessorInterface.
106 
107 // Special consumer module add
109 
110 /*
111  * Special ReporterContext that performs a scatter operation if a getScatter method is called on the
112  * VPP value.
113  *
114  * The source file contains an explicit instantiation.
115  * @see VectorPostprocessorInterface
116  */
117 template <typename T>
119 {
120 public:
122  const MooseObject & producer,
124  virtual void finalize() override;
125  virtual void copyValuesBack() override;
126 
129 
130 private:
133 };
An interface for accessing Moose::Functors for systems that do not care about automatic differentiati...
Base class for VectorPostprocessors that need to do "sampling" of values in the domain.
Definition: SamplerBase.h:37
A special version of RestartableData to aid in storing Reporter values.
ScatterVectorPostprocessorValue _scatter_value_old
std::string PPName() const
Returns the name of the VectorPostprocessor.
const THREAD_ID _vpp_tid
const ReporterState< T > & state() const
Return a reference to the ReporterState object that is storing the Reporter value.
const MooseEnum & _parallel_type
DISTRIBUTED or REPLICATED.
A class to provide an common interface to objects requiring "outputs" option.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const ScatterVectorPostprocessorValue & getScatterValueOld() const
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
const bool _contains_complete_history
bool containsCompleteHistory() const
Return whether or not this VectorPostprocessor contains complete history.
const ReporterMode REPORTER_MODE_VPP_SCATTER
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:28
const MooseObject & _vpp_moose_object
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:54
VectorPostprocessorValue & declareVector(const std::string &vector_name)
Register a new vector to fill up.
std::map< std::string, VectorPostprocessorValue > _thread_local_vectors
InputParameters validParams()
VectorPostprocessorContext(const libMesh::ParallelObject &other, const MooseObject &producer, ReporterState< T > &state)
virtual void copyValuesBack() override
Called by FEProblemBase::advanceState via ReporterData.
FEProblemBase & _vpp_fe_problem
The FEProblemBase.
std::vector< Real > VectorPostprocessorValue
Definition: MooseTypes.h:231
Real ScatterVectorPostprocessorValue
Definition: MooseTypes.h:232
static InputParameters validParams()
ScatterVectorPostprocessorValue _scatter_value
std::set< std::string > _vector_names
bool isDistributed() const
Return true if the VPP is operating in distributed mode.
Base class for Postprocessors that produce a vector of values.
virtual ~VectorPostprocessor()=default
MooseEnumItem that automatically creates the ID and doesn&#39;t allow the ID to be assigned.
Definition: ReporterMode.h:45
const std::set< std::string > & getVectorNames() const
Return the names of the vectors associated with this object.
const ScatterVectorPostprocessorValue & getScatterValue() const
VectorPostprocessor(const MooseObject *moose_object)
unsigned int THREAD_ID
Definition: MooseTypes.h:237
const std::string _vpp_name
The name of the VectorPostprocessor.
virtual void finalize() override
Perform automatic parallel communication based on the producer/consumer modes.