39 if (arr.
nelem() not_eq n)
40 throw std::runtime_error(
"Cannot sort, time array does not agree with sorting array size");
49 out[
i] = arr[sortings[
i]];
54 #define TIME_SORT_MACRO(VAR) \ 55 void time_stampsSort(VAR & out, const ArrayOfTime& time_stamps, const VAR & in, const Verbosity&) \ 56 {out = TimeSortTemplate(in, time_stamps);} 61 #undef TIME_SORT_MACRO 76 for (
auto& array: in) {
77 for (
auto& val: array) {
86 #define FLATTEN_MACRO(VAR) \ 87 void Flatten(VAR & out, const Array< VAR > & in, const Verbosity&) \ 88 {out = FlattenArrayTemplate(in);} 97 if (in.
nelem() == 0) {
103 if (not std::all_of(in.cbegin(), in.cend(), [m](
auto& v){
return m == v.
nelem();}))
104 throw std::runtime_error(
"Can only flatten array of same length data");
114 if (in.
nelem() == 0) {
118 const Index c = in[0].ncols();
119 const Index r = in[0].nrows();
121 if (not std::all_of(in.cbegin(), in.cend(), [c](
auto& v){
return c == v.ncols();})) {
122 throw std::runtime_error(
"Can only flatten array of same size data");
123 }
else if (not std::all_of(in.cbegin(), in.cend(), [r](
auto& v){
return r == v.nrows();})) {
124 throw std::runtime_error(
"Can only flatten array of same size data");
135 if (in.
nelem() == 0) {
139 const Index c = in[0].ncols();
140 const Index r = in[0].nrows();
141 const Index p = in[0].npages();
143 if (not std::all_of(in.cbegin(), in.cend(), [c](
auto& v){
return c == v.ncols();})) {
144 throw std::runtime_error(
"Can only flatten array of same size data");
145 }
else if (not std::all_of(in.cbegin(), in.cend(), [r](
auto& v){
return r == v.nrows();})) {
146 throw std::runtime_error(
"Can only flatten array of same size data");
147 }
else if (not std::all_of(in.cbegin(), in.cend(), [p](
auto& v){
return p == v.npages();})) {
148 throw std::runtime_error(
"Can only flatten array of same size data");
159 if (in.
nelem() == 0) {
163 const Index c = in[0].ncols();
164 const Index r = in[0].nrows();
165 const Index p = in[0].npages();
166 const Index b = in[0].nbooks();
168 if (not std::all_of(in.cbegin(), in.cend(), [c](
auto& v){
return c == v.ncols();})) {
169 throw std::runtime_error(
"Can only flatten array of same size data");
170 }
else if (not std::all_of(in.cbegin(), in.cend(), [r](
auto& v){
return r == v.nrows();})) {
171 throw std::runtime_error(
"Can only flatten array of same size data");
172 }
else if (not std::all_of(in.cbegin(), in.cend(), [p](
auto& v){
return p == v.npages();})) {
173 throw std::runtime_error(
"Can only flatten array of same size data");
174 }
else if (not std::all_of(in.cbegin(), in.cend(), [b](
auto& v){
return b == v.nbooks();})) {
175 throw std::runtime_error(
"Can only flatten array of same size data");
186 if (in.
nelem() == 0) {
187 out =
Tensor6(0, 0, 0, 0, 0, 0);
190 const Index c = in[0].ncols();
191 const Index r = in[0].nrows();
192 const Index p = in[0].npages();
193 const Index b = in[0].nbooks();
194 const Index s = in[0].nshelves();
196 if (not std::all_of(in.cbegin(), in.cend(), [c](
auto& v){
return c == v.ncols();})) {
197 throw std::runtime_error(
"Can only flatten array of same size data");
198 }
else if (not std::all_of(in.cbegin(), in.cend(), [r](
auto& v){
return r == v.nrows();})) {
199 throw std::runtime_error(
"Can only flatten array of same size data");
200 }
else if (not std::all_of(in.cbegin(), in.cend(), [p](
auto& v){
return p == v.npages();})) {
201 throw std::runtime_error(
"Can only flatten array of same size data");
202 }
else if (not std::all_of(in.cbegin(), in.cend(), [b](
auto& v){
return b == v.nbooks();})) {
203 throw std::runtime_error(
"Can only flatten array of same size data");
204 }
else if (not std::all_of(in.cbegin(), in.cend(), [s](
auto& v){
return s == v.nshelves();})) {
205 throw std::runtime_error(
"Can only flatten array of same size data");
208 out =
Tensor6(n, s, b, p, r, c);
216 if (in.
nelem() == 0) {
217 out =
Tensor7(0, 0, 0, 0, 0, 0, 0);
220 const Index c = in[0].ncols();
221 const Index r = in[0].nrows();
222 const Index p = in[0].npages();
223 const Index b = in[0].nbooks();
224 const Index s = in[0].nshelves();
225 const Index w = in[0].nvitrines();
227 if (not std::all_of(in.cbegin(), in.cend(), [c](
auto& v){
return c == v.ncols();})) {
228 throw std::runtime_error(
"Can only flatten array of same size data");
229 }
else if (not std::all_of(in.cbegin(), in.cend(), [r](
auto& v){
return r == v.nrows();})) {
230 throw std::runtime_error(
"Can only flatten array of same size data");
231 }
else if (not std::all_of(in.cbegin(), in.cend(), [p](
auto& v){
return p == v.npages();})) {
232 throw std::runtime_error(
"Can only flatten array of same size data");
233 }
else if (not std::all_of(in.cbegin(), in.cend(), [b](
auto& v){
return b == v.nbooks();})) {
234 throw std::runtime_error(
"Can only flatten array of same size data");
235 }
else if (not std::all_of(in.cbegin(), in.cend(), [s](
auto& v){
return s == v.nshelves();})) {
236 throw std::runtime_error(
"Can only flatten array of same size data");
237 }
else if (not std::all_of(in.cbegin(), in.cend(), [
w](
auto& v){
return w == v.nvitrines();})) {
238 throw std::runtime_error(
"Can only flatten array of same size data");
241 out =
Tensor7(n, w, s, b, p, r, c);
INDEX Index
The type to use for all integer numbers and indices.
Index nelem() const
Number of elements.
Declarations having to do with the four output streams.
cmplx FADDEEVA() w(cmplx z, double relerr)
void Flatten(Matrix &out, const ArrayOfVector &in, const Verbosity &)
WORKSPACE METHOD: Flatten.
Contains sorting routines.
#define TIME_SORT_MACRO(VAR)
Array< T > TimeSortTemplate(const Array< T > &arr, const ArrayOfTime &time_stamps)
void get_sorted_indexes(ArrayOfIndex &sorted, const T &data)
get_sorted_indexes
This can be used to make arrays out of anything.
Stuff related to time in ARTS.
Array< T > FlattenArrayTemplate(const Array< Array< T >> &in)
invlib::Matrix< ArtsMatrix > Matrix
invlib wrapper type for ARTS matrices.
#define FLATTEN_MACRO(VAR)