Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
DataSequence2D_bool.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/data/DataSequence2D.h"
25 
26 namespace ska {
27 namespace cheetah {
28 namespace data {
29 
31  : _fast_axis_length(0)
32  , _slow_axis_length(0)
33 {}
34 
35 DataSequence2D<Cpu,bool>::DataSequence2D(std::size_t fast_axis_length, std::size_t slow_axis_length)
36  : _fast_axis_length(fast_axis_length)
37  , _slow_axis_length(slow_axis_length)
38  , _data()
39 {
40  this->_data.resize(fast_axis_length*slow_axis_length);
41 }
42 
43 DataSequence2D<Cpu,bool>::DataSequence2D(std::size_t fast_axis_length, std::size_t slow_axis_length, const bool &fill)
44  : _fast_axis_length(fast_axis_length)
45  , _slow_axis_length(slow_axis_length)
46  , _data(fast_axis_length*slow_axis_length,fill)
47 {
48 }
49 
51 
52 void DataSequence2D<Cpu,bool>::resize(std::size_t fast_axis_length, std::size_t slow_axis_length, const bool &fill)
53 {
54  this->_fast_axis_length = fast_axis_length;
55  this->_slow_axis_length = slow_axis_length;
56  this->_data.resize(this->_fast_axis_length*this->_slow_axis_length);
57  std::fill(this->_data.begin(),this->_data.end(), fill);
58 }
59 
60 void DataSequence2D<Cpu,bool>::resize(std::size_t fast_axis_length, std::size_t slow_axis_length)
61 {
62  this->_fast_axis_length = fast_axis_length;
63  this->_slow_axis_length = slow_axis_length;
64  this->_data.resize(this->_fast_axis_length*this->_slow_axis_length);
65 }
66 
68  return _data.begin();
69 }
70 
72  return _data.begin();
73 }
74 
76  return _data.cbegin();
77 }
78 
79 
81  return _data.end();
82 }
83 
85  return _data.end();
86 }
87 
89  return _data.cend();
90 }
91 
93  std::size_t fbegin,
94  std::size_t fend,
95  std::size_t sbegin,
96  std::size_t send)
97 {
98  BOOST_ASSERT(fend <= this->fast_axis_length());
99  BOOST_ASSERT(send <= this->slow_axis_length());
100 
101  return DataSequence2DPartialRange<Cpu,bool>(*this, fbegin, fend, sbegin, send, _fast_axis_length);
102 }
103 
105  std::size_t fbegin,
106  std::size_t fend,
107  std::size_t sbegin,
108  std::size_t send) const
109 {
110  BOOST_ASSERT(fend <= this->fast_axis_length());
111  BOOST_ASSERT(send <= this->slow_axis_length());
112 
113  return DataSequence2D<Cpu,bool>::ConstPartialRange(*this, fbegin, fend, sbegin, send, _fast_axis_length);
114 }
115 
116 } // namespace data
117 } // namespace cheetah
118 } // namespace ska
Some limits and constants for FLDO.
Definition: Brdz.h:35
A 2-dimensional sequencial data of type T.