#include <Array.h>
|
| const Arrayrep * | m_rep |
| | Pointer to the representation.
|
| unsigned int | m_offs |
| | Offset in the Arrayrep's data of the first element of this array.
|
|
| void | init_sizes (bool resize_data=false) |
| | Initialize the m_sizes vector from the m_shape vector.
|
| void | write_array (std::ostream &stream) const |
| | Creates a text representation of the array content.
|
| void | write_subarray (std::ostream &stream, std::vector< Arrayelt >::size_type &idx, unsigned dimIndex) const |
| | Helper function for write_array.
|
|
| std::vector< Arrayelt > | m_data |
| | The array data, stored using the C array ordering.
|
| std::vector< unsigned int > | m_shape |
| | The array shape.
|
| std::vector< unsigned int > | m_sizes |
| | Subarray sizes, for faster access.
|
| Arrayrep * | m_rep_nc |
| | The underlying array representation, non-const copy.
|
template<unsigned int N>
class CaloRec::WritableArrayData< N >
Definition at line 772 of file Control/CxxUtils/CxxUtils/Array.h.
◆ const_iterator
◆ anonymous enum
◆ WritableArrayData() [1/2]
Constructor.
- Parameters
-
| shape | The shape of the array, as a C array. Should be N elements long. |
The shape is the size of the array along each dimension.
◆ WritableArrayData() [2/2]
Constructor.
- Parameters
-
| shape | The shape of the array, as a std::vector. Should be N elements long. |
The shape is the size of the array along each dimension.
◆ begin()
Return an iterator pointing at the beginning of the container.
- Returns
- An iterator pointing at the beginning of the container.
◆ end()
Return an iterator pointing past the end of the container.
- Returns
- An iterator pointing past the end of the container.
◆ init_sizes()
| void CaloRec::Arrayrep::init_sizes |
( |
bool | resize_data = false | ) |
|
|
inherited |
Initialize the m_sizes vector from the m_shape vector.
- Parameters
-
| resize_data | Should m_data be resized appropriately? |
The contents of the m_sizes vector are initialized from the contents of the m_shape vector. If resize_data is true, then the size of m_data is changed to the total size indicated by m_shape. Otherwise, we verify that m_data has the correct size, and raise an assertion if not.
Definition at line 34 of file Arrayrep.cxx.
35{
36
37
39 {
40
45 for (
unsigned int i=0;
i <
dim;
i++) {
48 }
49
50 if (resize_data) {
51
53 }
54 else {
55
57 }
58 }
59}
std::vector< Arrayelt > m_data
The array data, stored using the C array ordering.
std::vector< unsigned int > m_sizes
Subarray sizes, for faster access.
std::vector< unsigned int > m_shape
The array shape.
◆ operator[]() [1/2]
Array indexing.
- Parameters
-
| i | The desired index. Must be less than the array size along this dimension. |
- Returns
- The i'th
N-1 dimensional subarray in the array.
Note that this operation is not available if N is 0.
◆ operator[]() [2/2]
Array indexing.
- Parameters
-
| i | The desired index. Must be less than the array size along this dimension. |
- Returns
- The i'th
N-1 dimensional subarray in the array.
Note that this operation is not available if N is 0.
◆ ptr() [1/2]
Return a direct pointer to array elements.
- Returns
- A pointer to the first array elements.
Subsequent elements follow in standard C indexing order.
◆ ptr() [2/2]
Return a direct pointer to array elements.
- Returns
- A pointer to the first array elements.
Subsequent elements follow in standard C indexing order.
◆ shape()
Return the array shape.
- Returns
- The array shape.
The array shape is vector with one element for each array dimension, giving the size of the array along that dimension.
◆ size()
Return the size of the array along one dimension.
- Parameters
-
| dim | The dimension of the size to retrieve. Must be less than the number of dimensions. |
- Returns
- The array size along dimension
dim.
◆ valid()
Test for validity.
- Returns
- True if the
Array is associated with an Arrayrep, false if not.
◆ write_array() [1/2]
| void CaloRec::Arrayrep::write_array |
( |
std::ostream & | stream | ) |
const |
|
inherited |
Creates a text representation of the array content.
Helper function for write_array.
- Parameters
-
| std::ostream | where the text should be written |
Writes the content of the array to a ostream. The sub-arrays are enclosed by square brackets and separated by commas.
- Parameters
-
| stream | where the array should be written |
| idx | Current index in m_data |
| dimIndex | Current index in m_shapes |
Calls itself recursively with dimIndex-1
Definition at line 245 of file Arrayrep.cxx.
245 {
247 stream <<
"[ ]" << std::endl;
248 return;
249 }
250
253 return;
254 }
255
256
257
261 if (totSize!=
m_data.size())
262 error(
"",
"Array is inconsistent!");
263
264 std::vector<Arrayelt>::size_type dataIndex=0;
266 stream <<
"]" << std::endl;
267 return;
268}
void write_subarray(std::ostream &stream, std::vector< Arrayelt >::size_type &idx, unsigned dimIndex) const
Helper function for write_array.
◆ write_array() [2/2]
Creates a text representation of the array content.
- Parameters
-
| std::ostream | where the text should be written |
Writes the content of the array to a ostream. The sub-arrays are enclosed by square-brackets and separated by commas.
◆ write_subarray()
| void CaloRec::Arrayrep::write_subarray |
( |
std::ostream & | stream, |
|
|
std::vector< Arrayelt >::size_type & | idx, |
|
|
unsigned | dimIndex ) const |
|
inherited |
Helper function for write_array.
Creates a text representation of the array content.
- Parameters
-
| stream | where the array should be written |
| idx | Current index in m_data |
| dimIndex | Current index in m_shapes |
Calls itself recursively with dimIndex-1
- Parameters
-
| std::ostream | where the text should be written |
Writes the content of the array to a ostream. The sub-arrays are enclosed by square brackets and separated by commas.
Definition at line 279 of file Arrayrep.cxx.
279 {
280 if (dimIndex<(
m_shape.size()-1)) {
282 for (
unsigned i=0;
i<
m_shape[dimIndex];
i++) {
286 else
288 }
289 }
290 else {
292 for (
unsigned i=1;
i<
m_shape[dimIndex];
i++)
293 stream <<
", " <<
m_data[idx++];
294 }
295 return;
296}
◆ m_data
| std::vector<Arrayelt> CaloRec::Arrayrep::m_data |
|
inherited |
◆ m_offs
◆ m_rep
◆ m_rep_nc
◆ m_shape
| std::vector<unsigned int> CaloRec::Arrayrep::m_shape |
|
inherited |
◆ m_sizes
| std::vector<unsigned int> CaloRec::Arrayrep::m_sizes |
|
inherited |
The documentation for this class was generated from the following file: