ATLAS Offline Software
Control/CxxUtils/CxxUtils/Arrayrep.h
Go to the documentation of this file.
1 // This file's extension implies that it's C, but it's really -*- C++ -*-.
2 
3 /*
4  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
5 */
13 #ifndef CXXUTILS_ARRAYREP_H
14 #define CXXUTILS_ARRAYREP_H
15 
16 
17 #include <string>
18 #include <vector>
19 
20 
21 // Presently has to be in CaloRec ns for backwards compatibility.
22 namespace CaloRec {
23 
24 
26 typedef float Arrayelt;
27 
28 
61 struct Arrayrep
62 {
68  Arrayrep () {}
69 
78  explicit Arrayrep (const std::string& str,
79  const std::string& context = "");
80 
88  explicit Arrayrep (const std::vector<unsigned int>& shape);
89 
99  explicit Arrayrep (const unsigned int shape[], unsigned int n);
100 
102  std::vector<Arrayelt> m_data;
103 
106  std::vector<unsigned int> m_shape;
107 
110  std::vector<unsigned int> m_sizes;
111 
122  void init_sizes (bool resize_data = false);
123 
132  void write_array(std::ostream& stream) const;
133 
143  void write_subarray(std::ostream& stream, std::vector<Arrayelt>::size_type& idx, unsigned dimIndex) const;
144 
145 };
146 
147 
148 } // namespace CaloRec
149 
150 
151 namespace CxxUtils {
152  using CaloRec::Arrayrep;
153  using CaloRec::Arrayelt;
154 }
155 
156 
157 #endif // not CXXUTILS_ARRAYREP_H
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
CaloRec::Arrayrep::m_data
std::vector< Arrayelt > m_data
The array data, stored using the C array ordering.
Definition: Control/CxxUtils/CxxUtils/Arrayrep.h:102
CaloRec::Arrayrep::m_sizes
std::vector< unsigned int > m_sizes
Subarray sizes, for faster access.
Definition: Control/CxxUtils/CxxUtils/Arrayrep.h:110
beamspotman.n
n
Definition: beamspotman.py:731
CxxUtils
Definition: aligned_vector.h:29
CaloRec::Arrayrep::init_sizes
void init_sizes(bool resize_data=false)
Initialize the m_sizes vector from the m_shape vector.
Definition: Arrayrep.cxx:34
CaloRec::Arrayrep::write_subarray
void write_subarray(std::ostream &stream, std::vector< Arrayelt >::size_type &idx, unsigned dimIndex) const
Helper function for write_array.
Definition: Arrayrep.cxx:279
CaloRec::Arrayelt
float Arrayelt
The type of an element of an Array.
Definition: Control/CxxUtils/CxxUtils/Arrayrep.h:26
CaloRec::Arrayrep::m_shape
std::vector< unsigned int > m_shape
The array shape.
Definition: Control/CxxUtils/CxxUtils/Arrayrep.h:106
CaloRec
Namespace for helper functions.
Definition: CaloCellFactor.h:22
CaloRec::Arrayrep
Representation class for Array's.
Definition: Control/CxxUtils/CxxUtils/Arrayrep.h:62
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
str
Definition: BTagTrackIpAccessor.cxx:11
CaloRec::Arrayrep::write_array
void write_array(std::ostream &stream) const
Creates a text representation of the array content.
Definition: Arrayrep.cxx:245
CaloRec::Arrayrep::Arrayrep
Arrayrep()
Default constructor.
Definition: Control/CxxUtils/CxxUtils/Arrayrep.h:68