13 #include "libmesh/dense_matrix.h" 24 template <
typename InType,
typename OutType>
32 virtual void update(
const InType & data)
override;
33 virtual void finalize(
bool is_distributed)
override;
34 virtual std::vector<OutType>
get()
const override {
return _sobol; }
45 template <
typename InType,
typename OutType>
47 :
public Calculator<std::vector<std::vector<InType>>, std::vector<std::vector<OutType>>>
54 virtual void update(
const std::vector<InType> & data)
override;
55 virtual void finalize(
bool is_distributed)
override;
56 virtual std::vector<std::vector<OutType>>
get()
const override {
return _values; }
64 std::vector<std::vector<OutType>>
_values;
67 template <
typename InType,
typename OutType>
75 template <
typename InType,
typename OutType>
83 template <
typename InType,
typename OutType>
88 std::vector<InType> data_update;
92 if (data_update.size() <= i)
93 data_update.emplace_back(data.size());
94 data_update[i][
d] = data[
d][i];
100 if (_sobol_calcs.size() <= i)
102 _sobol_calcs.emplace_back(*
this,
"SOBOL_" + std::to_string(i), _resample);
105 _sobol_calcs[i].updateCalculator(data_update[i]);
109 template <
typename InType,
typename OutType>
116 auto ncalc = _sobol_calcs.size();
117 this->_communicator.max(ncalc);
118 for (
const auto & i :
make_range(_sobol_calcs.size(), ncalc))
120 _sobol_calcs.emplace_back(*
this,
"SOBOL_" + std::to_string(i), _resample);
127 _sobol_calcs[i].finalizeCalculator(is_distributed);
128 const auto val = _sobol_calcs[i].getValue();
132 if (_values.size() <= ind)
133 _values.emplace_back(_sobol_calcs.size());
134 _values[ind][i] = val[ind];
std::vector< T > resample(const std::vector< T > &data, MooseRandom &generator, const std::size_t seed_index=0)
IntRange< T > make_range(T beg, T end)
auto index_range(const T &sizable)