// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute // SPDX-License-Identifier: GPL-3.0-only #ifndef JFJOCH_BRAGGPREDICTIONGPU_H #define JFJOCH_BRAGGPREDICTIONGPU_H #include #include "BraggPrediction.h" #include "../indexing/CUDAMemHelpers.h" struct KernelConsts { float det_width_pxl; float det_height_pxl; float beam_x; float beam_y; float coeff_const; float one_over_wavelength; float one_over_dmax_sq; float ewald_cutoff; Coord Astar, Bstar, Cstar, S0; float rot[9]; char centering; }; class BraggPredictionGPU : public BraggPrediction { CudaRegisteredVector reg_out; // requires stable storage CudaDevicePtr d_out; // Dedicated stream CudaStream stream; // Device allocations via helpers CudaDevicePtr dK; CudaDevicePtr d_count; // Host pinned buffer for async download (optional but faster) CudaHostPtr h_count; public: explicit BraggPredictionGPU(int max_reflections = 10000); int Calc(const DiffractionExperiment &experiment, const CrystalLattice &lattice, const BraggPredictionSettings &settings) override; }; #endif //JFJOCH_BRAGGPREDICTIONGPU_H