32 #ifndef VSMC_SMP_BACKEND_OMP_HPP
33 #define VSMC_SMP_BACKEND_OMP_HPP
53 BaseState(static_cast<
54 typename traits::SizeTypeTrait<BaseState>::
type>(N)) {}
56 size_type
size ()
const {
return static_cast<size_type
>(BaseState::size());}
58 template <
typename IntType>
59 void copy (size_type N,
const IntType *copy_from)
63 #pragma omp parallel for default(shared)
64 for (size_type to = 0; to < N; ++to)
65 this->copy_particle(copy_from[to], to);
71 template <
typename T,
typename Derived>
72 class InitializeOMP :
public InitializeBase<T, Derived>
80 const size_type N =
static_cast<size_type
>(particle.
size());
83 std::size_t accept = 0;
84 #pragma omp parallel for reduction(+ : accept) default(shared)
85 for (size_type i = 0; i < N; ++i)
99 template <
typename T,
typename Derived>
108 const size_type N =
static_cast<size_type
>(particle.
size());
110 std::size_t accept = 0;
111 #pragma omp parallel for reduction(+ : accept) default(shared)
112 for (size_type i = 0; i < N; ++i)
126 template <
typename T,
typename Derived>
136 const size_type N =
static_cast<size_type
>(particle.
size());
138 #pragma omp parallel for default(shared)
139 for (size_type i = 0; i < N; ++i) {
153 template <
typename T,
typename Derived>
163 const size_type N =
static_cast<size_type
>(particle.
size());
165 #pragma omp parallel for default(shared)
166 for (size_type i = 0; i < N; ++i) {
182 #endif // VSMC_SMP_BACKEND_OMP_HPP
Particle class representing the whole particle set.
void initialize_param(Particle< T > &particle, void *param)
double operator()(std::size_t iter, const Particle< T > &particle, double *res)
Particle::value_type subtype using OpenMP.
traits::OMPSizeTypeTrait< typename traits::SizeTypeTrait< BaseState >::type >::type size_type
#define VSMC_RUNTIME_ASSERT_SMP_BACKEND_BASE_COPY_SIZE_MISMATCH(name)
void pre_processor(Particle< T > &particle)
Sampler::move_type subtype using OpenMP.
Monitor evalution base dispatch class.
void post_processor(std::size_t iter, const Particle< T > &particle)
Monitor::eval_type subtype using OpenMP.
Path::eval_type subtype using OpenMP.
std::size_t operator()(Particle< T > &particle, void *param)
double path_grid(std::size_t iter, const Particle< T > &particle)
void post_processor(std::size_t iter, Particle< T > &particle)
std::size_t move_state(std::size_t iter, SingleParticle< T > sp)
void pre_processor(std::size_t iter, Particle< T > &particle)
void copy(size_type N, const IntType *copy_from)
void monitor_state(std::size_t iter, std::size_t dim, ConstSingleParticle< T > csp, double *res)
void post_processor(std::size_t iter, const Particle< T > &particle)
std::size_t initialize_state(SingleParticle< T > sp)
void pre_processor(std::size_t iter, const Particle< T > &particle)
Move base dispatch class.
traits::SizeTypeTrait< T >::type size_type
internal::SizeTypeDispatch< T, value >::type type
double path_state(std::size_t iter, ConstSingleParticle< T > csp)
void post_processor(Particle< T > &particle)
Path evalution base dispatch class.
size_type size() const
Number of particles.
std::size_t operator()(std::size_t iter, Particle< T > &particle)
A thin wrapper over a complete Particle.
void pre_processor(std::size_t iter, const Particle< T > &particle)
void operator()(std::size_t iter, std::size_t dim, const Particle< T > &particle, double *res)
#define VSMC_DEFINE_SMP_FORWARD(Name)
A const variant to SingleParticle.
#define VSMC_DEFINE_SMP_IMPL_COPY(Impl, Name)