81void align(ofstream& ofs,
bool& is_first_parameter,
const String& indent) {
83 if (is_first_parameter)
84 is_first_parameter =
false;
104 bool is_first_parameter =
true;
112 bool pass_workspace =
false;
125 for (
Index j = 0; !pass_workspace && j < mdd.
In().nelem(); j++) {
127 pass_workspace =
true;
133 for (
Index j = 0; !pass_workspace && j < mdd.
GInType().nelem(); j++) {
135 pass_workspace =
true;
140 ofs <<
"//! WORKSPACE METHOD: " << fullname <<
".\n";
145 size_t start_pos = 0;
147 while (start_pos != string::npos) {
148 start_pos = DoxyDescription.find(
"\n ", start_pos);
149 if (start_pos && start_pos != string::npos &&
150 DoxyDescription[start_pos] - 1 !=
'\n') {
151 DoxyDescription.insert(start_pos + 1,
"<br>");
161 ofs << DoxyDescription <<
"\n";
165 ofs << indent <<
"\\author " << mdd.
Authors()[j] <<
"\n";
171 ofs << indent <<
"\\param[in,out] "
178 (std::find(mdd.
In().begin(), mdd.
In().end(), vo[j]) != mdd.
In().end());
181 ofs << indent <<
"\\param[in,out] " << wsv_data[vo[j]].Name()
182 <<
" WS Input/Output\n";
184 ofs << indent <<
"\\param[out] " << wsv_data[vo[j]].Name()
191 ofs << indent <<
"\\param[out] ";
193 if (mdd.
GOut()[j].length())
194 ofs << mdd.
GOut()[j];
196 ofs <<
"genericoutput" << j + 1;
199 ofs <<
" Supergeneric output\n";
201 ofs <<
" Generic output\n";
207 ofs << indent <<
"\\param[in] ";
208 if (mdd.
GOut()[j].length())
209 ofs << mdd.
GOut()[j] <<
"_wsvname";
211 ofs <<
"genericoutput" << j + 1 <<
"_wsvname";
213 ofs <<
" Generic Output Name" << endl;
219 ofs << indent <<
"\\param[in] " << wsv_data[vi[j]].Name()
225 ofs << indent <<
"\\param[in] ";
226 if (mdd.
GIn()[j] !=
"")
229 ofs <<
"genericinput" << j + 1;
231 ofs <<
" Generic Input";
234 ofs <<
" (Default: \"" << mdd.
GInDefault()[j] <<
"\")";
242 ofs << indent <<
"\\param[in] ";
243 if (mdd.
GIn()[j].length())
244 ofs << mdd.
GIn()[j] <<
"_wsvname";
246 ofs <<
"genericinput" << j + 1 <<
"_wsvname";
248 ofs <<
" Generic Input Name" << endl;
254 align(ofs, is_first_parameter, indent);
255 ofs << indent <<
"\\param[in] "
256 <<
"input_agenda Agenda from controlfile\n";
283 bool is_first_parameter =
true;
291 bool pass_workspace =
false;
304 for (
Index j = 0; !pass_workspace && j < mdd.
In().nelem(); j++) {
306 pass_workspace =
true;
312 for (
Index j = 0; !pass_workspace && j < mdd.
GInType().nelem(); j++) {
314 pass_workspace =
true;
325 ofs <<
"template <typename T>" << endl;
329 ofs <<
"void " << fullname <<
"(";
332 ofs <<
"// Workspace reference:\n";
333 ofs << indent <<
"Workspace& ws";
334 is_first_parameter =
false;
340 bool is_first_of_these =
true;
344 align(ofs, is_first_parameter, indent);
347 if (is_first_of_these) {
348 ofs <<
"// WS Output:\n";
350 is_first_of_these =
false;
361 bool is_first_of_these =
true;
365 align(ofs, is_first_parameter, indent);
368 if (is_first_of_these) {
369 ofs <<
"// WS Generic Output:\n";
371 is_first_of_these =
false;
374 if (wsv_groups[mdd.
GOutType()[j]] ==
"Any")
377 ofs << wsv_groups[mdd.
GOutType()[j]] <<
"& ";
379 if (mdd.
GOut()[j].length())
380 ofs << mdd.
GOut()[j];
382 ofs <<
"genericoutput" << j + 1;
389 bool is_first_of_these =
true;
393 align(ofs, is_first_parameter, indent);
396 if (is_first_of_these) {
397 ofs <<
"// WS Generic Output Names:\n";
399 is_first_of_these =
false;
402 ofs <<
"const String& ";
403 if (mdd.
GOut()[j].length())
404 ofs << mdd.
GOut()[j] <<
"_wsvname";
406 ofs <<
"genericoutput" << j + 1 <<
"_wsvname";
413 bool is_first_of_these =
true;
417 align(ofs, is_first_parameter, indent);
420 if (is_first_of_these) {
421 ofs <<
"// WS Input:\n";
423 is_first_of_these =
false;
434 bool is_first_of_these =
true;
438 align(ofs, is_first_parameter, indent);
441 if (is_first_of_these) {
442 ofs <<
"// WS Generic Input:\n";
444 is_first_of_these =
false;
447 if (wsv_groups[mdd.
GInType()[j]] ==
"Any") {
449 if (mdd.
GIn()[j].length())
452 ofs <<
"genericinput" << j + 1;
454 ofs <<
"const " << wsv_groups[mdd.
GInType()[j]] <<
"& ";
455 if (mdd.
GIn()[j].length())
458 ofs <<
"genericinput" << j + 1;
466 bool is_first_of_these =
true;
470 align(ofs, is_first_parameter, indent);
473 if (is_first_of_these) {
474 ofs <<
"// WS Generic Input Names:\n";
476 is_first_of_these =
false;
479 ofs <<
"const String& ";
480 if (mdd.
GIn()[j].length())
481 ofs << mdd.
GIn()[j] <<
"_wsvname";
483 ofs <<
"genericinput" << j + 1 <<
"_wsvname";
489 align(ofs, is_first_parameter, indent);
490 ofs <<
"// Agenda from controlfile:\n";
492 ofs <<
"const Agenda& input_agenda";
497 bool pass_verbosity =
true;
500 for (
Index j = 0; pass_verbosity && j < mdd.
In().nelem(); j++) {
501 if (wsv_data[mdd.
In()[j]].Name() ==
"verbosity") {
502 pass_verbosity =
false;
507 for (
Index j = 0; pass_verbosity && j < mdd.
Out().nelem(); j++) {
508 if (wsv_data[mdd.
Out()[j]].Name() ==
"verbosity") {
509 pass_verbosity =
false;
513 if (pass_verbosity) {
514 align(ofs, is_first_parameter, indent);
515 ofs <<
"// Verbosity object:\n";
517 ofs <<
"const Verbosity& verbosity";
527 for (
auto i = md_data.begin(); i < md_data.end();
529 bool invalid_author =
false;
530 for (
auto j = i->Authors().begin();
531 !invalid_author && j < i->Authors().end();
533 if (*j ==
"" || *j ==
"unknown") invalid_author =
true;
536 if (invalid_author) {
537 os << i->Name() <<
": Missing or invalid author.\n";
543 os << i->Name() <<
": Empty description.\n";
547 os << i->Name() <<
": Missing newline at the end of description.\n";
551 os << i->Name() <<
": Extra newline at the end of description.\n";
559 <<
"Error(s) found in workspace method documentation (check methods.cc):\n"
589 const Index n_md = md_data.nelem();
596 ofs <<
"// This file was generated automatically by make_auto_md_h.cc.\n";
597 ofs <<
"// DO NOT EDIT !\n";
598 ofs <<
"// Generated: " << __DATE__ <<
", " << __TIME__ <<
"\n\n";
600 ofs <<
"#ifndef auto_md_h\n";
601 ofs <<
"#define auto_md_h\n\n";
603 ofs <<
"#include \"matpackI.h\"\n"
604 <<
"#include \"matpackII.h\"\n"
605 <<
"#include \"species_tags.h\"\n"
606 <<
"#include \"artstime.h\"\n"
607 <<
"#include \"gas_abs_lookup.h\"\n"
608 <<
"#include \"gridded_fields.h\"\n"
609 <<
"#include \"linemixing_hitran.h\"\n"
610 <<
"#include \"optproperties.h\"\n"
611 <<
"#include \"jacobian.h\"\n"
612 <<
"#include \"mc_antenna.h\"\n"
613 <<
"#include \"m_general.h\"\n"
614 <<
"#include \"parser.h\"\n"
615 <<
"#include \"workspace_ng.h\"\n"
616 <<
"#include \"cia.h\"\n"
617 <<
"#include \"covariance_matrix.h\"\n"
618 <<
"#include \"propagationmatrix.h\"\n"
619 <<
"#include <predefined/predef_data.h>\n"
620 <<
"#include \"transmissionmatrix.h\"\n"
621 <<
"#include \"sun.h\"\n"
622 <<
"#include \"telsem.h\"\n"
623 <<
"#include \"tessem.h\"\n"
624 <<
"#include \"xsec_fit.h\"\n"
625 <<
"#include \"absorptionlines.h\"\n"
626 <<
"#include \"linemixing.h\"\n"
627 <<
"#include \"callback.h\"\n"
630 ofs <<
"// This is only used for a consistency check. You can get the\n"
631 <<
"// number of WSMs from md_data.nelem().\n"
632 <<
"#define N_MD " << n_md <<
"\n\n";
635 ofs <<
"// Method function declarations:\n\n";
636 for (
Index i = 0; i < n_md; ++i) {
645 ofs <<
"// Supergeneric template function declarations:\n\n";
646 for (
Index i = 0; i < md_data_raw.nelem(); ++i) {
647 const MdRecord& mdd = md_data_raw[i];
655 ofs <<
"// Get-away function declarations:\n\n";
656 for (
Index i = 0; i < n_md; ++i) {
660 <<
"_g(Workspace& ws, const MRecord& mr);\n";
662 ofs <<
"void " << mdd.
Name()
663 <<
"_g(Workspace& ws, const MRecord& mr);\n";
677 for (
Index i = 0; i < agenda_data.nelem(); i++) {
680 agenda_data[i].Name(),
" agenda fails");
681 bool is_agenda_array = wsv_data[wsv_ptr->second].Group() ==
688 ofs <<
"\n#endif // auto_md_h\n";
693 }
catch (
const std::runtime_error& x) {
694 cout <<
"Something went wrong. Message text:\n";
695 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)
INDEX Index
The type to use for all integer numbers and indices.
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.