18 std::vector<std::string>
desc;
20 std::vector<std::string>
name;
21 std::vector<std::string>
defs;
26 std::vector<std::string>
desc;
28 std::vector<std::string>
name;
61 std::vector<std::string>
ins;
62 std::vector<std::string>
outs;
65 std::map<std::string, Group>
groups() {
66 std::map<std::string, std::size_t> group;
68 std::map<std::string, std::size_t> name;
70 std::map<std::string, std::string> desc;
72 std::map<std::string, std::size_t> pos;
75 std::map<std::string, Group> out;
76 for (
auto&
x : name) {
77 for (
auto&
y : group) {
78 if (
y.second ==
x.second) {
79 out[
x.first] = {
y.first, desc[
x.first], pos[
x.first]};
88 const std::vector<std::string>& vargroups,
89 const std::vector<std::string>& vardefaults) {
90 std::vector<std::string> defaults(vargroups.size());
91 std::vector<bool> hasdefaults(vargroups.size());
92 for (
size_t i = 0; i < vargroups.size(); i++) {
93 if (vardefaults[i] ==
NODEF)
94 hasdefaults[i] =
false;
96 hasdefaults[i] =
true;
98 if (vargroups[i] ==
"String") {
99 defaults[i] = std::string(
"\"") + vardefaults[i] + std::string(
"\"");
100 }
else if (vargroups[i] ==
"Numeric") {
101 if (
"NaN" == vardefaults[i] or
"nan" == vardefaults[i]) {
102 defaults[i] =
"std::numeric_limits<Numeric>::quiet_NaN()";
103 }
else if (
"Inf" == vardefaults[i] or
"inf" == vardefaults[i]) {
104 defaults[i] =
"std::numeric_limits<Numeric>::infinity()";
105 }
else if (
"-Inf" == vardefaults[i] or
"-inf" == vardefaults[i]) {
106 defaults[i] =
"-std::numeric_limits<Numeric>::infinity()";
108 defaults[i] = vardefaults[i];
110 }
else if (vardefaults[i] ==
"[]") {
113 defaults[i] = vardefaults[i];
116 if (defaults[i] ==
"") defaults[i] =
"{}";
118 for (
auto&
x : defaults[i]) {
126 return {defaults, hasdefaults};
130 std::map<std::string, std::size_t> vargroup;
132 std::map<std::string, std::size_t> varpos;
134 std::map<std::string, std::size_t> methodpos;
137 std::vector<std::string> metname;
139 std::vector<std::string> actual_groups;
141 actual_groups.push_back(
x.ActualGroups());
142 std::vector<std::vector<std::size_t>> gin_group;
144 gin_group.push_back({
x.GInType().cbegin(),
x.GInType().cend()});
145 std::vector<std::vector<std::string>> gin_names;
147 gin_names.push_back({
x.GIn().cbegin(),
x.GIn().cend()});
148 std::vector<std::vector<std::string>> gin_defaults;
150 gin_defaults.push_back({
x.GInDefault().cbegin(),
x.GInDefault().cend()});
151 std::vector<std::vector<std::string>> gin_desc;
154 {
x.GInDescription().cbegin(),
x.GInDescription().cend()});
155 std::vector<std::vector<std::size_t>> gout_group;
157 gout_group.push_back({
x.GOutType().cbegin(),
x.GOutType().cend()});
158 std::vector<std::vector<std::string>> gout_names;
160 gout_names.push_back({
x.GOut().cbegin(),
x.GOut().cend()});
161 std::vector<std::vector<std::string>> gout_desc;
164 {
x.GOutDescription().cbegin(),
x.GOutDescription().cend()});
165 std::vector<std::vector<std::size_t>> in_wspace;
167 in_wspace.push_back({
x.In().cbegin(),
x.In().cend()});
168 std::vector<std::vector<std::size_t>> out_wspace;
170 out_wspace.push_back({
x.Out().cbegin(),
x.Out().cend()});
171 std::vector<std::string> desc;
173 std::vector<std::vector<std::string>> authors;
175 authors.push_back({
x.Authors().cbegin(),
x.Authors().cend()});
177 std::vector<bool> set_method;
179 std::vector<bool> agenda_method;
181 agenda_method.push_back(
x.AgendaMethod());
182 std::vector<bool> supergeneric;
184 std::vector<bool> uses_templates;
186 uses_templates.push_back(
x.UsesTemplates());
187 std::vector<bool> pass_workspace;
189 pass_workspace.push_back(
x.PassWorkspace());
190 std::vector<bool> pass_wsv_names;
192 pass_wsv_names.push_back(
x.PassWsvNames());
194 std::vector<std::vector<std::size_t>> inoutvarpos;
196 inoutvarpos.push_back({
x.InOut().cbegin(),
x.InOut().cend()});
197 std::vector<std::vector<std::size_t>> invarpos;
199 invarpos.push_back({
x.InOnly().cbegin(),
x.InOnly().cend()});
200 std::vector<std::vector<std::size_t>> outvarpos;
202 outvarpos.push_back({
x.Out().cbegin(),
x.Out().cend()});
204 std::vector<Method> retval;
205 for (std::size_t i = 0; i < desc.size(); i++) {
209 m.
pos = methodpos[metname[i] +
String(
"_sg_") + actual_groups[i]];
211 m.
pos = methodpos[metname[i]];
216 gin.
desc = gin_desc[i];
217 for (
auto g : gin_group[i]) {
219 for (
auto&
y : vargroup) {
221 gin.
group.push_back(
y.first);
227 std::cerr <<
"Cannot find group\n";
231 gin.
name = gin_names[i];
233 gin.
defs = fixgin.first;
238 gout.
desc = gout_desc[i];
239 for (
auto g : gout_group[i]) {
241 for (
auto&
y : vargroup) {
243 gout.
group.push_back(
y.first);
249 std::cerr <<
"Cannot find group\n";
253 gout.
name = gout_names[i];
257 for (
auto v : in_wspace[i]) {
259 for (
auto&
y : varpos) {
267 std::cerr <<
"Cannot find variable\n";
275 for (
auto v : out_wspace[i]) {
277 for (
auto&
y : varpos) {
285 std::cerr <<
"Cannot find variable\n";
289 out.
varpos = outvarpos[i];
308 std::map<std::string, AgendaData> out;
311 out[
x.Name()].desc =
x.Description();
313 for (std::size_t i :
x.In()) {
316 if (
y.second.artspos == i) {
317 out[
x.Name()].ins.push_back(
y.first);
323 std::cerr <<
"Cannot find the variable\n";
328 for (std::size_t i :
x.Out()) {
331 if (
y.second.artspos == i) {
332 out[
x.Name()].outs.push_back(
y.first);
338 std::cerr <<
"Cannot find the variable\n";
350 std::map<std::string, std::size_t>
group;
374 std::cout <<
"#ifndef autoarts_h\n"
375 <<
"#define autoarts_h\n"
377 <<
"#include <auto_md.h>" <<
'\n'
378 <<
"#include <arts.h>" <<
'\n'
379 <<
"#include <global_data.h>" <<
'\n'
380 <<
"#include <m_basic_types.h>" <<
'\n'
381 <<
"#include <m_general.h>" <<
'\n'
382 <<
"#include <m_append.h>" <<
'\n'
383 <<
"#include <m_conversion.h>" <<
'\n'
384 <<
"#include <m_copy.h>" <<
'\n'
385 <<
"#include <m_gridded_fields.h>" <<
'\n'
386 <<
"#include <m_xml.h>" <<
'\n'
387 <<
"#include <m_select.h>" <<
'\n'
388 <<
"#include <m_reduce.h>" <<
'\n'
389 <<
"#include <m_nc.h>" <<
'\n'
390 <<
"#include <m_delete.h>" <<
'\n'
391 <<
"#include <m_extract.h>" <<
'\n'
392 <<
"#include <m_ignore.h>" <<
'\n'
396 std::cout <<
"extern String out_basename;\n\n";
398 std::cout <<
"namespace ARTS { using Workspace=Workspace; }\n\n";
399 std::cout <<
"namespace ARTS::Group {\n";
400 for (
auto&
x : artsname.group) {
401 if (
x.first ==
"Any")
continue;
402 std::cout <<
"using " <<
x.first <<
'=' <<
x.first <<
';' <<
'\n';
404 std::cout <<
"} // ARTS::Group \n\n";
406 std::cout <<
"namespace ARTS::Var {\n";
407 for (
auto&
x : artsname.group) {
408 if (
x.first ==
"Any")
continue;
410 std::cout <<
"class " <<
x.first <<
' ' <<
'{' <<
'\n';
411 std::cout <<
" using type = Group::" <<
x.first <<
";\n";
412 std::cout <<
" std::size_t p;\n";
413 std::cout <<
" type* v;\n";
414 std::cout <<
"public:\n";
415 std::cout <<
" " <<
x.first
416 <<
"() noexcept : p(std::numeric_limits<std::size_t>::max()), "
418 std::cout <<
" " <<
x.first
419 <<
"(std::size_t i, void * x) noexcept : p(i), "
420 "v(static_cast<type *>(x)) {}\n";
421 std::cout <<
" ~" <<
x.first
422 <<
"() noexcept {if (islast() and not isnull()) delete v;}\n";
425 <<
"(const type& val) noexcept : p(std::numeric_limits<std::size_t>::max()), v(new type(val)) {}\n";
426 std::cout <<
" type& value() noexcept {return *v;}\n";
427 std::cout <<
" const type& value() const noexcept {return *v;}\n";
430 <<
"& operator=(const type& t) noexcept {value() = t; return *this;}\n";
431 std::cout <<
" std::size_t pos() const noexcept {return p;}\n";
432 std::cout <<
" bool isnull() const noexcept {return v == nullptr;}\n";
434 <<
" bool islast() const noexcept {return p == std::numeric_limits<std::size_t>::max();}\n";
436 <<
" const Group::String& name() const noexcept {return Workspace::wsv_data[p].Name();}\n";
437 std::cout <<
'}' <<
';' <<
'\n' <<
'\n';
439 for (
auto&
x : artsname.varname_group) {
440 std::cout <<
"/*! " <<
x.second.varname_desc <<
'\n';
441 std::cout <<
"@param[in,out] Workspace ws - An ARTS workspace\n";
442 std::cout <<
"@return A class with a pointer to this variable and its "
443 "position in the workspace\n*/\n";
444 std::cout <<
"[[nodiscard]] inline ";
445 std::cout <<
x.second.varname_group <<
' ' <<
x.first
446 <<
"(Workspace& ws) "
449 <<
x.second.artspos <<
", ws[" <<
x.second.artspos
453 for (
auto&
x : artsname.group) {
454 if (
x.first ==
"Any")
continue;
456 std::cout <<
"/*! Creates in, and returns from, Workspace a/an " <<
x.first
459 std::cout <<
"@param[in,out] Workspace ws - An ARTS workspace\n";
460 std::cout <<
"@param[in] " <<
x.first
461 <<
" inval - The default value the variable will have in "
463 std::cout <<
"@param[in] String name - The name the variable will have in "
465 std::cout <<
"@param[in] String desc - The description the variable will "
466 "have in the workspace (default: \"nodescription\")\n";
467 std::cout <<
"@return A class with a pointer to this variable and its new "
468 "position in the workspace\n";
470 std::cout <<
"[[nodiscard]] inline\n";
472 <<
x.first <<
' ' <<
x.first
473 <<
"Create(\n Workspace& ws,\n const Group::"
475 <<
"& inval,\n const Group::String& name,\n const Group::"
477 "desc=\"nodescription\") {\n";
478 std::cout <<
" const std::size_t ind = "
479 "std::size_t(ws.add_wsv_inplace({name.c_str(), desc.c_str(), "
480 <<
x.second <<
"}));\n";
481 std::cout <<
" " <<
x.first <<
' ' <<
"val{ind, ws[ind]};\n";
482 std::cout <<
" return val = inval;\n"
485 std::cout <<
"} // ARTS::Var \n\n";
487 std::cout <<
"namespace ARTS::Method {\n";
489 for (
auto&
x : artsname.methodname_method) {
491 if (
x.agenda_method)
continue;
494 if (std::any_of(artsname.group.cbegin(),
495 artsname.group.cend(),
496 [metname =
x.
name](
auto&
y) {
497 return (y.first + String(
"Create")) == metname;
502 std::cout <<
"/*! " <<
x.desc <<
'\n';
503 for (
auto a :
x.authors) std::cout <<
"@author " << a <<
'\n';
505 "@param[in,out] Workspace ws - An ARTS workspace\n";
506 for (std::size_t i = 0; i <
x.gout.
name.size(); i++)
507 std::cout <<
"@param[out] " <<
x.gout.
name[i] <<
" - " <<
x.gout.desc[i]
509 for (std::size_t i = 0; i <
x.gin.
name.size(); i++) {
510 std::cout <<
"@param[in] " <<
x.gin.
name[i] <<
" - " <<
x.gin.desc[i];
511 if (
x.gin.hasdefs[i]) std::cout <<
" (default: " <<
x.gin.defs[i] <<
")";
514 std::cout <<
"\nUse the ARTS documentation to read more on how the "
515 "workspace is manipulated\n";
516 std::cout <<
"This interface function has been automatically generated\n";
517 std::cout <<
"*/" <<
'\n';
520 std::cout <<
"inline void " <<
x.
name <<
"(\n Workspace& ws";
523 for (std::size_t i = 0; i <
x.gout.group.size(); i++) {
524 std::cout <<
',' <<
"\n Var::" <<
x.gout.group[i] <<
' '
529 for (std::size_t i = 0; i <
x.gin.group.size(); i++) {
530 if (not
x.gin.hasdefs[i]) {
531 std::cout <<
',' <<
"\n "
532 <<
"const Var::" <<
x.gin.group[i] <<
' ' <<
x.gin.
name[i];
537 for (std::size_t i = 0; i <
x.gin.group.size(); i++) {
538 if (
x.gin.hasdefs[i]) {
539 if (
x.gin.defs[i] ==
"{}") {
540 std::cout <<
',' <<
"\n "
541 <<
"const Var::" <<
x.gin.group[i] <<
' ' <<
x.gin.
name[i]
542 <<
'=' <<
"Group::" <<
x.gin.group[i] <<
x.gin.defs[i];
544 std::cout <<
',' <<
"\n "
545 <<
"const Var::" <<
x.gin.group[i] <<
' ' <<
x.gin.
name[i]
546 <<
'=' <<
"Group::" <<
x.gin.group[i] <<
'{'
547 <<
x.gin.defs[i] <<
'}';
553 std::cout <<
')' <<
' ' <<
'{' <<
'\n';
556 if (
x.gout.group.size()) std::cout <<
' ';
557 for (std::size_t i = 0; i <
x.gout.group.size(); i++) {
558 std::cout <<
" if (" <<
x.gout.
name[i]
559 <<
".islast()) {\n throw std::runtime_error(\""
560 <<
x.gout.
name[i] <<
" needs to be a defined Workspace"
561 <<
x.gout.group[i] <<
" since it is output of " <<
x.
name
564 if (
x.gout.group.size()) std::cout <<
'\n' <<
'\n';
567 std::cout <<
' ' <<
' ' <<
x.
name <<
'(';
570 bool has_any =
false;
571 if (
x.pass_workspace or
x.agenda_method or
573 x.gin.group.cbegin(),
575 [](
auto& g) { return g ==
"Agenda" or g ==
"ArrayOfAgenda"; }) or
576 std::any_of(
x.in.varname.cbegin(),
x.in.varname.cend(), [&](
auto& g) {
577 return artsname.varname_group.at(g).varname_group ==
"Agenda" or
578 artsname.varname_group.at(g).varname_group ==
"ArrayOfAgenda";
585 for (std::size_t i = 0; i <
x.out.varname.size(); i++) {
586 if (has_any) std::cout <<
',' <<
' ';
588 std::cout <<
"Var::" <<
x.out.varname[i] <<
"(ws).value()";
592 for (std::size_t i = 0; i <
x.gout.
name.size(); i++) {
593 if (has_any) std::cout <<
',' <<
' ';
595 std::cout <<
x.gout.
name[i];
596 std::cout <<
".value()";
600 if (
x.pass_wsv_names) {
601 for (std::size_t i = 0; i <
x.gout.
name.size(); i++) {
602 if (has_any) std::cout <<
',' <<
' ';
604 std::cout <<
x.gout.
name[i] <<
".name()";
609 for (std::size_t i = 0; i <
x.in.varname.size(); i++) {
611 x.out.varname.cbegin(),
612 x.out.varname.cend(),
613 [in =
x.in.varname[i]](
const auto& out) { return in == out; }))
615 if (has_any) std::cout <<
',' <<
' ';
617 std::cout <<
"Var::" <<
x.in.varname[i] <<
"(ws).value()";
621 for (std::size_t i = 0; i <
x.gin.
name.size(); i++) {
622 if (has_any) std::cout <<
',' <<
' ';
624 std::cout <<
x.gin.
name[i];
625 std::cout <<
".value()";
629 if (
x.pass_wsv_names) {
630 for (std::size_t i = 0; i <
x.gin.
name.size(); i++) {
631 if (has_any) std::cout <<
',' <<
' ';
633 std::cout <<
x.gin.
name[i] <<
".islast() ? Group::String{\""
634 <<
x.gin.
name[i] <<
"\"} : " <<
x.gin.
name[i] <<
".name()";
639 const bool has_verbosity =
640 std::any_of(
x.in.varname.cbegin(),
x.in.varname.cend(), [](
auto& name) {
641 return name ==
"verbosity";
645 if (not has_verbosity) {
646 if (has_any) std::cout <<
',' <<
' ';
648 std::cout <<
"Var::verbosity(ws).value()";
652 std::cout <<
')' <<
';' <<
'\n' <<
'}' <<
'\n' <<
'\n' <<
'\n';
654 std::cout <<
"} // ARTS::Method \n\n";
656 std::cout <<
"namespace ARTS::AgendaMethod {\n";
658 for (
auto&
x : artsname.methodname_method) {
660 if (
x.agenda_method)
continue;
663 if (std::any_of(artsname.group.cbegin(),
664 artsname.group.cend(),
665 [metname =
x.
name](
auto&
y) {
666 return (y.first + String(
"Create")) == metname;
671 std::cout <<
"/*! " <<
x.desc <<
'\n';
672 for (
auto a :
x.authors) std::cout <<
"@author " << a <<
'\n';
674 "@param[in,out] Workspace ws - An ARTS workspace\n";
675 for (std::size_t i = 0; i <
x.gout.
name.size(); i++)
676 std::cout <<
"@param[out] " <<
x.gout.
name[i] <<
" - " <<
x.gout.desc[i]
678 for (std::size_t i = 0; i <
x.gin.
name.size(); i++) {
679 std::cout <<
"@param[in] " <<
x.gin.
name[i] <<
" - " <<
x.gin.desc[i];
680 if (
x.gin.hasdefs[i]) std::cout <<
" (default: " <<
x.gin.defs[i] <<
")";
683 std::cout <<
"\nUse the ARTS documentation to read more on how the "
684 "workspace is manipulated\n";
685 std::cout <<
"This interface function has been automatically generated\n";
687 <<
"@return MRecord to call this method\n";
688 std::cout <<
"*/" <<
'\n';
691 std::cout <<
"[[nodiscard]] inline\nMRecord " <<
x.
name
692 <<
"(\n [[maybe_unused]] Workspace& ws";
695 for (std::size_t i = 0; i <
x.gout.group.size(); i++) {
696 std::cout <<
',' <<
'\n';
697 std::cout <<
" Var::" <<
x.gout.group[i] <<
' '
702 for (std::size_t i = 0; i <
x.gin.group.size(); i++) {
703 if (not
x.gin.hasdefs[i]) {
704 std::cout <<
',' <<
"\n";
705 std::cout <<
" const Var::" <<
x.gin.group[i] <<
' '
711 for (std::size_t i = 0; i <
x.gin.group.size(); i++) {
712 if (
x.gin.hasdefs[i]) {
713 std::cout <<
',' <<
"\n";
714 std::cout <<
" const Var::" <<
x.gin.group[i] <<
'&'
715 <<
' ' <<
x.gin.
name[i] <<
'=' <<
"{}";
720 std::cout <<
')' <<
' ' <<
'{' <<
'\n';
723 if (
x.gout.group.size() or
x.gin.group.size()) std::cout <<
' ';
724 for (std::size_t i = 0; i <
x.gout.group.size(); i++) {
725 std::cout <<
" if (" <<
x.gout.
name[i]
726 <<
".islast()) {\n throw std::runtime_error(\""
727 <<
x.gout.
name[i] <<
" needs to be a defined Workspace"
728 <<
x.gout.group[i] <<
" since it is output of " <<
x.
name
731 for (std::size_t i = 0; i <
x.gin.group.size(); i++) {
732 if (
x.gin.hasdefs[i])
733 std::cout <<
" if (not " <<
x.gin.
name[i] <<
".isnull() and "
735 <<
".islast()) {\n throw std::runtime_error(\""
736 <<
x.gin.
name[i] <<
" needs to be a defined Workspace"
738 <<
" (or left default) since it is agenda input to " <<
x.
name
741 std::cout <<
" if (" <<
x.gin.
name[i]
742 <<
".islast()) {\n throw std::runtime_error(\""
743 <<
x.gin.
name[i] <<
" needs to be a defined Workspace"
744 <<
x.gin.group[i] <<
" since it is agenda input to " <<
x.
name
747 if (
x.gout.group.size() or
x.gin.group.size()) std::cout <<
'\n' <<
'\n';
749 for (std::size_t i = 0; i <
x.gin.group.size(); i++) {
750 if (
x.gin.hasdefs[i]) {
752 <<
" static const auto " <<
x.gin.
name[i]
753 <<
"_default = Var::" <<
x.gin.group[i] <<
"Create(ws, "
754 <<
x.gin.defs[i] <<
",\n \"" <<
x.
name <<
'_' <<
x.gin.
name[i]
756 <<
"\",\n \"auto generated variable with default from method "
762 std::cout <<
" return MRecord(" <<
x.
pos <<
',' <<
' '
763 <<
"\n Group::ArrayOfIndex(" <<
'{';
766 for (std::size_t i = 0; i <
x.out.varpos.size(); i++) {
767 std::cout <<
x.out.varpos[i] <<
',' <<
' ';
771 for (std::size_t i = 0; i <
x.gout.
name.size(); i++) {
772 std::cout <<
"Group::Index(" <<
x.gout.
name[i] <<
".pos())" <<
',' <<
' ';
774 std::cout <<
'}' <<
')' <<
',' <<
' ' <<
"\n Group::ArrayOfIndex("
778 for (std::size_t i = 0; i <
x.in.varpos.size(); i++) {
779 std::cout <<
x.in.varpos[i] <<
',' <<
' ';
783 for (std::size_t i = 0; i <
x.gin.
name.size(); i++) {
784 if (
x.gin.hasdefs[i])
785 std::cout <<
x.gin.
name[i] <<
".isnull() ? Index(" <<
x.gin.
name[i]
786 <<
"_default.pos()) : ";
787 std::cout <<
"Group::Index(" <<
x.gin.
name[i] <<
".pos())" <<
',' <<
' ';
790 std::cout <<
'}' <<
')' <<
',' <<
' ';
793 std::cout <<
"\n TokVal{" <<
x.gin.
name[0] <<
".value()}";
795 std::cout <<
"\n TokVal{}";
797 std::cout <<
", Agenda{}";
800 std::cout <<
')' <<
';' <<
'\n' <<
'}' <<
'\n' <<
'\n' <<
'\n';
802 std::cout <<
"} // ARTS::AgendaMethod \n\n";
804 std::cout <<
"namespace ARTS::AgendaExecute { \n\n";
805 for (
auto&
x : artsname.agendaname_agenda) {
806 std::cout <<
"/*! " <<
x.second.desc <<
'\n'
807 <<
"@param[in,out] Workspace ws - An ARTS workspace\n"
809 <<
"inline void " <<
x.first <<
"(Workspace& ws) {\n " <<
x.first
811 for (
auto& name :
x.second.outs) {
812 std::cout <<
',' <<
"\n " <<
' ' <<
"Var::" << name
815 for (
auto& name :
x.second.ins) {
816 if (not std::any_of(
x.second.outs.cbegin(),
817 x.second.outs.cend(),
818 [name](
auto& outname) { return name == outname; }))
819 std::cout <<
',' <<
"\n " <<
' ' <<
"Var::" << name
822 std::cout <<
",\n Var::" <<
x.first <<
"(ws).value());\n}\n\n";
824 std::cout <<
"} // ARTS::AgendaExecute \n\n";
826 std::cout <<
"namespace ARTS::AgendaDefine { \n";
827 std::cout <<
"/*! Append Records to an agenda */\n";
828 std::cout <<
"template <typename ... Records>\nvoid Append(Agenda& ag, "
829 "Records ... records) {\n"
830 <<
" for (auto& x: { MRecord(records)... })\n "
831 "ag.push_back(x);\n}\n\n";
832 for (
auto&
x : artsname.agendaname_agenda) {
833 if (artsname.varname_group.at(
x.first).varname_group ==
"ArrayOfAgenda")
835 std::cout <<
"/*! " <<
x.second.desc <<
'\n'
836 <<
"@param[in,out] Workspace ws - An ARTS workspace\n"
837 <<
"@param[in] MRecords records - Any number of ARTS methods "
838 "from ARTS::AgendaMethod\n"
840 <<
"template <typename ... Records> "
841 <<
"inline\nvoid " <<
x.first
842 <<
"(Workspace& ws, Records ... records) {\n"
843 <<
" ARTS::Var::" <<
x.first <<
"(ws).value().resize(0);\n"
844 <<
" ARTS::Var::" <<
x.first <<
"(ws).value().set_name(\""
845 <<
x.first <<
"\");\n"
846 <<
" Append(ARTS::Var::" <<
x.first
847 <<
"(ws).value(), records...);"
849 <<
" Var::" <<
x.first
850 <<
"(ws).value().check(ws, Var::verbosity(ws).value());\n}\n\n";
852 std::cout <<
"} // ARTS::AgendaDefine \n\n";
855 std::cout <<
"namespace ARTS {\n";
856 std::cout <<
"/*! Create a Workspace and set its main verbosity\n\n"
857 <<
" @param[in] screen Screen verbosity\n"
858 <<
" @param[in] file File verbosity\n"
859 <<
" @param[in] agenda Agenda verbosity\n"
860 <<
" @param[in] basename Default basename for output variables\n"
861 <<
" @param[in] numthreads OpenMP thread count (defaults to max if invalid count)\n"
862 <<
" @return Workspace a full ARTS Workspace\n"
865 <<
"inline Workspace init(std::size_t screen=0, std::size_t file=0, std::size_t agenda=0, const Group::String& basename=\"arts\", int numthreads=0) {\n"
867 " omp_set_num_threads(numthreads < 1 ? arts_omp_get_max_threads() : numthreads > arts_omp_get_max_threads() ? arts_omp_get_max_threads() : numthreads);\n"
870 " define_wsv_group_names();\n"
871 " Workspace::define_wsv_data();\n"
872 " Workspace::define_wsv_map();\n"
873 " define_md_data_raw();\n"
874 " expand_md_data_raw_to_md_data();\n"
875 " define_md_map();\n"
876 " define_agenda_data();\n"
877 " define_agenda_map();\n"
878 " define_species_data();\n"
879 " define_species_map();\n"
880 " global_data::workspace_memory_handler.initialize();\n"
883 " ws.initialize();\n"
884 " Var::verbosity(ws).value().set_screen_verbosity(screen);\n"
885 " Var::verbosity(ws).value().set_agenda_verbosity(agenda);\n"
886 " Var::verbosity(ws).value().set_file_verbosity(file);\n"
887 " Var::verbosity(ws).value().set_main_agenda(1);\n"
889 " out_basename = basename;\n"
892 " ws.context = \"\";\n"
897 std::cout <<
"} // namespace::ARTS\n\n";
899 std::cout <<
"#endif // autoarts_h\n\n";