Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
Tdas.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_TDAS_TDAS_H
25 #define SKA_CHEETAH_TDAS_TDAS_H
26 
27 #include "cheetah/tdas/Config.h"
28 #include "cheetah/tdas/cuda/Tdas.h"
29 #include "cheetah/data/Ccl.h"
30 #include "cheetah/data/detail/DmTimeSlice.h"
31 #include "cheetah/data/DmTime.h"
32 #include "cheetah/data/DmTrials.h"
33 #include "panda/ConfigurableTask.h"
34 #include "panda/AlgorithmTuple.h"
35 #include "panda/Log.h"
36 #include <memory>
37 
38 
39 namespace ska {
40 namespace cheetah {
41 namespace tdas {
42 
43 typedef data::DmTrials<cheetah::Cpu,float> DmTrialsType;
44 typedef data::DmTime<DmTrialsType> DmTimeType;
45 typedef data::detail::DmTimeSlice<DmTimeType> DmTimeSliceType;
46 
56 template <typename T>
57 class TdasBase
58 {
59  private:
60  typedef panda::AlgorithmTuple<cuda::Tdas<T>> Implementations;
61 
62  public:
63 
69  TdasBase(Config const& config);
70  TdasBase(TdasBase const&) = delete;
71  TdasBase(TdasBase&&) = default;
72  ~TdasBase();
73 
90  template <typename Arch, typename... Args>
91  std::shared_ptr<data::Ccl> process(panda::PoolResource<Arch>& resource,
92  DmTimeSliceType const& data,
93  Args&&... args);
94 
95  private:
96  Config const& _config;
97  Implementations _implementations;
98 };
99 
106 template <typename T, typename Handler=void>
107 class Tdas: public TdasBase<T>
108 {
109  public:
110 
116  Tdas(ConfigType const& config, Handler& handler);
117  Tdas(Tdas const&) = delete;
118  Tdas(Tdas&&) = default;
119  ~Tdas();
120 
126  void operator()(std::shared_ptr<DmTimeType> const& data);
127 
128  private:
129  ConfigType const& _config;
130  panda::ConfigurableTask<typename Config::PoolType, Handler&, std::shared_ptr<DmTimeSliceType>> _task;
131 };
132 
138 template <typename T>
139 class Tdas<T,void>: public TdasBase<T>
140 {
141  using TdasBase<T>::TdasBase;
142 };
143 
144 
145 } // namespace tdas
146 } // namespace cheetah
147 } // namespace ska
148 
149 #include "cheetah/tdas/detail/Tdas.cpp"
150 
151 #endif // SKA_CHEETAH_TDAS_TDAS_H
Top-level synchronous interface for the Tdas module.
Definition: Tdas.h:57
Async + Sync mixed interface for Tdas.
Definition: Tdas.h:107
Some limits and constants for FLDO.
Definition: Brdz.h:35
std::shared_ptr< data::Ccl > process(panda::PoolResource< Arch > &resource, DmTimeSliceType const &data, Args &&... args)
Process a DmTimeSlice in search of significant periodic signals over a range of acceleration values...
Definition: Tdas.cpp:41
TdasBase(Config const &config)
Construct a new TdasBase instance.
Definition: Tdas.cpp:33