ARTS 2.5.9 (git: 825fa5f2)
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);
82 Index nelem;
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", "JacobianTarget");
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", "ArrayOfGriddedField1");
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", "ArrayOfGriddedField2");
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", "ArrayOfGriddedField3");
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//=== ArrayOfStar =========================================================
2707
2709
2714void xml_read_from_stream(istream& is_xml,
2715 ArrayOfStar& astar,
2716 bifstream* pbifs,
2717 const Verbosity& verbosity) {
2718 ArtsXMLTag tag(verbosity);
2719 Index nelem;
2720
2721 tag.read_from_stream(is_xml);
2722 tag.check_name("Array");
2723 tag.check_attribute("type", "Star");
2724
2725 tag.get_attribute_value("nelem", nelem);
2726 astar.resize(nelem);
2727
2728 Index n;
2729 try {
2730 for (n = 0; n < nelem; n++) {
2731 xml_read_from_stream(is_xml, astar[n], pbifs, verbosity);
2732 }
2733 } catch (const std::runtime_error& e) {
2734 ostringstream os;
2735 os << "Error reading ArrayOfStar: "
2736 << "\n Element: " << n << "\n"
2737 << e.what();
2738 throw runtime_error(os.str());
2739 }
2740
2741 tag.read_from_stream(is_xml);
2742 tag.check_name("/Array");
2743}
2744
2746
2752void xml_write_to_stream(ostream& os_xml,
2753 const ArrayOfStar& astar,
2754 bofstream* pbofs,
2755 const String& name,
2756 const Verbosity& verbosity) {
2757 ArtsXMLTag open_tag(verbosity);
2758 ArtsXMLTag close_tag(verbosity);
2759
2760 open_tag.set_name("Array");
2761 if (name.length()) open_tag.add_attribute("name", name);
2762
2763 open_tag.add_attribute("type", "Star");
2764 open_tag.add_attribute("nelem", astar.nelem());
2765
2766 open_tag.write_to_stream(os_xml);
2767 os_xml << '\n';
2768
2769 for (Index n = 0; n < astar.nelem(); n++) {
2770 xml_write_to_stream(os_xml, astar[n], pbofs, "", verbosity);
2771 }
2772
2773 close_tag.set_name("/Array");
2774 close_tag.write_to_stream(os_xml);
2775
2776 os_xml << '\n';
2777}
2778
2779//=== ArrayOfString ==========================================================
2780
2782
2788void xml_parse_from_stream(istream& is_xml,
2789 ArrayOfString& astring,
2790 bifstream* pbifs,
2791 XMLTag& tag,
2792 const Verbosity& verbosity) {
2793 Index nelem;
2794
2795 tag.check_attribute("type", "String");
2796
2797 tag.get_attribute_value("nelem", nelem);
2798 astring.resize(nelem);
2799
2800 Index n;
2801 try {
2802 for (n = 0; n < nelem; n++)
2803 xml_read_from_stream(is_xml, astring[n], pbifs, verbosity);
2804 } catch (const std::runtime_error& e) {
2805 ostringstream os;
2806 os << "Error reading ArrayOfString: "
2807 << "\n Element: " << n << "\n"
2808 << e.what();
2809 throw runtime_error(os.str());
2810 }
2811}
2812
2814
2819void xml_read_from_stream(istream& is_xml,
2820 ArrayOfString& astring,
2821 bifstream* pbifs,
2822 const Verbosity& verbosity) {
2823 XMLTag tag(verbosity);
2824
2825 tag.read_from_stream(is_xml);
2826 tag.check_name("Array");
2827
2828 xml_parse_from_stream(is_xml, astring, pbifs, tag, verbosity);
2829
2830 tag.read_from_stream(is_xml);
2831 tag.check_name("/Array");
2832}
2833
2835
2841void xml_write_to_stream(ostream& os_xml,
2842 const ArrayOfString& astring,
2843 bofstream* pbofs,
2844 const String& name,
2845 const Verbosity& verbosity) {
2846 ArtsXMLTag open_tag(verbosity);
2847 ArtsXMLTag close_tag(verbosity);
2848
2849 open_tag.set_name("Array");
2850 if (name.length()) open_tag.add_attribute("name", name);
2851
2852 open_tag.add_attribute("type", "String");
2853 open_tag.add_attribute("nelem", astring.nelem());
2854
2855 open_tag.write_to_stream(os_xml);
2856 os_xml << '\n';
2857
2858 for (Index n = 0; n < astring.nelem(); n++)
2859 xml_write_to_stream(os_xml, astring[n], pbofs, "", verbosity);
2860
2861 close_tag.set_name("/Array");
2862 close_tag.write_to_stream(os_xml);
2863
2864 os_xml << '\n';
2865}
2866
2867//=== ArrayOfVector ==========================================================
2868
2870
2875void xml_read_from_stream(istream& is_xml,
2876 ArrayOfVector& avector,
2877 bifstream* pbifs,
2878 const Verbosity& verbosity) {
2879 ArtsXMLTag tag(verbosity);
2880 Index nelem;
2881
2882 tag.read_from_stream(is_xml);
2883 tag.check_name("Array");
2884 tag.check_attribute("type", "Vector");
2885
2886 tag.get_attribute_value("nelem", nelem);
2887 avector.resize(nelem);
2888
2889 Index n;
2890 try {
2891 for (n = 0; n < nelem; n++)
2892 xml_read_from_stream(is_xml, avector[n], pbifs, verbosity);
2893 } catch (const std::runtime_error& e) {
2894 ostringstream os;
2895 os << "Error reading ArrayOfVector: "
2896 << "\n Element: " << n << "\n"
2897 << e.what();
2898 throw runtime_error(os.str());
2899 }
2900
2901 tag.read_from_stream(is_xml);
2902 tag.check_name("/Array");
2903}
2904
2906
2912void xml_write_to_stream(ostream& os_xml,
2913 const ArrayOfVector& avector,
2914 bofstream* pbofs,
2915 const String& name,
2916 const Verbosity& verbosity) {
2917 ArtsXMLTag open_tag(verbosity);
2918 ArtsXMLTag close_tag(verbosity);
2919
2920 open_tag.set_name("Array");
2921 if (name.length()) open_tag.add_attribute("name", name);
2922
2923 open_tag.add_attribute("type", "Vector");
2924 open_tag.add_attribute("nelem", avector.nelem());
2925
2926 open_tag.write_to_stream(os_xml);
2927 os_xml << '\n';
2928
2929 for (Index n = 0; n < avector.nelem(); n++)
2930 xml_write_to_stream(os_xml, avector[n], pbofs, "", verbosity);
2931
2932 close_tag.set_name("/Array");
2933 close_tag.write_to_stream(os_xml);
2934
2935 os_xml << '\n';
2936}
2937
2938//=== ArrayOfTransmissionMatrix ======================================================
2939
2941
2946void xml_read_from_stream(istream& is_xml,
2948 bifstream* pbifs,
2949 const Verbosity& verbosity) {
2950 ArtsXMLTag tag(verbosity);
2951 Index nelem;
2952
2953 tag.read_from_stream(is_xml);
2954 tag.check_name("Array");
2955 tag.check_attribute("type", "TransmissionMatrix");
2956
2957 tag.get_attribute_value("nelem", nelem);
2958 atm.resize(nelem);
2959
2960 Index n;
2961 try {
2962 for (n = 0; n < nelem; n++)
2963 xml_read_from_stream(is_xml, atm[n], pbifs, verbosity);
2964 } catch (const std::runtime_error& e) {
2965 ostringstream os;
2966 os << "Error reading ArrayOfTransmissionMatrix: "
2967 << "\n Element: " << n << "\n"
2968 << e.what();
2969 throw runtime_error(os.str());
2970 }
2971
2972 tag.read_from_stream(is_xml);
2973 tag.check_name("/Array");
2974}
2975
2977
2983void xml_write_to_stream(ostream& os_xml,
2984 const ArrayOfTransmissionMatrix& atm,
2985 bofstream* pbofs,
2986 const String& name,
2987 const Verbosity& verbosity) {
2988 ArtsXMLTag open_tag(verbosity);
2989 ArtsXMLTag close_tag(verbosity);
2990
2991 open_tag.set_name("Array");
2992 if (name.length()) open_tag.add_attribute("name", name);
2993
2994 open_tag.add_attribute("type", "TransmissionMatrix");
2995 open_tag.add_attribute("nelem", atm.nelem());
2996
2997 open_tag.write_to_stream(os_xml);
2998 os_xml << '\n';
2999
3000 for (Index n = 0; n < atm.nelem(); n++)
3001 xml_write_to_stream(os_xml, atm[n], pbofs, "", verbosity);
3002
3003 close_tag.set_name("/Array");
3004 close_tag.write_to_stream(os_xml);
3005
3006 os_xml << '\n';
3007}
3008
3009//=== ArrayOfArrayOfTransmissionMatrix ======================================================
3010
3012
3017void xml_read_from_stream(istream& is_xml,
3019 bifstream* pbifs,
3020 const Verbosity& verbosity) {
3021 ArtsXMLTag tag(verbosity);
3022 Index nelem;
3023
3024 tag.read_from_stream(is_xml);
3025 tag.check_name("Array");
3026 tag.check_attribute("type", "ArrayOfTransmissionMatrix");
3027
3028 tag.get_attribute_value("nelem", nelem);
3029 aatm.resize(nelem);
3030
3031 Index n;
3032 try {
3033 for (n = 0; n < nelem; n++)
3034 xml_read_from_stream(is_xml, aatm[n], pbifs, verbosity);
3035 } catch (const std::runtime_error& e) {
3036 ostringstream os;
3037 os << "Error reading ArrayOfArrayOfTransmissionMatrix: "
3038 << "\n Element: " << n << "\n"
3039 << e.what();
3040 throw runtime_error(os.str());
3041 }
3042
3043 tag.read_from_stream(is_xml);
3044 tag.check_name("/Array");
3045}
3046
3048
3054void xml_write_to_stream(ostream& os_xml,
3056 bofstream* pbofs,
3057 const String& name,
3058 const Verbosity& verbosity) {
3059 ArtsXMLTag open_tag(verbosity);
3060 ArtsXMLTag close_tag(verbosity);
3061
3062 open_tag.set_name("Array");
3063 if (name.length()) open_tag.add_attribute("name", name);
3064
3065 open_tag.add_attribute("type", "ArrayOfTransmissionMatrix");
3066 open_tag.add_attribute("nelem", aatm.nelem());
3067
3068 open_tag.write_to_stream(os_xml);
3069 os_xml << '\n';
3070
3071 for (Index n = 0; n < aatm.nelem(); n++)
3072 xml_write_to_stream(os_xml, aatm[n], pbofs, "", verbosity);
3073
3074 close_tag.set_name("/Array");
3075 close_tag.write_to_stream(os_xml);
3076
3077 os_xml << '\n';
3078}
3079
3080//=== ArrayOfRadiationVector ======================================================
3081
3083
3088void xml_read_from_stream(istream& is_xml,
3090 bifstream* pbifs,
3091 const Verbosity& verbosity) {
3092 ArtsXMLTag tag(verbosity);
3093 Index nelem;
3094
3095 tag.read_from_stream(is_xml);
3096 tag.check_name("Array");
3097 tag.check_attribute("type", "RadiationVector");
3098
3099 tag.get_attribute_value("nelem", nelem);
3100 arv.resize(nelem);
3101
3102 Index n;
3103 try {
3104 for (n = 0; n < nelem; n++)
3105 xml_read_from_stream(is_xml, arv[n], pbifs, verbosity);
3106 } catch (const std::runtime_error& e) {
3107 ostringstream os;
3108 os << "Error reading ArrayOfRadiationVector: "
3109 << "\n Element: " << n << "\n"
3110 << e.what();
3111 throw runtime_error(os.str());
3112 }
3113
3114 tag.read_from_stream(is_xml);
3115 tag.check_name("/Array");
3116}
3117
3119
3125void xml_write_to_stream(ostream& os_xml,
3126 const ArrayOfRadiationVector& arv,
3127 bofstream* pbofs,
3128 const String& name,
3129 const Verbosity& verbosity) {
3130 ArtsXMLTag open_tag(verbosity);
3131 ArtsXMLTag close_tag(verbosity);
3132
3133 open_tag.set_name("Array");
3134 if (name.length()) open_tag.add_attribute("name", name);
3135
3136 open_tag.add_attribute("type", "RadiationVector");
3137 open_tag.add_attribute("nelem", arv.nelem());
3138
3139 open_tag.write_to_stream(os_xml);
3140 os_xml << '\n';
3141
3142 for (Index n = 0; n < arv.nelem(); n++)
3143 xml_write_to_stream(os_xml, arv[n], pbofs, "", verbosity);
3144
3145 close_tag.set_name("/Array");
3146 close_tag.write_to_stream(os_xml);
3147
3148 os_xml << '\n';
3149}
3150
3151//=== ArrayOfArrayOfRadiationVector ======================================================
3152
3154
3159void xml_read_from_stream(istream& is_xml,
3161 bifstream* pbifs,
3162 const Verbosity& verbosity) {
3163 ArtsXMLTag tag(verbosity);
3164 Index nelem;
3165
3166 tag.read_from_stream(is_xml);
3167 tag.check_name("Array");
3168 tag.check_attribute("type", "ArrayOfRadiationVector");
3169
3170 tag.get_attribute_value("nelem", nelem);
3171 aarv.resize(nelem);
3172
3173 Index n;
3174 try {
3175 for (n = 0; n < nelem; n++)
3176 xml_read_from_stream(is_xml, aarv[n], pbifs, verbosity);
3177 } catch (const std::runtime_error& e) {
3178 ostringstream os;
3179 os << "Error reading ArrayOfArrayOfRadiationVector: "
3180 << "\n Element: " << n << "\n"
3181 << e.what();
3182 throw runtime_error(os.str());
3183 }
3184
3185 tag.read_from_stream(is_xml);
3186 tag.check_name("/Array");
3187}
3188
3190
3196void xml_write_to_stream(ostream& os_xml,
3198 bofstream* pbofs,
3199 const String& name,
3200 const Verbosity& verbosity) {
3201 ArtsXMLTag open_tag(verbosity);
3202 ArtsXMLTag close_tag(verbosity);
3203
3204 open_tag.set_name("Array");
3205 if (name.length()) open_tag.add_attribute("name", name);
3206
3207 open_tag.add_attribute("type", "ArrayOfRadiationVector");
3208 open_tag.add_attribute("nelem", aarv.nelem());
3209
3210 open_tag.write_to_stream(os_xml);
3211 os_xml << '\n';
3212
3213 for (Index n = 0; n < aarv.nelem(); n++)
3214 xml_write_to_stream(os_xml, aarv[n], pbofs, "", verbosity);
3215
3216 close_tag.set_name("/Array");
3217 close_tag.write_to_stream(os_xml);
3218
3219 os_xml << '\n';
3220}
3221
3222//=== ArrayOfPropagationMatrix ======================================================
3223
3225
3230void xml_read_from_stream(istream& is_xml,
3232 bifstream* pbifs,
3233 const Verbosity& verbosity) {
3234 ArtsXMLTag tag(verbosity);
3235 Index nelem;
3236
3237 tag.read_from_stream(is_xml);
3238 tag.check_name("Array");
3239 tag.check_attribute("type", "PropagationMatrix");
3240
3241 tag.get_attribute_value("nelem", nelem);
3242 apm.resize(nelem);
3243
3244 Index n;
3245 try {
3246 for (n = 0; n < nelem; n++)
3247 xml_read_from_stream(is_xml, apm[n], pbifs, verbosity);
3248 } catch (const std::runtime_error& e) {
3249 ostringstream os;
3250 os << "Error reading ArrayOfPropagationMatrix: "
3251 << "\n Element: " << n << "\n"
3252 << e.what();
3253 throw runtime_error(os.str());
3254 }
3255
3256 tag.read_from_stream(is_xml);
3257 tag.check_name("/Array");
3258}
3259
3261
3267void xml_write_to_stream(ostream& os_xml,
3268 const ArrayOfPropagationMatrix& apm,
3269 bofstream* pbofs,
3270 const String& name,
3271 const Verbosity& verbosity) {
3272 ArtsXMLTag open_tag(verbosity);
3273 ArtsXMLTag close_tag(verbosity);
3274
3275 open_tag.set_name("Array");
3276 if (name.length()) open_tag.add_attribute("name", name);
3277
3278 open_tag.add_attribute("type", "PropagationMatrix");
3279 open_tag.add_attribute("nelem", apm.nelem());
3280
3281 open_tag.write_to_stream(os_xml);
3282 os_xml << '\n';
3283
3284 for (Index n = 0; n < apm.nelem(); n++)
3285 xml_write_to_stream(os_xml, apm[n], pbofs, "", verbosity);
3286
3287 close_tag.set_name("/Array");
3288 close_tag.write_to_stream(os_xml);
3289
3290 os_xml << '\n';
3291}
3292
3293//=== ArrayOfAbsorptionLines ======================================================
3294
3296
3301void xml_read_from_stream(istream& is_xml,
3303 bifstream* pbifs,
3304 const Verbosity& verbosity) {
3305 ArtsXMLTag tag(verbosity);
3306 Index nelem;
3307
3308 tag.read_from_stream(is_xml);
3309 tag.check_name("Array");
3310 tag.check_attribute("type", "AbsorptionLines");
3311
3312 tag.get_attribute_value("nelem", nelem);
3313 aal.resize(nelem);
3314
3315 Index n;
3316 try {
3317 for (n = 0; n < nelem; n++)
3318 xml_read_from_stream(is_xml, aal[n], pbifs, verbosity);
3319 } catch (const std::runtime_error& e) {
3320 ostringstream os;
3321 os << "Error reading ArrayOfAbsorptionLines: "
3322 << "\n Element: " << n << "\n"
3323 << e.what();
3324 throw runtime_error(os.str());
3325 }
3326
3327 tag.read_from_stream(is_xml);
3328 tag.check_name("/Array");
3329}
3330
3332
3338void xml_write_to_stream(ostream& os_xml,
3339 const ArrayOfAbsorptionLines& aal,
3340 bofstream* pbofs,
3341 const String& name,
3342 const Verbosity& verbosity) {
3343 ArtsXMLTag open_tag(verbosity);
3344 ArtsXMLTag close_tag(verbosity);
3345
3346 open_tag.set_name("Array");
3347 if (name.length()) open_tag.add_attribute("name", name);
3348
3349 open_tag.add_attribute("type", "AbsorptionLines");
3350 open_tag.add_attribute("nelem", aal.nelem());
3351
3352 open_tag.write_to_stream(os_xml);
3353 os_xml << '\n';
3354
3355 for (Index n = 0; n < aal.nelem(); n++)
3356 xml_write_to_stream(os_xml, aal[n], pbofs, "", verbosity);
3357
3358 close_tag.set_name("/Array");
3359 close_tag.write_to_stream(os_xml);
3360
3361 os_xml << '\n';
3362}
3363
3364//=== ArrayOfArrayOfAbsorptionLines ======================================================
3365
3367
3372void xml_read_from_stream(istream& is_xml,
3374 bifstream* pbifs,
3375 const Verbosity& verbosity) {
3376 ArtsXMLTag tag(verbosity);
3377 Index nelem;
3378
3379 tag.read_from_stream(is_xml);
3380 tag.check_name("Array");
3381 tag.check_attribute("type", "ArrayOfAbsorptionLines");
3382
3383 tag.get_attribute_value("nelem", nelem);
3384 aal.resize(nelem);
3385
3386 Index n;
3387 try {
3388 for (n = 0; n < nelem; n++)
3389 xml_read_from_stream(is_xml, aal[n], pbifs, verbosity);
3390 } catch (const std::runtime_error& e) {
3391 ostringstream os;
3392 os << "Error reading ArrayOfArrayOfAbsorptionLines: "
3393 << "\n Element: " << n << "\n"
3394 << e.what();
3395 throw runtime_error(os.str());
3396 }
3397
3398 tag.read_from_stream(is_xml);
3399 tag.check_name("/Array");
3400}
3401
3403
3409void xml_write_to_stream(ostream& os_xml,
3411 bofstream* pbofs,
3412 const String& name,
3413 const Verbosity& verbosity) {
3414 ArtsXMLTag open_tag(verbosity);
3415 ArtsXMLTag close_tag(verbosity);
3416
3417 open_tag.set_name("Array");
3418 if (name.length()) open_tag.add_attribute("name", name);
3419
3420 open_tag.add_attribute("type", "ArrayOfAbsorptionLines");
3421 open_tag.add_attribute("nelem", aal.nelem());
3422
3423 open_tag.write_to_stream(os_xml);
3424 os_xml << '\n';
3425
3426 for (Index n = 0; n < aal.nelem(); n++)
3427 xml_write_to_stream(os_xml, aal[n], pbofs, "", verbosity);
3428
3429 close_tag.set_name("/Array");
3430 close_tag.write_to_stream(os_xml);
3431
3432 os_xml << '\n';
3433}
3434
3435//=== ArrayOfArrayOfPropagationMatrix ======================================================
3436
3438
3443void xml_read_from_stream(istream& is_xml,
3445 bifstream* pbifs,
3446 const Verbosity& verbosity) {
3447 ArtsXMLTag tag(verbosity);
3448 Index nelem;
3449
3450 tag.read_from_stream(is_xml);
3451 tag.check_name("Array");
3452 tag.check_attribute("type", "ArrayOfPropagationMatrix");
3453
3454 tag.get_attribute_value("nelem", nelem);
3455 aapm.resize(nelem);
3456
3457 Index n;
3458 try {
3459 for (n = 0; n < nelem; n++)
3460 xml_read_from_stream(is_xml, aapm[n], pbifs, verbosity);
3461 } catch (const std::runtime_error& e) {
3462 ostringstream os;
3463 os << "Error reading ArrayOfArrayOfPropagationMatrix: "
3464 << "\n Element: " << n << "\n"
3465 << e.what();
3466 throw runtime_error(os.str());
3467 }
3468
3469 tag.read_from_stream(is_xml);
3470 tag.check_name("/Array");
3471}
3472
3474
3480void xml_write_to_stream(ostream& os_xml,
3482 bofstream* pbofs,
3483 const String& name,
3484 const Verbosity& verbosity) {
3485 ArtsXMLTag open_tag(verbosity);
3486 ArtsXMLTag close_tag(verbosity);
3487
3488 open_tag.set_name("Array");
3489 if (name.length()) open_tag.add_attribute("name", name);
3490
3491 open_tag.add_attribute("type", "ArrayOfPropagationMatrix");
3492 open_tag.add_attribute("nelem", aapm.nelem());
3493
3494 open_tag.write_to_stream(os_xml);
3495 os_xml << '\n';
3496
3497 for (Index n = 0; n < aapm.nelem(); n++)
3498 xml_write_to_stream(os_xml, aapm[n], pbofs, "", verbosity);
3499
3500 close_tag.set_name("/Array");
3501 close_tag.write_to_stream(os_xml);
3502
3503 os_xml << '\n';
3504}
3505
3506//=== ArrayOfStokesVector ======================================================
3507
3509
3514void xml_read_from_stream(istream& is_xml,
3516 bifstream* pbifs,
3517 const Verbosity& verbosity) {
3518 ArtsXMLTag tag(verbosity);
3519 Index nelem;
3520
3521 tag.read_from_stream(is_xml);
3522 tag.check_name("Array");
3523 tag.check_attribute("type", "StokesVector");
3524
3525 tag.get_attribute_value("nelem", nelem);
3526 apm.resize(nelem);
3527
3528 Index n;
3529 try {
3530 for (n = 0; n < nelem; n++)
3531 xml_read_from_stream(is_xml, apm[n], pbifs, verbosity);
3532 } catch (const std::runtime_error& e) {
3533 ostringstream os;
3534 os << "Error reading ArrayOfStokesVector: "
3535 << "\n Element: " << n << "\n"
3536 << e.what();
3537 throw runtime_error(os.str());
3538 }
3539
3540 tag.read_from_stream(is_xml);
3541 tag.check_name("/Array");
3542}
3543
3545
3551void xml_write_to_stream(ostream& os_xml,
3552 const ArrayOfStokesVector& apm,
3553 bofstream* pbofs,
3554 const String& name,
3555 const Verbosity& verbosity) {
3556 ArtsXMLTag open_tag(verbosity);
3557 ArtsXMLTag close_tag(verbosity);
3558
3559 open_tag.set_name("Array");
3560 if (name.length()) open_tag.add_attribute("name", name);
3561
3562 open_tag.add_attribute("type", "StokesVector");
3563 open_tag.add_attribute("nelem", apm.nelem());
3564
3565 open_tag.write_to_stream(os_xml);
3566 os_xml << '\n';
3567
3568 for (Index n = 0; n < apm.nelem(); n++)
3569 xml_write_to_stream(os_xml, apm[n], pbofs, "", verbosity);
3570
3571 close_tag.set_name("/Array");
3572 close_tag.write_to_stream(os_xml);
3573
3574 os_xml << '\n';
3575}
3576
3577//=== ArrayOfArrayOfStokesVector ======================================================
3578
3580
3585void xml_read_from_stream(istream& is_xml,
3587 bifstream* pbifs,
3588 const Verbosity& verbosity) {
3589 ArtsXMLTag tag(verbosity);
3590 Index nelem;
3591
3592 tag.read_from_stream(is_xml);
3593 tag.check_name("Array");
3594 tag.check_attribute("type", "ArrayOfStokesVector");
3595
3596 tag.get_attribute_value("nelem", nelem);
3597 aapm.resize(nelem);
3598
3599 Index n;
3600 try {
3601 for (n = 0; n < nelem; n++)
3602 xml_read_from_stream(is_xml, aapm[n], pbifs, verbosity);
3603 } catch (const std::runtime_error& e) {
3604 ostringstream os;
3605 os << "Error reading ArrayOfArrayOfStokesVector: "
3606 << "\n Element: " << n << "\n"
3607 << e.what();
3608 throw runtime_error(os.str());
3609 }
3610
3611 tag.read_from_stream(is_xml);
3612 tag.check_name("/Array");
3613}
3614
3616
3622void xml_write_to_stream(ostream& os_xml,
3623 const ArrayOfArrayOfStokesVector& aapm,
3624 bofstream* pbofs,
3625 const String& name,
3626 const Verbosity& verbosity) {
3627 ArtsXMLTag open_tag(verbosity);
3628 ArtsXMLTag close_tag(verbosity);
3629
3630 open_tag.set_name("Array");
3631 if (name.length()) open_tag.add_attribute("name", name);
3632
3633 open_tag.add_attribute("type", "ArrayOfStokesVector");
3634 open_tag.add_attribute("nelem", aapm.nelem());
3635
3636 open_tag.write_to_stream(os_xml);
3637 os_xml << '\n';
3638
3639 for (Index n = 0; n < aapm.nelem(); n++)
3640 xml_write_to_stream(os_xml, aapm[n], pbofs, "", verbosity);
3641
3642 close_tag.set_name("/Array");
3643 close_tag.write_to_stream(os_xml);
3644
3645 os_xml << '\n';
3646}
3647
3648//=== ArrayOfXsecRecord ======================================================
3649
3651
3656void xml_read_from_stream(istream& is_xml,
3657 ArrayOfXsecRecord& axd,
3658 bifstream* pbifs,
3659 const Verbosity& verbosity) {
3660 ArtsXMLTag tag(verbosity);
3661 Index nelem;
3662
3663 tag.read_from_stream(is_xml);
3664 tag.check_name("Array");
3665 tag.check_attribute("type", "XsecRecord");
3666
3667 tag.get_attribute_value("nelem", nelem);
3668 axd.resize(nelem);
3669
3670 Index n;
3671 try {
3672 for (n = 0; n < nelem; n++)
3673 xml_read_from_stream(is_xml, axd[n], pbifs, verbosity);
3674 } catch (const std::runtime_error& e) {
3675 ostringstream os;
3676 os << "Error reading ArrayOfXsecRecord: "
3677 << "\n Element: " << n << "\n"
3678 << e.what();
3679 throw runtime_error(os.str());
3680 }
3681
3682 tag.read_from_stream(is_xml);
3683 tag.check_name("/Array");
3684}
3685
3687
3693void xml_write_to_stream(ostream& os_xml,
3694 const ArrayOfXsecRecord& axd,
3695 bofstream* pbofs,
3696 const String& name,
3697 const Verbosity& verbosity) {
3698 ArtsXMLTag open_tag(verbosity);
3699 ArtsXMLTag close_tag(verbosity);
3700
3701 open_tag.set_name("Array");
3702 if (name.length()) open_tag.add_attribute("name", name);
3703
3704 open_tag.add_attribute("type", "XsecRecord");
3705 open_tag.add_attribute("nelem", axd.nelem());
3706
3707 open_tag.write_to_stream(os_xml);
3708 os_xml << '\n';
3709
3710 for (Index n = 0; n < axd.nelem(); n++)
3711 xml_write_to_stream(os_xml, axd[n], pbofs, "", verbosity);
3712
3713 close_tag.set_name("/Array");
3714 close_tag.write_to_stream(os_xml);
3715
3716 os_xml << '\n';
3717}
3718
3719//=== ArrayOfTime ======================================================
3720
3722
3727void xml_read_from_stream(istream& is_xml,
3728 ArrayOfTime& at,
3729 bifstream* pbifs,
3730 const Verbosity& verbosity) {
3731 ArtsXMLTag tag(verbosity);
3732 Index nelem;
3733
3734 tag.read_from_stream(is_xml);
3735 tag.check_name("Array");
3736 tag.check_attribute("type", "Time");
3737
3738 tag.get_attribute_value("nelem", nelem);
3739 at.resize(nelem);
3740
3741 Index n;
3742 try {
3743 for (n = 0; n < nelem; n++)
3744 xml_read_from_stream(is_xml, at[n], pbifs, verbosity);
3745 } catch (const std::runtime_error& e) {
3746 ostringstream os;
3747 os << "Error reading ArrayOfTime: "
3748 << "\n Element: " << n << "\n"
3749 << e.what();
3750 throw runtime_error(os.str());
3751 }
3752
3753 tag.read_from_stream(is_xml);
3754 tag.check_name("/Array");
3755}
3756
3758
3764void xml_write_to_stream(ostream& os_xml,
3765 const ArrayOfTime& at,
3766 bofstream* pbofs,
3767 const String& name,
3768 const Verbosity& verbosity) {
3769 ArtsXMLTag open_tag(verbosity);
3770 ArtsXMLTag close_tag(verbosity);
3771
3772 open_tag.set_name("Array");
3773 if (name.length()) open_tag.add_attribute("name", name);
3774
3775 open_tag.add_attribute("type", "Time");
3776 open_tag.add_attribute("nelem", at.nelem());
3777
3778 open_tag.write_to_stream(os_xml);
3779 os_xml << '\n';
3780
3781 for (Index n = 0; n < at.nelem(); n++)
3782 xml_write_to_stream(os_xml, at[n], pbofs, "", verbosity);
3783
3784 close_tag.set_name("/Array");
3785 close_tag.write_to_stream(os_xml);
3786
3787 os_xml << '\n';
3788}
3789
3790//=== ArrayOfArrayOfTime ======================================================
3791
3793
3798void xml_read_from_stream(istream& is_xml,
3800 bifstream* pbifs,
3801 const Verbosity& verbosity) {
3802 ArtsXMLTag tag(verbosity);
3803 Index nelem;
3804
3805 tag.read_from_stream(is_xml);
3806 tag.check_name("Array");
3807 tag.check_attribute("type", "ArrayOfTime");
3808
3809 tag.get_attribute_value("nelem", nelem);
3810 at.resize(nelem);
3811
3812 Index n;
3813 try {
3814 for (n = 0; n < nelem; n++)
3815 xml_read_from_stream(is_xml, at[n], pbifs, verbosity);
3816 } catch (const std::runtime_error& e) {
3817 ostringstream os;
3818 os << "Error reading ArrayOfArrayOfTime: "
3819 << "\n Element: " << n << "\n"
3820 << e.what();
3821 throw runtime_error(os.str());
3822 }
3823
3824 tag.read_from_stream(is_xml);
3825 tag.check_name("/Array");
3826}
3827
3829
3835void xml_write_to_stream(ostream& os_xml,
3836 const ArrayOfArrayOfTime& at,
3837 bofstream* pbofs,
3838 const String& name,
3839 const Verbosity& verbosity) {
3840 ArtsXMLTag open_tag(verbosity);
3841 ArtsXMLTag close_tag(verbosity);
3842
3843 open_tag.set_name("Array");
3844 if (name.length()) open_tag.add_attribute("name", name);
3845
3846 open_tag.add_attribute("type", "ArrayOfTime");
3847 open_tag.add_attribute("nelem", at.nelem());
3848
3849 open_tag.write_to_stream(os_xml);
3850 os_xml << '\n';
3851
3852 for (Index n = 0; n < at.nelem(); n++)
3853 xml_write_to_stream(os_xml, at[n], pbofs, "", verbosity);
3854
3855 close_tag.set_name("/Array");
3856 close_tag.write_to_stream(os_xml);
3857
3858 os_xml << '\n';
3859}
3860
The global header file for ARTS.
This can be used to make arrays out of anything.
Definition: array.h:48
Index nelem() const ARTS_NOEXCEPT
Definition: array.h:92
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:70
void write_to_stream(ostream &os)
Write XML tag.
Definition: xml_io_base.cc:322
void check_name(const String &expected_name)
Check tag name.
Definition: xml_io_base.cc:54
void read_from_stream(istream &is)
Reads next XML tag.
Definition: xml_io_base.cc:201
void get_attribute_value(const String &aname, String &value)
Definition: xml_io_base.cc:140
void set_name(const String &new_name)
Definition: xml_io_base.h:78
void check_attribute(const String &aname, const String &value)
Checks whether attribute has the expected value.
Definition: xml_io_base.cc:111
Binary output file stream class.
Definition: bifstream.h:43
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
Quantum::Number::GlobalState QuantumIdentifier
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.