64void align(ofstream& ofs,
bool& is_first_parameter,
const String& indent) {
66 if (is_first_parameter)
67 is_first_parameter =
false;
87 bool is_first_parameter =
true;
95 bool pass_workspace =
false;
108 for (Index j = 0; !pass_workspace && j < mdd.
In().nelem(); j++) {
110 pass_workspace =
true;
116 for (Index j = 0; !pass_workspace && j < mdd.
GInType().nelem(); j++) {
118 pass_workspace =
true;
123 ofs <<
"//! WORKSPACE METHOD: " << fullname <<
".\n";
128 size_t start_pos = 0;
130 while (start_pos != string::npos) {
131 start_pos = DoxyDescription.find(
"\n ", start_pos);
132 if (start_pos && start_pos != string::npos &&
133 DoxyDescription[start_pos] - 1 !=
'\n') {
134 DoxyDescription.insert(start_pos + 1,
"<br>");
144 ofs << DoxyDescription <<
"\n";
147 for (Index j = 0; j < mdd.
Authors().nelem(); ++j) {
148 ofs << indent <<
"\\author " << mdd.
Authors()[j] <<
"\n";
154 ofs << indent <<
"\\param[in,out] "
159 for (Index j = 0; j < vo.
nelem(); ++j) {
161 (std::find(mdd.
In().begin(), mdd.
In().end(), vo[j]) != mdd.
In().end());
164 ofs << indent <<
"\\param[in,out] " << wsv_data[vo[j]].Name()
165 <<
" WS Input/Output\n";
167 ofs << indent <<
"\\param[out] " << wsv_data[vo[j]].Name()
173 for (Index j = 0; j < vgo.
nelem(); ++j) {
174 ofs << indent <<
"\\param[out] ";
176 if (mdd.
GOut()[j].length())
177 ofs << mdd.
GOut()[j];
179 ofs <<
"genericoutput" << j + 1;
182 ofs <<
" Supergeneric output\n";
184 ofs <<
" Generic output\n";
189 for (Index j = 0; j < vgo.
nelem(); ++j) {
190 ofs << indent <<
"\\param[in] ";
191 if (mdd.
GOut()[j].length())
192 ofs << mdd.
GOut()[j] <<
"_wsvname";
194 ofs <<
"genericoutput" << j + 1 <<
"_wsvname";
196 ofs <<
" Generic Output Name" << endl;
201 for (Index j = 0; j < vi.
nelem(); ++j) {
202 ofs << indent <<
"\\param[in] " << wsv_data[vi[j]].Name()
207 for (Index j = 0; j < vgi.
nelem(); ++j) {
208 ofs << indent <<
"\\param[in] ";
209 if (mdd.
GIn()[j] !=
"")
212 ofs <<
"genericinput" << j + 1;
214 ofs <<
" Generic Input";
217 ofs <<
" (Default: \"" << mdd.
GInDefault()[j] <<
"\")";
224 for (Index j = 0; j < vgi.
nelem(); ++j) {
225 ofs << indent <<
"\\param[in] ";
226 if (mdd.
GIn()[j].length())
227 ofs << mdd.
GIn()[j] <<
"_wsvname";
229 ofs <<
"genericinput" << j + 1 <<
"_wsvname";
231 ofs <<
" Generic Input Name" << endl;
237 align(ofs, is_first_parameter, indent);
238 ofs << indent <<
"\\param[in] "
239 <<
"input_agenda Agenda from controlfile\n";
266 bool is_first_parameter =
true;
274 bool pass_workspace =
false;
287 for (Index j = 0; !pass_workspace && j < mdd.
In().nelem(); j++) {
289 pass_workspace =
true;
295 for (Index j = 0; !pass_workspace && j < mdd.
GInType().nelem(); j++) {
297 pass_workspace =
true;
308 ofs <<
"template <typename T>" << endl;
312 ofs <<
"void " << fullname <<
"(";
315 ofs <<
"// Workspace reference:\n";
316 ofs << indent <<
"Workspace& ws";
317 is_first_parameter =
false;
323 bool is_first_of_these =
true;
325 for (Index j = 0; j < vo.
nelem(); ++j) {
327 align(ofs, is_first_parameter, indent);
330 if (is_first_of_these) {
331 ofs <<
"// WS Output:\n";
333 is_first_of_these =
false;
344 bool is_first_of_these =
true;
346 for (Index j = 0; j < vgo.
nelem(); ++j) {
348 align(ofs, is_first_parameter, indent);
351 if (is_first_of_these) {
352 ofs <<
"// WS Generic Output:\n";
354 is_first_of_these =
false;
357 if (wsv_groups[mdd.
GOutType()[j]] ==
"Any")
360 ofs << wsv_groups[mdd.
GOutType()[j]] <<
"& ";
362 if (mdd.
GOut()[j].length())
363 ofs << mdd.
GOut()[j];
365 ofs <<
"genericoutput" << j + 1;
372 bool is_first_of_these =
true;
374 for (Index j = 0; j < vgo.
nelem(); ++j) {
376 align(ofs, is_first_parameter, indent);
379 if (is_first_of_these) {
380 ofs <<
"// WS Generic Output Names:\n";
382 is_first_of_these =
false;
385 ofs <<
"const String& ";
386 if (mdd.
GOut()[j].length())
387 ofs << mdd.
GOut()[j] <<
"_wsvname";
389 ofs <<
"genericoutput" << j + 1 <<
"_wsvname";
396 bool is_first_of_these =
true;
398 for (Index j = 0; j < vi.
nelem(); ++j) {
400 align(ofs, is_first_parameter, indent);
403 if (is_first_of_these) {
404 ofs <<
"// WS Input:\n";
406 is_first_of_these =
false;
417 bool is_first_of_these =
true;
419 for (Index j = 0; j < vgi.
nelem(); ++j) {
421 align(ofs, is_first_parameter, indent);
424 if (is_first_of_these) {
425 ofs <<
"// WS Generic Input:\n";
427 is_first_of_these =
false;
430 if (wsv_groups[mdd.
GInType()[j]] ==
"Any") {
432 if (mdd.
GIn()[j].length())
435 ofs <<
"genericinput" << j + 1;
437 ofs <<
"const " << wsv_groups[mdd.
GInType()[j]] <<
"& ";
438 if (mdd.
GIn()[j].length())
441 ofs <<
"genericinput" << j + 1;
449 bool is_first_of_these =
true;
451 for (Index j = 0; j < vgi.
nelem(); ++j) {
453 align(ofs, is_first_parameter, indent);
456 if (is_first_of_these) {
457 ofs <<
"// WS Generic Input Names:\n";
459 is_first_of_these =
false;
462 ofs <<
"const String& ";
463 if (mdd.
GIn()[j].length())
464 ofs << mdd.
GIn()[j] <<
"_wsvname";
466 ofs <<
"genericinput" << j + 1 <<
"_wsvname";
472 align(ofs, is_first_parameter, indent);
473 ofs <<
"// Agenda from controlfile:\n";
475 ofs <<
"const Agenda& input_agenda";
480 bool pass_verbosity =
true;
483 for (Index j = 0; pass_verbosity && j < mdd.
In().nelem(); j++) {
484 if (wsv_data[mdd.
In()[j]].Name() ==
"verbosity") {
485 pass_verbosity =
false;
490 for (Index j = 0; pass_verbosity && j < mdd.
Out().nelem(); j++) {
491 if (wsv_data[mdd.
Out()[j]].Name() ==
"verbosity") {
492 pass_verbosity =
false;
496 if (pass_verbosity) {
497 align(ofs, is_first_parameter, indent);
498 ofs <<
"// Verbosity object:\n";
500 ofs <<
"const Verbosity& verbosity";
510 for (
auto i = md_data.begin(); i < md_data.end();
512 bool invalid_author =
false;
513 for (
auto j = i->Authors().begin();
514 !invalid_author && j < i->Authors().end();
516 if (*j ==
"" || *j ==
"unknown") invalid_author =
true;
519 if (invalid_author) {
520 os << i->Name() <<
": Missing or invalid author.\n";
526 os << i->Name() <<
": Empty description.\n";
530 os << i->Name() <<
": Missing newline at the end of description.\n";
534 os << i->Name() <<
": Extra newline at the end of description.\n";
542 <<
"Error(s) found in workspace method documentation (check methods.cc):\n"
572 const Index n_md = md_data.nelem();
579 ofs <<
"// This file was generated automatically by make_auto_md_h.cc.\n";
580 ofs <<
"// DO NOT EDIT !\n";
581 ofs <<
"// Generated: " << __DATE__ <<
", " << __TIME__ <<
"\n\n";
583 ofs <<
"#ifndef auto_md_h\n";
584 ofs <<
"#define auto_md_h\n\n";
586 ofs <<
"#include \"matpack_data.h\"\n"
587 <<
"#include \"matpack_sparse.h\"\n"
588 <<
"#include \"species_tags.h\"\n"
589 <<
"#include \"artstime.h\"\n"
590 <<
"#include \"gas_abs_lookup.h\"\n"
591 <<
"#include \"gridded_fields.h\"\n"
592 <<
"#include \"linemixing_hitran.h\"\n"
593 <<
"#include \"optproperties.h\"\n"
594 <<
"#include \"jacobian.h\"\n"
595 <<
"#include \"mc_antenna.h\"\n"
596 <<
"#include \"m_general.h\"\n"
597 <<
"#include \"parser.h\"\n"
598 <<
"#include \"workspace_ng.h\"\n"
599 <<
"#include \"cia.h\"\n"
600 <<
"#include \"covariance_matrix.h\"\n"
601 <<
"#include \"propagationmatrix.h\"\n"
602 <<
"#include <predefined/predef_data.h>\n"
603 <<
"#include \"transmissionmatrix.h\"\n"
604 <<
"#include \"sun.h\"\n"
605 <<
"#include \"telsem.h\"\n"
606 <<
"#include \"tessem.h\"\n"
607 <<
"#include \"xsec_fit.h\"\n"
608 <<
"#include \"absorptionlines.h\"\n"
609 <<
"#include \"linemixing.h\"\n"
610 <<
"#include \"callback.h\"\n"
613 ofs <<
"// This is only used for a consistency check. You can get the\n"
614 <<
"// number of WSMs from md_data.nelem().\n"
615 <<
"#define N_MD " << n_md <<
"\n\n";
618 ofs <<
"// Method function declarations:\n\n";
619 for (Index i = 0; i < n_md; ++i) {
628 ofs <<
"// Supergeneric template function declarations:\n\n";
629 for (Index i = 0; i < md_data_raw.nelem(); ++i) {
630 const MdRecord& mdd = md_data_raw[i];
638 ofs <<
"// Get-away function declarations:\n\n";
639 for (Index i = 0; i < n_md; ++i) {
643 <<
"_g(Workspace& ws, const MRecord& mr);\n";
645 ofs <<
"void " << mdd.
Name()
646 <<
"_g(Workspace& ws, const MRecord& mr);\n";
660 for (Index i = 0; i < agenda_data.nelem(); i++) {
663 agenda_data[i].Name(),
" agenda fails");
664 bool is_agenda_array = wsv_data[wsv_ptr->second].Group() ==
671 ofs <<
"\n#endif // auto_md_h\n";
676 }
catch (
const std::runtime_error& x) {
677 cout <<
"Something went wrong. Message text:\n";
678 cout << x.what() <<
'\n';
void write_agenda_wrapper_header(ofstream &ofs, const AgRecord &agr, bool is_agenda_array)
Write a agenda wrapper header.
Declarations for AgRecord, storing lookup information for one agenda.
void define_agenda_data()
This file contains the definition of Array.
The global header file for ARTS.
void define_wsv_groups()
Define the array of workspace variable group names.
This can be used to make arrays out of anything.
Index nelem() const ARTS_NOEXCEPT
All information for one workspace method.
const ArrayOfIndex & In() const
const String & Name() const
const ArrayOfIndex & InOnly() const
bool PassWorkspace() const
const ArrayOfIndex & GOutType() const
const String & ActualGroups() const
const Array< String > & GInDefault() const
bool PassWsvNames() const
const String & Description() const
const ArrayOfString & GOut() const
bool UsesTemplates() const
bool AgendaMethod() const
bool Supergeneric() const
const ArrayOfString & Authors() const
const ArrayOfIndex & Out() const
const ArrayOfIndex & GInType() const
const ArrayOfString & GIn() const
void insert_substr(const my_basic_string< charT > &searchstr, const my_basic_string< charT > &insstr)
Helper macros for debugging.
#define ARTS_USER_ERROR_IF(condition,...)
int check_newline(const std::string_view s)
Checks if there is exactly one newline character at the end of the string.
void open_output_file(ofstream &file, const std::string_view name)
Open a file for writing.
This file contains basic functions to handle ASCII files.
Index get_wsv_group_id(const String &name)
Returns the id of the given group.
bool is_agenda_group_id(const Index group)
Check if group is an agenda group.
void write_method_header_documentation(ofstream &ofs, const MdRecord &mdd)
Write method header documentation.
void write_method_header(ofstream &ofs, const MdRecord &mdd)
Write a method header.
void align(ofstream &ofs, bool &is_first_parameter, const String &indent)
bool md_sanity_checks(const Array< MdRecord > &md_data)
void define_md_data_raw()
Declaration of the class MdRecord.
void expand_md_data_raw_to_md_data()
Expand supergeneric methods.
const ArrayOfGroupRecord wsv_groups
The names associated with Wsv groups as Strings.
const Array< MdRecord > md_data_raw
Lookup information for workspace methods.
Array< WsvRecord > wsv_data
const Array< MdRecord > md_data
Lookup information for workspace methods.
std::map< String, Index > WsvMap
const Array< AgRecord > agenda_data
The lookup information for the agendas.
This file contains the Workspace class.