35 lines
1.0 KiB
C++
35 lines
1.0 KiB
C++
// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
|
|
#ifndef JFJOCH_FFTINDEXERCPU_H
|
|
#define JFJOCH_FFTINDEXERCPU_H
|
|
|
|
#include <vector>
|
|
#include <fftw3.h>
|
|
|
|
#include "FFTIndexer.h"
|
|
|
|
#include "../../common/Coord.h"
|
|
|
|
// CPU/FFTW-based FFT indexer (drop-in replacement for the CUDA version).
|
|
class FFTIndexerCPU : public FFTIndexer {
|
|
// Host-side buffers for batched FFTW
|
|
// Input: [nDirections][histogram_size]
|
|
// Output (R2C): [nDirections][(histogram_size/2)+1]
|
|
std::vector<float> h_input_fft;
|
|
std::vector<std::array<float,2>> h_output_fft; // fftw_complex-compatible layout
|
|
|
|
fftwf_plan plan;
|
|
|
|
void ExecuteFFT(const std::vector<Coord> &coord, size_t nspots) override;
|
|
|
|
public:
|
|
explicit FFTIndexerCPU(const IndexingSettings& settings);
|
|
FFTIndexerCPU(const FFTIndexerCPU&) = delete;
|
|
FFTIndexerCPU& operator=(const FFTIndexerCPU&) = delete;
|
|
~FFTIndexerCPU() override;
|
|
};
|
|
|
|
#endif //JFJOCH_FFTINDEXERCPU_H
|