77 void align(ofstream& ofs,
bool& is_first_parameter,
const String& indent)
80 if (is_first_parameter)
81 is_first_parameter =
false;
103 bool is_first_parameter =
true;
111 bool pass_workspace =
false;
124 for (
Index j = 0; !pass_workspace && j < mdd.
In().
nelem(); j++)
128 pass_workspace =
true;
138 pass_workspace =
true;
143 ofs <<
"//! WORKSPACE METHOD: " << fullname <<
".\n";
148 size_t start_pos = 0;
150 while (start_pos != string::npos)
152 start_pos = DoxyDescription.find (
"\n ", start_pos);
153 if (start_pos && start_pos != string::npos
154 && DoxyDescription[start_pos]-1 !=
'\n')
156 DoxyDescription.insert (start_pos + 1,
"<br>");
166 ofs << DoxyDescription <<
"\n";
171 ofs << indent <<
"\\author " << mdd.
Authors ()[j] <<
"\n";
178 ofs << indent <<
"\\param[in,out] " <<
"ws Workspace\n";
184 ofs << indent <<
"\\param[out] " 185 << wsv_data[vo[j]].Name() <<
" WS Output\n";
191 ofs << indent <<
"\\param[out] ";
193 if (mdd.
GOut()[j].length())
194 ofs << mdd.
GOut()[j];
196 ofs <<
"genericoutput" << j+1;
198 if (mdd.
Supergeneric ()) ofs <<
" Supergeneric output\n";
199 else 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;
220 ofs << indent <<
"\\param[in] " 221 << wsv_data[vi[j]].Name() <<
" WS Input\n";
227 ofs << indent <<
"\\param[in] ";
228 if (mdd.
GIn()[j] !=
"")
231 ofs <<
"genericinput" << j+1;
233 ofs <<
" Generic Input";
237 ofs <<
" (Default: \"" << mdd.
GInDefault()[j] <<
"\")";
247 ofs << indent <<
"\\param[in] ";
248 if (mdd.
GIn()[j].length())
249 ofs << mdd.
GIn()[j] <<
"_wsvname";
251 ofs <<
"genericinput" << j+1 <<
"_wsvname";
253 ofs <<
" Generic Input Name" << endl;
261 align(ofs,is_first_parameter,indent);
262 ofs << indent <<
"\\param[in] " <<
"input_agenda Agenda from controlfile\n";
291 bool is_first_parameter =
true;
299 bool pass_workspace =
false;
312 for (
Index j = 0; !pass_workspace && j < mdd.
In().
nelem(); j++)
316 pass_workspace =
true;
326 pass_workspace =
true;
338 ofs <<
"template <typename T>" << endl;
342 ofs <<
"void " << fullname <<
"(";
346 ofs <<
"// Workspace reference:\n";
347 ofs << indent <<
"Workspace& ws";
348 is_first_parameter =
false;
354 bool is_first_of_these =
true;
359 align(ofs,is_first_parameter,indent);
362 if (is_first_of_these)
364 ofs <<
"// WS Output:\n";
366 is_first_of_these =
false;
377 bool is_first_of_these =
true;
382 align(ofs,is_first_parameter,indent);
385 if (is_first_of_these)
387 ofs <<
"// WS Generic Output:\n";
389 is_first_of_these =
false;
395 if (mdd.
GOut()[j].length()) ofs << mdd.
GOut()[j];
396 else ofs <<
"genericoutput" << j+1;
404 bool is_first_of_these =
true;
409 align(ofs,is_first_parameter,indent);
412 if (is_first_of_these)
414 ofs <<
"// WS Generic Output Names:\n";
416 is_first_of_these =
false;
419 ofs <<
"const String& ";
420 if (mdd.
GOut()[j].length())
421 ofs << mdd.
GOut()[j] <<
"_wsvname";
423 ofs <<
"genericoutput" << j+1 <<
"_wsvname";
430 bool is_first_of_these =
true;
435 align(ofs,is_first_parameter,indent);
438 if (is_first_of_these)
440 ofs <<
"// WS Input:\n";
442 is_first_of_these =
false;
454 bool is_first_of_these =
true;
459 align(ofs,is_first_parameter,indent);
462 if (is_first_of_these)
464 ofs <<
"// WS Generic Input:\n";
466 is_first_of_these =
false;
472 if (mdd.
GIn()[j].length()) ofs << mdd.
GIn()[j];
473 else ofs <<
"genericinput" << j+1;
478 if (mdd.
GIn()[j].length()) ofs << mdd.
GIn()[j];
479 else ofs <<
"genericinput" << j+1;
488 bool is_first_of_these =
true;
493 align(ofs,is_first_parameter,indent);
496 if (is_first_of_these)
498 ofs <<
"// WS Generic Input Names:\n";
500 is_first_of_these =
false;
503 ofs <<
"const String& ";
504 if (mdd.
GIn()[j].length())
505 ofs << mdd.
GIn()[j] <<
"_wsvname";
507 ofs <<
"genericinput" << j+1 <<
"_wsvname";
514 align(ofs,is_first_parameter,indent);
515 ofs <<
"// Agenda from controlfile:\n";
517 ofs <<
"const Agenda& input_agenda";
522 bool pass_verbosity =
true;
525 for (
Index j = 0; pass_verbosity && j < mdd.
In().
nelem(); j++)
527 if (wsv_data[mdd.
In()[j]].Name() ==
"verbosity")
529 pass_verbosity =
false;
534 for (
Index j = 0; pass_verbosity && j < mdd.
Out().
nelem(); j++)
536 if (wsv_data[mdd.
Out()[j]].Name() ==
"verbosity")
538 pass_verbosity =
false;
544 align(ofs,is_first_parameter,indent);
545 ofs <<
"// Verbosity object:\n";
547 ofs <<
"const Verbosity& verbosity";
560 i < md_data.end (); ++i)
562 bool invalid_author =
false;
563 for (ArrayOfString::const_iterator j = i->Authors ().begin ();
564 !invalid_author && j < i->Authors ().end (); ++j)
566 if (*j ==
"" || *j ==
"unknown")
567 invalid_author =
true;
572 os << i->Name () <<
": Missing or invalid author.\n";
578 os << i->Name () <<
": Empty description.\n";
582 os << i->Name () <<
": Missing newline at the end of description.\n";
586 os << i->Name () <<
": Extra newline at the end of description.\n";
594 cerr <<
"Error(s) found in workspace method documentation (check methods.cc):\n" 635 ofs <<
"// This file was generated automatically by make_auto_md_h.cc.\n";
636 ofs <<
"// DO NOT EDIT !\n";
637 ofs <<
"// Generated: " 639 << __TIME__ <<
"\n\n";
641 ofs <<
"#ifndef auto_md_h\n";
642 ofs <<
"#define auto_md_h\n\n";
644 ofs <<
"#include \"matpackI.h\"\n" 645 <<
"#include \"matpackII.h\"\n" 646 <<
"#include \"abs_species_tags.h\"\n" 647 <<
"#include \"gas_abs_lookup.h\"\n" 648 <<
"#include \"gridded_fields.h\"\n" 649 <<
"#include \"optproperties.h\"\n" 650 <<
"#include \"jacobian.h\"\n" 651 <<
"#include \"mc_antenna.h\"\n" 652 <<
"#include \"m_general.h\"\n" 653 <<
"#include \"parser.h\"\n" 654 <<
"#include \"workspace_ng.h\"\n" 655 <<
"#include \"cia.h\"\n" 656 <<
"#include \"linemixingrecord.h\"\n" 659 ofs <<
"// This is only used for a consistency check. You can get the\n" 660 <<
"// number of WSMs from md_data.nelem().\n" 661 <<
"#define N_MD " << n_md <<
"\n\n";
665 ofs <<
"// Method function declarations:\n\n";
666 for (
Index i=0; i<n_md; ++i)
677 ofs <<
"// Supergeneric template function declarations:\n\n";
689 ofs <<
"// Get-away function declarations:\n\n";
690 for (
Index i=0; i<n_md; ++i)
695 ofs <<
"void " << mdd.
Name()
697 <<
"_g(Workspace& ws, const MRecord& mr);\n";
701 ofs <<
"void " << mdd.
Name()
702 <<
"_g(Workspace& ws, const MRecord& mr);\n";
722 ofs <<
"\n#endif // auto_md_h\n";
728 catch (runtime_error x)
730 cout <<
"Something went wrong. Message text:\n";
731 cout << x.what() <<
'\n';
Index get_wsv_group_id(const String &name)
Returns the id of the given group.
INDEX Index
The type to use for all integer numbers and indices.
static Array< WsvRecord > wsv_data
void write_method_header(ofstream &ofs, const MdRecord &mdd)
Write a method header.
Index nelem() const
Number of elements.
bool AgendaMethod() const
const ArrayOfIndex & Out() const
bool PassWsvNames() const
This file contains basic functions to handle ASCII files.
All information for one workspace method.
bool Supergeneric() const
const String & Name() const
void define_agenda_data()
This file contains the definition of Array.
const ArrayOfString & GOut() const
This file contains the declaration and partly the implementation of the workspace class...
The implementation for String, the ARTS string class.
const Array< String > & GInDefault() const
void expand_md_data_raw_to_md_data()
Expand supergeneric methods.
The global header file for ARTS.
void insert_substr(const my_basic_string< charT > &searchstr, const my_basic_string< charT > &insstr)
Insert string before all occurrences of the substring.
const String & ActualGroups() const
static void define_wsv_data()
const ArrayOfIndex & In() const
const ArrayOfString & Authors() const
Index nelem() const
Number of elements.
const Array< AgRecord > agenda_data
The lookup information for the agendas.
bool md_sanity_checks(const Array< MdRecord > &md_data)
void write_method_header_documentation(ofstream &ofs, const MdRecord &mdd)
Write method header documentation.
const ArrayOfIndex & InOnly() const
void open_output_file(ofstream &file, const String &name)
Open a file for writing.
const ArrayOfIndex & GOutType() const
void define_wsv_group_names()
Define the array of workspace variable group names.
const ArrayOfString wsv_group_names
The names associated with Wsv groups as Strings.
void define_md_data_raw()
void write_agenda_wrapper_header(ofstream &ofs, const AgRecord &agr)
Write a agenda wrapper header.
void align(ofstream &ofs, bool &is_first_parameter, const String &indent)
const Array< MdRecord > md_data
Lookup information for workspace methods.
int check_newline(const String &s)
Checks if there is exactly one newline character at the end of the string.
static void define_wsv_map()
const String & Description() const
const ArrayOfIndex & GInType() const
Declaration of the class MdRecord.
const ArrayOfString & GIn() const
Declarations for AgRecord, storing lookup information for one agenda.
bool UsesTemplates() const
const Array< MdRecord > md_data_raw
Lookup information for workspace methods.
bool PassWorkspace() const