HMLargeData.h
Go to the documentation of this file.
1 #ifndef art_test_Integration_high_memory_HMLargeData_h
2 #define art_test_Integration_high_memory_HMLargeData_h
3 
4 #include <vector>
5 
6 namespace arttest {
7  class HMLargeData;
8 }
9 
10 #include <cstddef>
11 namespace arttest {
12  constexpr unsigned short N_BLOCKS = 28;
13 }
14 
16 public:
18  static constexpr size_t size();
19  float* data();
20  float const* data() const;
21 
22  void aggregate(HMLargeData const& other);
23 
24 private:
25  static const int data_size_ = 32 * 12 * 32 * 100 * 3 * 5;
26  std::vector<float> data_;
27  // float data_[data_size_];
28 };
29 
30 #include <iterator>
31 
34 {
35  auto o = std::begin(other.data_); // Should be cbegin in C++2014.
36  for (auto i = std::begin(data_), e = std::begin(data_); i != e; ++i, ++o) {
37  *i += *o;
38  }
39  return *this;
40 }
41 
42 void
44 {
45  (void)operator+=(other);
46 }
47 
48 constexpr size_t
50 {
51  return data_size_;
52 }
53 
54 float*
56 {
57  if (data_.size() < data_size_) {
58  data_.resize(data_size_);
59  }
60  return data_.data();
61 }
62 
63 #include <cassert>
64 float const*
66 {
67  assert(!(data_.size() < data_size_));
68  return data_.data();
69 }
70 
71 #endif /* art_test_Integration_high_memory_HMLargeData_h */
72 
73 // Local Variables:
74 // mode: c++
75 // End:
static constexpr size_t size()
Definition: HMLargeData.h:49
void aggregate(HMLargeData const &other)
Definition: HMLargeData.h:43
const double e
constexpr unsigned short N_BLOCKS
Definition: HMLargeData.h:12
auto begin(Data< Value > const &data)
static const int data_size_
Definition: HMLargeData.h:25
HMLargeData & operator+=(HMLargeData const &other)
Definition: HMLargeData.h:33
std::vector< float > data_
Definition: HMLargeData.h:26