17#ifdef ENABLE_DOCSERVER
47 cerr <<
"Try `arts --help' for help.\n";
84 cerr <<
"Illegal value specified for --reporting (-r).\n"
85 <<
"The specified value is " << r <<
", which would be\n"
86 <<
"interpreted as:\n"
87 <<
"Verbosity for agendas: "
89 <<
"Verbosity for screen: "
91 <<
"Verbosity for report file: "
93 <<
"Only values of 0-3 are allowed for each verbosity.\n";
118 if (
"all" == methods) {
121 <<
"\n*-------------------------------------------------------------------*\n"
122 <<
"Complete list of ARTS workspace methods:\n"
123 <<
"---------------------------------------------------------------------\n";
125 for (Index i = 0; i < md_data_raw.nelem(); ++i) {
127 cout << md_data_raw[i].Name() <<
"\n";
132 <<
"*-------------------------------------------------------------------*\n\n";
141 auto mi = workspace.
WsvMap_ptr->find(methods);
144 Index wsv_key = mi->second;
149 <<
"\n*-------------------------------------------------------------------*\n"
150 <<
"Generic and supergeneric methods that can generate "
152 <<
"---------------------------------------------------------------------\n";
153 for (Index i = 0; i < md_data_raw.nelem(); ++i) {
155 const MdRecord& mdd = md_data_raw[i];
164 cout <<
"- " << mdd.
Name() <<
"\n";
166 }
else if (count(mdd.
GOutType().begin(),
175 cout <<
"- " << mdd.
Name() <<
"\n";
179 cout <<
"- " << mdd.
Name() <<
"\n";
186 if (0 == hitcount) cout <<
"none\n";
191 <<
"\n---------------------------------------------------------------------\n"
192 <<
"Specific methods that can generate "
194 <<
"---------------------------------------------------------------------\n";
195 for (Index i = 0; i < md_data_raw.nelem(); ++i) {
197 const MdRecord& mdd = md_data_raw[i];
202 if (count(mdd.
Out().begin(), mdd.
Out().end(), wsv_key)) {
203 cout <<
"- " << mdd.
Name() <<
"\n";
207 if (0 == hitcount) cout <<
"none\n";
210 <<
"*-------------------------------------------------------------------*\n\n";
221 find(wsv_groups.begin(), wsv_groups.end(), methods) -
226 if (group_key != wsv_groups.
nelem()) {
230 <<
"\n*-------------------------------------------------------------------*\n"
231 <<
"Generic and supergeneric methods that can generate variables of group "
232 << wsv_groups[group_key] <<
":\n"
233 <<
"---------------------------------------------------------------------\n";
234 for (Index i = 0; i < md_data_raw.nelem(); ++i) {
236 const MdRecord& mdd = md_data_raw[i];
243 cout <<
"- " << mdd.
Name() <<
"\n";
245 }
else if (count(mdd.
GOutType().begin(),
248 for (Index j = 0; j < mdd.
GOutType().nelem(); j++) {
254 cout <<
"- " << mdd.
Name() <<
"\n";
258 cout <<
"- " << mdd.
Name() <<
"\n";
265 if (0 == hitcount) cout <<
"none\n";
268 <<
"*-------------------------------------------------------------------*\n\n";
275 cerr <<
"The name " << methods <<
" matches neither `all',\n"
276 <<
"nor the name of a workspace variable, nor the name\n"
277 <<
"of a workspace variable group.\n";
304 Index wsv_key = mi->second;
308 <<
"\n*-------------------------------------------------------------------*\n"
309 <<
"Generic and supergeneric methods that can use "
311 <<
"---------------------------------------------------------------------\n";
312 for (Index i = 0; i < md_data_raw.nelem(); ++i) {
314 const MdRecord& mdd = md_data_raw[i];
320 if (count(mdd.
GInType().begin(),
323 cout <<
"- " << mdd.
Name() <<
"\n";
325 }
else if (count(mdd.
GInType().begin(),
328 for (Index j = 0; j < mdd.
GInType().nelem(); j++) {
334 cout <<
"- " << mdd.
Name() <<
"\n";
338 cout <<
"- " << mdd.
Name() <<
"\n";
345 if (0 == hitcount) cout <<
"none\n";
350 <<
"\n---------------------------------------------------------------------\n"
351 <<
"Specific methods that require "
353 <<
"---------------------------------------------------------------------\n";
354 for (Index i = 0; i < md_data_raw.nelem(); ++i) {
356 const MdRecord& mdd = md_data_raw[i];
361 if (count(mdd.
In().begin(), mdd.
In().end(), wsv_key)) {
362 cout <<
"- " << mdd.
Name() <<
"\n";
366 if (0 == hitcount) cout <<
"none\n";
369 <<
"*-------------------------------------------------------------------*\n\n";
380 find(wsv_groups.begin(), wsv_groups.end(), input) -
385 if (group_key != wsv_groups.
nelem()) {
392 <<
"\n*-------------------------------------------------------------------*\n"
393 <<
"Generic and supergeneric methods that require a variable of group "
394 << wsv_groups[group_key] <<
":\n"
395 <<
"---------------------------------------------------------------------\n";
396 for (Index i = 0; i < md_data_raw.nelem(); ++i) {
398 const MdRecord& mdd = md_data_raw[i];
404 if (count(mdd.
GInType().begin(), mdd.
GInType().end(), group_key)) {
405 cout <<
"- " << mdd.
Name() <<
"\n";
407 }
else if (count(mdd.
GInType().begin(),
410 for (Index j = 0; j < mdd.
GInType().nelem(); j++) {
416 cout <<
"- " << mdd.
Name() <<
"\n";
420 cout <<
"- " << mdd.
Name() <<
"\n";
427 if (0 == hitcount) cout <<
"none\n";
430 <<
"*-------------------------------------------------------------------*\n\n";
437 cerr <<
"The name " << input <<
" matches neither the name of a\n"
438 <<
"workspace variable, nor the name of a workspace variable group.\n";
462 if (
"all" == workspacevariables) {
465 <<
"\n*-------------------------------------------------------------------*\n"
466 <<
"Complete list of ARTS workspace variables:\n"
467 <<
"---------------------------------------------------------------------\n";
477 <<
"*-------------------------------------------------------------------*\n\n";
482 auto mi = MdMap.find(workspacevariables);
483 if (mi != MdMap.end()) {
487 const MdRecord& mdr = md_data[mi->second];
492 <<
"\n*-------------------------------------------------------------------*\n"
493 <<
"Generic workspace variables required by " << mdr.
Name()
495 <<
"---------------------------------------------------------------------\n";
496 for (Index i = 0; i < mdr.
GInType().nelem(); ++i) {
497 cout <<
"- " << wsv_groups[mdr.
GInType()[i]] <<
"\n";
500 if (0 == hitcount) cout <<
"none\n";
505 <<
"\n---------------------------------------------------------------------\n"
506 <<
"Specific workspace variables required by " << mdr.
Name() <<
":\n"
507 <<
"---------------------------------------------------------------------\n";
508 for (Index i = 0; i < mdr.
In().nelem(); ++i) {
512 if (0 == hitcount) cout <<
"none\n";
515 <<
"*-------------------------------------------------------------------*\n\n";
521 cerr <<
"The name " << workspacevariables <<
" matches neither `all',\n"
522 <<
"nor the name of a workspace method.\n";
540 auto i = MdRawMap.find(describe);
541 if (i != MdRawMap.end()) {
543 cout << md_data_raw[i->second] <<
"\n";
560 cerr <<
"The name " << describe <<
" matches neither method nor variable.\n";
564template <
typename TimePo
int>
566 auto tp = std::chrono::time_point_cast<std::chrono::system_clock::duration>(
567 time_point - TimePoint::clock::now() + std::chrono::system_clock::now());
568 return std::chrono::system_clock::to_time_t(tp);
579 if (std::filesystem::is_regular_file(filename)) {
580 auto modtime =
to_time_t(std::filesystem::last_write_time(filename));
581 os <<
" (compiled " << std::put_time(std::localtime(&modtime),
"%F %T")
584 }
catch (
const std::exception&) {
591 std::chrono::high_resolution_clock::time_point arts_realtime_start) {
592 const auto arts_realtime_end = std::chrono::high_resolution_clock::now();
593 return std::chrono::duration<double, std::ratio<1>>(arts_realtime_end -
612int main(
int argc,
char** argv) {
617 const auto arts_realtime_start = std::chrono::high_resolution_clock::now();
633 ostringstream osfeatures;
640 osfeatures <<
"Features in this build: " << endl
641 <<
" Numeric precision: "
642 << ((
sizeof(Numeric) ==
sizeof(
double)) ?
"double" :
"float")
644 <<
" OpenMP support: "
648 <<
"disabled" << endl
650 <<
" Documentation server: "
651#ifdef ENABLE_DOCSERVER
654 <<
"disabled" << endl
656 <<
" Zipped XML support: "
660 <<
"disabled" << endl
662 <<
" NetCDF support: "
666 <<
"disabled" << endl
668 <<
" Fortran support: "
669#ifdef FORTRAN_COMPILER
672 <<
"disabled" << endl
674 <<
" Legacy Fortran Disort:"
678 <<
"disabled" << endl
684 <<
"disabled" << endl
686 <<
" FASTEM support: "
690 <<
"disabled" << endl
695 <<
" MPI support for OEM: "
699 <<
"disabled" << endl
702 <<
"disabled" << endl
704 <<
" Tmatrix support: "
706#ifdef ENABLE_TMATRIX_QUAD
707 <<
"enabled (quad-precision)" << endl
709 <<
"enabled (double-precision)" << endl
712 <<
"disabled" << endl
714 <<
" IPO/LTO support: "
718 <<
"disabled" << endl
722 osfeatures <<
"Include search paths: " << endl;
724 osfeatures <<
" " << path << endl;
727 osfeatures <<
"Data searchpaths: " << endl;
729 osfeatures <<
" " << path << endl;
735 cout << osfeatures.str();
743 cerr <<
"Ignoring commandline option --numthreads/-n.\n"
744 <<
"This option only works with an OpenMP enabled ARTS build.\n";
793#ifdef ENABLE_DOCSERVER
796 const auto broken_links = Docserver::list_broken_description_links();
797 const size_t nbroken = std::get<0>(broken_links);
798 for (
auto&& s : std::get<1>(broken_links)) {
799 std::cout << s << std::endl;
801 std::cout << std::endl
802 << nbroken <<
" broken link" << (nbroken == 1 ?
"" :
"s")
803 <<
" found." << std::endl;
804 arts_exit(nbroken ? EXIT_FAILURE : EXIT_SUCCESS);
846 <<
"\n*-------------------------------------------------------------------*\n"
847 <<
"Complete list of ARTS workspace variable groups:\n"
848 <<
"---------------------------------------------------------------------\n";
851 for (Index i = 0; i < wsv_groups.
nelem(); ++i) {
853 cout << wsv_groups[i] <<
"\n";
858 <<
"*-------------------------------------------------------------------*\n\n";
862#ifdef ENABLE_DOCSERVER
873 cerr <<
"You must specify at least one control file name.\n";
892 cerr <<
"The controlfile must have the extension .arts.\n";
923 ostringstream report_file_ext;
925 report_file_ext <<
".rep";
927 }
catch (
const std::runtime_error& x) {
928 cerr << x.what() <<
"\n"
929 <<
"I have to be able to write to my report file.\n";
936 out1 <<
"Executing ARTS.\n";
939 out1 <<
"Command line:\n";
940 for (Index i = 0; i < argc; ++i) {
941 out1 << argv[i] <<
" ";
950 out2 << osfeatures.str() <<
"\n";
954 out2 <<
"Running with OpenMP, "
958 out2 <<
"Running without OpenMP.\n";
963#pragma omp parallel default(none) shared(out3)
967 os <<
" Thread " << tn <<
": ready.\n";
977 timeinfo = localtime(&rawtime);
978 out2 <<
"Run started: " << asctime(timeinfo) <<
"\n";
982 out3 <<
"Verbosity settings: Agendas: "
989 out3 <<
"\nReading control files:\n";
996 Agenda tasklist{workspace};
1003 tasklist.set_name(
"Arts");
1005 tasklist.set_main_agenda();
1008 Arts2(workspace, tasklist, verbosity);
1009 }
catch (
const std::exception& x) {
1014 throw runtime_error(os.str());
1017 }
catch (
const std::runtime_error& x) {
1018 out1 <<
"This run took " << fixed << setprecision(2)
1024 out1 <<
"This run took " << fixed << setprecision(2)
1027 out1 <<
"Everything seems fine. Goodbye.\n";
Declarations required for the calculation of absorption coefficients.
bool check_agenda_data()
Check that agendas.cc and workspace.cc are consistent.
Declarations for AgRecord, storing lookup information for one agenda.
void define_agenda_data()
void arts_exit_with_error_message(const String &m, ArtsOut &out)
Print error message and exit.
void arts_exit(int status)
This is the exit function of ARTS.
The global header file for ARTS.
void define_wsv_groups()
Define the array of workspace variable group names.
std::string_view arts_get_version_string()
int arts_omp_get_max_threads()
Wrapper for omp_get_max_threads.
int arts_omp_get_thread_num()
Wrapper for omp_get_thread_num.
Header file for helper functions for OpenMP.
Index nelem() const ARTS_NOEXCEPT
void parse_tasklist()
Public interface to the main function of the parser.
All information for one workspace method.
const ArrayOfIndex & In() const
const String & Name() const
const ArrayOfIndex & GOutType() const
const ArrayOfArrayOfIndex & GInSpecType() const
const ArrayOfArrayOfIndex & GOutSpecType() const
const ArrayOfIndex & Out() const
const ArrayOfIndex & GInType() const
Structure to hold all command line Parameters.
bool check_docs
Flag to check built-in documentation.
ArrayOfString includepath
List of paths to search for include files.
String helptext
Longer message explaining the options.
String usage
Short message how to call the program.
bool version
Display version information.
ArrayOfString datapath
List of paths to search for data files.
String workspacevariables
If this is given the argument ‘all’, it simply prints a list of all workspace variables.
String baseurl
Baseurl for the docserver.
String input
This is complementary to the methods switch.
ArrayOfString controlfiles
The filenames of the controlfiles.
bool plain
Generate plain help out suitable for script processing.
String basename
If this is specified (with the -b –basename option), it is used as the base name for the report file ...
bool groups
Print a list of all workspace variable groups.
bool help
Only display the help text.
Index reporting
This should be a two digit integer.
Index numthreads
The maximum number of threads to use.
Index docserver
Port to use for the docserver.
bool daemon
Flag to run the docserver in the background.
String describe
Print the description String of the given workspace variable or method.
String methods
If this is given the argument ‘all’, it simply prints a list of all methods.
Index get_screen_verbosity() const
void set_main_agenda(bool main_agenda)
Index get_agenda_verbosity() const
void set_screen_verbosity(Index v)
bool valid() const
Check if artsmessages contains valid message levels.
void set_agenda_verbosity(Index v)
Index get_file_verbosity() const
void set_file_verbosity(Index v)
std::shared_ptr< wsv_data_type > wsv_data_ptr
static std::shared_ptr< Workspace > create()
Creates a new Workspace, it has to be created as a shared pointer.
std::shared_ptr< WsvMap_type > WsvMap_ptr
static const Index npos
Define npos:
#define ARTS_ASSERT(condition,...)
void run_docserver(Index, const String &, bool)
Declarations for the arts documentation server.
The declarations of all the exception classes.
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.
void Arts2(Workspace &ws, const Agenda &input_agenda, const Verbosity &verbosity)
WORKSPACE METHOD: Arts2.
void set_reporting_level(Index r)
Set the reporting level.
void option_workspacevariables(const String &workspacevariables)
React to option ‘workspacevariables’.
std::time_t to_time_t(TimePoint time_point)
void option_methods(Workspace &workspace, const String &methods)
React to option ‘methods’.
double get_arts_runtime_in_sec(std::chrono::high_resolution_clock::time_point arts_realtime_start)
void option_input(const String &input)
React to option ‘input’.
String arts_mod_time(std::string_view filename)
This function returns the modification time of the arts executable as a string.
void polite_goodby()
Remind the user of –help and exit return value 1.
void option_describe(const String &describe)
React to option ‘describe’.
Verbosity verbosity_at_launch
The global message verbosity settings:
String out_basename
The basename for the report file and for all other output files.
ofstream report_file
The report file.
Declarations having to do with the four output streams.
void define_md_data_raw()
Declaration of the class MdRecord.
void define_md_raw_map()
Define MdRawMap.
void define_md_map()
Define MdMap.
void expand_md_data_raw_to_md_data()
Expand supergeneric methods.
This file contains the definition of String, the ARTS string class.
my_basic_string< char > String
The String type for ARTS.
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
WorkspaceMemoryHandler workspace_memory_handler
The workspace memory handler Defined in workspace_ng.cc.
const Array< MdRecord > md_data
Lookup information for workspace methods.
std::map< String, Index > WsvMap
const map< String, Index > MdMap
The map associated with md_data.
const map< String, Index > MdRawMap
The map associated with md_data_raw.
bool get_parameters(int argc, char **argv)
Get the command line parameters.
Parameters parameters
Holds the command line parameters.
This file contains header information for the dealing with command line parameters.
This file contains the Workspace class.
Auxiliary header stuff related to workspace variable groups.