www.mooseframework.org
VectorPostprocessor.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
18 // libMesh
19 #include "libmesh/parallel.h"
20 
21 // Forward declarations
22 class FEProblemBase;
23 class InputParameters;
24 class SamplerBase;
25 class VectorPostprocessorData;
26 
27 template <typename T>
29 
34 {
35 public:
37 
38  VectorPostprocessor(const MooseObject * moose_object);
39 
40  virtual ~VectorPostprocessor() = default;
41 
45  std::string PPName() const { return _vpp_name; }
46 
51 
55  bool isDistributed() const { return _is_distributed; }
56 
60  const std::set<std::string> & getVectorNames() const;
61 
62 protected:
66  VectorPostprocessorValue & declareVector(const std::string & vector_name);
67 
69  const std::string _vpp_name;
70 
73 
76 
77  friend class SamplerBase;
78 
79 private:
81 
83 
85 
86  const bool _is_distributed;
87 
88  const bool _is_broadcast;
89 
90  std::map<std::string, VectorPostprocessorValue> _thread_local_vectors;
91 
92  std::set<std::string> _vector_names;
93 };
94 
96 // The following items were created to maintain the various getScatter methods in the
97 // VectorPostprocessorInterface.
98 
99 // Special consumer module add
101 
102 /*
103  * Special ReporterContext that performs a scatter operation if a getScatter method is called on the
104  * VPP value.
105  *
106  * The source file contains an explicit instantiation.
107  * @see VectorPostprocessorInterface
108  */
109 template <typename T>
111 {
112 public:
114  const MooseObject & producer,
116  virtual void finalize() override;
117  virtual void copyValuesBack() override;
118 
121 
122 private:
125 };
Base class for VectorPostprocessors that need to do "sampling" of values in the domain.
Definition: SamplerBase.h:36
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:33
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:31
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:192
Real ScatterVectorPostprocessorValue
Definition: MooseTypes.h:193
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:198
const std::string _vpp_name
The name of the VectorPostprocessor.
virtual void finalize() override
Perform automatic parallel communication based on the producer/consumer modes.