Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
FrequencyTime.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 
25 #include "cheetah/data/cuda/CornerTurn.h"
26 #include "panda/Copy.h"
27 
28 namespace ska {
29 namespace cheetah {
30 namespace data {
31 
32 
33 template <typename NumericalT>
34 FrequencyTime<Cuda, NumericalT>::FrequencyTime(FrequencyTime<Cuda,NumericalT> const& ft)
35  : CommonBase(ft)
36  , _data(ft.number_of_channels()*ft.number_of_spectra())
37  , _number_of_channels(ft.number_of_channels())
38  , _number_of_spectra(ft.number_of_spectra())
39 {
40  panda::copy(ft.begin(), ft.end(), _data.begin());
41 }
42 
43 template <typename NumericalT>
44 template<typename OtherArch, typename OtherNumericalT>
46  : CommonBase(ft)
47  , _data(ft.number_of_channels()*ft.number_of_spectra())
48  , _number_of_channels(ft.number_of_channels())
49  , _number_of_spectra(ft.number_of_spectra())
50 {
51  panda::copy(ft.begin(), ft.end(), _data.begin());
52 }
53 
54 template <typename NumericalT>
55 template <typename OtherNumericalT>
57  : CommonBase(tf)
58  , _data(tf.number_of_channels()*tf.number_of_spectra())
59  , _number_of_channels(tf.number_of_channels())
60  , _number_of_spectra(tf.number_of_spectra())
61 {
62  cuda::corner_turn(&(*tf.begin()), (&(*this->begin())), tf.number_of_channels(), tf.number_of_spectra());
63 }
64 
65 template <typename NumericalT>
66 template <typename OtherNumericalT>
68  : CommonBase(tf)
69  , _data(tf.number_of_channels()*tf.number_of_spectra())
70  , _number_of_channels(tf.number_of_channels())
71  , _number_of_spectra(tf.number_of_spectra())
72 {
74  cuda::corner_turn(&(*tf_copy.begin()), (&(*_data.begin())), tf.number_of_channels(), tf.number_of_spectra());
75 }
76 
77 template <typename NumericalT>
78 typename FrequencyTime<Cuda, NumericalT>::Iterator FrequencyTime<Cuda, NumericalT>::begin()
79 {
80  return _data.begin();
81 }
82 
83 template <typename NumericalT>
84 typename FrequencyTime<Cuda, NumericalT>::ConstIterator FrequencyTime<Cuda, NumericalT>::begin() const
85 {
86  return _data.begin();
87 }
88 
89 template <typename NumericalT>
90 typename FrequencyTime<Cuda, NumericalT>::ConstIterator FrequencyTime<Cuda, NumericalT>::cbegin() const
91 {
92  return _data.cbegin();
93 }
94 
95 template <typename NumericalT>
96 typename FrequencyTime<Cuda, NumericalT>::Iterator FrequencyTime<Cuda, NumericalT>::end()
97 {
98  return _data.end();
99 }
100 
101 template <typename NumericalT>
102 typename FrequencyTime<Cuda, NumericalT>::ConstIterator FrequencyTime<Cuda, NumericalT>::end() const
103 {
104  return _data.end();
105 }
106 
107 template <typename NumericalT>
108 typename FrequencyTime<Cuda, NumericalT>::ConstIterator FrequencyTime<Cuda, NumericalT>::cend() const
109 {
110  return _data.cend();
111 }
112 
113 template <typename NumericalT>
115 {
116  return _number_of_channels;
117 }
118 
119 template <typename NumericalT>
121 {
122  return _number_of_spectra;
123 }
124 
125 } //namespace ska
126 } //namespace cheetah
127 } //namespace data
Some limits and constants for FLDO.
Definition: Brdz.h:35
std::size_t number_of_channels() const
std::size_t number_of_spectra() const