22 #include "libmesh/parallel.h" 23 #include "libmesh/parallel_sync.h" 34 template <
typename InType,
typename OutType>
50 template <
typename InType,
typename OutType>
55 const std::string &
name,
56 const std::vector<Real> & levels,
57 unsigned int replicates,
60 virtual std::vector<OutType>
compute(
const InType &,
const bool) = 0;
86 template <
typename InType,
typename OutType>
91 virtual std::vector<OutType>
compute(
const InType &,
const bool)
override;
97 template <
typename InType,
typename OutType>
102 virtual std::vector<OutType>
compute(
const InType &,
const bool)
override;
113 template <
typename InType,
typename OutType>
116 static std::unique_ptr<BootstrapCalculator<InType, OutType>>
119 const std::vector<Real> &,
125 template <
typename InType,
typename OutType>
126 std::unique_ptr<BootstrapCalculator<InType, OutType>>
129 const std::vector<Real> &,
134 template <
typename InType,
typename OutType>
137 const std::string &
name,
138 const std::vector<Real> & levels,
139 unsigned int replicates,
142 :
libMesh::ParallelObject(other),
144 _replicates(replicates),
149 mooseAssert(*std::min_element(levels.begin(), levels.end()) > 0,
150 "The supplied levels must be greater than zero.");
151 mooseAssert(*std::max_element(levels.begin(), levels.end()) < 1,
152 "The supplied levels must be less than one");
155 template <
typename InType,
typename OutType>
158 const bool is_distributed)
161 generator.
seed(0, _seed);
164 std::vector<OutType> values(_replicates);
165 auto calc_update = [
this](
const typename InType::value_type & val)
166 { _calc.updateCalculator(val); };
167 for (std::size_t i = 0; i < _replicates; ++i)
169 _calc.initializeCalculator();
171 data, calc_update, generator, 0, is_distributed ? &this->_communicator :
nullptr);
172 _calc.finalizeCalculator(is_distributed);
173 values[i] = _calc.getValue();
180 template <
typename InType,
typename OutType>
181 std::unique_ptr<BootstrapCalculator<InType, OutType>>
184 const std::vector<Real> & levels,
185 unsigned int replicates,
190 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)