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();
122 template <
typename T>
151 std::string prefix =
"");
152 template <
typename T>
159 std::deque<std::unique_ptr<StochasticReporterValueBase>>
_vectors;
162 template <
typename T>
168 std::vector<T> & vector =
170 value_name, mode, sampler);
This is a non-typed base class of the stochastic vector value, used to update reporter values during ...
virtual void copyValuesBack() override
virtual void finalize() override
static InputParameters validParams()
StochasticReporterValue(std::vector< T > &value, const Sampler &sampler)
const ReporterMode REPORTER_MODE_ROOT
std::deque< std::unique_ptr< StochasticReporterValueBase > > _vectors
Container for declared values that we may need to resize at initialize.
const ReporterState< std::vector< T > > & state() const
const InputParameters & parameters() const
virtual ReporterName declareStochasticReporterClone(const Sampler &sampler, const ReporterData &from_data, const ReporterName &from_reporter, std::string prefix="")
ReporterState< std::vector< T > > & _state
virtual void initialize()
virtual ~StochasticReporterValueBase()=default
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
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
virtual void finalize() override
const ReporterMode REPORTER_MODE_DISTRIBUTED
virtual void initialize() override final
std::vector< T > & _value
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.
StochasticReporterValueBase(const Sampler &sampler)
virtual void execute() override
std::string prettyCppType(const std::string &cpp_type)
virtual void initialize()