ARTS 2.5.11 (git: 6827797f)
methods_aux.cc
Go to the documentation of this file.
1
13#include <algorithm>
14#include <map>
15#include "arts.h"
16#include "groups.h"
17#include "methods.h"
18#include "workspace_ng.h"
20#include "wsv_aux.h"
21
22namespace global_data {
24map<String, Index> MdMap;
26map<String, Index> MdRawMap;
28
34
35extern const Array<MdRecord> md_data_raw;
37} // namespace global_data
38
39void limit_line_length(ostream& os,
40 ostringstream& curline,
41 ostringstream& token,
42 const String& indent,
43 size_t linelen);
44
46
52MdRecord::MdRecord(const char* name,
53 const char* description,
54 const ArrayOfString& authors,
55 const ArrayOfString& output,
56 const ArrayOfString& gout,
57 const ArrayOfString& gouttype,
58 const ArrayOfString& goutdesc,
59 const ArrayOfString& input,
60 const ArrayOfString& gin,
61 const ArrayOfString& gintype,
62 const ArrayOfString& gindefault,
63 const ArrayOfString& gindesc,
64 bool set_method,
65 bool agenda_method,
66 bool uses_templates,
67 bool pass_workspace,
68 bool pass_wsv_names)
69 : mname(name),
70 mdescription(description),
71 mauthors(authors),
72 moutput(0),
73 mgout(gout),
74 mgouttype(0),
75 mgoutdesc(goutdesc),
76 minput(0),
77 mgin(gin),
78 mgintype(0),
79 mgindefault(gindefault),
80 mgindesc(gindesc),
81 mset_method(set_method),
82 magenda_method(agenda_method),
83 msupergeneric(false),
84 muses_templates(uses_templates),
85 mpass_workspace(pass_workspace),
86 mpass_wsv_names(pass_wsv_names),
87 mactual_groups("") {
88 // Initializing the various arrays with input data should now
89 // work correctly.
90
91 // Generic variable names, types and defaults must have the same number of
92 // elements. (Defaults specifies the default values associated with each
93 // generic input.)
94 ARTS_ASSERT(mgout.nelem() == gouttype.nelem());
95 ARTS_ASSERT(mgout.nelem() == goutdesc.nelem());
97 ARTS_ASSERT(mgin.nelem() == gintype.nelem());
98 ARTS_ASSERT(mgin.nelem() == gindesc.nelem());
99
100 // Check that GIN and GOUT don't contain duplicates
101 ArrayOfString gin_sorted = mgin;
102 std::sort(gin_sorted.begin(), gin_sorted.end());
103 ArrayOfString gout_sorted = mgout;
104 std::sort(gout_sorted.begin(), gout_sorted.end());
105
106 for (auto par = mgin.begin(); mgin.nelem() > 1 && par + 1 != mgin.end();
107 par++) {
108 if (*par == *(par + 1)) {
109 std::ostringstream os;
110 os << "Two input parameters by the same name are not allowed: \n";
111 os << "Method: " << mname << ", Parameter: " << *par;
112 throw std::runtime_error(os.str());
113 }
114 }
115
116 for (auto par = mgout.begin(); mgout.nelem() > 1 && par + 1 != mgout.end();
117 par++) {
118 if (*par == *(par + 1)) {
119 std::ostringstream os;
120 os << "Two output parameters by the same name are not allowed: \n";
121 os << "Method: " << mname << ", Parameter: " << *par;
122 throw std::runtime_error(os.str());
123 }
124 }
125
126 // Check that GIN and GOUT don't share parameter names
127 ArrayOfString gisect(gin_sorted.nelem());
128 auto it = std::set_intersection(gin_sorted.begin(),
129 gin_sorted.end(),
130 gout_sorted.begin(),
131 gout_sorted.end(),
132 gisect.begin());
133 gisect.resize(it - gisect.begin());
134
135 if (gisect.nelem() > 0) {
136 std::ostringstream os;
137 os << "Using the same name for a generic input and generic output variable is not allowed: \n";
138 os << "Method: " << mname << ", Parameter: ";
139 for (auto& gname : gisect) {
140 os << gname << " ";
141 }
142 throw std::runtime_error(os.str());
143 }
144
145 // Map the WSV names to indexes
146 moutput.resize(output.nelem());
147 for (Index j = 0; j < output.nelem(); ++j) {
148 moutput[j] = global_data::WsvMap.at(output[j]);
149 if (moutput[j] == -1) {
150 ostringstream os;
151 os << "Unknown WSV " << output[j] << " for output (parameter #" << j
152 << ") "
153 << "in WSM " << mname;
154 throw runtime_error(os.str());
155 }
156 }
157
158 minput.resize(input.nelem());
159 for (Index j = 0; j < input.nelem(); ++j) {
160 minput[j] = global_data::WsvMap.at(input[j]);
161 if (minput[j] == -1) {
162 ostringstream os;
163 os << "Unknown WSV " << input[j] << " for input (parameter #" << j << ") "
164 << "in WSM " << mname;
165 throw runtime_error(os.str());
166 }
167 }
168
169 // Map the group names to groups' indexes
170 mgoutspectype.resize(gouttype.nelem());
171 mgouttype.resize(gouttype.nelem());
172 for (Index j = 0; j < gouttype.nelem(); ++j) {
173 ArrayOfIndex types;
174 get_wsv_group_ids(types, gouttype[j]);
175
176 if (types.nelem() == 1) {
177 mgouttype[j] = types[0];
178 mgoutspectype[j].resize(0);
179 if (types[0] == get_wsv_group_id("Any") && !muses_templates) {
180 ostringstream os;
181 os << "WSM " << mname << " takes \"Any\" as input and\n"
182 << "therefore must be implemented as a template function.\n"
183 << "Pass USES_TEMPLATES(true) in methods.cc!";
184 throw runtime_error(os.str());
185 }
186 } else if (types.nelem() > 1) {
187 mgouttype[j] = get_wsv_group_id("Any");
188 mgoutspectype[j] = types;
189 } else {
190 ostringstream os;
191 os << "Unknown WSV Group " << gouttype[j] << " for generic output "
192 << "in WSM " << mname;
193 throw runtime_error(os.str());
194 }
195 }
196
197 mginspectype.resize(gintype.nelem());
198 mgintype.resize(gintype.nelem());
199 for (Index j = 0; j < gintype.nelem(); ++j) {
200 ArrayOfIndex types;
201 get_wsv_group_ids(types, gintype[j]);
202
203 if (types.nelem() == 1) {
204 mgintype[j] = get_wsv_group_id(gintype[j]);
205 mginspectype[j].resize(0);
206 if (types[0] == get_wsv_group_id("Any") && !muses_templates) {
207 ostringstream os;
208 os << "WSM " << mname << " defines \"Any\" as output and\n"
209 << "therefore must be implemented as a template function.\n"
210 << "Pass USES_TEMPLATES(true) in methods.cc!";
211 throw runtime_error(os.str());
212 }
213 } else if (types.nelem() > 1) {
214 mgintype[j] = get_wsv_group_id("Any");
215 mginspectype[j] = types;
216 } else {
217 ostringstream os;
218 os << "Unknown WSV Group " << gintype[j] << " for generic input "
219 << "in WSM " << mname;
220 throw runtime_error(os.str());
221 }
222 }
223
224 // Check that the number of types for all supergeneric variables are
225 // consistent
227 bool consistent = true;
228 Index nspecs = 0;
229 for (Index i = 0; consistent && i < mginspectype.nelem(); i++) {
230 if (mginspectype[0].nelem()) {
231 if (!nspecs)
232 nspecs = mginspectype[0].nelem();
233 else if (nspecs != mginspectype[0].nelem())
234 consistent = false;
235 }
236 }
237
238 for (Index i = 0; consistent && i < mgoutspectype.nelem(); i++) {
239 if (mgoutspectype[0].nelem()) {
240 if (!nspecs)
241 nspecs = mgoutspectype[0].nelem();
242 else if (nspecs != mgoutspectype[0].nelem())
243 consistent = false;
244 }
245 }
246 if (!consistent) {
247 ostringstream os;
248 os << "Inconsistent number of types given for supergeneric variables"
249 << endl
250 << "in WSM " << mname << "." << endl;
251 throw runtime_error(os.str());
252 }
253 }
254
255 // Find out if this method is supergeneric, and set the flag if
256 // yes:
257 const Index anyid = get_wsv_group_id("Any");
258 for (Index j = 0; j < mgouttype.nelem(); ++j)
259 if (anyid == mgouttype[j]) msupergeneric = true;
260 for (Index j = 0; j < mgintype.nelem(); ++j)
261 if (anyid == mgintype[j]) msupergeneric = true;
262
263 // Determine variables that are only input
264 minonly = minput; // Input
265 for (ArrayOfIndex::const_iterator j = moutput.begin(); j < moutput.end(); ++j)
266 for (ArrayOfIndex::iterator k = minonly.begin(); k < minonly.end(); ++k)
267 if (*j == *k) {
268 k = minonly.erase(k) - 1;
269 // We need the -1 here, otherwise due to the
270 // following increment we would miss the element
271 // behind the erased one, which is now at the
272 // position of the erased one.
273 }
274
275 // Determine variables that are input and output
276 minout.resize(0);
277 Index i = 0;
278 for (ArrayOfIndex::const_iterator j = moutput.begin(); j < moutput.end();
279 ++j, ++i)
280 for (ArrayOfIndex::const_iterator k = minput.begin(); k < minput.end(); ++k)
281 if (*j == *k) minout.push_back(i);
282
283 // Determine variables that are only output
284 moutonly = moutput; // Output
285 for (ArrayOfIndex::const_iterator j = minput.begin(); j < minput.end(); ++j)
286 for (ArrayOfIndex::iterator k = moutonly.begin(); k < moutonly.end(); ++k)
287 if (*j == *k) {
288 k = moutonly.erase(k) - 1;
289 // We need the -1 here, otherwise due to the
290 // following increment we would miss the element
291 // behind the erased one, which is now at the
292 // position of the erased one.
293 }
294}
295
297
307 const Index wsv_group_id_Any = get_wsv_group_id("Any");
308 // The group names, we need them for the expansion:
310
311 // Make sure they are initialized:
312 ARTS_ASSERT(0 != wsv_groups.nelem());
313
314 // Make sure that g is in the allowed range, which means
315 // 0<=g<wsv_groups.nelem() and g != Any_
316 ARTS_ASSERT(0 <= g);
317 ARTS_ASSERT(wsv_group_id_Any != g);
318 ARTS_ASSERT(g < wsv_groups.nelem());
319
320 // Make sure that this really is a supergeneric method:
322
323 // Modify the name:
324 // {
325 // ostringstream os;
326 // os << mname << "_sg_" << wsv_groups[g];
327 // mname = os.str();
328 // }
329
330 for (Index j = 0; j < mgouttype.nelem(); ++j)
331 if (wsv_group_id_Any == mgouttype[j]) mgouttype[j] = g;
332 for (Index j = 0; j < mgintype.nelem(); ++j)
333 if (wsv_group_id_Any == mgintype[j]) mgintype[j] = g;
334
335 // Set the field for the actual group:
336 mactual_groups = wsv_groups[g].name;
337}
338
340
350 // The group names, we need them for the expansion:
352
353 const Index wsv_group_id_Any = get_wsv_group_id("Any");
354
355 // Make sure that g is in the allowed range, which means
356 // 0<=g<wsv_groups.nelem() and g != Any_
357 ARTS_ASSERT(0 <= g);
358
359 // Make sure that this really is a supergeneric method:
361
362 // Modify the name:
363 // {
364 // ostringstream os;
365 // os << mname << "_sg_" << wsv_groups[g];
366 // mname = os.str();
367 // }
368
369 mactual_groups = "";
370 for (Index j = 0; j < mgouttype.nelem(); ++j)
371 if (wsv_group_id_Any == mgouttype[j]) {
372 mgouttype[j] = mgoutspectype[j][g];
373 // Set the field for the actual group:
374 mactual_groups += wsv_groups[mgoutspectype[j][g]].name;
375 }
376
377 for (Index j = 0; j < mgintype.nelem(); ++j)
378 if (wsv_group_id_Any == mgintype[j]) {
379 mgintype[j] = mginspectype[j][g];
380 // Set the field for the actual group:
381 mactual_groups += wsv_groups[mginspectype[j][g]].name;
382 }
383}
384
386
398
399 // The group names, we need them for the expansion:
401
402 const Index wsv_group_id_Any = get_wsv_group_id("Any");
403
404 // Make sure that they have been initialized:
405 ARTS_ASSERT(0 != wsv_groups.nelem());
406
407 // Reset md_data, just in case:
408 md_data.resize(0);
409
410 for (Index i = 0; i < md_data_raw.nelem(); ++i) {
411 const MdRecord& mdd = md_data_raw[i];
412
413 if (!mdd.Supergeneric()) {
414 md_data.push_back(mdd);
415 } else {
416 // Special treatment for supergeneric methods:
417
418 // Check if the method is really supergeneric or just valid
419 // for certain types.
420
421 if ((mdd.GInSpecType().nelem() && mdd.GInSpecType()[0].nelem()) ||
422 (mdd.GOutSpecType().nelem() && mdd.GOutSpecType()[0].nelem())) {
423 Index max = 0;
424 if (mdd.GInSpecType().nelem()) max = mdd.GInSpecType()[0].nelem();
425 if (mdd.GOutSpecType().nelem() && mdd.GOutSpecType()[0].nelem() > max)
426 max = mdd.GOutSpecType()[0].nelem();
427
428 for (Index k = 0; k < max; k++) {
429 MdRecord mdlocal = mdd;
430
432
433 md_data.push_back(mdlocal);
434 }
435 } else {
436 for (Index j = 0; j < wsv_groups.nelem(); ++j) {
437 // Any_ itself is also a group, but we don't want to
438 // create a record for Any_!
439 if (wsv_group_id_Any != j) {
440 // Not a reference but a copy this time, since we
441 // have to manipulate this.
442 MdRecord mdlocal = mdd;
443
444 mdlocal.subst_any_with_group(j);
445
446 md_data.push_back(mdlocal);
447 }
448 }
449 }
450 }
451 }
452}
453
455
459 // md_data is constant here and should never be changed
461 using global_data::MdMap;
463
464 // Check that md_data and wsv_groups have already be defined:
465 ARTS_ASSERT(0 != md_data.nelem());
466 ARTS_ASSERT(0 != wsv_groups.nelem());
467
468 for (Index i = 0; i < md_data.nelem(); ++i) {
469 const MdRecord& mdd = md_data[i];
470
471 // For supergeneric methods, add group to method name
472 String methodname;
473 ostringstream os;
474 if (mdd.Supergeneric()) {
475 os << mdd.Name() << "_sg_" << mdd.ActualGroups();
476 } else {
477 os << mdd.Name();
478 }
479 methodname = os.str();
480
481 MdMap[methodname] = i;
482 }
483}
484
486
497
498 for (Index i = 0; i < md_data_raw.nelem(); ++i) {
499 MdRawMap[md_data_raw[i].Name()] = i;
500 }
501}
502
504 const String& indent,
505 const size_t linelen,
506 const size_t offset) {
507 bool fit = true;
508 String out;
509 String token;
510 size_t currentlinelength = offset;
511 for (size_t i = 0; i < s.length(); i++) {
512 if (s[i] == '\n') s[i] = ' ';
513 token += s[i];
514 if (s[i] == ' ') {
515 if (currentlinelength + token.length() > linelen) {
516 out += '\n' + indent;
517 currentlinelength = indent.length();
518 fit = false;
519 }
520 out += token;
521 currentlinelength += token.length();
522 token = "";
523 }
524 }
525
526 if (token.length()) {
527 if (currentlinelength + token.length() > linelen) {
528 out += '\n' + indent;
529 fit = false;
530 }
531 out += token;
532 }
533 s = out;
534 return fit;
535}
536
538 Index pos;
539 Index pos2;
540
541 // Find the end of the short WSV description
542 pos = desc.find(".\n");
543 pos2 = desc.find(". ");
544 if (pos == String::npos || (pos2 != String::npos && pos2 < pos)) pos = pos2;
545 if (pos == String::npos) pos = desc.find("\n");
546 if (pos != String::npos)
547 s = desc.substr(0, pos + 1);
548 else
549 s = desc;
550
551 // Replace any newlines inside the description with spaces
552 while ((pos = s.find("\n")) != String::npos) {
553 s[pos] = ' ';
554 }
555}
556
557ostream& MdRecord::PrintTemplate(ostream& os, bool show_description) const {
559
560 if (show_description) {
561 // FIXME: Print description String!
562 }
563
564 os << Name();
565
566 // Is this a generic method? -- Then we need round braces.
567 if (0 != GOutType().nelem() + GInType().nelem()) {
568 // First entry needs to comma before:
569 bool first = true;
570
571 os << '(';
572
573 for (Index i = 0; i < GOutType().nelem(); ++i) {
574 if (first)
575 first = false;
576 else
577 os << ",\n";
578
579 os << wsv_groups[GOutType()[i]];
580 }
581
582 for (Index i = 0; i < GInType().nelem(); ++i) {
583 if (first)
584 first = false;
585 else
586 os << ",\n";
587
588 os << wsv_groups[GInType()[i]];
589 }
590
591 os << ')';
592 }
593
594 // Now the keywords:
595
596 os << '{';
597
598 // Determine the length of the longest keyword:
599 Index maxsize = 0;
600 for (Index i = 0; i < GIn().nelem(); ++i)
601 if (GIn()[i].nelem() > maxsize) maxsize = GIn()[i].nelem();
602
603 for (Index i = 0; i < GIn().nelem(); ++i) {
604 os << "\t" << setw((int)maxsize) << GIn()[i] << " = \n";
605 }
606
607 os << '}';
608
609 return os;
610}
611
613
618void limit_line_length(ostream& os,
619 ostringstream& curline,
620 ostringstream& token,
621 const String& indent,
622 size_t linelen) {
623 if (indent.length() + curline.str().length() + token.str().length() >
624 linelen) {
625 os << curline.str() << endl << indent;
626 curline.str("");
627 }
628 curline << token.str();
629 token.str("");
630}
631
633ostream& operator<<(ostream& os, const MdRecord& mdr) {
635 bool first;
636 ostringstream buf;
637 ostringstream param;
638 String indent = "";
639 const size_t linelen = 68;
640 bool fit;
641 size_t lastlen;
642
643 os << "\n*-------------------------------------------------------------------*\n"
644 << "Workspace method = " << mdr.Name()
645 << "\n---------------------------------------------------------------------\n"
646 << "\n"
647 << mdr.Description() << "\n";
648
649 if (mdr.Description()[mdr.Description().nelem() - 1] != '\n') {
650 os << "\n";
651 }
652
653 // Print the method's synopsis
654 while (indent.length() < mdr.Name().length() + 2) indent += ' ';
655
656 os << "\nSynopsis:\n\n";
657 buf << mdr.Name() << "( ";
658 first = true;
659 for (Index i = 0; i < mdr.Out().nelem(); ++i) {
660 if (first)
661 first = false;
662 else
663 buf << ", ";
664 param << global_data::wsv_data[mdr.Out()[i]].Name();
665
666 limit_line_length(os, buf, param, indent, linelen);
667 }
668
669 for (Index i = 0; i < mdr.GOutType().nelem(); ++i) {
670 if (first)
671 first = false;
672 else
673 buf << ", ";
674 if (mdr.GOut()[i].length())
675 param << mdr.GOut()[i];
676 else
677 param << "gout" << i;
678
679 limit_line_length(os, buf, param, indent, linelen);
680 }
681
682 const ArrayOfIndex& inonly = mdr.InOnly();
683 for (Index i = 0; i < inonly.nelem(); ++i) {
684 if (first)
685 first = false;
686 else
687 buf << ", ";
688 param << global_data::wsv_data[inonly[i]].Name();
689
690 limit_line_length(os, buf, param, indent, linelen);
691 }
692
693 for (Index i = 0; i < mdr.GInType().nelem(); ++i) {
694 if (first)
695 first = false;
696 else
697 buf << ", ";
698 if (mdr.GIn()[i].length()) {
699 param << mdr.GIn()[i];
700 } else {
701 param << "gin" << i;
702 }
703
704 limit_line_length(os, buf, param, indent, linelen);
705 }
706 if (buf.str().length()) os << buf.str();
707
708 os << " )\n\n\n";
709
710 {
711 bool is_first_author = true;
712 for (Index i = 0; i < mdr.Authors().nelem(); i++) {
713 if (is_first_author) {
714 os << "Authors: ";
715 is_first_author = false;
716 } else
717 os << ", ";
718
719 os << mdr.Authors()[i];
720 }
721 os << "\n";
722 }
723
724 os << "\n\nVariables:\n\n";
725
726 // os << "\n-----\nName = " << mdr.Name() << '\n\n'
727 // << "Description =\n" << mdr.Description() << "\n\n";
728
729 // Out:
730 indent = String(6);
731 String desc;
732 for (Index i = 0; i < mdr.Out().nelem(); ++i) {
733 buf.str("");
734 buf << "OUT ";
735
736 buf << global_data::wsv_data[mdr.Out()[i]].Name();
737 buf << " (";
738 buf << wsv_groups[global_data::wsv_data[mdr.Out()[i]].Group()];
739 buf << "): ";
740
742 global_data::wsv_data[mdr.Out()[i]].Description());
743
744 if (buf.str().length() + desc.length() > linelen) {
745 format_paragraph(desc, indent, linelen);
746 buf << endl << indent << desc;
747 } else {
748 buf << desc;
749 }
750
751 os << buf.str() << endl;
752 }
753
754 for (Index i = 0; i < mdr.GOut().nelem(); ++i) {
755 buf.str("");
756 buf << "GOUT " << mdr.GOut()[i] << " (";
757 if (mdr.GOutType()[i] == get_wsv_group_id("Any") &&
758 mdr.GOutSpecType()[i].nelem()) {
759 bool firstarg = true;
760 for (Index j = 0; j < mdr.GOutSpecType()[i].nelem(); j++) {
761 if (!firstarg)
762 buf << ", ";
763 else
764 firstarg = false;
765 buf << wsv_groups[mdr.GOutSpecType()[i][j]];
766 }
767 } else {
768 buf << wsv_groups[mdr.GOutType()[i]];
769 }
770
771 buf << "): ";
772 desc = buf.str();
773 lastlen = desc.length();
774 fit = format_paragraph(desc, indent, linelen);
775 buf.str("");
776 os << desc;
777
778 desc = mdr.GOutDescription()[i];
779 if (!fit) {
780 format_paragraph(desc, indent, linelen);
781 buf << endl << indent << desc;
782 } else if (lastlen + desc.length() > linelen) {
783 format_paragraph(desc, indent, linelen, lastlen);
784 buf << endl << desc;
785 } else {
786 buf << desc;
787 }
788
789 os << buf.str() << endl;
790 }
791
792 for (Index i = 0; i < mdr.In().nelem(); ++i) {
793 buf.str("");
794 buf << "IN ";
795
796 buf << global_data::wsv_data[mdr.In()[i]].Name();
797 buf << " (";
798 buf << wsv_groups[global_data::wsv_data[mdr.In()[i]].Group()];
799 buf << "): ";
800
802 global_data::wsv_data[mdr.In()[i]].Description());
803
804 if (buf.str().length() + desc.length() > linelen) {
805 format_paragraph(desc, indent, linelen, indent.length());
806 buf << endl << indent << desc;
807 } else {
808 buf << desc;
809 }
810
811 os << buf.str() << endl;
812 }
813
814 for (Index i = 0; i < mdr.GIn().nelem(); ++i) {
815 buf.str("");
816 buf << "GIN " << mdr.GIn()[i] << " (";
817 if (mdr.GInType()[i] == get_wsv_group_id("Any") &&
818 mdr.GInSpecType()[i].nelem()) {
819 bool firstarg = true;
820 for (Index j = 0; j < mdr.GInSpecType()[i].nelem(); j++) {
821 if (!firstarg)
822 buf << ", ";
823 else
824 firstarg = false;
825 buf << wsv_groups[mdr.GInSpecType()[i][j]];
826 }
827 } else {
828 buf << wsv_groups[mdr.GInType()[i]];
829 }
830
831 if (mdr.GInDefault()[i] != NODEF) {
832 buf << ", Default: ";
833 if (mdr.GInType()[i] == get_wsv_group_id("String")) {
834 buf << "\"" << mdr.GInDefault()[i] << "\"";
835 } else {
836 buf << mdr.GInDefault()[i];
837 }
838 }
839
840 buf << "): ";
841 desc = buf.str();
842 lastlen = desc.length();
843 fit = format_paragraph(desc, indent, linelen);
844 buf.str("");
845 os << desc;
846
847 desc = mdr.GInDescription()[i];
848 if (!fit) {
849 format_paragraph(desc, indent, linelen);
850 buf << endl << indent << desc;
851 } else if (lastlen + desc.length() > linelen) {
852 format_paragraph(desc, indent, linelen, indent.length());
853 buf << endl << indent << desc;
854 } else {
855 buf << desc;
856 }
857
858 os << buf.str() << endl;
859 }
860
861 os << "\n*-------------------------------------------------------------------*\n";
862
863 return os;
864}
base max(const Array< base > &x)
Max function.
Definition: array.h:128
The global header file for ARTS.
This can be used to make arrays out of anything.
Definition: array.h:31
Index nelem() const ARTS_NOEXCEPT
Definition: array.h:75
All information for one workspace method.
Definition: methods.h:21
ArrayOfIndex mgouttype
Generic Workspace Output Type.
Definition: methods.h:136
ArrayOfArrayOfIndex mginspectype
Generic Workspace Input Types (Contains the valid types if the method.
Definition: methods.h:156
bool muses_templates
Flag, whether method implementation relies on templates.
Definition: methods.h:199
const ArrayOfIndex & In() const
Definition: methods.h:76
ArrayOfIndex moutput
Workspace Output.
Definition: methods.h:130
String mactual_groups
The actual groups of a supergeneric method.
Definition: methods.h:220
const String & Name() const
Definition: methods.h:68
void subst_any_with_specific_group(Index g)
Expand supergeneric record for given Index in GOutSpecType and GInSpecType.
Definition: methods_aux.cc:349
const ArrayOfIndex & InOnly() const
Definition: methods.h:82
const ArrayOfIndex & GOutType() const
Definition: methods.h:73
const Array< String > & GOutDescription() const
Definition: methods.h:75
const String & ActualGroups() const
Definition: methods.h:91
String mname
The name of this method.
Definition: methods.h:121
const Array< String > & GInDefault() const
Definition: methods.h:80
MdRecord()
Default constructor.
Definition: methods.h:24
ArrayOfIndex minout
Indexes of Input-Output variables.
Definition: methods.h:171
const ArrayOfArrayOfIndex & GInSpecType() const
Definition: methods.h:79
ArrayOfString mgindefault
Generic Workspace Input Defaults.
Definition: methods.h:159
const String & Description() const
Definition: methods.h:69
const ArrayOfString & GOut() const
Definition: methods.h:72
ArrayOfIndex minput
Workspace Input.
Definition: methods.h:146
ArrayOfIndex mgintype
Generic Workspace Input.
Definition: methods.h:152
void subst_any_with_group(Index g)
Expand supergeneric record for given group.
Definition: methods_aux.cc:306
ArrayOfIndex moutonly
Indexes of Output-only variables.
Definition: methods.h:168
const Array< String > & GInDescription() const
Definition: methods.h:81
friend void subst_any_with_group(MdRecord &mdd, Index g)
ArrayOfIndex minonly
Indexes of Input-only variables.
Definition: methods.h:165
bool Supergeneric() const
Definition: methods.h:87
ostream & PrintTemplate(ostream &os, bool show_description=true) const
Print method template for the control file.
Definition: methods_aux.cc:557
const ArrayOfString & Authors() const
Definition: methods.h:70
ArrayOfString mgin
Generic Workspace Input Names.
Definition: methods.h:149
const ArrayOfArrayOfIndex & GOutSpecType() const
Definition: methods.h:74
const ArrayOfIndex & Out() const
Definition: methods.h:71
const ArrayOfIndex & GInType() const
Definition: methods.h:78
ArrayOfString mgout
Generic Workspace Output Names.
Definition: methods.h:133
ArrayOfArrayOfIndex mgoutspectype
Generic Workspace Output Types (Contains the valid types if the method.
Definition: methods.h:140
const ArrayOfString & GIn() const
Definition: methods.h:77
bool msupergeneric
Flag, whether this method is supergeneric.
Definition: methods.h:192
Index nelem() const
Definition: mystring.h:172
static const Index npos
Define npos:
Definition: mystring.h:192
#define DEBUG_ONLY(...)
Definition: debug.h:53
#define ARTS_ASSERT(condition,...)
Definition: debug.h:84
Index get_wsv_group_id(const String &name)
Returns the id of the given group.
Definition: groups.cc:346
void get_wsv_group_ids(ArrayOfIndex &ids, String name)
Returns list of ids of the given group names.
Definition: groups.cc:353
Declaration of the class MdRecord.
#define NODEF
Definition: methods.h:18
void define_md_raw_map()
Define MdRawMap.
Definition: methods_aux.cc:494
void get_short_wsv_description(String &s, const String &desc)
Definition: methods_aux.cc:537
void define_md_map()
Define MdMap.
Definition: methods_aux.cc:458
void expand_md_data_raw_to_md_data()
Expand supergeneric methods.
Definition: methods_aux.cc:395
void limit_line_length(ostream &os, ostringstream &curline, ostringstream &token, const String &indent, size_t linelen)
Limit length of output.
Definition: methods_aux.cc:618
ostream & operator<<(ostream &os, const MdRecord &mdr)
Output operator for MdRecord.
Definition: methods_aux.cc:633
bool format_paragraph(String &s, const String &indent, const size_t linelen, const size_t offset)
Definition: methods_aux.cc:503
my_basic_string< char > String
The String type for ARTS.
Definition: mystring.h:199
const ArrayOfGroupRecord wsv_groups
The names associated with Wsv groups as Strings.
Definition: global_data.h:74
const Array< MdRecord > md_data_raw
Lookup information for workspace methods.
Definition: methods.cc:22
Array< WsvRecord > wsv_data
Definition: workspace.cc:22
const Array< MdRecord > md_data
Lookup information for workspace methods.
Definition: methods_aux.cc:33
std::map< String, Index > WsvMap
Definition: workspace.cc:24
const map< String, Index > MdMap
The map associated with md_data.
Definition: methods_aux.cc:24
const map< String, Index > MdRawMap
The map associated with md_data_raw.
Definition: methods_aux.cc:26
This file contains the Workspace class.
Auxiliary header stuff related to workspace variable groups.