Skip to main content

Rocky Solver SDK 2024 R2

api_omp_particles

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

Connect with Ansys