Go to the documentation of this file.
77 void align(ofstream& ofs,
bool& is_first_parameter,
const String& indent) {
79 if (is_first_parameter)
80 is_first_parameter =
false;
100 bool is_first_parameter =
true;
108 bool pass_workspace =
false;
121 for (
Index j = 0; !pass_workspace && j < mdd.
In().
nelem(); j++) {
123 pass_workspace =
true;
131 pass_workspace =
true;
136 ofs <<
"//! WORKSPACE METHOD: " << fullname <<
".\n";
141 size_t start_pos = 0;
143 while (start_pos != string::npos) {
144 start_pos = DoxyDescription.find(
"\n ", start_pos);
145 if (start_pos && start_pos != string::npos &&
146 DoxyDescription[start_pos] - 1 !=
'\n') {
147 DoxyDescription.insert(start_pos + 1,
"<br>");
157 ofs << DoxyDescription <<
"\n";
161 ofs << indent <<
"\\author " << mdd.
Authors()[j] <<
"\n";
167 ofs << indent <<
"\\param[in,out] "
174 (std::find(mdd.
In().begin(), mdd.
In().end(), vo[j]) != mdd.
In().end());
177 ofs << indent <<
"\\param[in,out] " << wsv_data[vo[j]].Name()
178 <<
" WS Input/Output\n";
180 ofs << indent <<
"\\param[out] " << wsv_data[vo[j]].Name()
187 ofs << indent <<
"\\param[out] ";
189 if (mdd.
GOut()[j].length())
190 ofs << mdd.
GOut()[j];
192 ofs <<
"genericoutput" << j + 1;
195 ofs <<
" Supergeneric output\n";
197 ofs <<
" Generic output\n";
203 ofs << indent <<
"\\param[in] ";
204 if (mdd.
GOut()[j].length())
205 ofs << mdd.
GOut()[j] <<
"_wsvname";
207 ofs <<
"genericoutput" << j + 1 <<
"_wsvname";
209 ofs <<
" Generic Output Name" << endl;
215 ofs << indent <<
"\\param[in] " << wsv_data[vi[j]].Name()
221 ofs << indent <<
"\\param[in] ";
222 if (mdd.
GIn()[j] !=
"")
225 ofs <<
"genericinput" << j + 1;
227 ofs <<
" Generic Input";
230 ofs <<
" (Default: \"" << mdd.
GInDefault()[j] <<
"\")";
238 ofs << indent <<
"\\param[in] ";
239 if (mdd.
GIn()[j].length())
240 ofs << mdd.
GIn()[j] <<
"_wsvname";
242 ofs <<
"genericinput" << j + 1 <<
"_wsvname";
244 ofs <<
" Generic Input Name" << endl;
250 align(ofs, is_first_parameter, indent);
251 ofs << indent <<
"\\param[in] "
252 <<
"input_agenda Agenda from controlfile\n";
279 bool is_first_parameter =
true;
287 bool pass_workspace =
false;
300 for (
Index j = 0; !pass_workspace && j < mdd.
In().
nelem(); j++) {
302 pass_workspace =
true;
310 pass_workspace =
true;
321 ofs <<
"template <typename T>" << endl;
325 ofs <<
"void " << fullname <<
"(";
328 ofs <<
"// Workspace reference:\n";
329 ofs << indent <<
"Workspace& ws";
330 is_first_parameter =
false;
336 bool is_first_of_these =
true;
340 align(ofs, is_first_parameter, indent);
343 if (is_first_of_these) {
344 ofs <<
"// WS Output:\n";
346 is_first_of_these =
false;
357 bool is_first_of_these =
true;
361 align(ofs, is_first_parameter, indent);
364 if (is_first_of_these) {
365 ofs <<
"// WS Generic Output:\n";
367 is_first_of_these =
false;
375 if (mdd.
GOut()[j].length())
376 ofs << mdd.
GOut()[j];
378 ofs <<
"genericoutput" << j + 1;
385 bool is_first_of_these =
true;
389 align(ofs, is_first_parameter, indent);
392 if (is_first_of_these) {
393 ofs <<
"// WS Generic Output Names:\n";
395 is_first_of_these =
false;
398 ofs <<
"const String& ";
399 if (mdd.
GOut()[j].length())
400 ofs << mdd.
GOut()[j] <<
"_wsvname";
402 ofs <<
"genericoutput" << j + 1 <<
"_wsvname";
409 bool is_first_of_these =
true;
413 align(ofs, is_first_parameter, indent);
416 if (is_first_of_these) {
417 ofs <<
"// WS Input:\n";
419 is_first_of_these =
false;
430 bool is_first_of_these =
true;
434 align(ofs, is_first_parameter, indent);
437 if (is_first_of_these) {
438 ofs <<
"// WS Generic Input:\n";
440 is_first_of_these =
false;
445 if (mdd.
GIn()[j].length())
448 ofs <<
"genericinput" << j + 1;
451 if (mdd.
GIn()[j].length())
454 ofs <<
"genericinput" << j + 1;
462 bool is_first_of_these =
true;
466 align(ofs, is_first_parameter, indent);
469 if (is_first_of_these) {
470 ofs <<
"// WS Generic Input Names:\n";
472 is_first_of_these =
false;
475 ofs <<
"const String& ";
476 if (mdd.
GIn()[j].length())
477 ofs << mdd.
GIn()[j] <<
"_wsvname";
479 ofs <<
"genericinput" << j + 1 <<
"_wsvname";
485 align(ofs, is_first_parameter, indent);
486 ofs <<
"// Agenda from controlfile:\n";
488 ofs <<
"const Agenda& input_agenda";
493 bool pass_verbosity =
true;
496 for (
Index j = 0; pass_verbosity && j < mdd.
In().
nelem(); j++) {
497 if (wsv_data[mdd.
In()[j]].Name() ==
"verbosity") {
498 pass_verbosity =
false;
503 for (
Index j = 0; pass_verbosity && j < mdd.
Out().
nelem(); j++) {
504 if (wsv_data[mdd.
Out()[j]].Name() ==
"verbosity") {
505 pass_verbosity =
false;
509 if (pass_verbosity) {
510 align(ofs, is_first_parameter, indent);
511 ofs <<
"// Verbosity object:\n";
513 ofs <<
"const Verbosity& verbosity";
525 bool invalid_author =
false;
526 for (ArrayOfString::const_iterator j = i->Authors().begin();
527 !invalid_author && j < i->Authors().
end();
529 if (*j ==
"" || *j ==
"unknown") invalid_author =
true;
532 if (invalid_author) {
533 os << i->Name() <<
": Missing or invalid author.\n";
539 os << i->Name() <<
": Empty description.\n";
543 os << i->Name() <<
": Missing newline at the end of description.\n";
547 os << i->Name() <<
": Extra newline at the end of description.\n";
555 <<
"Error(s) found in workspace method documentation (check methods.cc):\n"
592 ofs <<
"// This file was generated automatically by make_auto_md_h.cc.\n";
593 ofs <<
"// DO NOT EDIT !\n";
594 ofs <<
"// Generated: " << __DATE__ <<
", " << __TIME__ <<
"\n\n";
596 ofs <<
"#ifndef auto_md_h\n";
597 ofs <<
"#define auto_md_h\n\n";
599 ofs <<
"#include \"matpackI.h\"\n"
600 <<
"#include \"matpackII.h\"\n"
601 <<
"#include \"abs_species_tags.h\"\n"
602 <<
"#include \"artstime.h\"\n"
603 <<
"#include \"gas_abs_lookup.h\"\n"
604 <<
"#include \"gridded_fields.h\"\n"
605 <<
"#include \"linemixing_hitran.h\"\n"
606 <<
"#include \"optproperties.h\"\n"
607 <<
"#include \"jacobian.h\"\n"
608 <<
"#include \"mc_antenna.h\"\n"
609 <<
"#include \"m_general.h\"\n"
610 <<
"#include \"parser.h\"\n"
611 <<
"#include \"workspace_ng.h\"\n"
612 <<
"#include \"cia.h\"\n"
613 <<
"#include \"covariance_matrix.h\"\n"
614 <<
"#include \"propagationmatrix.h\"\n"
615 <<
"#include \"transmissionmatrix.h\"\n"
616 <<
"#include \"telsem.h\"\n"
617 <<
"#include \"tessem.h\"\n"
618 <<
"#include \"hitran_xsec.h\"\n"
619 <<
"#include \"absorptionlines.h\"\n"
622 ofs <<
"// This is only used for a consistency check. You can get the\n"
623 <<
"// number of WSMs from md_data.nelem().\n"
624 <<
"#define N_MD " << n_md <<
"\n\n";
627 ofs <<
"// Method function declarations:\n\n";
628 for (
Index i = 0; i < n_md; ++i) {
637 ofs <<
"// Supergeneric template function declarations:\n\n";
647 ofs <<
"// Get-away function declarations:\n\n";
648 for (
Index i = 0; i < n_md; ++i) {
652 <<
"_g(Workspace& ws, const MRecord& mr);\n";
654 ofs <<
"void " << mdd.
Name()
655 <<
"_g(Workspace& ws, const MRecord& mr);\n";
670 bool is_agenda_array =
678 ofs <<
"\n#endif // auto_md_h\n";
683 }
catch (
const std::runtime_error&
x) {
684 cout <<
"Something went wrong. Message text:\n";
685 cout <<
x.what() <<
'\n';
Declarations for AgRecord, storing lookup information for one agenda.
void write_agenda_wrapper_header(ofstream &ofs, const AgRecord &agr, bool is_agenda_array)
Write a agenda wrapper header.
const ArrayOfString & GOut() const
bool UsesTemplates() const
static Array< WsvRecord > wsv_data
Global WSV data.
bool Supergeneric() const
const ArrayOfIndex & GOutType() const
void define_agenda_data()
const ArrayOfIndex & GInType() const
bool PassWsvNames() const
void write_method_header_documentation(ofstream &ofs, const MdRecord &mdd)
Write method header documentation.
Index get_wsv_id(const String &name)
Get index of WSV.
const Array< MdRecord > md_data_raw
Lookup information for workspace methods.
bool md_sanity_checks(const Array< MdRecord > &md_data)
This file contains the definition of Array.
Index nelem(const Lines &l)
Number of lines.
const String & ActualGroups() const
void write_method_header(ofstream &ofs, const MdRecord &mdd)
Write a method header.
void insert_substr(const my_basic_string< charT > &searchstr, const my_basic_string< charT > &insstr)
Insert string before all occurrences of the substring.
void align(ofstream &ofs, bool &is_first_parameter, const String &indent)
bool AgendaMethod() const
static void define_wsv_data()
Define workspace variables.
bool is_agenda_group_id(const Index group)
Check if group is an agenda group.
void expand_md_data_raw_to_md_data()
Expand supergeneric methods.
void define_wsv_group_names()
Define the array of workspace variable group names.
const String & Name() const
const ArrayOfIndex & In() const
const ArrayOfIndex & InOnly() const
constexpr Rational end(Rational Ju, Rational Jl, Polarization type) noexcept
Gives the largest M for a polarization type of this transition.
void open_output_file(ofstream &file, const String &name)
Open a file for writing.
Index nelem() const
Number of elements.
const Array< String > & GInDefault() const
const Array< MdRecord > md_data
Lookup information for workspace methods.
const ArrayOfString & GIn() const
This file contains the Workspace class.
All information for one workspace method.
int check_newline(const String &s)
Checks if there is exactly one newline character at the end of the string.
const Array< AgRecord > agenda_data
The lookup information for the agendas.
This file contains basic functions to handle ASCII files.
Vector x(Workspace &ws) noexcept
INDEX Index
The type to use for all integer numbers and indices.
const ArrayOfIndex & Out() const
const ArrayOfString wsv_group_names
The names associated with Wsv groups as Strings.
static void define_wsv_map()
Map WSV names to indices.
Index get_wsv_group_id(const String &name)
Returns the id of the given group.
const String & Description() const
bool PassWorkspace() const
Index nelem() const
Number of elements.
Declaration of the class MdRecord.
void define_md_data_raw()
const ArrayOfString & Authors() const
The global header file for ARTS.