Loading [MathJax]/extensions/tex2jax.js
 |
ATLAS Offline Software
|
Go to the documentation of this file.
45 for (
unsigned int i=0;
i <
dim;
i++) {
90 for (
unsigned int i=0;
i <
n;
i++)
108 void error (
const std::string& context,
109 const std::string&
msg)
111 throw std::runtime_error (
msg +
": " + context);
127 void read_array (Arrayrep&
rep,
130 const std::string& context)
136 bool know_size =
false;
137 if (
rep.m_shape.size() > nest) {
144 rep.m_shape.push_back (0);
157 if (
rep.m_data.size() > 0 && nest >=
rep.m_shape.size())
158 error (context,
"Bad array nesting");
162 read_array (
rep,
s, nest+1, context);
164 }
while (
s.at_open());
169 while (
s.at_num (elt)) {
170 rep.m_data.push_back (elt);
177 error (context,
"Missing close bracket");
181 rep.m_shape[nest] =
n;
183 else if (
rep.m_shape[nest] !=
n) {
186 error (context,
"Array not rectangular");
207 else if (
str ==
"False")
211 std::istringstream is (
str);
217 read_array (*
this,
s, 0, context);
222 error (context,
"Number expected");
228 error (context,
"End of vector before end of string");
247 stream <<
"[ ]" << std::endl;
261 if (totSize!=
m_data.size())
262 error(
"",
"Array is inconsistent!");
264 std::vector<Arrayelt>::size_type dataIndex=0;
266 stream <<
"]" << std::endl;
280 if (dimIndex<(
m_shape.size()-1)) {
Helper class for converting strings to Array's.
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.
Representation class for Array's.
void init_sizes(bool resize_data=false)
Initialize the m_sizes vector from the m_shape vector.
void write_subarray(std::ostream &stream, std::vector< Arrayelt >::size_type &idx, unsigned dimIndex) const
Helper function for write_array.
float Arrayelt
The type of an element of an Array.
std::vector< unsigned int > m_shape
The array shape.
Namespace for helper functions.
void write_array(std::ostream &stream) const
Creates a text representation of the array content.
Arrayrep()
Default constructor.
Helper class for converting strings to Array's.