Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
Fft.cpp
1 /*
2  * The MIT License (MIT)
3  *
4  * Copyright (c) 2016 The SKA organisation
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all
14  * copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
24 #include "cheetah/fft/altera/Fft.h"
25 
26 namespace ska {
27 namespace cheetah {
28 namespace fft {
29 namespace altera {
30 
31 #ifdef ENABLE_OPENCL
32 template <typename T, typename InputAlloc, typename OutputAlloc>
33 void Fft::process(ResourceType& fpga,
34  data::TimeSeries<cheetah::Fpga,T,InputAlloc> const& input,
35  data::FrequencySeries<cheetah::Fpga, ComplexT<T>, OutputAlloc>& output)
36 {
37  //update the size of the output buffer to match output transform size, only half spectrum considered
38  output.resize(input.size()/2 + 1);
39  _workers(fpga)(input, output);
40  //Calculate the new frequency step that the output will have
41  output.frequency_step((1.0f/(input.sampling_interval().value() * input.size())) * data::hz);
42 }
43 /*
44  * commented FFT types for future scope: C2R, C2C_fwd, C2C_inv
45  */
46 /*
47 template <typename T, typename InputAlloc, typename OutputAlloc>
48 void Fft::process(ResourceType& fpga,
49  data::FrequencySeries<cheetah::Fpga, ComplexT<T>, InputAlloc> const& input,
50  data::TimeSeries<cheetah::Fpga,T,OutputAlloc>& output)
51 {
52  //update the size of the output buffer to match output transform size
53  output.resize(2*(input.size() - 1));
54  //Calculate the new sampling time that the output will have
55  output.sampling_interval((1.0f/(input.frequency_step().value()*output.size())) * data::seconds);
56 }
57 */
58 
59 /*
60 template <typename T, typename InputAlloc, typename OutputAlloc>
61 void Fft::process(ResourceType& fpga,
62  data::TimeSeries<cheetah::Fpga, std::complex<T>, InputAlloc> const& input,
63  data::FrequencySeries<cheetah::Fpga, ComplexT<T>, OutputAlloc>& output)
64 {
65  //update the size of the output buffer to match output transform size
66  output.resize(input.size());
67  //Calculate the new frequency step that the output will have
68  output.frequency_step((1.0f/(input.sampling_interval().value() * input.size())) * data::hz);
69 }
70 */
71 
72 /*
73 template <typename T, typename InputAlloc, typename OutputAlloc>
74 void Fft::process(ResourceType& fpga,
75  data::FrequencySeries<cheetah::Fpga, std::complex<T>, InputAlloc> const& input,
76  data::TimeSeries<cheetah::Fpga, ComplexT<T>, OutputAlloc>& output)
77 {
78  //update the size of the output buffer to match output transform size
79  output.resize(input.size());
80  //Calculate the new sampling time that the output will have
81  output.sampling_interval((1.0f/(input.frequency_step().value()*output.size())) * data::seconds);
82 }
83 */
84 #endif // ENABLE_OPENCL
85 
86 } // namespace altera
87 } // namespace fft
88 } // namespace cheetah
89 } // namespace ska
Some limits and constants for FLDO.
Definition: Brdz.h:35
void process(panda::PoolResource< Arch > &resource, InputType const &input, OutputType &output, Args &&... args)
Perform an FFT.
Definition: Fft.cpp:41