ARTS 2.5.0 (git: 9ee3ac6c)
xml_io_array_types.cc
Go to the documentation of this file.
1/* Copyright (C) 2003-2012 Oliver Lemke <olemke@core-dump.info>
2
3 This program is free software; you can redistribute it and/or modify it
4 under the terms of the GNU General Public License as published by the
5 Free Software Foundation; either version 2, or (at your option) any
6 later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16 USA. */
17
19// File description
21
30#include "arts.h"
31#include "xml_io.h"
32
34// Overloaded functions for reading/writing data from/to XML stream
36
37//=== ArrayOfAgenda ===========================================
38
40
45void xml_read_from_stream(istream& is_xml _U_,
47 bifstream* pbifs _U_,
48 const Verbosity&) {
49 throw runtime_error("Not supported.");
50}
51
53
59void xml_write_to_stream(ostream& os_xml _U_,
60 const ArrayOfAgenda& aa _U_,
61 bofstream* pbofs _U_,
62 const String& name _U_,
63 const Verbosity&)
64
65{
66 throw runtime_error("ArrayOfAgendas can't be saved.");
67}
68
69//=== ArrayOfArrayOfSpeciesTag ================================================
70
72
77void xml_read_from_stream(istream& is_xml,
79 bifstream* pbifs,
80 const Verbosity& verbosity) {
81 ArtsXMLTag tag(verbosity);
83
84 tag.read_from_stream(is_xml);
85 tag.check_name("Array");
86 tag.check_attribute("type", "ArrayOfSpeciesTag");
87
88 tag.get_attribute_value("nelem", nelem);
89 aastag.resize(nelem);
90
91 Index n;
92 try {
93 for (n = 0; n < nelem; n++) {
94 xml_read_from_stream(is_xml, aastag[n], pbifs, verbosity);
95 }
96 } catch (const std::runtime_error& e) {
97 ostringstream os;
98 os << "Error reading ArrayOfArrayOfSpeciesTag: "
99 << "\n Element: " << n << "\n"
100 << e.what();
101 throw runtime_error(os.str());
102 }
103
104 tag.read_from_stream(is_xml);
105 tag.check_name("/Array");
106}
107
109
115void xml_write_to_stream(ostream& os_xml,
116 const ArrayOfArrayOfSpeciesTag& aastag,
117 bofstream* pbofs,
118 const String& name,
119 const Verbosity& verbosity) {
120 ArtsXMLTag open_tag(verbosity);
121 ArtsXMLTag close_tag(verbosity);
122
123 open_tag.set_name("Array");
124 if (name.length()) open_tag.add_attribute("name", name);
125
126 open_tag.add_attribute("type", "ArrayOfSpeciesTag");
127 open_tag.add_attribute("nelem", aastag.nelem());
128
129 open_tag.write_to_stream(os_xml);
130 os_xml << '\n';
131
132 for (Index n = 0; n < aastag.nelem(); n++) {
133 xml_write_to_stream(os_xml, aastag[n], pbofs, "", verbosity);
134 }
135
136 close_tag.set_name("/Array");
137 close_tag.write_to_stream(os_xml);
138
139 os_xml << '\n';
140}
141
142//=== ArrayOfArrayOfString ==========================================================
143
145
150void xml_read_from_stream(istream& is_xml,
151 ArrayOfArrayOfString& aastring,
152 bifstream* pbifs,
153 const Verbosity& verbosity) {
154 ArtsXMLTag tag(verbosity);
155 Index nelem;
156
157 tag.read_from_stream(is_xml);
158 tag.check_name("Array");
159
160 tag.check_attribute("type", "ArrayOfString");
161
162 tag.get_attribute_value("nelem", nelem);
163 aastring.resize(nelem);
164
165 Index n;
166 try {
167 for (n = 0; n < nelem; n++)
168 xml_read_from_stream(is_xml, aastring[n], pbifs, verbosity);
169 } catch (const std::runtime_error& e) {
170 ostringstream os;
171 os << "Error reading ArrayOfArrayOfString: "
172 << "\n Element: " << n << "\n"
173 << e.what();
174 throw runtime_error(os.str());
175 }
176
177 tag.read_from_stream(is_xml);
178 tag.check_name("/Array");
179}
180
182
188void xml_write_to_stream(ostream& os_xml,
189 const ArrayOfArrayOfString& aastring,
190 bofstream* pbofs,
191 const String& name,
192 const Verbosity& verbosity) {
193 ArtsXMLTag open_tag(verbosity);
194 ArtsXMLTag close_tag(verbosity);
195
196 open_tag.set_name("Array");
197 if (name.length()) open_tag.add_attribute("name", name);
198
199 open_tag.add_attribute("type", "ArrayOfString");
200 open_tag.add_attribute("nelem", aastring.nelem());
201
202 open_tag.write_to_stream(os_xml);
203 os_xml << '\n';
204
205 for (Index n = 0; n < aastring.nelem(); n++)
206 xml_write_to_stream(os_xml, aastring[n], pbofs, "", verbosity);
207
208 close_tag.set_name("/Array");
209 close_tag.write_to_stream(os_xml);
210
211 os_xml << '\n';
212}
213
214//=== ArrayOfPpath =========================================================
215
217
222void xml_read_from_stream(istream& is_xml,
223 ArrayOfPpath& appath,
224 bifstream* pbifs,
225 const Verbosity& verbosity) {
226 ArtsXMLTag tag(verbosity);
227 Index nelem;
228
229 tag.read_from_stream(is_xml);
230 tag.check_name("Array");
231 tag.check_attribute("type", "Ppath");
232
233 tag.get_attribute_value("nelem", nelem);
234 appath.resize(nelem);
235
236 Index n;
237 try {
238 for (n = 0; n < nelem; n++) {
239 xml_read_from_stream(is_xml, appath[n], pbifs, verbosity);
240 }
241 } catch (const std::runtime_error& e) {
242 ostringstream os;
243 os << "Error reading ArrayOfPpath: "
244 << "\n Element: " << n << "\n"
245 << e.what();
246 throw runtime_error(os.str());
247 }
248
249 tag.read_from_stream(is_xml);
250 tag.check_name("/Array");
251}
252
254
260void xml_write_to_stream(ostream& os_xml,
261 const ArrayOfPpath& appath,
262 bofstream* pbofs,
263 const String& name,
264 const Verbosity& verbosity) {
265 ArtsXMLTag open_tag(verbosity);
266 ArtsXMLTag close_tag(verbosity);
267
268 open_tag.set_name("Array");
269 if (name.length()) open_tag.add_attribute("name", name);
270
271 open_tag.add_attribute("type", "Ppath");
272 open_tag.add_attribute("nelem", appath.nelem());
273
274 open_tag.write_to_stream(os_xml);
275 os_xml << '\n';
276
277 for (Index n = 0; n < appath.nelem(); n++) {
278 xml_write_to_stream(os_xml, appath[n], pbofs, "", verbosity);
279 }
280
281 close_tag.set_name("/Array");
282 close_tag.write_to_stream(os_xml);
283
284 os_xml << '\n';
285}
286
287//=== ArrayOfArrayOfTensor3==================================================
288
290
295void xml_read_from_stream(istream& is_xml,
296 ArrayOfArrayOfTensor3& aatensor3,
297 bifstream* pbifs,
298 const Verbosity& verbosity) {
299 ArtsXMLTag tag(verbosity);
300 Index nelem;
301
302 tag.read_from_stream(is_xml);
303 tag.check_name("Array");
304 tag.check_attribute("type", "ArrayOfTensor3");
305
306 tag.get_attribute_value("nelem", nelem);
307 aatensor3.resize(nelem);
308
309 Index n;
310 try {
311 for (n = 0; n < nelem; n++)
312 xml_read_from_stream(is_xml, aatensor3[n], pbifs, verbosity);
313 } catch (const std::runtime_error& e) {
314 ostringstream os;
315 os << "Error reading ArrayOfArrayOfTensor3: "
316 << "\n Element: " << n << "\n"
317 << e.what();
318 throw runtime_error(os.str());
319 }
320
321 tag.read_from_stream(is_xml);
322 tag.check_name("/Array");
323}
324
326
332void xml_write_to_stream(ostream& os_xml,
333 const ArrayOfArrayOfTensor3& aatensor3,
334 bofstream* pbofs,
335 const String& name,
336 const Verbosity& verbosity) {
337 ArtsXMLTag open_tag(verbosity);
338 ArtsXMLTag close_tag(verbosity);
339
340 open_tag.set_name("Array");
341 if (name.length()) open_tag.add_attribute("name", name);
342
343 open_tag.add_attribute("type", "ArrayOfTensor3");
344 open_tag.add_attribute("nelem", aatensor3.nelem());
345
346 open_tag.write_to_stream(os_xml);
347 os_xml << '\n';
348
349 for (Index n = 0; n < aatensor3.nelem(); n++) {
350 xml_write_to_stream(os_xml, aatensor3[n], pbofs, "", verbosity);
351 }
352
353 close_tag.set_name("/Array");
354 close_tag.write_to_stream(os_xml);
355
356 os_xml << '\n';
357}
358
359//=== ArrayOfArrayOfTensor6==================================================
360
362
367void xml_read_from_stream(istream& is_xml,
368 ArrayOfArrayOfTensor6& aatensor6,
369 bifstream* pbifs,
370 const Verbosity& verbosity) {
371 ArtsXMLTag tag(verbosity);
372 Index nelem;
373
374 tag.read_from_stream(is_xml);
375 tag.check_name("Array");
376 tag.check_attribute("type", "ArrayOfTensor6");
377
378 tag.get_attribute_value("nelem", nelem);
379 aatensor6.resize(nelem);
380
381 Index n;
382 try {
383 for (n = 0; n < nelem; n++)
384 xml_read_from_stream(is_xml, aatensor6[n], pbifs, verbosity);
385 } catch (const std::runtime_error& e) {
386 ostringstream os;
387 os << "Error reading ArrayOfArrayOfTensor6: "
388 << "\n Element: " << n << "\n"
389 << e.what();
390 throw runtime_error(os.str());
391 }
392
393 tag.read_from_stream(is_xml);
394 tag.check_name("/Array");
395}
396
398
404void xml_write_to_stream(ostream& os_xml,
405 const ArrayOfArrayOfTensor6& aatensor6,
406 bofstream* pbofs,
407 const String& name,
408 const Verbosity& verbosity) {
409 ArtsXMLTag open_tag(verbosity);
410 ArtsXMLTag close_tag(verbosity);
411
412 open_tag.set_name("Array");
413 if (name.length()) open_tag.add_attribute("name", name);
414
415 open_tag.add_attribute("type", "ArrayOfTensor6");
416 open_tag.add_attribute("nelem", aatensor6.nelem());
417
418 open_tag.write_to_stream(os_xml);
419 os_xml << '\n';
420
421 for (Index n = 0; n < aatensor6.nelem(); n++)
422 xml_write_to_stream(os_xml, aatensor6[n], pbofs, "", verbosity);
423
424 close_tag.set_name("/Array");
425 close_tag.write_to_stream(os_xml);
426
427 os_xml << '\n';
428}
429
430//=== ArrayOfGridPos =========================================================
431
433
438void xml_read_from_stream(istream& is_xml,
439 ArrayOfGridPos& agpos,
440 bifstream* pbifs,
441 const Verbosity& verbosity) {
442 ArtsXMLTag tag(verbosity);
443 Index nelem;
444
445 tag.read_from_stream(is_xml);
446 tag.check_name("Array");
447 tag.check_attribute("type", "GridPos");
448
449 tag.get_attribute_value("nelem", nelem);
450 agpos.resize(nelem);
451
452 Index n;
453 try {
454 for (n = 0; n < nelem; n++)
455 xml_read_from_stream(is_xml, agpos[n], pbifs, verbosity);
456 } catch (const std::runtime_error& e) {
457 ostringstream os;
458 os << "Error reading ArrayOfGridPos: "
459 << "\n Element: " << n << "\n"
460 << e.what();
461 throw runtime_error(os.str());
462 }
463
464 tag.read_from_stream(is_xml);
465 tag.check_name("/Array");
466}
467
469
475void xml_write_to_stream(ostream& os_xml,
476 const ArrayOfGridPos& agpos,
477 bofstream* pbofs,
478 const String& name,
479 const Verbosity& verbosity) {
480 ArtsXMLTag open_tag(verbosity);
481 ArtsXMLTag close_tag(verbosity);
482
483 open_tag.set_name("Array");
484 if (name.length()) open_tag.add_attribute("name", name);
485
486 open_tag.add_attribute("type", "GridPos");
487 open_tag.add_attribute("nelem", agpos.nelem());
488
489 open_tag.write_to_stream(os_xml);
490 os_xml << '\n';
491
492 for (Index n = 0; n < agpos.nelem(); n++)
493 xml_write_to_stream(os_xml, agpos[n], pbofs, "", verbosity);
494
495 close_tag.set_name("/Array");
496 close_tag.write_to_stream(os_xml);
497
498 os_xml << '\n';
499}
500
501//=== ArrayOfArrayOfGridPos =====================================
502
504
509void xml_read_from_stream(istream& is_xml,
510 ArrayOfArrayOfGridPos& aagpos,
511 bifstream* pbifs,
512 const Verbosity& verbosity) {
513 ArtsXMLTag tag(verbosity);
514 Index nelem;
515
516 tag.read_from_stream(is_xml);
517 tag.check_name("Array");
518 tag.check_attribute("type", "ArrayOfGridPos");
519
520 tag.get_attribute_value("nelem", nelem);
521 aagpos.resize(nelem);
522
523 Index n;
524 try {
525 for (n = 0; n < nelem; n++)
526 xml_read_from_stream(is_xml, aagpos[n], pbifs, verbosity);
527 } catch (const std::runtime_error& e) {
528 ostringstream os;
529 os << "Error reading ArrayOfArrayOfGridPos: "
530 << "\n Element: " << n << "\n"
531 << e.what();
532 throw runtime_error(os.str());
533 }
534
535 tag.read_from_stream(is_xml);
536 tag.check_name("/Array");
537}
538
540
546void xml_write_to_stream(ostream& os_xml,
547 const ArrayOfArrayOfGridPos& aagpos,
548 bofstream* pbofs,
549 const String& name,
550 const Verbosity& verbosity) {
551 ArtsXMLTag open_tag(verbosity);
552 ArtsXMLTag close_tag(verbosity);
553
554 open_tag.set_name("Array");
555 if (name.length()) open_tag.add_attribute("name", name);
556
557 open_tag.add_attribute("type", "ArrayOfGridPos");
558 open_tag.add_attribute("nelem", aagpos.nelem());
559
560 open_tag.write_to_stream(os_xml);
561 os_xml << '\n';
562
563 for (Index n = 0; n < aagpos.nelem(); n++)
564 xml_write_to_stream(os_xml, aagpos[n], pbofs, "", verbosity);
565
566 close_tag.set_name("/Array");
567 close_tag.write_to_stream(os_xml);
568
569 os_xml << '\n';
570}
571
572//=== ArrayOfArrayOfArrayOfGridPos =====================================
573
575
580void xml_read_from_stream(istream& is_xml,
582 bifstream* pbifs,
583 const Verbosity& verbosity) {
584 ArtsXMLTag tag(verbosity);
585 Index nelem;
586
587 tag.read_from_stream(is_xml);
588 tag.check_name("Array");
589 tag.check_attribute("type", "ArrayOfArrayOfGridPos");
590
591 tag.get_attribute_value("nelem", nelem);
592 aaagpos.resize(nelem);
593
594 Index n;
595 try {
596 for (n = 0; n < nelem; n++)
597 xml_read_from_stream(is_xml, aaagpos[n], pbifs, verbosity);
598 } catch (const std::runtime_error& e) {
599 ostringstream os;
600 os << "Error reading ArrayOfArrayOfArrayOfGridPos: "
601 << "\n Element: " << n << "\n"
602 << e.what();
603 throw runtime_error(os.str());
604 }
605
606 tag.read_from_stream(is_xml);
607 tag.check_name("/Array");
608}
609
611
617void xml_write_to_stream(ostream& os_xml,
618 const ArrayOfArrayOfArrayOfGridPos& aaagpos,
619 bofstream* pbofs,
620 const String& name,
621 const Verbosity& verbosity) {
622 ArtsXMLTag open_tag(verbosity);
623 ArtsXMLTag close_tag(verbosity);
624
625 open_tag.set_name("Array");
626 if (name.length()) open_tag.add_attribute("name", name);
627
628 open_tag.add_attribute("type", "ArrayOfArrayOfGridPos");
629 open_tag.add_attribute("nelem", aaagpos.nelem());
630
631 open_tag.write_to_stream(os_xml);
632 os_xml << '\n';
633
634 for (Index n = 0; n < aaagpos.nelem(); n++)
635 xml_write_to_stream(os_xml, aaagpos[n], pbofs, "", verbosity);
636
637 close_tag.set_name("/Array");
638 close_tag.write_to_stream(os_xml);
639
640 os_xml << '\n';
641}
642
643//=== ArrayOfArrayOfArrayOfArrayOfGridPos =====================================
644
646
651void xml_read_from_stream(istream& is_xml,
653 bifstream* pbifs,
654 const Verbosity& verbosity) {
655 ArtsXMLTag tag(verbosity);
656 Index nelem;
657
658 tag.read_from_stream(is_xml);
659 tag.check_name("Array");
660 tag.check_attribute("type", "ArrayOfArrayOfArrayOfGridPos");
661
662 tag.get_attribute_value("nelem", nelem);
663 aaaagpos.resize(nelem);
664
665 Index n;
666 try {
667 for (n = 0; n < nelem; n++)
668 xml_read_from_stream(is_xml, aaaagpos[n], pbifs, verbosity);
669 } catch (const std::runtime_error& e) {
670 ostringstream os;
671 os << "Error reading ArrayOfArrayOfArrayOfArrayOfGridPos: "
672 << "\n Element: " << n << "\n"
673 << e.what();
674 throw runtime_error(os.str());
675 }
676
677 tag.read_from_stream(is_xml);
678 tag.check_name("/Array");
679}
680
682
688void xml_write_to_stream(ostream& os_xml,
690 bofstream* pbofs,
691 const String& name,
692 const Verbosity& verbosity) {
693 ArtsXMLTag open_tag(verbosity);
694 ArtsXMLTag close_tag(verbosity);
695
696 open_tag.set_name("Array");
697 if (name.length()) open_tag.add_attribute("name", name);
698
699 open_tag.add_attribute("type", "ArrayOfArrayOfArrayOfGridPos");
700 open_tag.add_attribute("nelem", aaaagpos.nelem());
701
702 open_tag.write_to_stream(os_xml);
703 os_xml << '\n';
704
705 for (Index n = 0; n < aaaagpos.nelem(); n++)
706 xml_write_to_stream(os_xml, aaaagpos[n], pbofs, "", verbosity);
707
708 close_tag.set_name("/Array");
709 close_tag.write_to_stream(os_xml);
710
711 os_xml << '\n';
712}
713
714//=== ArrayOfJacobianTarget ===========================================================
715
717
722void xml_read_from_stream(istream& is_xml,
724 bifstream* pbifs,
725 const Verbosity& verbosity) {
726 ArtsXMLTag tag(verbosity);
727 Index nelem;
728
729 tag.read_from_stream(is_xml);
730 tag.check_name("Array");
731 tag.check_attribute("type", "JacobianTarget");
732
733 tag.get_attribute_value("nelem", nelem);
734 ajt.resize(nelem);
735
736 Index n;
737 try {
738 for (n = 0; n < nelem; n++)
739 xml_read_from_stream(is_xml, ajt[n], pbifs, verbosity);
740 } catch (const std::runtime_error& e) {
741 ostringstream os;
742 os << "Error reading ArrayOfIndex: "
743 << "\n Element: " << n << "\n"
744 << e.what();
745 throw runtime_error(os.str());
746 }
747
748 tag.read_from_stream(is_xml);
749 tag.check_name("/Array");
750}
751
753
759void xml_write_to_stream(ostream& os_xml,
760 const ArrayOfJacobianTarget& ajt,
761 bofstream* pbofs,
762 const String& name,
763 const Verbosity& verbosity) {
764 ArtsXMLTag open_tag(verbosity);
765 ArtsXMLTag close_tag(verbosity);
766
767 open_tag.set_name("Array");
768 if (name.length()) open_tag.add_attribute("name", name);
769
770 open_tag.add_attribute("type", "ArrayOfJacobianTarget");
771 open_tag.add_attribute("nelem", ajt.nelem());
772
773 open_tag.write_to_stream(os_xml);
774 os_xml << '\n';
775
776 for (Index n = 0; n < ajt.nelem(); n++)
777 xml_write_to_stream(os_xml, ajt[n], pbofs, "", verbosity);
778
779 close_tag.set_name("/Array");
780 close_tag.write_to_stream(os_xml);
781
782 os_xml << '\n';
783}
784
785//=== ArrayOfIndex ===========================================================
786
788
793void xml_read_from_stream(istream& is_xml,
794 ArrayOfIndex& aindex,
795 bifstream* pbifs,
796 const Verbosity& verbosity) {
797 ArtsXMLTag tag(verbosity);
798 Index nelem;
799
800 tag.read_from_stream(is_xml);
801 tag.check_name("Array");
802 tag.check_attribute("type", "Index");
803
804 tag.get_attribute_value("nelem", nelem);
805 aindex.resize(nelem);
806
807 Index n;
808 try {
809 for (n = 0; n < nelem; n++)
810 xml_read_from_stream(is_xml, aindex[n], pbifs, verbosity);
811 } catch (const std::runtime_error& e) {
812 ostringstream os;
813 os << "Error reading ArrayOfIndex: "
814 << "\n Element: " << n << "\n"
815 << e.what();
816 throw runtime_error(os.str());
817 }
818
819 tag.read_from_stream(is_xml);
820 tag.check_name("/Array");
821}
822
824
830void xml_write_to_stream(ostream& os_xml,
831 const ArrayOfIndex& aindex,
832 bofstream* pbofs,
833 const String& name,
834 const Verbosity& verbosity) {
835 ArtsXMLTag open_tag(verbosity);
836 ArtsXMLTag close_tag(verbosity);
837
838 open_tag.set_name("Array");
839 if (name.length()) open_tag.add_attribute("name", name);
840
841 open_tag.add_attribute("type", "Index");
842 open_tag.add_attribute("nelem", aindex.nelem());
843
844 open_tag.write_to_stream(os_xml);
845 os_xml << '\n';
846
847 for (Index n = 0; n < aindex.nelem(); n++)
848 xml_write_to_stream(os_xml, aindex[n], pbofs, "", verbosity);
849
850 close_tag.set_name("/Array");
851 close_tag.write_to_stream(os_xml);
852
853 os_xml << '\n';
854}
855
856//=== ArrayOfArrayOfIndex =====================================================
857
859
864void xml_read_from_stream(istream& is_xml,
865 ArrayOfArrayOfIndex& aaindex,
866 bifstream* pbifs,
867 const Verbosity& verbosity) {
868 ArtsXMLTag tag(verbosity);
869 Index nelem;
870
871 tag.read_from_stream(is_xml);
872 tag.check_name("Array");
873 tag.check_attribute("type", "ArrayOfIndex");
874
875 tag.get_attribute_value("nelem", nelem);
876 aaindex.resize(nelem);
877
878 Index n;
879 try {
880 for (n = 0; n < nelem; n++)
881 xml_read_from_stream(is_xml, aaindex[n], pbifs, verbosity);
882 } catch (const std::runtime_error& e) {
883 ostringstream os;
884 os << "Error reading ArrayOfArrayOfIndex: "
885 << "\n Element: " << n << "\n"
886 << e.what();
887 throw runtime_error(os.str());
888 }
889
890 tag.read_from_stream(is_xml);
891 tag.check_name("/Array");
892}
893
895
901void xml_write_to_stream(ostream& os_xml,
902 const ArrayOfArrayOfIndex& aaindex,
903 bofstream* pbofs,
904 const String& name,
905 const Verbosity& verbosity) {
906 ArtsXMLTag open_tag(verbosity);
907 ArtsXMLTag close_tag(verbosity);
908
909 open_tag.set_name("Array");
910 if (name.length()) open_tag.add_attribute("name", name);
911
912 open_tag.add_attribute("type", "ArrayOfIndex");
913 open_tag.add_attribute("nelem", aaindex.nelem());
914
915 open_tag.write_to_stream(os_xml);
916 os_xml << '\n';
917
918 for (Index n = 0; n < aaindex.nelem(); n++)
919 xml_write_to_stream(os_xml, aaindex[n], pbofs, "", verbosity);
920
921 close_tag.set_name("/Array");
922 close_tag.write_to_stream(os_xml);
923
924 os_xml << '\n';
925}
926
927//=== ArrayOfCIARecord ===========================================
928
930
935void xml_read_from_stream(istream& is_xml,
936 ArrayOfCIARecord& acr,
937 bifstream* pbifs,
938 const Verbosity& verbosity) {
939 ArtsXMLTag tag(verbosity);
940 Index nelem;
941
942 tag.read_from_stream(is_xml);
943 tag.check_name("Array");
944 tag.check_attribute("type", "CIARecord");
945
946 tag.get_attribute_value("nelem", nelem);
947 acr.resize(nelem);
948
949 Index n;
950 try {
951 for (n = 0; n < nelem; n++)
952 xml_read_from_stream(is_xml, acr[n], pbifs, verbosity);
953 } catch (const std::runtime_error& e) {
954 ostringstream os;
955 os << "Error reading ArrayOfCIARecord: "
956 << "\n Element: " << n << "\n"
957 << e.what();
958 throw runtime_error(os.str());
959 }
960
961 tag.read_from_stream(is_xml);
962 tag.check_name("/Array");
963}
964
966
972void xml_write_to_stream(ostream& os_xml,
973 const ArrayOfCIARecord& acr,
974 bofstream* pbofs,
975 const String& name,
976 const Verbosity& verbosity)
977
978{
979 ArtsXMLTag open_tag(verbosity);
980 ArtsXMLTag close_tag(verbosity);
981
982 open_tag.set_name("Array");
983 if (name.length()) open_tag.add_attribute("name", name);
984
985 open_tag.add_attribute("type", "CIARecord");
986 open_tag.add_attribute("nelem", acr.nelem());
987
988 open_tag.write_to_stream(os_xml);
989 os_xml << '\n';
990
991 for (Index n = 0; n < acr.nelem(); n++)
992 xml_write_to_stream(os_xml, acr[n], pbofs, "", verbosity);
993
994 close_tag.set_name("/Array");
995 close_tag.write_to_stream(os_xml);
996
997 os_xml << '\n';
998}
999
1000//=== ArrayOfMatrix ==========================================================
1001
1003
1008void xml_read_from_stream(istream& is_xml,
1009 ArrayOfMatrix& amatrix,
1010 bifstream* pbifs,
1011 const Verbosity& verbosity) {
1012 ArtsXMLTag tag(verbosity);
1013 Index nelem;
1014
1015 tag.read_from_stream(is_xml);
1016 tag.check_name("Array");
1017 tag.check_attribute("type", "Matrix");
1018
1019 tag.get_attribute_value("nelem", nelem);
1020 amatrix.resize(nelem);
1021
1022 Index n;
1023 try {
1024 for (n = 0; n < nelem; n++)
1025 xml_read_from_stream(is_xml, amatrix[n], pbifs, verbosity);
1026 } catch (const std::runtime_error& e) {
1027 ostringstream os;
1028 os << "Error reading ArrayOfMatrix: "
1029 << "\n Element: " << n << "\n"
1030 << e.what();
1031 throw runtime_error(os.str());
1032 }
1033
1034 tag.read_from_stream(is_xml);
1035 tag.check_name("/Array");
1036}
1037
1039
1045void xml_write_to_stream(ostream& os_xml,
1046 const ArrayOfMatrix& amatrix,
1047 bofstream* pbofs,
1048 const String& name,
1049 const Verbosity& verbosity) {
1050 ArtsXMLTag open_tag(verbosity);
1051 ArtsXMLTag close_tag(verbosity);
1052
1053 open_tag.set_name("Array");
1054 if (name.length()) open_tag.add_attribute("name", name);
1055
1056 open_tag.add_attribute("type", "Matrix");
1057 open_tag.add_attribute("nelem", amatrix.nelem());
1058
1059 open_tag.write_to_stream(os_xml);
1060 os_xml << '\n';
1061
1062 for (Index n = 0; n < amatrix.nelem(); n++)
1063 xml_write_to_stream(os_xml, amatrix[n], pbofs, "", verbosity);
1064
1065 close_tag.set_name("/Array");
1066 close_tag.write_to_stream(os_xml);
1067
1068 os_xml << '\n';
1069}
1070
1071//=== ArrayOfArrayOfMatrix====================================================
1072
1074
1079void xml_read_from_stream(istream& is_xml,
1080 ArrayOfArrayOfMatrix& aamatrix,
1081 bifstream* pbifs,
1082 const Verbosity& verbosity) {
1083 ArtsXMLTag tag(verbosity);
1084 Index nelem;
1085
1086 tag.read_from_stream(is_xml);
1087 tag.check_name("Array");
1088 tag.check_attribute("type", "ArrayOfMatrix");
1089
1090 tag.get_attribute_value("nelem", nelem);
1091 aamatrix.resize(nelem);
1092
1093 Index n;
1094 try {
1095 for (n = 0; n < nelem; n++)
1096 xml_read_from_stream(is_xml, aamatrix[n], pbifs, verbosity);
1097 } catch (const std::runtime_error& e) {
1098 ostringstream os;
1099 os << "Error reading ArrayOfArrayOfMatrix: "
1100 << "\n Element: " << n << "\n"
1101 << e.what();
1102 throw runtime_error(os.str());
1103 }
1104
1105 tag.read_from_stream(is_xml);
1106 tag.check_name("/Array");
1107}
1108
1110
1116void xml_write_to_stream(ostream& os_xml,
1117 const ArrayOfArrayOfMatrix& aamatrix,
1118 bofstream* pbofs,
1119 const String& name,
1120 const Verbosity& verbosity) {
1121 ArtsXMLTag open_tag(verbosity);
1122 ArtsXMLTag close_tag(verbosity);
1123
1124 open_tag.set_name("Array");
1125 if (name.length()) open_tag.add_attribute("name", name);
1126
1127 open_tag.add_attribute("type", "ArrayOfMatrix");
1128 open_tag.add_attribute("nelem", aamatrix.nelem());
1129
1130 open_tag.write_to_stream(os_xml);
1131 os_xml << '\n';
1132
1133 for (Index n = 0; n < aamatrix.nelem(); n++)
1134 xml_write_to_stream(os_xml, aamatrix[n], pbofs, "", verbosity);
1135
1136 close_tag.set_name("/Array");
1137 close_tag.write_to_stream(os_xml);
1138
1139 os_xml << '\n';
1140}
1141
1142//=== ArrayOfArrayOfVector====================================================
1143
1145
1150void xml_read_from_stream(istream& is_xml,
1151 ArrayOfArrayOfVector& aavector,
1152 bifstream* pbifs,
1153 const Verbosity& verbosity) {
1154 ArtsXMLTag tag(verbosity);
1155 Index nelem;
1156
1157 tag.read_from_stream(is_xml);
1158 tag.check_name("Array");
1159 tag.check_attribute("type", "ArrayOfVector");
1160
1161 tag.get_attribute_value("nelem", nelem);
1162 aavector.resize(nelem);
1163
1164 Index n;
1165 try {
1166 for (n = 0; n < nelem; n++)
1167 xml_read_from_stream(is_xml, aavector[n], pbifs, verbosity);
1168 } catch (const std::runtime_error& e) {
1169 ostringstream os;
1170 os << "Error reading ArrayOfArrayOfVector: "
1171 << "\n Element: " << n << "\n"
1172 << e.what();
1173 throw runtime_error(os.str());
1174 }
1175
1176 tag.read_from_stream(is_xml);
1177 tag.check_name("/Array");
1178}
1179
1181
1187void xml_write_to_stream(ostream& os_xml,
1188 const ArrayOfArrayOfVector& aaVector,
1189 bofstream* pbofs,
1190 const String& name,
1191 const Verbosity& verbosity) {
1192 ArtsXMLTag open_tag(verbosity);
1193 ArtsXMLTag close_tag(verbosity);
1194
1195 open_tag.set_name("Array");
1196 if (name.length()) open_tag.add_attribute("name", name);
1197
1198 open_tag.add_attribute("type", "ArrayOfVector");
1199 open_tag.add_attribute("nelem", aaVector.nelem());
1200
1201 open_tag.write_to_stream(os_xml);
1202 os_xml << '\n';
1203
1204 for (Index n = 0; n < aaVector.nelem(); n++)
1205 xml_write_to_stream(os_xml, aaVector[n], pbofs, "", verbosity);
1206
1207 close_tag.set_name("/Array");
1208 close_tag.write_to_stream(os_xml);
1209
1210 os_xml << '\n';
1211}
1212
1213//=== ArrayOfSparse ==========================================================
1214
1216
1221void xml_read_from_stream(istream& is_xml,
1222 ArrayOfSparse& asparse,
1223 bifstream* pbifs,
1224 const Verbosity& verbosity) {
1225 ArtsXMLTag tag(verbosity);
1226 Index nelem;
1227
1228 tag.read_from_stream(is_xml);
1229 tag.check_name("Array");
1230 tag.check_attribute("type", "Sparse");
1231
1232 tag.get_attribute_value("nelem", nelem);
1233 asparse.resize(nelem);
1234
1235 Index n;
1236 try {
1237 for (n = 0; n < nelem; n++)
1238 xml_read_from_stream(is_xml, asparse[n], pbifs, verbosity);
1239 } catch (const std::runtime_error& e) {
1240 ostringstream os;
1241 os << "Error reading ArrayOfSparse: "
1242 << "\n Element: " << n << "\n"
1243 << e.what();
1244 throw runtime_error(os.str());
1245 }
1246
1247 tag.read_from_stream(is_xml);
1248 tag.check_name("/Array");
1249}
1250
1252
1258void xml_write_to_stream(ostream& os_xml,
1259 const ArrayOfSparse& asparse,
1260 bofstream* pbofs,
1261 const String& name,
1262 const Verbosity& verbosity) {
1263 ArtsXMLTag open_tag(verbosity);
1264 ArtsXMLTag close_tag(verbosity);
1265
1266 open_tag.set_name("Array");
1267 if (name.length()) open_tag.add_attribute("name", name);
1268
1269 open_tag.add_attribute("type", "Sparse");
1270 open_tag.add_attribute("nelem", asparse.nelem());
1271
1272 open_tag.write_to_stream(os_xml);
1273 os_xml << '\n';
1274
1275 for (Index n = 0; n < asparse.nelem(); n++)
1276 xml_write_to_stream(os_xml, asparse[n], pbofs, "", verbosity);
1277
1278 close_tag.set_name("/Array");
1279 close_tag.write_to_stream(os_xml);
1280
1281 os_xml << '\n';
1282}
1283
1284//=== ArrayOfQuantumIdentifier ================================================
1285
1287
1292void xml_read_from_stream(istream& is_xml,
1294 bifstream* pbifs,
1295 const Verbosity& verbosity) {
1296 ArtsXMLTag tag(verbosity);
1297 Index nelem;
1298
1299 tag.read_from_stream(is_xml);
1300 tag.check_name("Array");
1301 tag.check_attribute("type", "QuantumIdentifier");
1302
1303 tag.get_attribute_value("nelem", nelem);
1304 aqtag.resize(nelem);
1305
1306 Index n;
1307 try {
1308 for (n = 0; n < nelem; n++) {
1309 aqtag[n] = QuantumIdentifier();
1310 xml_read_from_stream(is_xml, aqtag[n], pbifs, verbosity);
1311 }
1312 } catch (const std::runtime_error& e) {
1313 ostringstream os;
1314 os << "Error reading ArrayOfQuantumIdentifier: "
1315 << "\n Element: " << n << "\n"
1316 << e.what();
1317 throw runtime_error(os.str());
1318 }
1319
1320 tag.read_from_stream(is_xml);
1321 tag.check_name("/Array");
1322}
1323
1325
1331void xml_write_to_stream(ostream& os_xml,
1332 const ArrayOfQuantumIdentifier& aqtag,
1333 bofstream* pbofs,
1334 const String& name,
1335 const Verbosity& verbosity) {
1336 ArtsXMLTag open_tag(verbosity);
1337 ArtsXMLTag close_tag(verbosity);
1338
1339 open_tag.set_name("Array");
1340 if (name.length()) open_tag.add_attribute("name", name);
1341
1342 open_tag.add_attribute("type", "QuantumIdentifier");
1343 open_tag.add_attribute("nelem", aqtag.nelem());
1344
1345 open_tag.write_to_stream(os_xml);
1346 os_xml << '\n';
1347
1348 for (Index n = 0; n < aqtag.nelem(); n++)
1349 xml_write_to_stream(os_xml, aqtag[n], pbofs, "", verbosity);
1350
1351 close_tag.set_name("/Array");
1352 close_tag.write_to_stream(os_xml);
1353
1354 os_xml << '\n';
1355}
1356
1357//=== ArrayOfRetrievalQuantity =======================================
1358
1360
1365void xml_read_from_stream(istream& is_xml,
1367 bifstream* pbifs,
1368 const Verbosity& verbosity) {
1369 ArtsXMLTag tag(verbosity);
1370 Index nelem;
1371
1372 tag.read_from_stream(is_xml);
1373 tag.check_name("Array");
1374 tag.check_attribute("type", "RetrievalQuantity");
1375
1376 tag.get_attribute_value("nelem", nelem);
1377 arq.resize(nelem);
1378
1379 Index n;
1380 try {
1381 for (n = 0; n < nelem; n++)
1382 xml_read_from_stream(is_xml, arq[n], pbifs, verbosity);
1383 } catch (const std::runtime_error& e) {
1384 ostringstream os;
1385 os << "Error reading ArrayOfRetrievalQuantity: "
1386 << "\n Element: " << n << "\n"
1387 << e.what();
1388 throw runtime_error(os.str());
1389 }
1390
1391 tag.read_from_stream(is_xml);
1392 tag.check_name("/Array");
1393}
1394
1396
1402void xml_write_to_stream(ostream& os_xml,
1403 const ArrayOfRetrievalQuantity& arq,
1404 bofstream* pbofs,
1405 const String& name,
1406 const Verbosity& verbosity) {
1407 ArtsXMLTag open_tag(verbosity);
1408 ArtsXMLTag close_tag(verbosity);
1409
1410 open_tag.set_name("Array");
1411 if (name.length()) open_tag.add_attribute("name", name);
1412
1413 open_tag.add_attribute("type", "RetrievalQuantity");
1414 open_tag.add_attribute("nelem", arq.nelem());
1415
1416 open_tag.write_to_stream(os_xml);
1417 os_xml << '\n';
1418
1419 for (Index n = 0; n < arq.nelem(); n++)
1420 xml_write_to_stream(os_xml, arq[n], pbofs, "", verbosity);
1421
1422 close_tag.set_name("/Array");
1423 close_tag.write_to_stream(os_xml);
1424
1425 os_xml << '\n';
1426}
1427
1428//=== ArrayOfSpeciesTag ================================================
1429
1431
1436void xml_read_from_stream(istream& is_xml,
1437 ArrayOfSpeciesTag& astag,
1438 bifstream* pbifs,
1439 const Verbosity& verbosity) {
1440 ArtsXMLTag tag(verbosity);
1441 Index nelem;
1442
1443 tag.read_from_stream(is_xml);
1444 tag.check_name("Array");
1445 tag.check_attribute("type", "SpeciesTag");
1446
1447 tag.get_attribute_value("nelem", nelem);
1448 astag.resize(nelem);
1449
1450 Index n;
1451 try {
1452 for (n = 0; n < nelem; n++)
1453 xml_read_from_stream(is_xml, astag[n], pbifs, verbosity);
1454 } catch (const std::runtime_error& e) {
1455 ostringstream os;
1456 os << "Error reading ArrayOfSpeciesTag: "
1457 << "\n Element: " << n << "\n"
1458 << e.what();
1459 throw runtime_error(os.str());
1460 }
1461
1462 tag.read_from_stream(is_xml);
1463 tag.check_name("/Array");
1464}
1465
1467
1473void xml_write_to_stream(ostream& os_xml,
1474 const ArrayOfSpeciesTag& astag,
1475 bofstream* pbofs,
1476 const String& name,
1477 const Verbosity& verbosity) {
1478 ArtsXMLTag open_tag(verbosity);
1479 ArtsXMLTag close_tag(verbosity);
1480
1481 open_tag.set_name("Array");
1482 if (name.length()) open_tag.add_attribute("name", name);
1483
1484 open_tag.add_attribute("type", "SpeciesTag");
1485 open_tag.add_attribute("nelem", astag.nelem());
1486
1487 open_tag.write_to_stream(os_xml);
1488 os_xml << '\n';
1489
1490 for (Index n = 0; n < astag.nelem(); n++)
1491 xml_write_to_stream(os_xml, astag[n], pbofs, "", verbosity);
1492
1493 close_tag.set_name("/Array");
1494 close_tag.write_to_stream(os_xml);
1495
1496 os_xml << '\n';
1497}
1498
1499//=== ArrayOfSingleScatteringData===========================================
1500
1502
1507void xml_read_from_stream(istream& is_xml,
1509 bifstream* pbifs,
1510 const Verbosity& verbosity) {
1511 ArtsXMLTag tag(verbosity);
1512 Index nelem;
1513
1514 tag.read_from_stream(is_xml);
1515 tag.check_name("Array");
1516 tag.check_attribute("type", "SingleScatteringData");
1517
1518 tag.get_attribute_value("nelem", nelem);
1519 assdata.resize(nelem);
1520
1521 Index n;
1522 try {
1523 for (n = 0; n < nelem; n++)
1524 xml_read_from_stream(is_xml, assdata[n], pbifs, verbosity);
1525 } catch (const std::runtime_error& e) {
1526 ostringstream os;
1527 os << "Error reading ArrayOfSingleScatteringData: "
1528 << "\n Element: " << n << "\n"
1529 << e.what();
1530 throw runtime_error(os.str());
1531 }
1532
1533 tag.read_from_stream(is_xml);
1534 tag.check_name("/Array");
1535}
1536
1538
1544void xml_write_to_stream(ostream& os_xml,
1545 const ArrayOfSingleScatteringData& assdata,
1546 bofstream* pbofs,
1547 const String& name,
1548 const Verbosity& verbosity) {
1549 ArtsXMLTag open_tag(verbosity);
1550 ArtsXMLTag close_tag(verbosity);
1551
1552 open_tag.set_name("Array");
1553 if (name.length()) open_tag.add_attribute("name", name);
1554
1555 open_tag.add_attribute("type", "SingleScatteringData");
1556 open_tag.add_attribute("nelem", assdata.nelem());
1557
1558 open_tag.write_to_stream(os_xml);
1559 os_xml << '\n';
1560
1561 for (Index n = 0; n < assdata.nelem(); n++)
1562 xml_write_to_stream(os_xml, assdata[n], pbofs, "", verbosity);
1563
1564 close_tag.set_name("/Array");
1565 close_tag.write_to_stream(os_xml);
1566
1567 os_xml << '\n';
1568}
1569
1570//=== ArrayOfArrayOfSingleScatteringData===========================================
1571
1573
1578void xml_read_from_stream(istream& is_xml,
1580 bifstream* pbifs,
1581 const Verbosity& verbosity) {
1582 ArtsXMLTag tag(verbosity);
1583 Index nelem;
1584
1585 tag.read_from_stream(is_xml);
1586 tag.check_name("Array");
1587 tag.check_attribute("type", "ArrayOfSingleScatteringData");
1588
1589 tag.get_attribute_value("nelem", nelem);
1590 assdata.resize(nelem);
1591
1592 Index n;
1593 try {
1594 for (n = 0; n < nelem; n++)
1595 xml_read_from_stream(is_xml, assdata[n], pbifs, verbosity);
1596 } catch (const std::runtime_error& e) {
1597 ostringstream os;
1598 os << "Error reading ArrayOfArrayOfSingleScatteringData: "
1599 << "\n Element: " << n << "\n"
1600 << e.what();
1601 throw runtime_error(os.str());
1602 }
1603
1604 tag.read_from_stream(is_xml);
1605 tag.check_name("/Array");
1606}
1607
1609
1615void xml_write_to_stream(ostream& os_xml,
1617 bofstream* pbofs,
1618 const String& name,
1619 const Verbosity& verbosity) {
1620 ArtsXMLTag open_tag(verbosity);
1621 ArtsXMLTag close_tag(verbosity);
1622
1623 open_tag.set_name("Array");
1624 if (name.length()) open_tag.add_attribute("name", name);
1625
1626 open_tag.add_attribute("type", "ArrayOfSingleScatteringData");
1627 open_tag.add_attribute("nelem", assdata.nelem());
1628
1629 open_tag.write_to_stream(os_xml);
1630 os_xml << '\n';
1631
1632 for (Index n = 0; n < assdata.nelem(); n++)
1633 xml_write_to_stream(os_xml, assdata[n], pbofs, "", verbosity);
1634
1635 close_tag.set_name("/Array");
1636 close_tag.write_to_stream(os_xml);
1637
1638 os_xml << '\n';
1639}
1640
1641//=== ArrayOfScatteringMetaData===========================================
1642
1644
1649void xml_read_from_stream(istream& is_xml,
1651 bifstream* pbifs,
1652 const Verbosity& verbosity) {
1653 ArtsXMLTag tag(verbosity);
1654 Index nelem;
1655
1656 tag.read_from_stream(is_xml);
1657 tag.check_name("Array");
1658 tag.check_attribute("type", "ScatteringMetaData");
1659
1660 tag.get_attribute_value("nelem", nelem);
1661 asmdata.resize(nelem);
1662
1663 Index n;
1664 try {
1665 for (n = 0; n < nelem; n++)
1666 xml_read_from_stream(is_xml, asmdata[n], pbifs, verbosity);
1667 } catch (const std::runtime_error& e) {
1668 ostringstream os;
1669 os << "Error reading ArrayOfScatteringMetaData: "
1670 << "\n Element: " << n << "\n"
1671 << e.what();
1672 throw runtime_error(os.str());
1673 }
1674
1675 tag.read_from_stream(is_xml);
1676 tag.check_name("/Array");
1677}
1678
1680
1686void xml_write_to_stream(ostream& os_xml,
1687 const ArrayOfScatteringMetaData& asmdata,
1688 bofstream* pbofs,
1689 const String& name,
1690 const Verbosity& verbosity) {
1691 ArtsXMLTag open_tag(verbosity);
1692 ArtsXMLTag close_tag(verbosity);
1693
1694 open_tag.set_name("Array");
1695 if (name.length()) open_tag.add_attribute("name", name);
1696
1697 open_tag.add_attribute("type", "ScatteringMetaData");
1698 open_tag.add_attribute("nelem", asmdata.nelem());
1699
1700 open_tag.write_to_stream(os_xml);
1701 os_xml << '\n';
1702
1703 for (Index n = 0; n < asmdata.nelem(); n++)
1704 xml_write_to_stream(os_xml, asmdata[n], pbofs, "", verbosity);
1705
1706 close_tag.set_name("/Array");
1707 close_tag.write_to_stream(os_xml);
1708
1709 os_xml << '\n';
1710}
1711
1712//=== ArrayOfArrayOfScatteringMetaData===========================================
1713
1715
1720void xml_read_from_stream(istream& is_xml,
1722 bifstream* pbifs,
1723 const Verbosity& verbosity) {
1724 ArtsXMLTag tag(verbosity);
1725 Index nelem;
1726
1727 tag.read_from_stream(is_xml);
1728 tag.check_name("Array");
1729 tag.check_attribute("type", "ArrayOfScatteringMetaData");
1730
1731 tag.get_attribute_value("nelem", nelem);
1732 asmdata.resize(nelem);
1733
1734 Index n;
1735 try {
1736 for (n = 0; n < nelem; n++)
1737 xml_read_from_stream(is_xml, asmdata[n], pbifs, verbosity);
1738 } catch (const std::runtime_error& e) {
1739 ostringstream os;
1740 os << "Error reading ArrayOfArrayOfScatteringMetaData: "
1741 << "\n Element: " << n << "\n"
1742 << e.what();
1743 throw runtime_error(os.str());
1744 }
1745
1746 tag.read_from_stream(is_xml);
1747 tag.check_name("/Array");
1748}
1749
1751
1757void xml_write_to_stream(ostream& os_xml,
1758 const ArrayOfArrayOfScatteringMetaData& asmdata,
1759 bofstream* pbofs,
1760 const String& name,
1761 const Verbosity& verbosity) {
1762 ArtsXMLTag open_tag(verbosity);
1763 ArtsXMLTag close_tag(verbosity);
1764
1765 open_tag.set_name("Array");
1766 if (name.length()) open_tag.add_attribute("name", name);
1767
1768 open_tag.add_attribute("type", "ArrayOfScatteringMetaData");
1769 open_tag.add_attribute("nelem", asmdata.nelem());
1770
1771 open_tag.write_to_stream(os_xml);
1772 os_xml << '\n';
1773
1774 for (Index n = 0; n < asmdata.nelem(); n++)
1775 xml_write_to_stream(os_xml, asmdata[n], pbofs, "", verbosity);
1776
1777 close_tag.set_name("/Array");
1778 close_tag.write_to_stream(os_xml);
1779
1780 os_xml << '\n';
1781}
1782
1783//=== ArrayOfGriddedField1 ===========================================
1784
1786
1791void xml_read_from_stream(istream& is_xml,
1792 ArrayOfGriddedField1& agfield,
1793 bifstream* pbifs,
1794 const Verbosity& verbosity) {
1795 ArtsXMLTag tag(verbosity);
1796 Index nelem;
1797
1798 tag.read_from_stream(is_xml);
1799 tag.check_name("Array");
1800 tag.check_attribute("type", "GriddedField1");
1801
1802 tag.get_attribute_value("nelem", nelem);
1803 agfield.resize(nelem);
1804
1805 Index n;
1806 try {
1807 for (n = 0; n < nelem; n++)
1808 xml_read_from_stream(is_xml, agfield[n], pbifs, verbosity);
1809 } catch (const std::runtime_error& e) {
1810 ostringstream os;
1811 os << "Error reading ArrayOfGriddedField1: "
1812 << "\n Element: " << n << "\n"
1813 << e.what();
1814 throw runtime_error(os.str());
1815 }
1816
1817 tag.read_from_stream(is_xml);
1818 tag.check_name("/Array");
1819}
1820
1822
1828void xml_write_to_stream(ostream& os_xml,
1829 const ArrayOfGriddedField1& agfield,
1830 bofstream* pbofs,
1831 const String& name,
1832 const Verbosity& verbosity) {
1833 ArtsXMLTag open_tag(verbosity);
1834 ArtsXMLTag close_tag(verbosity);
1835
1836 open_tag.set_name("Array");
1837 if (name.length()) open_tag.add_attribute("name", name);
1838
1839 open_tag.add_attribute("type", "GriddedField1");
1840 open_tag.add_attribute("nelem", agfield.nelem());
1841
1842 open_tag.write_to_stream(os_xml);
1843 os_xml << '\n';
1844
1845 for (Index n = 0; n < agfield.nelem(); n++)
1846 xml_write_to_stream(os_xml, agfield[n], pbofs, "", verbosity);
1847
1848 close_tag.set_name("/Array");
1849 close_tag.write_to_stream(os_xml);
1850
1851 os_xml << '\n';
1852}
1853
1854//=== ArrayOfGriddedField2 ===========================================
1855
1857
1862void xml_read_from_stream(istream& is_xml,
1863 ArrayOfGriddedField2& agfield,
1864 bifstream* pbifs,
1865 const Verbosity& verbosity) {
1866 ArtsXMLTag tag(verbosity);
1867 Index nelem;
1868
1869 tag.read_from_stream(is_xml);
1870 tag.check_name("Array");
1871 tag.check_attribute("type", "GriddedField2");
1872
1873 tag.get_attribute_value("nelem", nelem);
1874 agfield.resize(nelem);
1875
1876 Index n;
1877 try {
1878 for (n = 0; n < nelem; n++)
1879 xml_read_from_stream(is_xml, agfield[n], pbifs, verbosity);
1880 } catch (const std::runtime_error& e) {
1881 ostringstream os;
1882 os << "Error reading ArrayOfGriddedField2: "
1883 << "\n Element: " << n << "\n"
1884 << e.what();
1885 throw runtime_error(os.str());
1886 }
1887
1888 tag.read_from_stream(is_xml);
1889 tag.check_name("/Array");
1890}
1891
1893
1899void xml_write_to_stream(ostream& os_xml,
1900 const ArrayOfGriddedField2& agfield,
1901 bofstream* pbofs,
1902 const String& name,
1903 const Verbosity& verbosity) {
1904 ArtsXMLTag open_tag(verbosity);
1905 ArtsXMLTag close_tag(verbosity);
1906
1907 open_tag.set_name("Array");
1908 if (name.length()) open_tag.add_attribute("name", name);
1909
1910 open_tag.add_attribute("type", "GriddedField2");
1911 open_tag.add_attribute("nelem", agfield.nelem());
1912
1913 open_tag.write_to_stream(os_xml);
1914 os_xml << '\n';
1915
1916 for (Index n = 0; n < agfield.nelem(); n++)
1917 xml_write_to_stream(os_xml, agfield[n], pbofs, "", verbosity);
1918
1919 close_tag.set_name("/Array");
1920 close_tag.write_to_stream(os_xml);
1921
1922 os_xml << '\n';
1923}
1924
1925//=== ArrayOfGriddedField3 ===========================================
1926
1928
1933void xml_read_from_stream(istream& is_xml,
1934 ArrayOfGriddedField3& agfield,
1935 bifstream* pbifs,
1936 const Verbosity& verbosity) {
1937 ArtsXMLTag tag(verbosity);
1938 Index nelem;
1939
1940 tag.read_from_stream(is_xml);
1941 tag.check_name("Array");
1942 tag.check_attribute("type", "GriddedField3");
1943
1944 tag.get_attribute_value("nelem", nelem);
1945 agfield.resize(nelem);
1946
1947 Index n;
1948 try {
1949 for (n = 0; n < nelem; n++)
1950 xml_read_from_stream(is_xml, agfield[n], pbifs, verbosity);
1951 } catch (const std::runtime_error& e) {
1952 ostringstream os;
1953 os << "Error reading ArrayOfGriddedField3: "
1954 << "\n Element: " << n << "\n"
1955 << e.what();
1956 throw runtime_error(os.str());
1957 }
1958
1959 tag.read_from_stream(is_xml);
1960 tag.check_name("/Array");
1961}
1962
1964
1970void xml_write_to_stream(ostream& os_xml,
1971 const ArrayOfGriddedField3& agfield,
1972 bofstream* pbofs,
1973 const String& name,
1974 const Verbosity& verbosity) {
1975 ArtsXMLTag open_tag(verbosity);
1976 ArtsXMLTag close_tag(verbosity);
1977
1978 open_tag.set_name("Array");
1979 if (name.length()) open_tag.add_attribute("name", name);
1980
1981 open_tag.add_attribute("type", "GriddedField3");
1982 open_tag.add_attribute("nelem", agfield.nelem());
1983
1984 open_tag.write_to_stream(os_xml);
1985 os_xml << '\n';
1986
1987 for (Index n = 0; n < agfield.nelem(); n++)
1988 xml_write_to_stream(os_xml, agfield[n], pbofs, "", verbosity);
1989
1990 close_tag.set_name("/Array");
1991 close_tag.write_to_stream(os_xml);
1992
1993 os_xml << '\n';
1994}
1995
1996//=== ArrayOfArrayOfGriddedField1 ===========================================
1997
1999
2004void xml_read_from_stream(istream& is_xml,
2006 bifstream* pbifs,
2007 const Verbosity& verbosity) {
2008 ArtsXMLTag tag(verbosity);
2009 Index nelem;
2010
2011 tag.read_from_stream(is_xml);
2012 tag.check_name("Array");
2013 tag.check_attribute("type", "ArrayOfGriddedField1");
2014
2015 tag.get_attribute_value("nelem", nelem);
2016 aagfield.resize(nelem);
2017
2018 Index n;
2019 try {
2020 for (n = 0; n < nelem; n++)
2021 xml_read_from_stream(is_xml, aagfield[n], pbifs, verbosity);
2022 } catch (const std::runtime_error& e) {
2023 ostringstream os;
2024 os << "Error reading ArrayOfArrayOfGriddedField1: "
2025 << "\n Element: " << n << "\n"
2026 << e.what();
2027 throw runtime_error(os.str());
2028 }
2029
2030 tag.read_from_stream(is_xml);
2031 tag.check_name("/Array");
2032}
2033
2035
2041void xml_write_to_stream(ostream& os_xml,
2042 const ArrayOfArrayOfGriddedField1& aagfield,
2043 bofstream* pbofs,
2044 const String& name,
2045 const Verbosity& verbosity) {
2046 ArtsXMLTag open_tag(verbosity);
2047 ArtsXMLTag close_tag(verbosity);
2048
2049 open_tag.set_name("Array");
2050 if (name.length()) open_tag.add_attribute("name", name);
2051
2052 open_tag.add_attribute("type", "ArrayGriddedField1");
2053 open_tag.add_attribute("nelem", aagfield.nelem());
2054
2055 open_tag.write_to_stream(os_xml);
2056 os_xml << '\n';
2057
2058 for (Index n = 0; n < aagfield.nelem(); n++)
2059 xml_write_to_stream(os_xml, aagfield[n], pbofs, "", verbosity);
2060
2061 close_tag.set_name("/Array");
2062 close_tag.write_to_stream(os_xml);
2063
2064 os_xml << '\n';
2065}
2066
2067//=== ArrayOfArrayOfGriddedField2 ===========================================
2068
2070
2075void xml_read_from_stream(istream& is_xml,
2077 bifstream* pbifs,
2078 const Verbosity& verbosity) {
2079 ArtsXMLTag tag(verbosity);
2080 Index nelem;
2081
2082 tag.read_from_stream(is_xml);
2083 tag.check_name("Array");
2084 tag.check_attribute("type", "ArrayOfGriddedField2");
2085
2086 tag.get_attribute_value("nelem", nelem);
2087 aagfield.resize(nelem);
2088
2089 Index n;
2090 try {
2091 for (n = 0; n < nelem; n++)
2092 xml_read_from_stream(is_xml, aagfield[n], pbifs, verbosity);
2093 } catch (const std::runtime_error& e) {
2094 ostringstream os;
2095 os << "Error reading ArrayOfArrayOfGriddedField2: "
2096 << "\n Element: " << n << "\n"
2097 << e.what();
2098 throw runtime_error(os.str());
2099 }
2100
2101 tag.read_from_stream(is_xml);
2102 tag.check_name("/Array");
2103}
2104
2106
2112void xml_write_to_stream(ostream& os_xml,
2113 const ArrayOfArrayOfGriddedField2& aagfield,
2114 bofstream* pbofs,
2115 const String& name,
2116 const Verbosity& verbosity) {
2117 ArtsXMLTag open_tag(verbosity);
2118 ArtsXMLTag close_tag(verbosity);
2119
2120 open_tag.set_name("Array");
2121 if (name.length()) open_tag.add_attribute("name", name);
2122
2123 open_tag.add_attribute("type", "ArrayGriddedField2");
2124 open_tag.add_attribute("nelem", aagfield.nelem());
2125
2126 open_tag.write_to_stream(os_xml);
2127 os_xml << '\n';
2128
2129 for (Index n = 0; n < aagfield.nelem(); n++)
2130 xml_write_to_stream(os_xml, aagfield[n], pbofs, "", verbosity);
2131
2132 close_tag.set_name("/Array");
2133 close_tag.write_to_stream(os_xml);
2134
2135 os_xml << '\n';
2136}
2137
2138//=== ArrayOfArrayOfGriddedField3 ===========================================
2139
2141
2146void xml_read_from_stream(istream& is_xml,
2148 bifstream* pbifs,
2149 const Verbosity& verbosity) {
2150 ArtsXMLTag tag(verbosity);
2151 Index nelem;
2152
2153 tag.read_from_stream(is_xml);
2154 tag.check_name("Array");
2155 tag.check_attribute("type", "ArrayOfGriddedField3");
2156
2157 tag.get_attribute_value("nelem", nelem);
2158 aagfield.resize(nelem);
2159
2160 Index n;
2161 try {
2162 for (n = 0; n < nelem; n++)
2163 xml_read_from_stream(is_xml, aagfield[n], pbifs, verbosity);
2164 } catch (const std::runtime_error& e) {
2165 ostringstream os;
2166 os << "Error reading ArrayOfArrayOfGriddedField3: "
2167 << "\n Element: " << n << "\n"
2168 << e.what();
2169 throw runtime_error(os.str());
2170 }
2171
2172 tag.read_from_stream(is_xml);
2173 tag.check_name("/Array");
2174}
2175
2177
2183void xml_write_to_stream(ostream& os_xml,
2184 const ArrayOfArrayOfGriddedField3& aagfield,
2185 bofstream* pbofs,
2186 const String& name,
2187 const Verbosity& verbosity) {
2188 ArtsXMLTag open_tag(verbosity);
2189 ArtsXMLTag close_tag(verbosity);
2190
2191 open_tag.set_name("Array");
2192 if (name.length()) open_tag.add_attribute("name", name);
2193
2194 open_tag.add_attribute("type", "ArrayGriddedField3");
2195 open_tag.add_attribute("nelem", aagfield.nelem());
2196
2197 open_tag.write_to_stream(os_xml);
2198 os_xml << '\n';
2199
2200 for (Index n = 0; n < aagfield.nelem(); n++)
2201 xml_write_to_stream(os_xml, aagfield[n], pbofs, "", verbosity);
2202
2203 close_tag.set_name("/Array");
2204 close_tag.write_to_stream(os_xml);
2205
2206 os_xml << '\n';
2207}
2208
2209//=== ArrayOfGriddedField4 ===========================================
2210
2212
2217void xml_read_from_stream(istream& is_xml,
2218 ArrayOfGriddedField4& agfield,
2219 bifstream* pbifs,
2220 const Verbosity& verbosity) {
2221 ArtsXMLTag tag(verbosity);
2222 Index nelem;
2223
2224 tag.read_from_stream(is_xml);
2225 tag.check_name("Array");
2226 tag.check_attribute("type", "GriddedField4");
2227
2228 tag.get_attribute_value("nelem", nelem);
2229 agfield.resize(nelem);
2230
2231 Index n;
2232 try {
2233 for (n = 0; n < nelem; n++)
2234 xml_read_from_stream(is_xml, agfield[n], pbifs, verbosity);
2235 } catch (const std::runtime_error& e) {
2236 ostringstream os;
2237 os << "Error reading ArrayOfGriddedField4: "
2238 << "\n Element: " << n << "\n"
2239 << e.what();
2240 throw runtime_error(os.str());
2241 }
2242
2243 tag.read_from_stream(is_xml);
2244 tag.check_name("/Array");
2245}
2246
2248
2254void xml_write_to_stream(ostream& os_xml,
2255 const ArrayOfGriddedField4& agfield,
2256 bofstream* pbofs,
2257 const String& name,
2258 const Verbosity& verbosity) {
2259 ArtsXMLTag open_tag(verbosity);
2260 ArtsXMLTag close_tag(verbosity);
2261
2262 open_tag.set_name("Array");
2263 if (name.length()) open_tag.add_attribute("name", name);
2264
2265 open_tag.add_attribute("type", "GriddedField4");
2266 open_tag.add_attribute("nelem", agfield.nelem());
2267
2268 open_tag.write_to_stream(os_xml);
2269 os_xml << '\n';
2270
2271 for (Index n = 0; n < agfield.nelem(); n++)
2272 xml_write_to_stream(os_xml, agfield[n], pbofs, "", verbosity);
2273
2274 close_tag.set_name("/Array");
2275 close_tag.write_to_stream(os_xml);
2276
2277 os_xml << '\n';
2278}
2279
2280//=== ArrayOfTelsemAtlas =========================================================
2281
2283
2288void xml_read_from_stream(istream& is_xml,
2289 ArrayOfTelsemAtlas& arr_telsem,
2290 bifstream* pbifs,
2291 const Verbosity& verbosity) {
2292 ArtsXMLTag tag(verbosity);
2293 Index nelem;
2294
2295 tag.read_from_stream(is_xml);
2296 tag.check_name("Array");
2297 tag.check_attribute("type", "TelsemAtlas");
2298
2299 tag.get_attribute_value("nelem", nelem);
2300 arr_telsem.resize(nelem);
2301
2302 Index n;
2303 try {
2304 for (n = 0; n < nelem; n++)
2305 xml_read_from_stream(is_xml, arr_telsem[n], pbifs, verbosity);
2306 } catch (const std::runtime_error& e) {
2307 ostringstream os;
2308 os << "Error reading ArrayOfTelsemAtlas: "
2309 << "\n Element: " << n << "\n"
2310 << e.what();
2311 throw runtime_error(os.str());
2312 }
2313
2314 tag.read_from_stream(is_xml);
2315 tag.check_name("/Array");
2316}
2317
2319
2325void xml_write_to_stream(ostream& os_xml,
2326 const ArrayOfTelsemAtlas& arr_telsem,
2327 bofstream* pbofs,
2328 const String& name,
2329 const Verbosity& verbosity) {
2330 ArtsXMLTag open_tag(verbosity);
2331 ArtsXMLTag close_tag(verbosity);
2332
2333 open_tag.set_name("Array");
2334 if (name.length()) open_tag.add_attribute("name", name);
2335
2336 open_tag.add_attribute("type", "TelsemAtlas");
2337 open_tag.add_attribute("nelem", arr_telsem.nelem());
2338
2339 open_tag.write_to_stream(os_xml);
2340 os_xml << '\n';
2341
2342 for (Index n = 0; n < arr_telsem.nelem(); n++)
2343 xml_write_to_stream(os_xml, arr_telsem[n], pbofs, "", verbosity);
2344
2345 close_tag.set_name("/Array");
2346 close_tag.write_to_stream(os_xml);
2347
2348 os_xml << '\n';
2349}
2350
2351//=== ArrayOfTensor3=========================================================
2352
2354
2359void xml_read_from_stream(istream& is_xml,
2360 ArrayOfTensor3& atensor3,
2361 bifstream* pbifs,
2362 const Verbosity& verbosity) {
2363 ArtsXMLTag tag(verbosity);
2364 Index nelem;
2365
2366 tag.read_from_stream(is_xml);
2367 tag.check_name("Array");
2368 tag.check_attribute("type", "Tensor3");
2369
2370 tag.get_attribute_value("nelem", nelem);
2371 atensor3.resize(nelem);
2372
2373 Index n;
2374 try {
2375 for (n = 0; n < nelem; n++)
2376 xml_read_from_stream(is_xml, atensor3[n], pbifs, verbosity);
2377 } catch (const std::runtime_error& e) {
2378 ostringstream os;
2379 os << "Error reading ArrayOfTensor3: "
2380 << "\n Element: " << n << "\n"
2381 << e.what();
2382 throw runtime_error(os.str());
2383 }
2384
2385 tag.read_from_stream(is_xml);
2386 tag.check_name("/Array");
2387}
2388
2390
2396void xml_write_to_stream(ostream& os_xml,
2397 const ArrayOfTensor3& atensor3,
2398 bofstream* pbofs,
2399 const String& name,
2400 const Verbosity& verbosity) {
2401 ArtsXMLTag open_tag(verbosity);
2402 ArtsXMLTag close_tag(verbosity);
2403
2404 open_tag.set_name("Array");
2405 if (name.length()) open_tag.add_attribute("name", name);
2406
2407 open_tag.add_attribute("type", "Tensor3");
2408 open_tag.add_attribute("nelem", atensor3.nelem());
2409
2410 open_tag.write_to_stream(os_xml);
2411 os_xml << '\n';
2412
2413 for (Index n = 0; n < atensor3.nelem(); n++)
2414 xml_write_to_stream(os_xml, atensor3[n], pbofs, "", verbosity);
2415
2416 close_tag.set_name("/Array");
2417 close_tag.write_to_stream(os_xml);
2418
2419 os_xml << '\n';
2420}
2421
2422//=== ArrayOfTensor4=========================================================
2423
2425
2430void xml_read_from_stream(istream& is_xml,
2431 ArrayOfTensor4& atensor4,
2432 bifstream* pbifs,
2433 const Verbosity& verbosity) {
2434 ArtsXMLTag tag(verbosity);
2435 Index nelem;
2436
2437 tag.read_from_stream(is_xml);
2438 tag.check_name("Array");
2439 tag.check_attribute("type", "Tensor4");
2440
2441 tag.get_attribute_value("nelem", nelem);
2442 atensor4.resize(nelem);
2443
2444 Index n;
2445 try {
2446 for (n = 0; n < nelem; n++)
2447 xml_read_from_stream(is_xml, atensor4[n], pbifs, verbosity);
2448 } catch (const std::runtime_error& e) {
2449 ostringstream os;
2450 os << "Error reading ArrayOfTensor4: "
2451 << "\n Element: " << n << "\n"
2452 << e.what();
2453 throw runtime_error(os.str());
2454 }
2455
2456 tag.read_from_stream(is_xml);
2457 tag.check_name("/Array");
2458}
2459
2461
2467void xml_write_to_stream(ostream& os_xml,
2468 const ArrayOfTensor4& atensor4,
2469 bofstream* pbofs,
2470 const String& name,
2471 const Verbosity& verbosity) {
2472 ArtsXMLTag open_tag(verbosity);
2473 ArtsXMLTag close_tag(verbosity);
2474
2475 open_tag.set_name("Array");
2476 if (name.length()) open_tag.add_attribute("name", name);
2477
2478 open_tag.add_attribute("type", "Tensor4");
2479 open_tag.add_attribute("nelem", atensor4.nelem());
2480
2481 open_tag.write_to_stream(os_xml);
2482 os_xml << '\n';
2483
2484 for (Index n = 0; n < atensor4.nelem(); n++)
2485 xml_write_to_stream(os_xml, atensor4[n], pbofs, "", verbosity);
2486
2487 close_tag.set_name("/Array");
2488 close_tag.write_to_stream(os_xml);
2489
2490 os_xml << '\n';
2491}
2492
2493//=== ArrayOfTensor5=========================================================
2494
2496
2501void xml_read_from_stream(istream& is_xml,
2502 ArrayOfTensor5& atensor5,
2503 bifstream* pbifs,
2504 const Verbosity& verbosity) {
2505 ArtsXMLTag tag(verbosity);
2506 Index nelem;
2507
2508 tag.read_from_stream(is_xml);
2509 tag.check_name("Array");
2510 tag.check_attribute("type", "Tensor5");
2511
2512 tag.get_attribute_value("nelem", nelem);
2513 atensor5.resize(nelem);
2514
2515 Index n;
2516 try {
2517 for (n = 0; n < nelem; n++)
2518 xml_read_from_stream(is_xml, atensor5[n], pbifs, verbosity);
2519 } catch (const std::runtime_error& e) {
2520 ostringstream os;
2521 os << "Error reading ArrayOfTensor5: "
2522 << "\n Element: " << n << "\n"
2523 << e.what();
2524 throw runtime_error(os.str());
2525 }
2526
2527 tag.read_from_stream(is_xml);
2528 tag.check_name("/Array");
2529}
2530
2532
2538void xml_write_to_stream(ostream& os_xml,
2539 const ArrayOfTensor5& atensor5,
2540 bofstream* pbofs,
2541 const String& name,
2542 const Verbosity& verbosity) {
2543 ArtsXMLTag open_tag(verbosity);
2544 ArtsXMLTag close_tag(verbosity);
2545
2546 open_tag.set_name("Array");
2547 if (name.length()) open_tag.add_attribute("name", name);
2548
2549 open_tag.add_attribute("type", "Tensor5");
2550 open_tag.add_attribute("nelem", atensor5.nelem());
2551
2552 open_tag.write_to_stream(os_xml);
2553 os_xml << '\n';
2554
2555 for (Index n = 0; n < atensor5.nelem(); n++)
2556 xml_write_to_stream(os_xml, atensor5[n], pbofs, "", verbosity);
2557
2558 close_tag.set_name("/Array");
2559 close_tag.write_to_stream(os_xml);
2560
2561 os_xml << '\n';
2562}
2563
2564//=== ArrayOfTensor6=========================================================
2565
2567
2572void xml_read_from_stream(istream& is_xml,
2573 ArrayOfTensor6& atensor6,
2574 bifstream* pbifs,
2575 const Verbosity& verbosity) {
2576 ArtsXMLTag tag(verbosity);
2577 Index nelem;
2578
2579 tag.read_from_stream(is_xml);
2580 tag.check_name("Array");
2581 tag.check_attribute("type", "Tensor6");
2582
2583 tag.get_attribute_value("nelem", nelem);
2584 atensor6.resize(nelem);
2585
2586 Index n;
2587 try {
2588 for (n = 0; n < nelem; n++)
2589 xml_read_from_stream(is_xml, atensor6[n], pbifs, verbosity);
2590 } catch (const std::runtime_error& e) {
2591 ostringstream os;
2592 os << "Error reading ArrayOfTensor6: "
2593 << "\n Element: " << n << "\n"
2594 << e.what();
2595 throw runtime_error(os.str());
2596 }
2597
2598 tag.read_from_stream(is_xml);
2599 tag.check_name("/Array");
2600}
2601
2603
2609void xml_write_to_stream(ostream& os_xml,
2610 const ArrayOfTensor6& atensor6,
2611 bofstream* pbofs,
2612 const String& name,
2613 const Verbosity& verbosity) {
2614 ArtsXMLTag open_tag(verbosity);
2615 ArtsXMLTag close_tag(verbosity);
2616
2617 open_tag.set_name("Array");
2618 if (name.length()) open_tag.add_attribute("name", name);
2619
2620 open_tag.add_attribute("type", "Tensor6");
2621 open_tag.add_attribute("nelem", atensor6.nelem());
2622
2623 open_tag.write_to_stream(os_xml);
2624 os_xml << '\n';
2625
2626 for (Index n = 0; n < atensor6.nelem(); n++)
2627 xml_write_to_stream(os_xml, atensor6[n], pbofs, "", verbosity);
2628
2629 close_tag.set_name("/Array");
2630 close_tag.write_to_stream(os_xml);
2631
2632 os_xml << '\n';
2633}
2634
2635//=== ArrayOfTensor7=========================================================
2636
2638
2643void xml_read_from_stream(istream& is_xml,
2644 ArrayOfTensor7& atensor7,
2645 bifstream* pbifs,
2646 const Verbosity& verbosity) {
2647 ArtsXMLTag tag(verbosity);
2648 Index nelem;
2649
2650 tag.read_from_stream(is_xml);
2651 tag.check_name("Array");
2652 tag.check_attribute("type", "Tensor7");
2653
2654 tag.get_attribute_value("nelem", nelem);
2655 atensor7.resize(nelem);
2656
2657 Index n;
2658 try {
2659 for (n = 0; n < nelem; n++)
2660 xml_read_from_stream(is_xml, atensor7[n], pbifs, verbosity);
2661 } catch (const std::runtime_error& e) {
2662 ostringstream os;
2663 os << "Error reading ArrayOfTensor7: "
2664 << "\n Element: " << n << "\n"
2665 << e.what();
2666 throw runtime_error(os.str());
2667 }
2668
2669 tag.read_from_stream(is_xml);
2670 tag.check_name("/Array");
2671}
2672
2674
2680void xml_write_to_stream(ostream& os_xml,
2681 const ArrayOfTensor7& atensor7,
2682 bofstream* pbofs,
2683 const String& name,
2684 const Verbosity& verbosity) {
2685 ArtsXMLTag open_tag(verbosity);
2686 ArtsXMLTag close_tag(verbosity);
2687
2688 open_tag.set_name("Array");
2689 if (name.length()) open_tag.add_attribute("name", name);
2690
2691 open_tag.add_attribute("type", "Tensor7");
2692 open_tag.add_attribute("nelem", atensor7.nelem());
2693
2694 open_tag.write_to_stream(os_xml);
2695 os_xml << '\n';
2696
2697 for (Index n = 0; n < atensor7.nelem(); n++)
2698 xml_write_to_stream(os_xml, atensor7[n], pbofs, "", verbosity);
2699
2700 close_tag.set_name("/Array");
2701 close_tag.write_to_stream(os_xml);
2702
2703 os_xml << '\n';
2704}
2705
2706//=== ArrayOfString ==========================================================
2707
2709
2715void xml_parse_from_stream(istream& is_xml,
2716 ArrayOfString& astring,
2717 bifstream* pbifs,
2718 XMLTag& tag,
2719 const Verbosity& verbosity) {
2720 Index nelem;
2721
2722 tag.check_attribute("type", "String");
2723
2724 tag.get_attribute_value("nelem", nelem);
2725 astring.resize(nelem);
2726
2727 Index n;
2728 try {
2729 for (n = 0; n < nelem; n++)
2730 xml_read_from_stream(is_xml, astring[n], pbifs, verbosity);
2731 } catch (const std::runtime_error& e) {
2732 ostringstream os;
2733 os << "Error reading ArrayOfString: "
2734 << "\n Element: " << n << "\n"
2735 << e.what();
2736 throw runtime_error(os.str());
2737 }
2738}
2739
2741
2746void xml_read_from_stream(istream& is_xml,
2747 ArrayOfString& astring,
2748 bifstream* pbifs,
2749 const Verbosity& verbosity) {
2750 XMLTag tag(verbosity);
2751
2752 tag.read_from_stream(is_xml);
2753 tag.check_name("Array");
2754
2755 xml_parse_from_stream(is_xml, astring, pbifs, tag, verbosity);
2756
2757 tag.read_from_stream(is_xml);
2758 tag.check_name("/Array");
2759}
2760
2762
2768void xml_write_to_stream(ostream& os_xml,
2769 const ArrayOfString& astring,
2770 bofstream* pbofs,
2771 const String& name,
2772 const Verbosity& verbosity) {
2773 ArtsXMLTag open_tag(verbosity);
2774 ArtsXMLTag close_tag(verbosity);
2775
2776 open_tag.set_name("Array");
2777 if (name.length()) open_tag.add_attribute("name", name);
2778
2779 open_tag.add_attribute("type", "String");
2780 open_tag.add_attribute("nelem", astring.nelem());
2781
2782 open_tag.write_to_stream(os_xml);
2783 os_xml << '\n';
2784
2785 for (Index n = 0; n < astring.nelem(); n++)
2786 xml_write_to_stream(os_xml, astring[n], pbofs, "", verbosity);
2787
2788 close_tag.set_name("/Array");
2789 close_tag.write_to_stream(os_xml);
2790
2791 os_xml << '\n';
2792}
2793
2794//=== ArrayOfVector ==========================================================
2795
2797
2802void xml_read_from_stream(istream& is_xml,
2803 ArrayOfVector& avector,
2804 bifstream* pbifs,
2805 const Verbosity& verbosity) {
2806 ArtsXMLTag tag(verbosity);
2807 Index nelem;
2808
2809 tag.read_from_stream(is_xml);
2810 tag.check_name("Array");
2811 tag.check_attribute("type", "Vector");
2812
2813 tag.get_attribute_value("nelem", nelem);
2814 avector.resize(nelem);
2815
2816 Index n;
2817 try {
2818 for (n = 0; n < nelem; n++)
2819 xml_read_from_stream(is_xml, avector[n], pbifs, verbosity);
2820 } catch (const std::runtime_error& e) {
2821 ostringstream os;
2822 os << "Error reading ArrayOfVector: "
2823 << "\n Element: " << n << "\n"
2824 << e.what();
2825 throw runtime_error(os.str());
2826 }
2827
2828 tag.read_from_stream(is_xml);
2829 tag.check_name("/Array");
2830}
2831
2833
2839void xml_write_to_stream(ostream& os_xml,
2840 const ArrayOfVector& avector,
2841 bofstream* pbofs,
2842 const String& name,
2843 const Verbosity& verbosity) {
2844 ArtsXMLTag open_tag(verbosity);
2845 ArtsXMLTag close_tag(verbosity);
2846
2847 open_tag.set_name("Array");
2848 if (name.length()) open_tag.add_attribute("name", name);
2849
2850 open_tag.add_attribute("type", "Vector");
2851 open_tag.add_attribute("nelem", avector.nelem());
2852
2853 open_tag.write_to_stream(os_xml);
2854 os_xml << '\n';
2855
2856 for (Index n = 0; n < avector.nelem(); n++)
2857 xml_write_to_stream(os_xml, avector[n], pbofs, "", verbosity);
2858
2859 close_tag.set_name("/Array");
2860 close_tag.write_to_stream(os_xml);
2861
2862 os_xml << '\n';
2863}
2864
2865//=== ArrayOfTransmissionMatrix ======================================================
2866
2868
2873void xml_read_from_stream(istream& is_xml,
2875 bifstream* pbifs,
2876 const Verbosity& verbosity) {
2877 ArtsXMLTag tag(verbosity);
2878 Index nelem;
2879
2880 tag.read_from_stream(is_xml);
2881 tag.check_name("Array");
2882 tag.check_attribute("type", "TransmissionMatrix");
2883
2884 tag.get_attribute_value("nelem", nelem);
2885 atm.resize(nelem);
2886
2887 Index n;
2888 try {
2889 for (n = 0; n < nelem; n++)
2890 xml_read_from_stream(is_xml, atm[n], pbifs, verbosity);
2891 } catch (const std::runtime_error& e) {
2892 ostringstream os;
2893 os << "Error reading ArrayOfTransmissionMatrix: "
2894 << "\n Element: " << n << "\n"
2895 << e.what();
2896 throw runtime_error(os.str());
2897 }
2898
2899 tag.read_from_stream(is_xml);
2900 tag.check_name("/Array");
2901}
2902
2904
2910void xml_write_to_stream(ostream& os_xml,
2911 const ArrayOfTransmissionMatrix& atm,
2912 bofstream* pbofs,
2913 const String& name,
2914 const Verbosity& verbosity) {
2915 ArtsXMLTag open_tag(verbosity);
2916 ArtsXMLTag close_tag(verbosity);
2917
2918 open_tag.set_name("Array");
2919 if (name.length()) open_tag.add_attribute("name", name);
2920
2921 open_tag.add_attribute("type", "TransmissionMatrix");
2922 open_tag.add_attribute("nelem", atm.nelem());
2923
2924 open_tag.write_to_stream(os_xml);
2925 os_xml << '\n';
2926
2927 for (Index n = 0; n < atm.nelem(); n++)
2928 xml_write_to_stream(os_xml, atm[n], pbofs, "", verbosity);
2929
2930 close_tag.set_name("/Array");
2931 close_tag.write_to_stream(os_xml);
2932
2933 os_xml << '\n';
2934}
2935
2936//=== ArrayOfArrayOfTransmissionMatrix ======================================================
2937
2939
2944void xml_read_from_stream(istream& is_xml,
2946 bifstream* pbifs,
2947 const Verbosity& verbosity) {
2948 ArtsXMLTag tag(verbosity);
2949 Index nelem;
2950
2951 tag.read_from_stream(is_xml);
2952 tag.check_name("Array");
2953 tag.check_attribute("type", "ArrayOfTransmissionMatrix");
2954
2955 tag.get_attribute_value("nelem", nelem);
2956 aatm.resize(nelem);
2957
2958 Index n;
2959 try {
2960 for (n = 0; n < nelem; n++)
2961 xml_read_from_stream(is_xml, aatm[n], pbifs, verbosity);
2962 } catch (const std::runtime_error& e) {
2963 ostringstream os;
2964 os << "Error reading ArrayOfArrayOfTransmissionMatrix: "
2965 << "\n Element: " << n << "\n"
2966 << e.what();
2967 throw runtime_error(os.str());
2968 }
2969
2970 tag.read_from_stream(is_xml);
2971 tag.check_name("/Array");
2972}
2973
2975
2981void xml_write_to_stream(ostream& os_xml,
2983 bofstream* pbofs,
2984 const String& name,
2985 const Verbosity& verbosity) {
2986 ArtsXMLTag open_tag(verbosity);
2987 ArtsXMLTag close_tag(verbosity);
2988
2989 open_tag.set_name("Array");
2990 if (name.length()) open_tag.add_attribute("name", name);
2991
2992 open_tag.add_attribute("type", "ArrayOfTransmissionMatrix");
2993 open_tag.add_attribute("nelem", aatm.nelem());
2994
2995 open_tag.write_to_stream(os_xml);
2996 os_xml << '\n';
2997
2998 for (Index n = 0; n < aatm.nelem(); n++)
2999 xml_write_to_stream(os_xml, aatm[n], pbofs, "", verbosity);
3000
3001 close_tag.set_name("/Array");
3002 close_tag.write_to_stream(os_xml);
3003
3004 os_xml << '\n';
3005}
3006
3007//=== ArrayOfRadiationVector ======================================================
3008
3010
3015void xml_read_from_stream(istream& is_xml,
3017 bifstream* pbifs,
3018 const Verbosity& verbosity) {
3019 ArtsXMLTag tag(verbosity);
3020 Index nelem;
3021
3022 tag.read_from_stream(is_xml);
3023 tag.check_name("Array");
3024 tag.check_attribute("type", "RadiationVector");
3025
3026 tag.get_attribute_value("nelem", nelem);
3027 arv.resize(nelem);
3028
3029 Index n;
3030 try {
3031 for (n = 0; n < nelem; n++)
3032 xml_read_from_stream(is_xml, arv[n], pbifs, verbosity);
3033 } catch (const std::runtime_error& e) {
3034 ostringstream os;
3035 os << "Error reading ArrayOfRadiationVector: "
3036 << "\n Element: " << n << "\n"
3037 << e.what();
3038 throw runtime_error(os.str());
3039 }
3040
3041 tag.read_from_stream(is_xml);
3042 tag.check_name("/Array");
3043}
3044
3046
3052void xml_write_to_stream(ostream& os_xml,
3053 const ArrayOfRadiationVector& arv,
3054 bofstream* pbofs,
3055 const String& name,
3056 const Verbosity& verbosity) {
3057 ArtsXMLTag open_tag(verbosity);
3058 ArtsXMLTag close_tag(verbosity);
3059
3060 open_tag.set_name("Array");
3061 if (name.length()) open_tag.add_attribute("name", name);
3062
3063 open_tag.add_attribute("type", "RadiationVector");
3064 open_tag.add_attribute("nelem", arv.nelem());
3065
3066 open_tag.write_to_stream(os_xml);
3067 os_xml << '\n';
3068
3069 for (Index n = 0; n < arv.nelem(); n++)
3070 xml_write_to_stream(os_xml, arv[n], pbofs, "", verbosity);
3071
3072 close_tag.set_name("/Array");
3073 close_tag.write_to_stream(os_xml);
3074
3075 os_xml << '\n';
3076}
3077
3078//=== ArrayOfArrayOfRadiationVector ======================================================
3079
3081
3086void xml_read_from_stream(istream& is_xml,
3088 bifstream* pbifs,
3089 const Verbosity& verbosity) {
3090 ArtsXMLTag tag(verbosity);
3091 Index nelem;
3092
3093 tag.read_from_stream(is_xml);
3094 tag.check_name("Array");
3095 tag.check_attribute("type", "ArrayOfRadiationVector");
3096
3097 tag.get_attribute_value("nelem", nelem);
3098 aarv.resize(nelem);
3099
3100 Index n;
3101 try {
3102 for (n = 0; n < nelem; n++)
3103 xml_read_from_stream(is_xml, aarv[n], pbifs, verbosity);
3104 } catch (const std::runtime_error& e) {
3105 ostringstream os;
3106 os << "Error reading ArrayOfArrayOfRadiationVector: "
3107 << "\n Element: " << n << "\n"
3108 << e.what();
3109 throw runtime_error(os.str());
3110 }
3111
3112 tag.read_from_stream(is_xml);
3113 tag.check_name("/Array");
3114}
3115
3117
3123void xml_write_to_stream(ostream& os_xml,
3125 bofstream* pbofs,
3126 const String& name,
3127 const Verbosity& verbosity) {
3128 ArtsXMLTag open_tag(verbosity);
3129 ArtsXMLTag close_tag(verbosity);
3130
3131 open_tag.set_name("Array");
3132 if (name.length()) open_tag.add_attribute("name", name);
3133
3134 open_tag.add_attribute("type", "ArrayOfRadiationVector");
3135 open_tag.add_attribute("nelem", aarv.nelem());
3136
3137 open_tag.write_to_stream(os_xml);
3138 os_xml << '\n';
3139
3140 for (Index n = 0; n < aarv.nelem(); n++)
3141 xml_write_to_stream(os_xml, aarv[n], pbofs, "", verbosity);
3142
3143 close_tag.set_name("/Array");
3144 close_tag.write_to_stream(os_xml);
3145
3146 os_xml << '\n';
3147}
3148
3149//=== ArrayOfPropagationMatrix ======================================================
3150
3152
3157void xml_read_from_stream(istream& is_xml,
3159 bifstream* pbifs,
3160 const Verbosity& verbosity) {
3161 ArtsXMLTag tag(verbosity);
3162 Index nelem;
3163
3164 tag.read_from_stream(is_xml);
3165 tag.check_name("Array");
3166 tag.check_attribute("type", "PropagationMatrix");
3167
3168 tag.get_attribute_value("nelem", nelem);
3169 apm.resize(nelem);
3170
3171 Index n;
3172 try {
3173 for (n = 0; n < nelem; n++)
3174 xml_read_from_stream(is_xml, apm[n], pbifs, verbosity);
3175 } catch (const std::runtime_error& e) {
3176 ostringstream os;
3177 os << "Error reading ArrayOfPropagationMatrix: "
3178 << "\n Element: " << n << "\n"
3179 << e.what();
3180 throw runtime_error(os.str());
3181 }
3182
3183 tag.read_from_stream(is_xml);
3184 tag.check_name("/Array");
3185}
3186
3188
3194void xml_write_to_stream(ostream& os_xml,
3195 const ArrayOfPropagationMatrix& apm,
3196 bofstream* pbofs,
3197 const String& name,
3198 const Verbosity& verbosity) {
3199 ArtsXMLTag open_tag(verbosity);
3200 ArtsXMLTag close_tag(verbosity);
3201
3202 open_tag.set_name("Array");
3203 if (name.length()) open_tag.add_attribute("name", name);
3204
3205 open_tag.add_attribute("type", "PropagationMatrix");
3206 open_tag.add_attribute("nelem", apm.nelem());
3207
3208 open_tag.write_to_stream(os_xml);
3209 os_xml << '\n';
3210
3211 for (Index n = 0; n < apm.nelem(); n++)
3212 xml_write_to_stream(os_xml, apm[n], pbofs, "", verbosity);
3213
3214 close_tag.set_name("/Array");
3215 close_tag.write_to_stream(os_xml);
3216
3217 os_xml << '\n';
3218}
3219
3220//=== ArrayOfAbsorptionLines ======================================================
3221
3223
3228void xml_read_from_stream(istream& is_xml,
3230 bifstream* pbifs,
3231 const Verbosity& verbosity) {
3232 ArtsXMLTag tag(verbosity);
3233 Index nelem;
3234
3235 tag.read_from_stream(is_xml);
3236 tag.check_name("Array");
3237 tag.check_attribute("type", "AbsorptionLines");
3238
3239 tag.get_attribute_value("nelem", nelem);
3240 aal.resize(nelem);
3241
3242 Index n;
3243 try {
3244 for (n = 0; n < nelem; n++)
3245 xml_read_from_stream(is_xml, aal[n], pbifs, verbosity);
3246 } catch (const std::runtime_error& e) {
3247 ostringstream os;
3248 os << "Error reading ArrayOfAbsorptionLines: "
3249 << "\n Element: " << n << "\n"
3250 << e.what();
3251 throw runtime_error(os.str());
3252 }
3253
3254 tag.read_from_stream(is_xml);
3255 tag.check_name("/Array");
3256}
3257
3259
3265void xml_write_to_stream(ostream& os_xml,
3266 const ArrayOfAbsorptionLines& aal,
3267 bofstream* pbofs,
3268 const String& name,
3269 const Verbosity& verbosity) {
3270 ArtsXMLTag open_tag(verbosity);
3271 ArtsXMLTag close_tag(verbosity);
3272
3273 open_tag.set_name("Array");
3274 if (name.length()) open_tag.add_attribute("name", name);
3275
3276 open_tag.add_attribute("type", "AbsorptionLines");
3277 open_tag.add_attribute("nelem", aal.nelem());
3278
3279 open_tag.write_to_stream(os_xml);
3280 os_xml << '\n';
3281
3282 for (Index n = 0; n < aal.nelem(); n++)
3283 xml_write_to_stream(os_xml, aal[n], pbofs, "", verbosity);
3284
3285 close_tag.set_name("/Array");
3286 close_tag.write_to_stream(os_xml);
3287
3288 os_xml << '\n';
3289}
3290
3291//=== ArrayOfArrayOfAbsorptionLines ======================================================
3292
3294
3299void xml_read_from_stream(istream& is_xml,
3301 bifstream* pbifs,
3302 const Verbosity& verbosity) {
3303 ArtsXMLTag tag(verbosity);
3304 Index nelem;
3305
3306 tag.read_from_stream(is_xml);
3307 tag.check_name("Array");
3308 tag.check_attribute("type", "ArrayOfAbsorptionLines");
3309
3310 tag.get_attribute_value("nelem", nelem);
3311 aal.resize(nelem);
3312
3313 Index n;
3314 try {
3315 for (n = 0; n < nelem; n++)
3316 xml_read_from_stream(is_xml, aal[n], pbifs, verbosity);
3317 } catch (const std::runtime_error& e) {
3318 ostringstream os;
3319 os << "Error reading ArrayOfArrayOfAbsorptionLines: "
3320 << "\n Element: " << n << "\n"
3321 << e.what();
3322 throw runtime_error(os.str());
3323 }
3324
3325 tag.read_from_stream(is_xml);
3326 tag.check_name("/Array");
3327}
3328
3330
3336void xml_write_to_stream(ostream& os_xml,
3338 bofstream* pbofs,
3339 const String& name,
3340 const Verbosity& verbosity) {
3341 ArtsXMLTag open_tag(verbosity);
3342 ArtsXMLTag close_tag(verbosity);
3343
3344 open_tag.set_name("Array");
3345 if (name.length()) open_tag.add_attribute("name", name);
3346
3347 open_tag.add_attribute("type", "ArrayOfAbsorptionLines");
3348 open_tag.add_attribute("nelem", aal.nelem());
3349
3350 open_tag.write_to_stream(os_xml);
3351 os_xml << '\n';
3352
3353 for (Index n = 0; n < aal.nelem(); n++)
3354 xml_write_to_stream(os_xml, aal[n], pbofs, "", verbosity);
3355
3356 close_tag.set_name("/Array");
3357 close_tag.write_to_stream(os_xml);
3358
3359 os_xml << '\n';
3360}
3361
3362//=== ArrayOfArrayOfPropagationMatrix ======================================================
3363
3365
3370void xml_read_from_stream(istream& is_xml,
3372 bifstream* pbifs,
3373 const Verbosity& verbosity) {
3374 ArtsXMLTag tag(verbosity);
3375 Index nelem;
3376
3377 tag.read_from_stream(is_xml);
3378 tag.check_name("Array");
3379 tag.check_attribute("type", "ArrayOfPropagationMatrix");
3380
3381 tag.get_attribute_value("nelem", nelem);
3382 aapm.resize(nelem);
3383
3384 Index n;
3385 try {
3386 for (n = 0; n < nelem; n++)
3387 xml_read_from_stream(is_xml, aapm[n], pbifs, verbosity);
3388 } catch (const std::runtime_error& e) {
3389 ostringstream os;
3390 os << "Error reading ArrayOfArrayOfPropagationMatrix: "
3391 << "\n Element: " << n << "\n"
3392 << e.what();
3393 throw runtime_error(os.str());
3394 }
3395
3396 tag.read_from_stream(is_xml);
3397 tag.check_name("/Array");
3398}
3399
3401
3407void xml_write_to_stream(ostream& os_xml,
3409 bofstream* pbofs,
3410 const String& name,
3411 const Verbosity& verbosity) {
3412 ArtsXMLTag open_tag(verbosity);
3413 ArtsXMLTag close_tag(verbosity);
3414
3415 open_tag.set_name("Array");
3416 if (name.length()) open_tag.add_attribute("name", name);
3417
3418 open_tag.add_attribute("type", "ArrayOfPropagationMatrix");
3419 open_tag.add_attribute("nelem", aapm.nelem());
3420
3421 open_tag.write_to_stream(os_xml);
3422 os_xml << '\n';
3423
3424 for (Index n = 0; n < aapm.nelem(); n++)
3425 xml_write_to_stream(os_xml, aapm[n], pbofs, "", verbosity);
3426
3427 close_tag.set_name("/Array");
3428 close_tag.write_to_stream(os_xml);
3429
3430 os_xml << '\n';
3431}
3432
3433//=== ArrayOfStokesVector ======================================================
3434
3436
3441void xml_read_from_stream(istream& is_xml,
3443 bifstream* pbifs,
3444 const Verbosity& verbosity) {
3445 ArtsXMLTag tag(verbosity);
3446 Index nelem;
3447
3448 tag.read_from_stream(is_xml);
3449 tag.check_name("Array");
3450 tag.check_attribute("type", "StokesVector");
3451
3452 tag.get_attribute_value("nelem", nelem);
3453 apm.resize(nelem);
3454
3455 Index n;
3456 try {
3457 for (n = 0; n < nelem; n++)
3458 xml_read_from_stream(is_xml, apm[n], pbifs, verbosity);
3459 } catch (const std::runtime_error& e) {
3460 ostringstream os;
3461 os << "Error reading ArrayOfStokesVector: "
3462 << "\n Element: " << n << "\n"
3463 << e.what();
3464 throw runtime_error(os.str());
3465 }
3466
3467 tag.read_from_stream(is_xml);
3468 tag.check_name("/Array");
3469}
3470
3472
3478void xml_write_to_stream(ostream& os_xml,
3479 const ArrayOfStokesVector& apm,
3480 bofstream* pbofs,
3481 const String& name,
3482 const Verbosity& verbosity) {
3483 ArtsXMLTag open_tag(verbosity);
3484 ArtsXMLTag close_tag(verbosity);
3485
3486 open_tag.set_name("Array");
3487 if (name.length()) open_tag.add_attribute("name", name);
3488
3489 open_tag.add_attribute("type", "StokesVector");
3490 open_tag.add_attribute("nelem", apm.nelem());
3491
3492 open_tag.write_to_stream(os_xml);
3493 os_xml << '\n';
3494
3495 for (Index n = 0; n < apm.nelem(); n++)
3496 xml_write_to_stream(os_xml, apm[n], pbofs, "", verbosity);
3497
3498 close_tag.set_name("/Array");
3499 close_tag.write_to_stream(os_xml);
3500
3501 os_xml << '\n';
3502}
3503
3504//=== ArrayOfArrayOfStokesVector ======================================================
3505
3507
3512void xml_read_from_stream(istream& is_xml,
3514 bifstream* pbifs,
3515 const Verbosity& verbosity) {
3516 ArtsXMLTag tag(verbosity);
3517 Index nelem;
3518
3519 tag.read_from_stream(is_xml);
3520 tag.check_name("Array");
3521 tag.check_attribute("type", "ArrayOfStokesVector");
3522
3523 tag.get_attribute_value("nelem", nelem);
3524 aapm.resize(nelem);
3525
3526 Index n;
3527 try {
3528 for (n = 0; n < nelem; n++)
3529 xml_read_from_stream(is_xml, aapm[n], pbifs, verbosity);
3530 } catch (const std::runtime_error& e) {
3531 ostringstream os;
3532 os << "Error reading ArrayOfArrayOfStokesVector: "
3533 << "\n Element: " << n << "\n"
3534 << e.what();
3535 throw runtime_error(os.str());
3536 }
3537
3538 tag.read_from_stream(is_xml);
3539 tag.check_name("/Array");
3540}
3541
3543
3549void xml_write_to_stream(ostream& os_xml,
3550 const ArrayOfArrayOfStokesVector& aapm,
3551 bofstream* pbofs,
3552 const String& name,
3553 const Verbosity& verbosity) {
3554 ArtsXMLTag open_tag(verbosity);
3555 ArtsXMLTag close_tag(verbosity);
3556
3557 open_tag.set_name("Array");
3558 if (name.length()) open_tag.add_attribute("name", name);
3559
3560 open_tag.add_attribute("type", "ArrayOfStokesVector");
3561 open_tag.add_attribute("nelem", aapm.nelem());
3562
3563 open_tag.write_to_stream(os_xml);
3564 os_xml << '\n';
3565
3566 for (Index n = 0; n < aapm.nelem(); n++)
3567 xml_write_to_stream(os_xml, aapm[n], pbofs, "", verbosity);
3568
3569 close_tag.set_name("/Array");
3570 close_tag.write_to_stream(os_xml);
3571
3572 os_xml << '\n';
3573}
3574
3575//=== ArrayOfXsecRecord ======================================================
3576
3578
3583void xml_read_from_stream(istream& is_xml,
3584 ArrayOfXsecRecord& axd,
3585 bifstream* pbifs,
3586 const Verbosity& verbosity) {
3587 ArtsXMLTag tag(verbosity);
3588 Index nelem;
3589
3590 tag.read_from_stream(is_xml);
3591 tag.check_name("Array");
3592 tag.check_attribute("type", "XsecRecord");
3593
3594 tag.get_attribute_value("nelem", nelem);
3595 axd.resize(nelem);
3596
3597 Index n;
3598 try {
3599 for (n = 0; n < nelem; n++)
3600 xml_read_from_stream(is_xml, axd[n], pbifs, verbosity);
3601 } catch (const std::runtime_error& e) {
3602 ostringstream os;
3603 os << "Error reading ArrayOfXsecRecord: "
3604 << "\n Element: " << n << "\n"
3605 << e.what();
3606 throw runtime_error(os.str());
3607 }
3608
3609 tag.read_from_stream(is_xml);
3610 tag.check_name("/Array");
3611}
3612
3614
3620void xml_write_to_stream(ostream& os_xml,
3621 const ArrayOfXsecRecord& axd,
3622 bofstream* pbofs,
3623 const String& name,
3624 const Verbosity& verbosity) {
3625 ArtsXMLTag open_tag(verbosity);
3626 ArtsXMLTag close_tag(verbosity);
3627
3628 open_tag.set_name("Array");
3629 if (name.length()) open_tag.add_attribute("name", name);
3630
3631 open_tag.add_attribute("type", "XsecRecord");
3632 open_tag.add_attribute("nelem", axd.nelem());
3633
3634 open_tag.write_to_stream(os_xml);
3635 os_xml << '\n';
3636
3637 for (Index n = 0; n < axd.nelem(); n++)
3638 xml_write_to_stream(os_xml, axd[n], pbofs, "", verbosity);
3639
3640 close_tag.set_name("/Array");
3641 close_tag.write_to_stream(os_xml);
3642
3643 os_xml << '\n';
3644}
3645
3646//=== ArrayOfTime ======================================================
3647
3649
3654void xml_read_from_stream(istream& is_xml,
3655 ArrayOfTime& at,
3656 bifstream* pbifs,
3657 const Verbosity& verbosity) {
3658 ArtsXMLTag tag(verbosity);
3659 Index nelem;
3660
3661 tag.read_from_stream(is_xml);
3662 tag.check_name("Array");
3663 tag.check_attribute("type", "Time");
3664
3665 tag.get_attribute_value("nelem", nelem);
3666 at.resize(nelem);
3667
3668 Index n;
3669 try {
3670 for (n = 0; n < nelem; n++)
3671 xml_read_from_stream(is_xml, at[n], pbifs, verbosity);
3672 } catch (const std::runtime_error& e) {
3673 ostringstream os;
3674 os << "Error reading ArrayOfTime: "
3675 << "\n Element: " << n << "\n"
3676 << e.what();
3677 throw runtime_error(os.str());
3678 }
3679
3680 tag.read_from_stream(is_xml);
3681 tag.check_name("/Array");
3682}
3683
3685
3691void xml_write_to_stream(ostream& os_xml,
3692 const ArrayOfTime& at,
3693 bofstream* pbofs,
3694 const String& name,
3695 const Verbosity& verbosity) {
3696 ArtsXMLTag open_tag(verbosity);
3697 ArtsXMLTag close_tag(verbosity);
3698
3699 open_tag.set_name("Array");
3700 if (name.length()) open_tag.add_attribute("name", name);
3701
3702 open_tag.add_attribute("type", "Time");
3703 open_tag.add_attribute("nelem", at.nelem());
3704
3705 open_tag.write_to_stream(os_xml);
3706 os_xml << '\n';
3707
3708 for (Index n = 0; n < at.nelem(); n++)
3709 xml_write_to_stream(os_xml, at[n], pbofs, "", verbosity);
3710
3711 close_tag.set_name("/Array");
3712 close_tag.write_to_stream(os_xml);
3713
3714 os_xml << '\n';
3715}
3716
3717//=== ArrayOfArrayOfTime ======================================================
3718
3720
3725void xml_read_from_stream(istream& is_xml,
3727 bifstream* pbifs,
3728 const Verbosity& verbosity) {
3729 ArtsXMLTag tag(verbosity);
3730 Index nelem;
3731
3732 tag.read_from_stream(is_xml);
3733 tag.check_name("Array");
3734 tag.check_attribute("type", "ArrayOfTime");
3735
3736 tag.get_attribute_value("nelem", nelem);
3737 at.resize(nelem);
3738
3739 Index n;
3740 try {
3741 for (n = 0; n < nelem; n++)
3742 xml_read_from_stream(is_xml, at[n], pbifs, verbosity);
3743 } catch (const std::runtime_error& e) {
3744 ostringstream os;
3745 os << "Error reading ArrayOfArrayOfTime: "
3746 << "\n Element: " << n << "\n"
3747 << e.what();
3748 throw runtime_error(os.str());
3749 }
3750
3751 tag.read_from_stream(is_xml);
3752 tag.check_name("/Array");
3753}
3754
3756
3762void xml_write_to_stream(ostream& os_xml,
3763 const ArrayOfArrayOfTime& at,
3764 bofstream* pbofs,
3765 const String& name,
3766 const Verbosity& verbosity) {
3767 ArtsXMLTag open_tag(verbosity);
3768 ArtsXMLTag close_tag(verbosity);
3769
3770 open_tag.set_name("Array");
3771 if (name.length()) open_tag.add_attribute("name", name);
3772
3773 open_tag.add_attribute("type", "ArrayOfTime");
3774 open_tag.add_attribute("nelem", at.nelem());
3775
3776 open_tag.write_to_stream(os_xml);
3777 os_xml << '\n';
3778
3779 for (Index n = 0; n < at.nelem(); n++)
3780 xml_write_to_stream(os_xml, at[n], pbofs, "", verbosity);
3781
3782 close_tag.set_name("/ArrayOfTime");
3783 close_tag.write_to_stream(os_xml);
3784
3785 os_xml << '\n';
3786}
3787
The global header file for ARTS.
This can be used to make arrays out of anything.
Definition: array.h:107
Index nelem() const ARTS_NOEXCEPT
Number of elements.
Definition: array.h:195
The ARTS XML tag class.
Definition: xml_io.h:45
void add_attribute(const String &aname, const std::vector< QuantumNumberType > &value)
Adds value of attribute as type std::vector<QuantumNumberType> to tag.
Definition: xml_io.cc:42
void get_attribute_value(const String &aname, SpeciesTag &value)
Returns value of attribute as type SpeciesTag.
Definition: xml_io.cc:70
The ARTS XML tag class.
Definition: xml_io_base.h:68
void write_to_stream(ostream &os)
Write XML tag.
Definition: xml_io_base.cc:300
void check_name(const String &expected_name)
Check tag name.
Definition: xml_io_base.cc:48
void read_from_stream(istream &is)
Reads next XML tag.
Definition: xml_io_base.cc:179
void get_attribute_value(const String &aname, String &value)
Returns value of attribute as String.
Definition: xml_io_base.cc:124
void set_name(const String &new_name)
Definition: xml_io_base.h:76
void check_attribute(const String &aname, const String &value)
Checks whether attribute has the expected value.
Definition: xml_io_base.cc:97
Binary output file stream class.
Definition: bifstream.h:42
Binary output file stream class.
Definition: bofstream.h:42
#define _U_
Definition: config.h:180
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
Index nelem(const Lines &l)
Number of lines.
Quantum::Identifier QuantumIdentifier
Definition: quantum.h:471
This file contains basic functions to handle XML data files.
void xml_write_to_stream(ostream &os_xml, const ArrayOfAgenda &aa, bofstream *pbofs, const String &name, const Verbosity &)
Writes ArrayOfAgenda to XML output stream.
void xml_read_from_stream(istream &is_xml, ArrayOfAgenda &aa, bifstream *pbifs, const Verbosity &)
Reads ArrayOfAgenda from XML input stream.
void xml_parse_from_stream(istream &is_xml, ArrayOfString &astring, bifstream *pbifs, XMLTag &tag, const Verbosity &verbosity)
Parse ArrayOfString from XML input stream.