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;
71 for (
auto& x : Workspace::wsv_data) desc[x.Name()] = x.Description();
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;
140 for (
auto& x : global_data::md_data)
141 actual_groups.push_back(x.ActualGroups());
142 std::vector<std::vector<std::size_t>> gin_group;
143 for (
auto& x : global_data::md_data)
144 gin_group.push_back({x.GInType().cbegin(), x.GInType().cend()});
145 std::vector<std::vector<std::string>> gin_names;
146 for (
auto& x : global_data::md_data)
147 gin_names.push_back({x.GIn().cbegin(), x.GIn().cend()});
148 std::vector<std::vector<std::string>> gin_defaults;
149 for (
auto& x : global_data::md_data)
150 gin_defaults.push_back({x.GInDefault().cbegin(), x.GInDefault().cend()});
151 std::vector<std::vector<std::string>> gin_desc;
152 for (
auto& x : global_data::md_data)
154 {x.GInDescription().cbegin(), x.GInDescription().cend()});
155 std::vector<std::vector<std::size_t>> gout_group;
156 for (
auto& x : global_data::md_data)
157 gout_group.push_back({x.GOutType().cbegin(), x.GOutType().cend()});
158 std::vector<std::vector<std::string>> gout_names;
159 for (
auto& x : global_data::md_data)
160 gout_names.push_back({x.GOut().cbegin(), x.GOut().cend()});
161 std::vector<std::vector<std::string>> gout_desc;
162 for (
auto& x : global_data::md_data)
164 {x.GOutDescription().cbegin(), x.GOutDescription().cend()});
165 std::vector<std::vector<std::size_t>> in_wspace;
166 for (
auto& x : global_data::md_data)
167 in_wspace.push_back({x.In().cbegin(), x.In().cend()});
168 std::vector<std::vector<std::size_t>> out_wspace;
169 for (
auto& x : global_data::md_data)
170 out_wspace.push_back({x.Out().cbegin(), x.Out().cend()});
171 std::vector<std::string> desc;
172 for (
auto& x : global_data::md_data) desc.push_back(x.Description());
173 std::vector<std::vector<std::string>> authors;
174 for (
auto& x : global_data::md_data)
175 authors.push_back({x.Authors().cbegin(), x.Authors().cend()});
177 std::vector<bool> set_method;
178 for (
auto& x : global_data::md_data) set_method.push_back(x.SetMethod());
179 std::vector<bool> agenda_method;
180 for (
auto& x : global_data::md_data)
181 agenda_method.push_back(x.AgendaMethod());
182 std::vector<bool> supergeneric;
183 for (
auto& x : global_data::md_data) supergeneric.push_back(x.Supergeneric());
184 std::vector<bool> uses_templates;
185 for (
auto& x : global_data::md_data)
186 uses_templates.push_back(x.UsesTemplates());
187 std::vector<bool> pass_workspace;
188 for (
auto& x : global_data::md_data)
189 pass_workspace.push_back(x.PassWorkspace());
190 std::vector<bool> pass_wsv_names;
191 for (
auto& x : global_data::md_data)
192 pass_wsv_names.push_back(x.PassWsvNames());
194 std::vector<std::vector<std::size_t>> inoutvarpos;
195 for (
auto& x : global_data::md_data)
196 inoutvarpos.push_back({x.InOut().cbegin(), x.InOut().cend()});
197 std::vector<std::vector<std::size_t>> invarpos;
198 for (
auto& x : global_data::md_data)
199 invarpos.push_back({x.InOnly().cbegin(), x.InOnly().cend()});
200 std::vector<std::vector<std::size_t>> outvarpos;
201 for (
auto& x : global_data::md_data)
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) {
279 out.
varname.push_back(y.first);
285 std::cerr <<
"Cannot find variable\n";
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 <<
"namespace ARTS { using Workspace=Workspace; }\n\n";
397 std::cout <<
"namespace ARTS::Group {\n";
398 for (
auto& x : artsname.group) {
399 if (x.first ==
"Any")
continue;
400 std::cout <<
"using " << x.first <<
'=' << x.first <<
';' <<
'\n';
402 std::cout <<
"} // ARTS::Group \n\n";
404 std::cout <<
"namespace ARTS::Var {\n";
405 for (
auto& x : artsname.group) {
406 if (x.first ==
"Any")
continue;
408 std::cout <<
"class Workspace" << x.first <<
' ' <<
'{' <<
'\n';
409 std::cout <<
" using type = Group::" << x.first <<
";\n";
410 std::cout <<
" std::size_t p;\n";
411 std::cout <<
" type* v;\n";
412 std::cout <<
"public:\n";
413 std::cout <<
" Workspace" << x.first
414 <<
"() noexcept : p(std::numeric_limits<std::size_t>::max()), " 416 std::cout <<
" Workspace" << x.first <<
"(std::size_t i, void * x) noexcept : p(i), " "v(static_cast<type *>(x)) {}\n";
417 std::cout <<
" ~Workspace" << x.first <<
"() noexcept {if (islast() and not isnull()) delete v;}\n";
418 std::cout <<
" Workspace" << x.first <<
"(const type& val) noexcept : p(std::numeric_limits<std::size_t>::max()), v(new type(val)) {}\n";
419 std::cout <<
" type& value() noexcept {return *v;}\n";
420 std::cout <<
" const type& value() const noexcept {return *v;}\n";
422 <<
" Workspace" << x.first
423 <<
"& operator=(const type& t) noexcept {value() = t; return *this;}\n";
424 std::cout <<
" std::size_t pos() const noexcept {return p;}\n";
425 std::cout <<
" bool isnull() const noexcept {return v == nullptr;}\n";
426 std::cout <<
" bool islast() const noexcept {return p == std::numeric_limits<std::size_t>::max();}\n";
427 std::cout <<
" const Group::String& name() const noexcept {return Workspace::wsv_data[p].Name();}\n";
428 std::cout <<
'}' <<
';' <<
'\n' <<
'\n';
430 for (
auto& x : artsname.varname_group) {
431 std::cout <<
"/*! " << x.second.varname_desc <<
'\n';
432 std::cout <<
"@param[in,out] Workspace ws - An ARTS workspace\n";
433 std::cout <<
"@return A class with a pointer to this variable and its " 434 "position in the workspace\n*/\n";
435 std::cout <<
"[[nodiscard]] inline ";
436 std::cout <<
"Workspace" << x.second.varname_group <<
' ' << x.first
437 <<
"(Workspace& ws) " 440 << x.second.artspos <<
", ws[" << x.second.artspos
444 for (
auto& x : artsname.group) {
445 if (x.first ==
"Any")
continue;
447 std::cout <<
"/*! Creates in, and returns from, Workspace a/an " << x.first
450 std::cout <<
"@param[in,out] Workspace ws - An ARTS workspace\n";
451 std::cout <<
"@param[in] " << x.first
452 <<
" inval - The default value the variable will have in " 454 std::cout <<
"@param[in] String name - The name the variable will have in " 456 std::cout <<
"@param[in] String desc - The description the variable will " 457 "have in the workspace (default: \"nodescription\")\n";
458 std::cout <<
"@return A class with a pointer to this variable and its new " 459 "position in the workspace\n";
461 std::cout <<
"[[nodiscard]] inline\n";
462 std::cout <<
"Workspace" << x.first <<
' ' << x.first
463 <<
"Create(\n Workspace& ws,\n const Group::" 465 <<
"& inval,\n const Group::String& name,\n const Group::" 467 "desc=\"nodescription\") {\n";
468 std::cout <<
" const std::size_t ind = " 469 "std::size_t(ws.add_wsv_inplace({name.c_str(), desc.c_str(), " 470 << x.second <<
"}));\n";
471 std::cout <<
" Workspace" << x.first <<
' ' <<
"val{ind, ws[ind]};\n";
472 std::cout <<
" return val = inval;\n" 475 std::cout <<
"} // ARTS::Var \n\n";
477 std::cout <<
"namespace ARTS::Method {\n";
479 for (
auto& x : artsname.methodname_method) {
481 if (x.agenda_method)
continue;
484 if (std::any_of(artsname.group.cbegin(), artsname.group.cend(),
485 [metname = x.name](
auto& y) {
486 return (y.first +
String(
"Create")) == metname;
491 std::cout <<
"/*! " << x.desc <<
'\n';
492 for (
auto a : x.authors) std::cout <<
"@author " << a <<
'\n';
494 "@param[in,out] Workspace ws - An ARTS workspace\n";
495 for (std::size_t
i = 0;
i < x.gout.name.size();
i++)
496 std::cout <<
"@param[out] " << x.gout.name[
i] <<
" - " << x.gout.desc[
i]
498 for (std::size_t
i = 0;
i < x.gin.name.size();
i++) {
499 std::cout <<
"@param[in] " << x.gin.name[
i] <<
" - " << x.gin.desc[
i];
500 if (x.gin.hasdefs[
i]) std::cout <<
" (default: " << x.gin.defs[
i] <<
")";
503 std::cout <<
"\nUse the ARTS documentation to read more on how the " 504 "workspace is manipulated\n";
505 std::cout <<
"This interface function has been automatically generated\n";
506 std::cout <<
"*/" <<
'\n';
509 std::cout <<
"inline void " << x.name <<
"(\n Workspace& ws";
512 for (std::size_t
i = 0;
i < x.gout.group.size();
i++) {
513 std::cout <<
',' <<
"\n Var::Workspace" << x.gout.group[
i] <<
' ' 518 for (std::size_t
i = 0;
i < x.gin.group.size();
i++) {
519 if (not x.gin.hasdefs[
i]) {
520 std::cout <<
',' <<
"\n " 521 <<
"const Var::Workspace" << x.gin.group[
i] <<
' ' 527 for (std::size_t
i = 0;
i < x.gin.group.size();
i++) {
528 if (x.gin.hasdefs[
i]) {
529 if (x.gin.defs[
i] ==
"{}") {
530 std::cout <<
',' <<
"\n " 531 <<
"const Var::Workspace" << x.gin.group[
i] <<
' ' << x.gin.name[
i]
532 <<
'=' <<
"Group::" << x.gin.group[
i] << x.gin.defs[
i];
534 std::cout <<
',' <<
"\n " 535 <<
"const Var::Workspace" << x.gin.group[
i] <<
' ' << x.gin.name[
i]
536 <<
'=' <<
"Group::" << x.gin.group[
i] <<
'{' << x.gin.defs[
i] <<
'}';
542 std::cout <<
')' <<
' ' <<
'{' <<
'\n';
545 if (x.gout.group.size()) std::cout <<
' ';
546 for (std::size_t
i = 0;
i < x.gout.group.size();
i++) {
547 std::cout <<
" if (" << x.gout.name[
i] <<
".islast()) {\n throw std::runtime_error(\"" 548 << x.gout.name[
i] <<
" needs to be a defined Workspace" 549 << x.gout.group[
i] <<
" since it is output of "<<x.name<<
"\");\n }";
551 if (x.gout.group.size()) std::cout <<
'\n' <<
'\n';
554 std::cout <<
' ' <<
' ' << x.name <<
'(';
557 bool has_any =
false;
558 if (x.pass_workspace or x.agenda_method or
560 x.gin.group.cbegin(), x.gin.group.cend(),
561 [](
auto& g) {
return g ==
"Agenda" or g ==
"ArrayOfAgenda"; }) or
562 std::any_of(x.in.varname.cbegin(), x.in.varname.cend(), [&](
auto& g) {
563 return artsname.varname_group.at(g).varname_group ==
"Agenda" or
564 artsname.varname_group.at(g).varname_group ==
"ArrayOfAgenda";
571 for (std::size_t
i = 0;
i < x.out.varname.size();
i++) {
572 if (has_any) std::cout <<
',' <<
' ';
574 std::cout <<
"Var::" << x.out.varname[
i] <<
"(ws).value()";
578 for (std::size_t
i = 0;
i < x.gout.name.size();
i++) {
579 if (has_any) std::cout <<
',' <<
' ';
581 std::cout << x.gout.name[
i];
582 std::cout <<
".value()";
586 if (x.pass_wsv_names) {
587 for (std::size_t
i = 0;
i < x.gout.name.size();
i++) {
588 if (has_any) std::cout <<
',' <<
' ';
590 std::cout << x.gout.name[
i] <<
".name()";
595 for (std::size_t
i = 0;
i < x.in.varname.size();
i++) {
597 x.out.varname.cbegin(), x.out.varname.cend(),
598 [in = x.in.varname[
i]](
const auto& out) {
return in == out; }))
600 if (has_any) std::cout <<
',' <<
' ';
602 std::cout <<
"Var::" << x.in.varname[
i] <<
"(ws).value()";
606 for (std::size_t
i = 0;
i < x.gin.name.size();
i++) {
607 if (has_any) std::cout <<
',' <<
' ';
609 std::cout << x.gin.name[
i];
610 std::cout <<
".value()";
614 if (x.pass_wsv_names) {
615 for (std::size_t
i = 0;
i < x.gin.name.size();
i++) {
616 if (has_any) std::cout <<
',' <<
' ';
618 std::cout << x.gin.name[
i] <<
".islast() ? Group::String{\"" << x.gin.name[
i] <<
"\"} : " << x.gin.name[
i] <<
".name()";
623 const bool has_verbosity =
624 std::any_of(x.in.varname.cbegin(), x.in.varname.cend(),
625 [](
auto& name) {
return name ==
"verbosity"; });
628 if (not has_verbosity) {
629 if (has_any) std::cout <<
',' <<
' ';
631 std::cout <<
"Var::verbosity(ws).value()";
635 std::cout <<
')' <<
';' <<
'\n' <<
'}' <<
'\n' <<
'\n' <<
'\n';
637 std::cout <<
"} // ARTS::Method \n\n";
639 std::cout <<
"namespace ARTS::AgendaMethod {\n";
641 for (
auto& x : artsname.methodname_method) {
643 if (x.agenda_method)
continue;
646 if (std::any_of(artsname.group.cbegin(), artsname.group.cend(),
647 [metname = x.name](
auto& y) {
648 return (y.first +
String(
"Create")) == metname;
653 std::cout <<
"/*! " << x.desc <<
'\n';
654 for (
auto a : x.authors) std::cout <<
"@author " << a <<
'\n';
656 "@param[in,out] Workspace ws - An ARTS workspace\n";
657 for (std::size_t
i = 0;
i < x.gout.name.size();
i++)
658 std::cout <<
"@param[out] " << x.gout.name[
i] <<
" - " << x.gout.desc[
i]
660 for (std::size_t
i = 0;
i < x.gin.name.size();
i++) {
661 std::cout <<
"@param[in] " << x.gin.name[
i] <<
" - " << x.gin.desc[
i];
662 if (x.gin.hasdefs[
i]) std::cout <<
" (default: " << x.gin.defs[
i] <<
")";
665 std::cout <<
"\nUse the ARTS documentation to read more on how the " 666 "workspace is manipulated\n";
667 std::cout <<
"This interface function has been automatically generated\n";
669 <<
"@return MRecord to call this method\n";
670 std::cout <<
"*/" <<
'\n';
673 std::cout <<
"[[nodiscard]] inline\nMRecord " << x.name
674 <<
"(\n [[maybe_unused]] Workspace& ws";
677 for (std::size_t
i = 0;
i < x.gout.group.size();
i++) {
678 std::cout <<
',' <<
'\n';
679 std::cout <<
" Var::Workspace" 680 << x.gout.group[
i] <<
' ' << x.gout.name[
i];
684 for (std::size_t
i = 0;
i < x.gin.group.size();
i++) {
685 if (not x.gin.hasdefs[
i]) {
686 std::cout <<
',' <<
"\n";
687 std::cout <<
" const Var::Workspace" 688 << x.gin.group[
i] <<
' ' << x.gin.name[
i];
693 for (std::size_t
i = 0;
i < x.gin.group.size();
i++) {
694 if (x.gin.hasdefs[
i]) {
695 std::cout <<
',' <<
"\n";
696 std::cout <<
" const Var::Workspace" 697 << x.gin.group[
i] <<
'&' <<
' ' << x.gin.name[
i] <<
'=' 703 std::cout <<
')' <<
' ' <<
'{' <<
'\n';
706 if (x.gout.group.size() or x.gin.group.size()) std::cout <<
' ';
707 for (std::size_t
i = 0;
i < x.gout.group.size();
i++) {
708 std::cout <<
" if (" << x.gout.name[
i] <<
".islast()) {\n throw std::runtime_error(\"" 709 << x.gout.name[
i] <<
" needs to be a defined Workspace" 710 << x.gout.group[
i] <<
" since it is output of "<<x.name<<
"\");\n }";
712 for (std::size_t
i = 0;
i < x.gin.group.size();
i++) {
713 if (x.gin.hasdefs[
i])
714 std::cout <<
" if (not " << x.gin.name[
i] <<
".isnull() and " << x.gin.name[
i] <<
".islast()) {\n throw std::runtime_error(\"" 715 << x.gin.name[
i] <<
" needs to be a defined Workspace" 716 << x.gin.group[
i] <<
" (or left default) since it is agenda input to "<<x.name<<
"\");\n }";
718 std::cout <<
" if (" << x.gin.name[
i] <<
".islast()) {\n throw std::runtime_error(\"" 719 << x.gin.name[
i] <<
" needs to be a defined Workspace" 720 << x.gin.group[
i] <<
" since it is agenda input to "<<x.name<<
"\");\n }";
722 if (x.gout.group.size() or x.gin.group.size()) std::cout <<
'\n' <<
'\n';
724 for (std::size_t
i = 0;
i < x.gin.group.size();
i++) {
725 if (x.gin.hasdefs[
i]) {
727 <<
" static const auto " << x.gin.name[
i]
728 <<
"_default = Var::" << x.gin.group[
i] <<
"Create(ws, " 729 << x.gin.defs[
i] <<
",\n \"" << x.name <<
'_' << x.gin.name[
i]
731 <<
"\",\n \"auto generated variable with default from method " 737 std::cout <<
" return MRecord(" << x.pos <<
',' <<
' ' 738 <<
"\n Group::ArrayOfIndex(" <<
'{';
741 for (std::size_t
i = 0;
i < x.out.varpos.size();
i++) {
742 std::cout << x.out.varpos[
i] <<
',' <<
' ';
746 for (std::size_t
i = 0;
i < x.gout.name.size();
i++) {
747 std::cout <<
"Group::Index(" << x.gout.name[
i] <<
".pos())" <<
',' <<
' ';
749 std::cout <<
'}' <<
')' <<
',' <<
' ' <<
"\n Group::ArrayOfIndex(" <<
'{';
752 for (std::size_t
i = 0;
i < x.in.varpos.size();
i++) {
753 std::cout << x.in.varpos[
i] <<
',' <<
' ';
757 for (std::size_t
i = 0;
i < x.gin.name.size();
i++) {
758 if (x.gin.hasdefs[
i])
759 std::cout << x.gin.name[
i] <<
".isnull() ? Index(" << x.gin.name[
i]
760 <<
"_default.pos()) : ";
761 std::cout <<
"Group::Index(" << x.gin.name[
i] <<
".pos())" <<
',' <<
' ';
764 std::cout <<
'}' <<
')' <<
',' <<
' ';
767 std::cout <<
"\n TokVal{" << x.gin.name[0] <<
".value()}";
769 std::cout <<
"\n TokVal{}";
771 std::cout <<
", Agenda{}";
774 std::cout <<
')' <<
';' <<
'\n' <<
'}' <<
'\n' <<
'\n' <<
'\n';
776 std::cout <<
"} // ARTS::AgendaMethod \n\n";
778 std::cout <<
"namespace ARTS::AgendaExecute { \n\n";
779 for (
auto& x : artsname.agendaname_agenda) {
780 std::cout <<
"/*! " << x.second.desc <<
'\n' 781 <<
"@param[in,out] Workspace ws - An ARTS workspace\n" 783 <<
"inline void " << x.first <<
"(Workspace& ws) {\n " << x.first
785 for (
auto& name : x.second.outs) {
786 std::cout <<
',' <<
"\n " <<
' ' <<
"Var::" << name <<
"(ws).value()";
788 for (
auto& name : x.second.ins) {
789 if (not std::any_of(x.second.outs.cbegin(), x.second.outs.cend(),
790 [name](
auto& outname) {
return name == outname; }))
791 std::cout <<
',' <<
"\n " <<
' ' <<
"Var::" << name
794 std::cout <<
",\n Var::" << x.first <<
"(ws).value());\n}\n\n";
796 std::cout <<
"} // ARTS::AgendaExecute \n\n";
798 std::cout <<
"namespace ARTS::AgendaDefine { \n";
799 std::cout <<
"/*! Append Records to an agenda */\n";
800 std::cout <<
"template <typename ... Records>\nvoid Append(Agenda& ag, " 801 "Records ... records) {\n" 802 <<
" for (auto& x: { MRecord(records)... })\n " 803 "ag.push_back(x);\n}\n\n";
804 for (
auto& x : artsname.agendaname_agenda) {
805 if (artsname.varname_group.at(x.first).varname_group ==
"ArrayOfAgenda")
807 std::cout <<
"/*! " << x.second.desc <<
'\n' 808 <<
"@param[in,out] Workspace ws - An ARTS workspace\n" 809 <<
"@param[in] MRecords records - Any number of ARTS methods " 810 "from ARTS::AgendaMethod\n" 812 <<
"template <typename ... Records> " 813 <<
"inline\nvoid " << x.first
814 <<
"(Workspace& ws, Records ... records) {\n" 815 <<
" ARTS::Var::" << x.first <<
"(ws).value().resize(0);\n" 816 <<
" ARTS::Var::" << x.first <<
"(ws).value().set_name(\"" << x.first
818 <<
" Append(ARTS::Var::" << x.first <<
"(ws).value(), records...);" 820 <<
" Var::" << x.first
821 <<
"(ws).value().check(ws, Var::verbosity(ws).value());\n}\n\n";
823 std::cout <<
"} // ARTS::AgendaDefine \n\n";
826 std::cout <<
"namespace ARTS {\n";
828 "inline Workspace init(std::size_t screen=0, std::size_t file=0, std::size_t agenda=0) {\n" 829 " define_wsv_group_names();\n" 830 " Workspace::define_wsv_data();\n" 831 " Workspace::define_wsv_map();\n" 832 " define_md_data_raw();\n" 833 " expand_md_data_raw_to_md_data();\n" 834 " define_md_map();\n" 835 " define_agenda_data();\n" 836 " define_agenda_map();\n" 837 " define_species_data();\n" 838 " define_species_map();\n" 839 " global_data::workspace_memory_handler.initialize();\n" 842 " ws.initialize();\n" 843 " Var::verbosity(ws).value().set_screen_verbosity(screen);\n" 844 " Var::verbosity(ws).value().set_agenda_verbosity(agenda);\n" 845 " Var::verbosity(ws).value().set_file_verbosity(file);\n" 846 " Var::verbosity(ws).value().set_main_agenda(1);\n" 849 " ws.context = \"\";\n" 854 std::cout <<
"} // namespace::ARTS\n\n";
856 std::cout <<
"#endif // autoarts_h\n\n";
static Array< WsvRecord > wsv_data
Global WSV data.
void define_md_map()
Define MdMap.
std::vector< std::string > authors
map< String, Index > AgendaMap
The map associated with agenda_data.
std::vector< std::size_t > varpos
std::vector< std::size_t > varpos
std::map< std::string, AgendaData > agendaname_agenda
std::map< std::string, Group > groups()
std::vector< Method > methodname_method
std::vector< std::string > desc
std::vector< std::string > varname
void define_species_map()
std::map< std::string, std::size_t > group
void define_agenda_data()
const map< String, Index > MdMap
The map associated with md_data.
std::vector< std::string > outs
std::vector< std::size_t > inoutvarpos
void expand_md_data_raw_to_md_data()
Expand supergeneric methods.
std::string varname_group
static void define_wsv_data()
Define workspace variables.
std::vector< Method > methods()
std::vector< std::string > name
std::map< std::string, Group > varname_group
const Array< AgRecord > agenda_data
The lookup information for the agendas.
std::vector< std::string > desc
std::vector< std::string > ins
std::vector< std::string > name
void define_species_data()
std::vector< std::string > group
std::vector< std::string > group
void define_wsv_group_names()
Define the array of workspace variable group names.
static map< String, Index > WsvMap
Global map associated with wsv_data.
const map< String, Index > WsvGroupMap
The map associated with wsv_group_names.
void define_md_data_raw()
const Array< MdRecord > md_data
Lookup information for workspace methods.
static void define_wsv_map()
Map WSV names to indices.
std::pair< std::vector< std::string >, std::vector< bool > > fixed_defaults(const std::vector< std::string > &vargroups, const std::vector< std::string > &vardefaults)
std::vector< std::string > varname
std::map< std::string, AgendaData > agendas()
std::vector< std::string > defs
std::vector< bool > hasdefs
my_basic_string< char > String
The String type for ARTS.