ARTS 2.5.0 (git: 9ee3ac6c)
make_autoarts_h.cc
Go to the documentation of this file.
1#include <auto_md.h>
2#include <global_data.h>
3
4#include <algorithm>
5#include <iostream>
6#include <map>
7#include <string>
8#include <vector>
9
10struct Group {
11 std::string varname_group;
12 std::string varname_desc;
13 std::size_t artspos;
14};
15
16struct Method {
17 struct Gin {
18 std::vector<std::string> desc;
19 std::vector<std::string> group;
20 std::vector<std::string> name;
21 std::vector<std::string> defs;
22 std::vector<bool> hasdefs;
23 };
24
25 struct Gout {
26 std::vector<std::string> desc;
27 std::vector<std::string> group;
28 std::vector<std::string> name;
29 };
30
31 struct In {
32 std::vector<std::string> varname;
33 std::vector<std::size_t> varpos;
34 };
35
36 struct Out {
37 std::vector<std::string> varname;
38 std::vector<std::size_t> varpos;
39 };
40
41 std::string name;
42 std::size_t pos;
43 std::string desc;
44 std::vector<std::string> authors;
55 std::vector<std::size_t> inoutvarpos;
56};
57
58struct AgendaData {
59 std::size_t pos;
60 std::string desc;
61 std::vector<std::string> ins;
62 std::vector<std::string> outs;
63};
64
65std::map<std::string, Group> groups() {
66 std::map<std::string, std::size_t> group;
67 for (auto& x : global_data::WsvGroupMap) group[x.first] = x.second;
68 std::map<std::string, std::size_t> name;
69 for (auto& x : Workspace::wsv_data) name[x.Name()] = x.Group();
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;
73 for (auto& x : Workspace::WsvMap) pos[x.first] = x.second;
74
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]};
80 break;
81 }
82 }
83 }
84 return out;
85}
86
87std::pair<std::vector<std::string>, std::vector<bool>> fixed_defaults(
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;
95 else
96 hasdefaults[i] = true;
97
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()";
107 } else {
108 defaults[i] = vardefaults[i];
109 }
110 } else if (vardefaults[i] == "[]") {
111 defaults[i] = "{}";
112 } else {
113 defaults[i] = vardefaults[i];
114 }
115
116 if (defaults[i] == "") defaults[i] = "{}";
117
118 for (auto& x : defaults[i]) {
119 if (x == '[')
120 x = '{';
121 else if (x == ']')
122 x = '}';
123 }
124 }
125
126 return {defaults, hasdefaults};
127}
128
129std::vector<Method> methods() {
130 std::map<std::string, std::size_t> vargroup;
131 for (auto& x : global_data::WsvGroupMap) vargroup[x.first] = x.second;
132 std::map<std::string, std::size_t> varpos;
133 for (auto& x : Workspace::WsvMap) varpos[x.first] = x.second;
134 std::map<std::string, std::size_t> methodpos;
135 for (auto& x : global_data::MdMap) methodpos[x.first] = x.second;
136
137 std::vector<std::string> metname;
138 for (auto& x : global_data::md_data) metname.push_back(x.Name());
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)
153 gin_desc.push_back(
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)
163 gout_desc.push_back(
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()});
176
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());
193
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()});
203
204 std::vector<Method> retval;
205 for (std::size_t i = 0; i < desc.size(); i++) {
206 Method m;
207 m.name = metname[i];
208 if (supergeneric[i])
209 m.pos = methodpos[metname[i] + String("_sg_") + actual_groups[i]];
210 else
211 m.pos = methodpos[metname[i]];
212 m.desc = desc[i];
213 m.authors = authors[i];
214
215 Method::Gin gin;
216 gin.desc = gin_desc[i];
217 for (auto g : gin_group[i]) {
218 bool found = false;
219 for (auto& y : vargroup) {
220 if (y.second == g) {
221 gin.group.push_back(y.first);
222 found = true;
223 break;
224 }
225 }
226 if (not found) {
227 std::cerr << "Cannot find group\n";
228 std::terminate();
229 }
230 }
231 gin.name = gin_names[i];
232 auto fixgin = fixed_defaults(gin.group, gin_defaults[i]);
233 gin.defs = fixgin.first;
234 gin.hasdefs = fixgin.second;
235 m.gin = gin;
236
237 Method::Gout gout;
238 gout.desc = gout_desc[i];
239 for (auto g : gout_group[i]) {
240 bool found = false;
241 for (auto& y : vargroup) {
242 if (y.second == g) {
243 gout.group.push_back(y.first);
244 found = true;
245 break;
246 }
247 }
248 if (not found) {
249 std::cerr << "Cannot find group\n";
250 std::terminate();
251 }
252 }
253 gout.name = gout_names[i];
254 m.gout = gout;
255
256 Method::In in;
257 for (auto v : in_wspace[i]) {
258 bool found = false;
259 for (auto& y : varpos) {
260 if (v == y.second) {
261 in.varname.push_back(y.first);
262 found = true;
263 break;
264 }
265 }
266 if (not found) {
267 std::cerr << "Cannot find variable\n";
268 std::terminate();
269 }
270 }
271 in.varpos = invarpos[i];
272 m.in = in;
273
274 Method::Out out;
275 for (auto v : out_wspace[i]) {
276 bool found = false;
277 for (auto& y : varpos) {
278 if (v == y.second) {
279 out.varname.push_back(y.first);
280 found = true;
281 break;
282 }
283 }
284 if (not found) {
285 std::cerr << "Cannot find variable\n";
286 std::terminate();
287 }
288 }
289 out.varpos = outvarpos[i];
290 m.out = out;
291
292 m.set_method = set_method[i];
293 m.agenda_method = agenda_method[i];
294 m.supergeneric = supergeneric[i];
295 m.uses_templates = uses_templates[i];
296 m.pass_workspace = pass_workspace[i];
297 m.pass_wsv_names = pass_wsv_names[i];
298 m.inoutvarpos = inoutvarpos[i];
299 retval.push_back(m);
300 }
301
302 return retval;
303}
304
305std::map<std::string, AgendaData> agendas() {
306 auto g = groups();
307
308 std::map<std::string, AgendaData> out;
309 for (auto& x : global_data::agenda_data) {
310 out[x.Name()].pos = global_data::AgendaMap.at(x.Name());
311 out[x.Name()].desc = x.Description();
312
313 for (std::size_t i : x.In()) {
314 bool found = false;
315 for (auto& y : g) {
316 if (y.second.artspos == i) {
317 out[x.Name()].ins.push_back(y.first);
318 found = true;
319 break;
320 }
321 }
322 if (not found) {
323 std::cerr << "Cannot find the variable\n";
324 std::terminate();
325 }
326 }
327
328 for (std::size_t i : x.Out()) {
329 bool found = false;
330 for (auto& y : g) {
331 if (y.second.artspos == i) {
332 out[x.Name()].outs.push_back(y.first);
333 found = true;
334 break;
335 }
336 }
337 if (not found) {
338 std::cerr << "Cannot find the variable\n";
339 std::terminate();
340 }
341 }
342 }
343 return out;
344}
345
346struct NameMaps {
347 std::map<std::string, AgendaData> agendaname_agenda;
348 std::vector<Method> methodname_method;
349 std::map<std::string, Group> varname_group;
350 std::map<std::string, std::size_t> group;
351
353 for (auto& x : global_data::WsvGroupMap) group[x.first] = x.second;
357 }
358};
359
361 std::cout << "#include <auto_md.h>" << '\n'
362 << "#include <arts.h>" << '\n'
363 << "#include <global_data.h>" << '\n'
364 << "#include <m_basic_types.h>" << '\n'
365 << "#include <m_general.h>" << '\n'
366 << "#include <m_append.h>" << '\n'
367 << "#include <m_conversion.h>" << '\n'
368 << "#include <m_copy.h>" << '\n'
369 << "#include <m_gridded_fields.h>" << '\n'
370 << "#include <m_xml.h>" << '\n'
371 << "#include <m_select.h>" << '\n'
372 << "#include <m_reduce.h>" << '\n'
373 << "#include <m_nc.h>" << '\n'
374 << "#include <m_delete.h>" << '\n'
375 << "#include <m_extract.h>" << '\n'
376 << "#include <m_ignore.h>" << '\n'
377 << "#include <isotopologues.h>" << '\n'
378 << '\n'
379 << '\n';
380
381 std::cout << "extern String out_basename;\n\n";
382}
383
385 std::cout << "/*! An ARTS Workspace, the main class of ARTS */\n";
386 std::cout << "using Workspace=Workspace; \n\n";
387 std::cout << "/*! The ARTS constants namespace */\n";
388 std::cout << "namespace Constant { using namespace ::Constant; }\n\n";
389 std::cout << "/*! The ARTS conversions namespace */\n";
390 std::cout << "namespace Conversion { using namespace ::Conversion; }\n\n";
391 std::cout << "/*! The ARTS Group namespace */\n";
392 std::cout << "namespace Group {\n";
393 for (auto& x : artsname.group) {
394 if (x.first == "Any") continue;
395 std::cout << "/*! ARTS " << x.first << " type */\n";
396 std::cout << "using " << x.first << '=' << x.first << ';' << '\n' << '\n';
397 }
398
399 std::cout << "/*! The ARTS Internal Groups namespace */\n";
400 std::cout << "namespace Internal {\n";
401 std::cout << "/*! A Tokenized Value. Used purely in internal code */\n";
402 std::cout << "using TokVal=TokVal;\n" << '\n';
403 std::cout << "/*! A Method Record. Used to pass methods to agendas */\n";
404 std::cout << "using MRecord=MRecord;\n" << '\n';
405 std::cout << "} // namespace Internal\n";
406 std::cout << "} // namespace Group \n\n";
407}
408
409void print_variables(const NameMaps& artsname) {
410 std::cout << "namespace Var {\n";
411 for (auto& x : artsname.group) {
412 if (x.first == "Any") continue;
413 std::cout << "/*! Workspace Variable class. Used as default\n"
414 " input to many Method and AgendaMethod.\n"
415 " Note that it is not recommended to manually\n"
416 " create this class as many methods makes distinct\n"
417 " assumptions about the states that this class are\n"
418 " allowed to be in */\n";
419 std::cout << "class " << x.first << ' ' << '{' << '\n';
420 std::cout << " std::size_t p;\n";
421 std::cout << " Group::" << x.first << "* v;\n";
422 std::cout << "public:\n";
423 std::cout << " /*! Default construct. DO NOT USE MANUALLY. Leaves "
424 "islast() true and isnull() true */\n";
425 std::cout << " " << x.first
426 << "() noexcept : p(std::numeric_limits<std::size_t>::max()), "
427 "v(nullptr) {}\n\n";
428 std::cout << " /*! Construct from existing Workspace. DO NOT USE "
429 "MANUALLY. Leaves islast() false and isnull() false */\n";
430 std::cout << " " << x.first
431 << "(std::size_t i, void * x) noexcept : p(i), "
432 "v(static_cast<Group::" << x.first << " *>(x)) {}\n\n";
433 std::cout << " /*! Construct from Group::" << x.first << ". Leaves islast() true and "
434 "isnull() false */\n";
435 std::cout << " " << x.first
436 << "(const Group::" << x.first << "& val) noexcept : "
437 "p(std::numeric_limits<std::size_t>::max()), v(new Group::" << x.first << "(val)) "
438 "{}\n\n";
439 std::cout << " /*! Delete data only when islast() is true and isnull() is "
440 "false */\n";
441 std::cout << " ~" << x.first
442 << "() noexcept {if (islast() and not isnull()) delete v;}\n\n";
443 std::cout
444 << " /*! Get value ref as Group::" << x.first << ". Works when isnull() is false */\n";
445 std::cout << " Group::" << x.first << "& value() noexcept {return *v;}\n\n";
446 std::cout
447 << " /*! Get value const-ref as Group::" << x.first << ". Works when isnull() is false */\n";
448 std::cout << " const Group::" << x.first << "& value() const noexcept {return *v;}\n\n";
449 std::cout << " /*! Set value from Group::" << x.first << ". Works when isnull() is "
450 "false */\n";
451 std::cout << " " << x.first
452 << "& operator=(const Group::" << x.first << "& t) noexcept {value() = t; return "
453 "*this;}\n\n";
454 std::cout
455 << " /*! Return the position of the variable in the Workspace */\n";
456 std::cout << " std::size_t pos() const noexcept {return p;}\n\n";
457 std::cout << " /*! Return true if there is no data */\n";
458 std::cout << " bool isnull() const noexcept {return v == nullptr;}\n\n";
459 std::cout << " /*! Return true if data is not in the Workspace */\n";
460 std::cout << " bool islast() const noexcept {return p == "
461 "std::numeric_limits<std::size_t>::max();}\n\n";
462 std::cout << " /*! Name of variable. Must be in the workspace */\n";
463 std::cout << " const Group::String& name() const noexcept {return "
464 "Workspace::wsv_data[p].Name();}\n\n";
465
466 // NOTE: Don't add more groups here. The ones that are here are ugly
467 // enough as it is. Just define an output operator...
468 if (x.first not_eq "Ppath" and x.first not_eq "TessemNN" and
469 x.first not_eq "Timer" and x.first not_eq "ArrayOfPpath") {
470 std::cout << " /*! Output to stream of internal variable */\n";
471 std::cout << " friend std::ostream& operator<<(std::ostream& os, const "
472 << x.first
473 << "& var) {if (var.isnull()) return os << \"NULLDATA\"; else "
474 "return os << var.value();}\n";
475 }
476
477 std::cout << '}' << ';' << '\n' << '\n';
478 }
479 for (auto& x : artsname.varname_group) {
480 std::cout << "/*! " << x.second.varname_desc << '\n';
481 std::cout << "@param[in,out] Workspace ws - An ARTS workspace\n";
482 std::cout << "@return A class with a pointer to this variable and its "
483 "position in the workspace\n*/\n";
484 std::cout << "[[nodiscard]] inline ";
485 std::cout << x.second.varname_group << ' ' << x.first
486 << "(Workspace& ws) "
487 "noexcept { "
488 "return {"
489 << x.second.artspos << ", ws[" << x.second.artspos
490 << "]}; "
491 "}\n\n";
492 }
493 for (auto& x : artsname.group) {
494 if (x.first == "Any") continue;
495
496 std::cout << "/*! Creates in, and returns from, Workspace a/an " << x.first
497 << '\n'
498 << '\n';
499 std::cout << "@param[in,out] Workspace ws - An ARTS workspace\n";
500 std::cout << "@param[in] " << x.first
501 << " inval - The default value the variable will have in "
502 "the workspace\n";
503 std::cout << "@param[in] String name - The name the variable will have in "
504 "the workspace\n";
505 std::cout << "@param[in] String desc - The description the variable will "
506 "have in the workspace (default: \"nodescription\")\n";
507 std::cout << "@return A class with a pointer to this variable and its new "
508 "position in the workspace\n";
509 std::cout << "*/\n";
510 std::cout << "[[nodiscard]] inline\n";
511 std::cout
512 << x.first << ' ' << x.first
513 << "Create(\n Workspace& ws,\n const Group::"
514 << x.first
515 << "& inval,\n const Group::String& name,\n "
516 "const Group::"
517 "String& "
518 "desc=\"nodescription\") {\n";
519 std::cout << " const std::size_t ind = "
520 "std::size_t(ws.add_wsv_inplace({name.c_str(), desc.c_str(), "
521 << x.second << "}));\n";
522 std::cout << " " << x.first << ' ' << "val{ind, ws[ind]};\n";
523 std::cout << " return val = inval;\n"
524 << "}\n\n";
525 }
526 std::cout << "} // namespace Var \n\n";
527}
528
529std::string spaces(std::size_t n) {
530 std::string s = "";
531 for (std::size_t i=0; i<n; i++)
532 s += " ";
533 return s;
534}
535
536void print_gin_methods(const NameMaps& artsname) {
537 for (auto& x : artsname.methodname_method) {
538 // Skip methods using verbosity and Agenda methods (for now)
539 if (x.agenda_method) continue;
540
541 // Also skip create methods since these must be called via Var
542 if (std::any_of(artsname.group.cbegin(), artsname.group.cend(),
543 [metname = x.name](auto& y) {
544 return (y.first + String("Create")) == metname;
545 }))
546 continue;
547
548 // Describe the method
549 std::cout << "/*! " << x.desc << '\n';
550 for (auto a : x.authors) std::cout << "@author " << a << '\n';
551 std::cout << "\n"
552 "@param[in,out] Workspace ws - An ARTS workspace\n";
553 for (std::size_t i = 0; i < x.gout.name.size(); i++)
554 std::cout << "@param[out] " << x.gout.name[i] << " - " << x.gout.desc[i]
555 << "\n";
556 for (std::size_t i = 0; i < x.gin.name.size(); i++) {
557 std::cout << "@param[in] " << x.gin.name[i] << " - " << x.gin.desc[i];
558 if (x.gin.hasdefs[i]) std::cout << " (default: " << x.gin.defs[i] << ")";
559 std::cout << '\n';
560 }
561 std::cout << "\nUse the ARTS documentation to read more on how the "
562 "workspace is manipulated\n";
563 std::cout << "This interface function has been automatically generated\n";
564 std::cout << "*/" << '\n';
565
566 // Make the function
567 std::cout << "inline void " << x.name << "(Workspace& ws";
568
569 // First put all GOUT variables
570 for (std::size_t i = 0; i < x.gout.group.size(); i++) {
571 std::cout << ',' << '\n' << spaces(x.name.size() + 13) << "Var::" << x.gout.group[i] << ' '
572 << x.gout.name[i];
573 }
574
575 // Second put all GIN variables that have no default argument
576 for (std::size_t i = 0; i < x.gin.group.size(); i++) {
577 if (not x.gin.hasdefs[i]) {
578 std::cout << ',' << '\n' << spaces(x.name.size() + 13 - 6)
579 << "const Var::" << x.gin.group[i] << ' ' << x.gin.name[i];
580 }
581 }
582
583 // Lastly put all GIN variables that have a default argument
584 for (std::size_t i = 0; i < x.gin.group.size(); i++) {
585 if (x.gin.hasdefs[i]) {
586 if (x.gin.defs[i] == "{}") {
587 std::cout << ',' << '\n' << spaces(x.name.size() + 13 - 6)
588 << "const Var::" << x.gin.group[i] << ' ' << x.gin.name[i]
589 << '=' << "Group::" << x.gin.group[i] << x.gin.defs[i];
590 } else {
591 std::cout << ',' << '\n' << spaces(x.name.size() + 13 - 6)
592 << "const Var::" << x.gin.group[i] << ' ' << x.gin.name[i]
593 << '=' << "Group::" << x.gin.group[i] << '{'
594 << x.gin.defs[i] << '}';
595 }
596 }
597 }
598
599 // End of function definition and open function block
600 std::cout << ')' << ' ' << '{' << '\n';
601
602 // Output variables have to be on the Workspace
603 if (x.gout.group.size()) std::cout << ' ';
604 for (std::size_t i = 0; i < x.gout.group.size(); i++) {
605 std::cout << " if (" << x.gout.name[i]
606 << ".islast()) {\n throw std::runtime_error(\""
607 << x.gout.name[i] << " needs to be a defined "
608 << x.gout.group[i] << " since it is output of " << x.name
609 << "\");\n }";
610 }
611 if (x.gout.group.size()) std::cout << '\n' << '\n';
612
613 // Call the ARTS auto_md.h function
614 std::cout << ' ' << ' ' << x.name << '(';
615
616 // We need the workspace if we input an Agenda or simply pass the workspace
617 bool has_any = false;
618 if (x.pass_workspace or x.agenda_method or
619 std::any_of(
620 x.gin.group.cbegin(), x.gin.group.cend(),
621 [](auto& g) { return g == "Agenda" or g == "ArrayOfAgenda"; }) or
622 std::any_of(x.in.varname.cbegin(), x.in.varname.cend(), [&](auto& g) {
623 return artsname.varname_group.at(g).varname_group == "Agenda" or
624 artsname.varname_group.at(g).varname_group == "ArrayOfAgenda";
625 })) {
626 std::cout << "ws";
627 has_any = true;
628 }
629
630 // First are all the outputs
631 for (std::size_t i = 0; i < x.out.varname.size(); i++) {
632 if (has_any) std::cout << ',' << '\n' << spaces(x.name.size() + 2 + 1);
633 has_any = true;
634 std::cout << "Var::" << x.out.varname[i] << "(ws).value()";
635 }
636
637 // Second comes all the generic outputs
638 for (std::size_t i = 0; i < x.gout.name.size(); i++) {
639 if (has_any) std::cout << ',' << '\n' << spaces(x.name.size() + 2 + 1);
640 has_any = true;
641 std::cout << x.gout.name[i];
642 std::cout << ".value()";
643 }
644
645 // And their filenames if relevant
646 if (x.pass_wsv_names) {
647 for (std::size_t i = 0; i < x.gout.name.size(); i++) {
648 if (has_any) std::cout << ',' << '\n' << spaces(x.name.size() + 2 + 1);
649 has_any = true;
650 std::cout << x.gout.name[i] << ".name()";
651 }
652 }
653
654 // Then come all the inputs that are not also outputs
655 for (std::size_t i = 0; i < x.in.varname.size(); i++) {
656 if (std::any_of(
657 x.out.varname.cbegin(), x.out.varname.cend(),
658 [in = x.in.varname[i]](const auto& out) { return in == out; }))
659 continue;
660 if (has_any) std::cout << ',' << '\n' << spaces(x.name.size() + 2 + 1);
661 has_any = true;
662 std::cout << "Var::" << x.in.varname[i] << "(ws).value()";
663 }
664
665 // Lastly are all the generic inputs, which cannot also be outputs
666 for (std::size_t i = 0; i < x.gin.name.size(); i++) {
667 if (has_any) std::cout << ',' << '\n' << spaces(x.name.size() + 2 + 1);
668 has_any = true;
669 std::cout << x.gin.name[i];
670 std::cout << ".value()";
671 }
672
673 // And their filenames if relevant
674 if (x.pass_wsv_names) {
675 for (std::size_t i = 0; i < x.gin.name.size(); i++) {
676 if (has_any) std::cout << ',' << '\n' << spaces(x.name.size() + 2 + 1);
677 has_any = true;
678 std::cout << x.gin.name[i] << ".islast() ? Group::String{\""
679 << x.gin.name[i] << "\"} : " << x.gin.name[i] << ".name()";
680 }
681 }
682
683 // Check verbosity
684 const bool has_verbosity =
685 std::any_of(x.in.varname.cbegin(), x.in.varname.cend(),
686 [](auto& name) { return name == "verbosity"; });
687
688 // Add verbosity of it does not exist
689 if (not has_verbosity) {
690 if (has_any) std::cout << ',' << '\n' << spaces(x.name.size() + 2 + 1);
691 has_any = true;
692 std::cout << "Var::verbosity(ws).value()";
693 }
694
695 // Close the function call and the function itself
696 std::cout << ')' << ';' << '\n' << '}' << '\n' << '\n' << '\n';
697 }
698}
699
700void print_full_methods(const NameMaps& artsname) {
701 for (auto& x : artsname.methodname_method) {
702 // Skip methods using verbosity and Agenda methods (for now)
703 if (x.agenda_method) continue;
704
705 // Also skip create methods since these must be called via Var
706 if (std::any_of(artsname.group.cbegin(), artsname.group.cend(),
707 [metname = x.name](auto& y) {
708 return (y.first + String("Create")) == metname;
709 }))
710 continue;
711
712 // Skip the 'silly' methods
713 if (not x.out.varname.size() and not x.gout.name.size() and
714 not x.in.varname.size() and not x.gin.name.size())
715 continue;
716
717 // Describe the method
718 std::cout << "/*! " << x.desc << '\n';
719 for (auto a : x.authors) std::cout << "@author " << a << '\n';
720 std::cout << "\n"
721 "@param[in,out] Workspace ws - An ARTS workspace\n";
722 for (std::size_t i = 0; i < x.out.varname.size(); i++) {
723 if (std::any_of(
724 x.in.varname.cbegin(), x.in.varname.cend(),
725 [out = x.out.varname[i]](const auto& in) { return in == out; }))
726 std::cout << "@param[in,out] ";
727 else
728 std::cout << "@param[out] ";
729 std::cout << x.out.varname[i] << " - as *Var::" << x.out.varname[i]
730 << "(ws)*\n";
731 }
732 for (std::size_t i = 0; i < x.gout.name.size(); i++)
733 std::cout << "@param[out] " << x.gout.name[i] << " - " << x.gout.desc[i]
734 << "\n";
735 for (std::size_t i = 0; i < x.in.varname.size(); i++) {
736 if (std::any_of(
737 x.out.varname.cbegin(), x.out.varname.cend(),
738 [in = x.in.varname[i]](const auto& out) { return in == out; }))
739 continue;
740 std::cout << "@param[in] " << x.in.varname[i]
741 << " - as *Var::" << x.in.varname[i] << "(ws)*\n";
742 }
743 for (std::size_t i = 0; i < x.gin.name.size(); i++) {
744 std::cout << "@param[in] " << x.gin.name[i] << " - " << x.gin.desc[i];
745 if (x.gin.hasdefs[i]) std::cout << " (default: " << x.gin.defs[i] << ")";
746 std::cout << '\n';
747 }
748 std::cout << "\nUse the ARTS documentation to read more on how the "
749 "workspace is manipulated\n";
750 std::cout << "This interface function has been automatically generated\n";
751 std::cout << "*/" << '\n';
752
753 // Make the function
754 std::cout << "inline void " << x.name
755 << "(Workspace& ws [[maybe_unused]]";
756
757 // First put all OUT variables
758 for (std::size_t i = 0; i < x.out.varname.size(); i++)
759 std::cout << ',' << '\n' << spaces(x.name.size() + 13) << "Group::"
760 << artsname.varname_group.at(x.out.varname[i]).varname_group
761 << '&' << ' ' << x.out.varname[i];
762
763 // Second put all GOUT variables
764 for (std::size_t i = 0; i < x.gout.group.size(); i++)
765 std::cout << ',' << '\n' << spaces(x.name.size() + 13) << "Group::" << x.gout.group[i]
766 << '&' << ' ' << x.gout.name[i];
767
768 // Third put all the inputs that are not also outputs
769 for (std::size_t i = 0; i < x.in.varname.size(); i++) {
770 if (std::any_of(
771 x.out.varname.cbegin(), x.out.varname.cend(),
772 [in = x.in.varname[i]](const auto& out) { return in == out; }))
773 continue;
774 std::cout << ',' << '\n' << spaces(x.name.size() + 13 - 6) << "const Group::"
775 << artsname.varname_group.at(x.in.varname[i]).varname_group
776 << '&' << ' ' << x.in.varname[i];
777 }
778
779 // Last put all GIN variables that have no default argument
780 for (std::size_t i = 0; i < x.gin.group.size(); i++)
781 std::cout << ',' << '\n' << spaces(x.name.size() + 13 - 6) << "const Group::" << x.gin.group[i] << '&'
782 << ' ' << x.gin.name[i];
783
784 // End of function definition and open function block
785 std::cout << ')' << ' ' << '{' << '\n';
786
787 // Call the ARTS auto_md.h function
788 std::cout << ' ' << ' ' << x.name << '(';
789
790 // We need the workspace if we input an Agenda or simply pass the workspace
791 bool has_any = false;
792 if (x.pass_workspace or x.agenda_method or
793 std::any_of(
794 x.gin.group.cbegin(), x.gin.group.cend(),
795 [](auto& g) { return g == "Agenda" or g == "ArrayOfAgenda"; }) or
796 std::any_of(x.in.varname.cbegin(), x.in.varname.cend(), [&](auto& g) {
797 return artsname.varname_group.at(g).varname_group == "Agenda" or
798 artsname.varname_group.at(g).varname_group == "ArrayOfAgenda";
799 })) {
800 std::cout << "ws";
801 has_any = true;
802 }
803
804 // First are all the outputs
805 for (std::size_t i = 0; i < x.out.varname.size(); i++) {
806 if (has_any) std::cout << ',' << '\n' << spaces(x.name.size() + 2 + 1);
807 has_any = true;
808 std::cout << x.out.varname[i];
809 }
810
811 // Second comes all the generic outputs
812 for (std::size_t i = 0; i < x.gout.name.size(); i++) {
813 if (has_any) std::cout << ',' << '\n' << spaces(x.name.size() + 2 + 1);
814 has_any = true;
815 std::cout << x.gout.name[i];
816 }
817
818 // And their filenames if relevant
819 if (x.pass_wsv_names) {
820 for (std::size_t i = 0; i < x.gout.name.size(); i++) {
821 if (has_any) std::cout << ',' << '\n' << spaces(x.name.size() + 2 + 1);
822 has_any = true;
823 std::cout << "Group::String{\"" << x.gout.name[i] << "\"}";
824 }
825 }
826
827 // Then come all the inputs that are not also outputs
828 for (std::size_t i = 0; i < x.in.varname.size(); i++) {
829 if (std::any_of(
830 x.out.varname.cbegin(), x.out.varname.cend(),
831 [in = x.in.varname[i]](const auto& out) { return in == out; }))
832 continue;
833 if (has_any) std::cout << ',' << '\n' << spaces(x.name.size() + 2 + 1);
834 has_any = true;
835 std::cout << x.in.varname[i];
836 }
837
838 // Lastly are all the generic inputs, which cannot also be outputs
839 for (std::size_t i = 0; i < x.gin.name.size(); i++) {
840 if (has_any) std::cout << ',' << '\n' << spaces(x.name.size() + 2 + 1);
841 has_any = true;
842 std::cout << x.gin.name[i];
843 }
844
845 // And their filenames if relevant
846 if (x.pass_wsv_names) {
847 for (std::size_t i = 0; i < x.gin.name.size(); i++) {
848 if (has_any) std::cout << ',' << '\n' << spaces(x.name.size() + 2 + 1);
849 has_any = true;
850 std::cout << "Group::String{\"" << x.gin.name[i] << "\"}";
851 }
852 }
853
854 // Check verbosity
855 const bool has_verbosity =
856 std::any_of(x.in.varname.cbegin(), x.in.varname.cend(),
857 [](auto& name) { return name == "verbosity"; });
858
859 // Add verbosity of it does not exist
860 if (not has_verbosity) {
861 if (has_any) std::cout << ',' << '\n' << spaces(x.name.size() + 2 + 1);
862 has_any = true;
863 std::cout << "Var::verbosity(ws).value()";
864 }
865
866 // Close the function call and the function itself
867 std::cout << ')' << ';' << '\n' << '}' << '\n' << '\n' << '\n';
868 }
869}
870
871void print_methods(const NameMaps& artsname) {
872 std::cout << "#pragma clang diagnostic push\n";
873 std::cout << "#pragma clang diagnostic ignored \"-Wbraced-scalar-init\"\n";
874 std::cout << "namespace Method {\n";
875 print_gin_methods(artsname);
876 print_full_methods(artsname);
877 std::cout << "} // namespace Method \n\n";
878 std::cout << "#pragma clang diagnostic pop\n";
879}
880
881void print_agenda_methods(const NameMaps& artsname) {
882 std::cout << "namespace Method {\n";
883
884 for (auto& x : artsname.methodname_method) {
885 // Skip methods using verbosity and Agenda methods (for now)
886 if (x.agenda_method) continue;
887
888 // Also skip create methods since these must be called via Var
889 if (std::any_of(artsname.group.cbegin(), artsname.group.cend(),
890 [metname = x.name](auto& y) {
891 return (y.first + String("Create")) == metname;
892 }))
893 continue;
894
895 // Describe the method
896 std::cout << "/*! " << x.desc << '\n';
897 for (auto a : x.authors) std::cout << "@author " << a << '\n';
898 std::cout << "\n"
899 "@param[in,out] Workspace ws - An ARTS workspace\n";
900 for (std::size_t i = 0; i < x.gout.name.size(); i++)
901 std::cout << "@param[out] " << x.gout.name[i] << " - " << x.gout.desc[i]
902 << "\n";
903 for (std::size_t i = 0; i < x.gin.name.size(); i++) {
904 std::cout << "@param[in] " << x.gin.name[i] << " - " << x.gin.desc[i];
905 if (x.gin.hasdefs[i]) std::cout << " (default: " << x.gin.defs[i] << ")";
906 std::cout << '\n';
907 }
908 std::cout << "\nUse the ARTS documentation to read more on how the "
909 "workspace is manipulated\n";
910 std::cout << "This interface function has been automatically generated\n";
911 std::cout << "\n"
912 << "@return MRecord to call this method\n";
913 std::cout << "*/" << '\n';
914
915 // Make the function
916 std::cout << "[[nodiscard]] inline\nGroup::Internal::MRecord " << x.name
917 << "(Workspace& ws [[maybe_unused]]";
918
919 // Check if we have the first input
920 for (std::size_t i = 0; i < x.gout.group.size(); i++) {
921 std::cout << ',' << '\n' << spaces(x.name.size() + 26);
922 std::cout << "Var::" << x.gout.group[i] << ' '
923 << x.gout.name[i];
924 }
925
926 // Second put all GIN variables that have no default argument
927 for (std::size_t i = 0; i < x.gin.group.size(); i++) {
928 if (not x.gin.hasdefs[i]) {
929 std::cout << ',' << '\n' << spaces(x.name.size() + 26 - 6);
930 std::cout << "const Var::" << x.gin.group[i] << ' '
931 << x.gin.name[i];
932 }
933 }
934
935 // Lastly put all GIN variables that have a default argument
936 for (std::size_t i = 0; i < x.gin.group.size(); i++) {
937 if (x.gin.hasdefs[i]) {
938 std::cout << ',' << '\n' << spaces(x.name.size() + 26 - 6);
939 std::cout << "const Var::" << x.gin.group[i] << '&'
940 << ' ' << x.gin.name[i] << '=' << "{}";
941 }
942 }
943
944 // End of function definition and open function block
945 std::cout << ')' << ' ' << '{' << '\n';
946
947 // Output variables have to be on the Workspace
948 if (x.gout.group.size() or x.gin.group.size()) std::cout << ' ';
949 for (std::size_t i = 0; i < x.gout.group.size(); i++) {
950 std::cout << " if (" << x.gout.name[i]
951 << ".islast()) {\n throw std::runtime_error(\""
952 << x.gout.name[i] << " needs to be a defined Workspace"
953 << x.gout.group[i] << " since it is output of " << x.name
954 << "\");\n }";
955 }
956 for (std::size_t i = 0; i < x.gin.group.size(); i++) {
957 if (x.gin.hasdefs[i])
958 std::cout << " if (not " << x.gin.name[i] << ".isnull() and "
959 << x.gin.name[i]
960 << ".islast()) {\n throw std::runtime_error(\""
961 << x.gin.name[i] << " needs to be a defined Workspace"
962 << x.gin.group[i]
963 << " (or left default) since it is agenda input to " << x.name
964 << "\");\n }";
965 else
966 std::cout << " if (" << x.gin.name[i]
967 << ".islast()) {\n throw std::runtime_error(\""
968 << x.gin.name[i] << " needs to be a defined Workspace"
969 << x.gin.group[i] << " since it is agenda input to " << x.name
970 << "\");\n }";
971 }
972 if (x.gout.group.size() or x.gin.group.size()) std::cout << '\n' << '\n';
973
974 for (std::size_t i = 0; i < x.gin.group.size(); i++) {
975 if (x.gin.hasdefs[i]) {
976 std::cout
977 << " static const auto " << x.gin.name[i]
978 << "_default = Var::" << x.gin.group[i] << "Create(ws, "
979 << x.gin.defs[i] << ",\n \"" << x.name << '_' << x.gin.name[i]
980 << "_autodefault"
981 << "\",\n \"auto generated variable with default from method "
982 "definition\");\n";
983 }
984 }
985
986 // Call the ARTS auto_md.h function
987 std::cout << " return Group::Internal::MRecord(" << x.pos << ',' << '\n'
988 << spaces(34) << "Group::ArrayOfIndex(" << '{';
989
990 // First are all the outputs
991 for (std::size_t i = 0; i < x.out.varpos.size(); i++) {
992 std::cout << x.out.varpos[i] << ',' << '\n' << spaces(34 + 21);
993 }
994
995 // Second comes all the generic outputs
996 for (std::size_t i = 0; i < x.gout.name.size(); i++) {
997 std::cout << "Group::Index(" << x.gout.name[i] << ".pos())" << ',' << '\n' << spaces(34 + 21);
998 }
999 std::cout << '}' << ')' << ',' << '\n' << spaces(34) << "Group::ArrayOfIndex("
1000 << '{';
1001
1002 // Then come all the inputs that are not also outputs
1003 for (std::size_t i = 0; i < x.in.varpos.size(); i++) {
1004 std::cout << x.in.varpos[i] << ',' << '\n' << spaces(34 + 21);
1005 }
1006
1007 // Lastly are all the generic inputs, which cannot also be outputs
1008 for (std::size_t i = 0; i < x.gin.name.size(); i++) {
1009 if (x.gin.hasdefs[i])
1010 std::cout << x.gin.name[i] << ".isnull() ? Group::Index(" << x.gin.name[i]
1011 << "_default.pos()) :" << '\n' << spaces(34 + 21 + 12 + x.gin.name[i].size());
1012 std::cout << "Group::Index(" << x.gin.name[i] << ".pos())" << ',' << '\n' << spaces(34 + 21);
1013 }
1014
1015 std::cout << '}' << ')' << ',' << ' ';
1016
1017 if (x.set_method)
1018 std::cout << '\n' << spaces(34) << "Group::Internal::TokVal{" << x.gin.name[0]
1019 << ".value()}";
1020 else
1021 std::cout << '\n' << spaces(34) << "Group::Internal::TokVal{}";
1022
1023 std::cout << ',' << '\n' << spaces(34) << "Group::Agenda{}";
1024
1025 // Close the function call and the function itself
1026 std::cout << ')' << ';' << '\n' << '}' << '\n' << '\n' << '\n';
1027 }
1028 std::cout << "} // namespace Method \n\n";
1029}
1030
1031void print_agenda_execute(const NameMaps& artsname) {
1032 std::cout << "namespace Execute { \n\n";
1033 for (auto& x : artsname.agendaname_agenda) {
1034 std::cout << "/*! " << x.second.desc << '\n'
1035 << "@param[in,out] Workspace ws - An ARTS workspace\n"
1036 << "*/\n"
1037 << "inline void " << x.first << "(Workspace& ws) {\n " << x.first
1038 << "Execute(ws";
1039 for (auto& name : x.second.outs) {
1040 std::cout << ',' << '\n' << spaces(x.first.size() + 2 + 1 + 7) << "Var::" << name
1041 << "(ws).value()";
1042 }
1043 for (auto& name : x.second.ins) {
1044 if (not std::any_of(x.second.outs.cbegin(), x.second.outs.cend(),
1045 [name](auto& outname) { return name == outname; }))
1046 std::cout << ',' << '\n' << spaces(x.first.size() + 2 + 1 + 7) << "Var::" << name
1047 << "(ws).value()";
1048 }
1049 std::cout << ',' << '\n' << spaces(x.first.size() + 2 + 1 + 7) << "Var::" << x.first << "(ws).value());\n}\n\n";
1050 }
1051 std::cout << "} // namespace Execute \n\n";
1052}
1053
1054void print_agenda_define(const NameMaps& artsname) {
1055 std::cout << "namespace Define { \n";
1056 std::cout << "/*! Append Records to an agenda */\n";
1057 std::cout
1058 << "template <typename ... Records>\nvoid Append(Group::Agenda& ag, "
1059 "Records ... records) {\n"
1060 << " for (auto& x: { Group::Internal::MRecord(records)... })\n "
1061 "ag.push_back(x);\n}\n\n";
1062 for (auto& x : artsname.agendaname_agenda) {
1063 if (artsname.varname_group.at(x.first).varname_group == "ArrayOfAgenda")
1064 continue;
1065 std::cout << "/*! " << x.second.desc << '\n'
1066 << "@param[in,out] Workspace ws - An ARTS workspace\n"
1067 << "@param[in] MRecords records - Any number of ARTS methods "
1068 "from AgendaMethod\n"
1069 << "*/\n"
1070 << "template <typename ... Records> "
1071 << "\nvoid " << x.first
1072 << "(Workspace& ws, Records ... records) {\n"
1073 << " Var::" << x.first << "(ws).value().resize(0);\n"
1074 << " Var::" << x.first << "(ws).value().set_name(\"" << x.first
1075 << "\");\n"
1076 << " Append(Var::" << x.first << "(ws).value(), records...);"
1077 << "\n"
1078 << " Var::" << x.first
1079 << "(ws).value().check(ws, Var::verbosity(ws).value());\n}\n\n";
1080 }
1081 std::cout << "} // namespace Define \n\n";
1082}
1083
1084void print_agendas(const NameMaps& artsname) {
1085 std::cout << "/*! ARTS Agenda interaction namespace\n\n Will only be "
1086 "populated by namespaces.\n Users of the API can define their "
1087 "Agendas\n in the Agenda namespace\n*/\n";
1088 std::cout << "namespace Agenda {\n";
1089 print_agenda_methods(artsname);
1090 print_agenda_execute(artsname);
1091 print_agenda_define(artsname);
1092 std::cout << "} // namespace Agenda\n";
1093}
1094
1096 std::cout << "namespace Species {\n";
1097 std::cout << " using namespace ::Species;\n";
1098 std::cout << "} // namespace Species \n\n";
1099}
1100
1102 std::cout << "/*! Create a Workspace and set its main verbosity\n\n"
1103 << " @param[in] screen Screen verbosity\n"
1104 << " @param[in] file File verbosity\n"
1105 << " @param[in] agenda Agenda verbosity\n"
1106 << " @param[in] basename Default basename for output variables\n"
1107 << " @param[in] numthreads OpenMP thread count (defaults to max "
1108 "if invalid count)\n"
1109 << " @return Workspace a full ARTS Workspace\n"
1110 << "*/\n";
1111 std::cout
1112 << "inline Workspace init(std::size_t screen=0, std::size_t file=0, "
1113 "std::size_t agenda=0, const Group::String& basename=\"arts\", "
1114 "[[maybe_unused]] int numthreads=0) {\n"
1115#ifdef _OPENMP
1116 " omp_set_num_threads(numthreads < 1 ? arts_omp_get_max_threads() : "
1117 "numthreads > arts_omp_get_max_threads() ? arts_omp_get_max_threads() "
1118 ": numthreads);\n"
1119 "\n"
1120#endif
1121 " define_wsv_group_names();\n"
1122 " Workspace::define_wsv_data();\n"
1123 " Workspace::define_wsv_map();\n"
1124 " define_md_data_raw();\n"
1125 " expand_md_data_raw_to_md_data();\n"
1126 " define_md_map();\n"
1127 " define_agenda_data();\n"
1128 " define_agenda_map();\n"
1129 " global_data::workspace_memory_handler.initialize();\n"
1130 "\n"
1131 " Workspace ws;\n"
1132 " ws.initialize();\n"
1133 " Var::verbosity(ws).value().set_screen_verbosity(screen);\n"
1134 " Var::verbosity(ws).value().set_agenda_verbosity(agenda);\n"
1135 " Var::verbosity(ws).value().set_file_verbosity(file);\n"
1136 " Var::verbosity(ws).value().set_main_agenda(1);\n"
1137 "\n"
1138 " out_basename = basename;\n"
1139 "\n"
1140 "#ifndef NDEBUG\n"
1141 " ws.context = \"\";\n"
1142 "#endif\n"
1143 "\n"
1144 " return ws;\n"
1145 "}\n";
1146}
1147
1148int main() {
1154 define_md_map();
1157
1158 const auto artsname = NameMaps();
1159
1160 std::cout << "#ifndef autoarts_h\n"
1161 << "#define autoarts_h\n"
1162 << '\n';
1163
1165
1166 std::cout << "namespace ARTS {\n";
1167
1169
1170 print_variables(artsname);
1171
1172 print_methods(artsname);
1173
1174 print_agendas(artsname);
1175
1177
1178 print_startup();
1179
1180 std::cout << "} // namespace::ARTS\n\n";
1181
1182 std::cout << "#endif // autoarts_h\n";
1183}
void define_agenda_map()
void define_agenda_data()
Definition: agendas.cc:44
void define_wsv_group_names()
Define the array of workspace variable group names.
Definition: groups.cc:77
static void define_wsv_data()
Define workspace variables.
Definition: workspace.cc:39
static void define_wsv_map()
Map WSV names to indices.
Definition: workspace_ng.cc:48
static Array< WsvRecord > wsv_data
Global WSV data.
Definition: workspace_ng.h:58
static map< String, Index > WsvMap
Global map associated with wsv_data.
Definition: workspace_ng.h:61
void print_include_and_external()
void print_agenda_methods(const NameMaps &artsname)
std::vector< Method > methods()
std::pair< std::vector< std::string >, std::vector< bool > > fixed_defaults(const std::vector< std::string > &vargroups, const std::vector< std::string > &vardefaults)
void print_gin_methods(const NameMaps &artsname)
void print_methods(const NameMaps &artsname)
void print_full_methods(const NameMaps &artsname)
void print_agenda_define(const NameMaps &artsname)
void print_agenda_execute(const NameMaps &artsname)
std::map< std::string, AgendaData > agendas()
void print_startup()
std::string spaces(std::size_t n)
void print_variables(const NameMaps &artsname)
std::map< std::string, Group > groups()
void print_agendas(const NameMaps &artsname)
int main()
void print_groups_and_namespaces(const NameMaps &artsname)
void print_species_identification()
void define_md_data_raw()
Definition: methods.cc:191
void define_md_map()
Define MdMap.
Definition: methods_aux.cc:473
void expand_md_data_raw_to_md_data()
Expand supergeneric methods.
Definition: methods_aux.cc:410
#define NODEF
Definition: methods.h:35
my_basic_string< char > String
The String type for ARTS.
Definition: mystring.h:287
const Array< MdRecord > md_data
Lookup information for workspace methods.
const map< String, Index > MdMap
The map associated with md_data.
Definition: methods_aux.cc:39
const Array< AgRecord > agenda_data
The lookup information for the agendas.
Definition: agendas.cc:41
const map< String, Index > WsvGroupMap
The map associated with wsv_group_names.
Definition: groups.cc:41
map< String, Index > AgendaMap
The map associated with agenda_data.
#define v
#define a
std::size_t pos
std::vector< std::string > outs
std::vector< std::string > ins
std::string desc
std::string varname_desc
std::size_t artspos
std::string varname_group
std::vector< std::string > group
std::vector< bool > hasdefs
std::vector< std::string > defs
std::vector< std::string > name
std::vector< std::string > desc
std::vector< std::string > group
std::vector< std::string > desc
std::vector< std::string > name
std::vector< std::size_t > varpos
std::vector< std::string > varname
std::vector< std::size_t > varpos
std::vector< std::string > varname
std::string desc
bool pass_workspace
bool agenda_method
bool uses_templates
std::string name
std::vector< std::string > authors
std::vector< std::size_t > inoutvarpos
bool pass_wsv_names
bool set_method
std::size_t pos
bool supergeneric
std::vector< Method > methodname_method
std::map< std::string, AgendaData > agendaname_agenda
std::map< std::string, std::size_t > group
std::map< std::string, Group > varname_group