29 virtual void storeInfo(nlohmann::json & json)
const override;
45 _has_allgathered(false)
54 this->_state.copyValuesBack();
55 if (_has_allgathered || (_has_gathered && this->processor_id() == 0))
57 auto & val = this->_state.value();
58 val.erase(val.begin(), val.begin() + _sampler.getLocalRowBegin());
59 val.erase(val.begin() + _sampler.getLocalRowEnd(), val.end());
61 _has_gathered =
false;
62 _has_allgathered =
false;
71 for (
const auto & pair : this->_state.getConsumers())
75 gather_required =
true;
77 allgather_required =
true;
80 if (allgather_required && !_has_allgathered)
82 else if (gather_required && !_has_gathered)
85 _has_gathered = gather_required || _has_gathered;
86 _has_allgathered = allgather_required || _has_allgathered;
94 if (_has_allgathered || (_has_gathered && this->processor_id() == 0))
96 json[
"row_begin"] = 0;
97 json[
"row_end"] = this->_sampler.getNumberOfRows();
101 json[
"row_begin"] = this->_sampler.getLocalRowBegin();
102 json[
"row_end"] = this->_sampler.getLocalRowEnd();
151 std::string prefix =
"");
152 template <
typename T>
159 std::deque<std::unique_ptr<StochasticReporterValueBase>>
_vectors;
168 std::vector<T> & vector =
170 value_name, mode, sampler);
const ReporterMode REPORTER_MODE_REPLICATED
const ReporterMode REPORTER_MODE_DISTRIBUTED
const ReporterMode REPORTER_MODE_ROOT
const InputParameters & parameters() const
const ReporterState< T > & state() const
ReporterState< T > & _state
T & value(const std::size_t time_index=0)
Transfer Reporters from sub-applications to a StochasticReporter on the main application.
dof_id_type getNumberOfLocalRows() const
virtual std::string contextType() const override
virtual void storeInfo(nlohmann::json &json) const override
virtual void copyValuesBack() override
virtual void finalize() override
StochasticReporterContext(const libMesh::ParallelObject &other, const MooseObject &producer, ReporterState< std::vector< T > > &state, const Sampler &sampler)
This is a non-typed base class of the stochastic vector value, used to update reporter values during ...
virtual ~StochasticReporterValueBase()=default
StochasticReporterValueBase(const Sampler &sampler)
virtual void initialize()
virtual void initialize()
StochasticReporterValue(std::vector< T > &value, const Sampler &sampler)
std::vector< T > & _value
static InputParameters validParams()
virtual void finalize() override
virtual void execute() override
virtual ReporterName declareStochasticReporterClone(const Sampler &sampler, const ReporterData &from_data, const ReporterName &from_reporter, std::string prefix="")
std::deque< std::unique_ptr< StochasticReporterValueBase > > _vectors
Container for declared values that we may need to resize at initialize.
std::vector< T > & declareStochasticReporter(std::string value_name, const Sampler &sampler)
virtual void initialize() override final
const unsigned int _parallel_type
std::string prettyCppType(const std::string &cpp_type)