Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
TimeFrequency.h
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 #ifndef SKA_CHEETAH_TIMEFREQUENCY_H
25 #define SKA_CHEETAH_TIMEFREQUENCY_H
26 
27 #include "cheetah/data/Units.h"
28 #include "cheetah/data/TimeFrequencyCommon.h"
29 #include "cheetah/utils/Architectures.h"
30 #include "panda/DataChunk.h"
31 
32 #pragma GCC diagnostic push
33 #pragma GCC diagnostic ignored "-Wall"
34 #pragma GCC diagnostic ignored "-Wpragmas"
35 #pragma GCC diagnostic ignored "-Wunused-parameter"
36 #pragma GCC diagnostic ignored "-Wunused-variable"
37 #include "pss/astrotypes/types/TimeFrequency.h"
38 #pragma GCC diagnostic pop
39 
40 namespace ska {
41 namespace cheetah {
42 namespace data {
43 
44 template <class Arch, typename NumericalT> class FrequencyTime;
45 
85 template <class Arch, typename NumericalT>
86 class TimeFrequency : public pss::astrotypes::TimeFrequency<NumericalT> // TODO Arch in base type -> use allocator
87  , public TimeFrequencyCommon<TimeFrequency<Arch, NumericalT>>
88 {
89  typedef pss::astrotypes::TimeFrequency<NumericalT> BaseT;
90  typedef TimeFrequencyCommon<TimeFrequency<Arch, NumericalT>> CommonBaseT;
91 
92  public:
96  typedef NumericalT DataType;
97  typedef NumericalT NumericalRep;
98  typedef Arch Architecture;
99 
100  typedef typename CommonBaseT::FrequencyType FrequencyType;
101  typedef typename CommonBaseT::TimeType TimeType;
102  typedef typename CommonBaseT::TimePointType TimePointType;
103 
104  typedef typename BaseT::iterator Iterator;
105  typedef typename BaseT::const_iterator ConstIterator;
106 
112  typedef typename BaseT::Spectra Spectra;
113  typedef typename BaseT::ConstSpectra ConstSpectra;
114  typedef typename BaseT::Channel Channel;
115  typedef typename BaseT::ConstChannel ConstChannel;
116 
117  using pss::astrotypes::TimeFrequency<NumericalT>::TimeFrequency;
118 
119  public:
123  TimeFrequency();
124 
128  TimeFrequency(DimensionSize<Time> number_of_spectra, DimensionSize<Frequency> number_of_channels);
129  TimeFrequency(DimensionSize<Frequency> number_of_channels, DimensionSize<Time> number_of_spectra);
130 
131  template<class OtherArch, typename OtherNumericalT>
133 
134  template<typename OtherNumericalT>
136 
137  template<class OtherArch, typename OtherNumericalT>
139 
143  std::size_t number_of_channels() const;
144 
148  std::size_t number_of_spectra() const;
149 
154  void set_channel(unsigned channel_number, DataType const& value);
155 
159  bool operator==(TimeFrequency const&) const;
160 };
161 
172 template<typename T>
174 
180 template<typename T, typename Enable = void>
182 
186 template<typename DataType, typename T=bool>
187 using EnableIfIsTimeFrequency = typename std::enable_if<pss::astrotypes::has_exact_dimensions<typename std::remove_reference<DataType>::type
188  , pss::astrotypes::units::Time
189  , pss::astrotypes::units::Frequency>::value, T>::type;
190 
191 } // namespace data
192 } // namespace cheetah
193 } // namespace ska
194 
195 namespace pss {
196 namespace astrotypes {
197 
198 template<typename Alloc, typename T>
199 struct has_exact_dimensions<ska::cheetah::data::TimeFrequency<T, Alloc>, units::Time, units::Frequency> : public std::true_type
200 {
201 };
202 
203 } // namespace pss
204 } // namespace astrotypes
205 
206 #include "detail/TimeFrequency.cpp"
207 #include "cuda/TimeFrequency.h"
208 
209 #endif // SKA_CHEETAH_TIMEFREQUENCY_H
bool operator==(TimeFrequency const &) const
return true if equivalent data
extract the TimeFrequency data type from compound types
Implementation Helper class for the ExtractTimeFrequencyDataType - do not call directly.
Some limits and constants for FLDO.
Definition: Brdz.h:35
NumericalT DataType
the underlying data storage type for the amplitude of the signal
Definition: TimeFrequency.h:96
std::size_t number_of_channels() const
BaseT::Spectra Spectra
Iterator class for accessing each time sample.
void set_channel(unsigned channel_number, DataType const &value)
sets the value of the specified channel to the provided value across all time samples ...
std::size_t number_of_spectra() const