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 
46  std::string PPName() const { return _vpp_name; }
47 
52 
56  bool isDistributed() const { return _is_distributed; }
57 
61  const std::set<std::string> & getVectorNames() const;
62 
63 protected:
67  VectorPostprocessorValue & declareVector(const std::string & vector_name);
68 
70  const std::string _vpp_name;
71 
74 
77 
78  friend class SamplerBase;
79 
80 private:
82 
84 
86 
87  const bool _is_distributed;
88 
89  const bool _is_broadcast;
90 
91  std::map<std::string, VectorPostprocessorValue> _thread_local_vectors;
92 
93  std::set<std::string> _vector_names;
94 };
95 
97 // The following items were created to maintain the various getScatter methods in the
98 // VectorPostprocessorInterface.
99 
100 // Special consumer module add
102 
103 /*
104  * Special ReporterContext that performs a scatter operation if a getScatter method is called on the
105  * VPP value.
106  *
107  * The source file contains an explicit instantiation.
108  * @see VectorPostprocessorInterface
109  */
110 template <typename T>
112 {
113 public:
115  const MooseObject & producer,
117  virtual void finalize() override;
118  virtual void copyValuesBack() override;
119 
122 
123 private:
126 };
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:27
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:33
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:203
Real ScatterVectorPostprocessorValue
Definition: MooseTypes.h:204
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:44
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:209
const std::string _vpp_name
The name of the VectorPostprocessor.
virtual void finalize() override
Perform automatic parallel communication based on the producer/consumer modes.