12 #include "libmesh/dense_matrix.h" 23 template <
typename InType,
typename OutType>
31 virtual void update(
const InType & data)
override;
32 virtual void finalize(
bool is_distributed)
override;
33 virtual std::vector<OutType>
get()
const override {
return _sobol; }
44 template <
typename InType,
typename OutType>
46 :
public Calculator<std::vector<std::vector<InType>>, std::vector<std::vector<OutType>>>
53 virtual void update(
const std::vector<InType> & data)
override;
54 virtual void finalize(
bool is_distributed)
override;
55 virtual std::vector<std::vector<OutType>>
get()
const override {
return _values; }
63 std::vector<std::vector<OutType>>
_values;
66 template <
typename InType,
typename OutType>
74 template <
typename InType,
typename OutType>
82 template <
typename InType,
typename OutType>
87 std::vector<InType> data_update;
91 if (data_update.size() <= i)
92 data_update.emplace_back(data.size());
93 data_update[i][
d] = data[
d][i];
99 if (_sobol_calcs.size() <= i)
101 _sobol_calcs.emplace_back(*
this,
"SOBOL_" + std::to_string(i), _resample);
104 _sobol_calcs[i].updateCalculator(data_update[i]);
108 template <
typename InType,
typename OutType>
115 auto ncalc = _sobol_calcs.size();
116 this->_communicator.max(ncalc);
117 for (
const auto & i :
make_range(_sobol_calcs.size(), ncalc))
119 _sobol_calcs.emplace_back(*
this,
"SOBOL_" + std::to_string(i), _resample);
126 _sobol_calcs[i].finalizeCalculator(is_distributed);
127 const auto val = _sobol_calcs[i].getValue();
131 if (_values.size() <= ind)
132 _values.emplace_back(_sobol_calcs.size());
133 _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)