23 #include "libmesh/parallel.h" 24 #include "libmesh/parallel_sync.h" 35 template <
typename InType,
typename OutType>
51 template <
typename InType,
typename OutType>
56 const std::string &
name,
57 const std::vector<Real> & levels,
58 unsigned int replicates,
61 virtual std::vector<OutType>
compute(
const InType &,
const bool) = 0;
87 template <
typename InType,
typename OutType>
92 virtual std::vector<OutType>
compute(
const InType &,
const bool)
override;
98 template <
typename InType,
typename OutType>
103 virtual std::vector<OutType>
compute(
const InType &,
const bool)
override;
114 template <
typename InType,
typename OutType>
117 static std::unique_ptr<BootstrapCalculator<InType, OutType>>
120 const std::vector<Real> &,
126 template <
typename InType,
typename OutType>
127 std::unique_ptr<BootstrapCalculator<InType, OutType>>
130 const std::vector<Real> &,
135 template <
typename InType,
typename OutType>
138 const std::string &
name,
139 const std::vector<Real> & levels,
140 unsigned int replicates,
143 :
libMesh::ParallelObject(other),
145 _replicates(replicates),
150 mooseAssert(*std::min_element(levels.begin(), levels.end()) > 0,
151 "The supplied levels must be greater than zero.");
152 mooseAssert(*std::max_element(levels.begin(), levels.end()) < 1,
153 "The supplied levels must be less than one");
156 template <
typename InType,
typename OutType>
159 const bool is_distributed)
162 generator.
seed(0, _seed);
165 std::vector<OutType> values(_replicates);
166 auto calc_update = [
this](
const typename InType::value_type & val)
167 { _calc.updateCalculator(val); };
168 for (std::size_t i = 0; i < _replicates; ++i)
170 _calc.initializeCalculator();
172 data, calc_update, generator, 0, is_distributed ? &this->_communicator :
nullptr);
173 _calc.finalizeCalculator(is_distributed);
174 values[i] = _calc.getValue();
181 template <
typename InType,
typename OutType>
182 std::unique_ptr<BootstrapCalculator<InType, OutType>>
185 const std::vector<Real> & levels,
186 unsigned int replicates,
191 item, other, levels, replicates, seed, calc);
void seed(std::size_t i, unsigned int seed)
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
void resampleWithFunctor(const std::vector< T > &data, const ActionFunctor &functor, MooseRandom &generator, const std::size_t seed_index=0)