Skip to main content

Rocky Solver SDK 2025 R2

api_omp_particles

Last update: 16.07.2025
1// (C) 2024 ANSYS, Inc. Unauthorized use, distribution, or duplication is prohibited.
2#pragma once
3
4#include <rocky20/api/device/api_device_particles.hpp>
5#include <rocky20/device/omp_backend.hpp>
6
7namespace rocky::omp
8{
9
10void dispatch_particles_kernel(
11 IRockyModel &model,
12 particles_f_type h_particle_f_ptr,
13 void *udf_data
14)
15{
16 if (model.get_number_of_active_particles() <= 0)
17 return;
18
19 SDeviceModel *device_data = model.get_device_data(0);
20
21 #pragma omp parallel num_threads(model.get_number_of_processes())
22 {
23 device::execute_particles_function<OMPBackend>(
24 device_data,
25 model.get_current_time(),
26 Function2Functor<particles_f_type> { h_particle_f_ptr },
27 udf_data);
28 }
29}
30
31void dispatch_instantaneous_breakage_kernel(
32 IRockyModel& model,
33 instantaneous_breakage_f_type h_instantaneous_breakage_f_ptr,
34 void* udf_data
35)
36{
37 SDeviceModel* device_data = model.get_device_data(0);
38
39 #pragma omp parallel num_threads(model.get_number_of_processes())
40 {
41 device::compute_instantaneous_breakage<OMPBackend>(
42 device_data,
43 0,
44 Function2Functor<instantaneous_breakage_f_type> { h_instantaneous_breakage_f_ptr },
45 udf_data,
46 model._impl->iteration.current_time);
47 }
48}
49
50} // namespace rocky::omp
Definition rocky_api.h:58
int get_number_of_active_particles() const
Definition rocky_api.cpp:153
double get_current_time() const
Definition rocky_api.cpp:143

Connect with Ansys