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();
120 std::string prefix =
"");
121 template <
typename T>
129 template <
typename T>
136 value_name, mode, sampler);
virtual void copyValuesBack() override
virtual void finalize() override
static InputParameters validParams()
const ReporterMode REPORTER_MODE_ROOT
const ReporterState< std::vector< T > > & state() const
virtual ReporterName declareStochasticReporterClone(const Sampler &sampler, const ReporterData &from_data, const ReporterName &from_reporter, std::string prefix="")
ReporterState< std::vector< T > > & _state
const unsigned int _parallel_type
dof_id_type getNumberOfLocalRows() const
StochasticReporter(const InputParameters ¶meters)
virtual void storeInfo(nlohmann::json &json) const override
StochasticReporterContext(const libMesh::ParallelObject &other, const MooseObject &producer, ReporterState< std::vector< T >> &state, const Sampler &sampler)
virtual std::string contextType() const override
virtual void finalize() override
const ReporterMode REPORTER_MODE_DISTRIBUTED
virtual void initialize() override
const InputParameters & parameters() const
std::vector< T > & value(const std::size_t time_index=0)
const ReporterMode REPORTER_MODE_REPLICATED
std::vector< T > & declareStochasticReporter(std::string value_name, const Sampler &sampler)
Transfer Reporters from sub-applications to a StochasticReporter on the main application.
virtual void execute() override
std::string prettyCppType(const std::string &cpp_type)