35 #include <sys/times.h> 36 #include <sys/types.h> 62 cerr <<
"Try `arts --help' for help.\n";
98 if (!verbosity_at_launch.
valid()) {
99 cerr <<
"Illegal value specified for --reporting (-r).\n" 100 <<
"The specified value is " << r <<
", which would be\n" 101 <<
"interpreted as:\n" 102 <<
"Verbosity for agendas: " 104 <<
"Verbosity for screen: " 106 <<
"Verbosity for report file: " 108 <<
"Only values of 0-3 are allowed for each verbosity.\n";
135 if (
"all" == methods) {
136 if (!parameters.
plain) {
138 <<
"\n*-------------------------------------------------------------------*\n" 139 <<
"Complete list of ARTS workspace methods:\n" 140 <<
"---------------------------------------------------------------------\n";
143 if (!parameters.
plain) cout <<
"- ";
147 if (!parameters.
plain)
149 <<
"*-------------------------------------------------------------------*\n\n";
161 Index wsv_key = mi->second;
166 <<
"\n*-------------------------------------------------------------------*\n" 167 <<
"Generic and supergeneric methods that can generate " 169 <<
"---------------------------------------------------------------------\n";
181 cout <<
"- " << mdd.
Name() <<
"\n";
183 }
else if (count(mdd.
GOutType().begin(),
192 cout <<
"- " << mdd.
Name() <<
"\n";
196 cout <<
"- " << mdd.
Name() <<
"\n";
203 if (0 == hitcount) cout <<
"none\n";
208 <<
"\n---------------------------------------------------------------------\n" 209 <<
"Specific methods that can generate " 211 <<
"---------------------------------------------------------------------\n";
219 if (count(mdd.
Out().begin(), mdd.
Out().end(), wsv_key)) {
220 cout <<
"- " << mdd.
Name() <<
"\n";
224 if (0 == hitcount) cout <<
"none\n";
227 <<
"*-------------------------------------------------------------------*\n\n";
247 <<
"\n*-------------------------------------------------------------------*\n" 248 <<
"Generic and supergeneric methods that can generate variables of group " 250 <<
"---------------------------------------------------------------------\n";
260 cout <<
"- " << mdd.
Name() <<
"\n";
262 }
else if (count(mdd.
GOutType().begin(),
271 cout <<
"- " << mdd.
Name() <<
"\n";
275 cout <<
"- " << mdd.
Name() <<
"\n";
282 if (0 == hitcount) cout <<
"none\n";
285 <<
"*-------------------------------------------------------------------*\n\n";
292 cerr <<
"The name " << methods <<
" matches neither `all',\n" 293 <<
"nor the name of a workspace variable, nor the name\n" 294 <<
"of a workspace variable group.\n";
321 Index wsv_key = mi->second;
325 <<
"\n*-------------------------------------------------------------------*\n" 326 <<
"Generic and supergeneric methods that can use " 328 <<
"---------------------------------------------------------------------\n";
337 if (count(mdd.
GInType().begin(),
340 cout <<
"- " << mdd.
Name() <<
"\n";
342 }
else if (count(mdd.
GInType().begin(),
351 cout <<
"- " << mdd.
Name() <<
"\n";
355 cout <<
"- " << mdd.
Name() <<
"\n";
362 if (0 == hitcount) cout <<
"none\n";
367 <<
"\n---------------------------------------------------------------------\n" 368 <<
"Specific methods that require " 370 <<
"---------------------------------------------------------------------\n";
378 if (count(mdd.
In().begin(), mdd.
In().end(), wsv_key)) {
379 cout <<
"- " << mdd.
Name() <<
"\n";
383 if (0 == hitcount) cout <<
"none\n";
386 <<
"*-------------------------------------------------------------------*\n\n";
409 <<
"\n*-------------------------------------------------------------------*\n" 410 <<
"Generic and supergeneric methods that require a variable of group " 412 <<
"---------------------------------------------------------------------\n";
421 if (count(mdd.
GInType().begin(), mdd.
GInType().end(), group_key)) {
422 cout <<
"- " << mdd.
Name() <<
"\n";
424 }
else if (count(mdd.
GInType().begin(),
433 cout <<
"- " << mdd.
Name() <<
"\n";
437 cout <<
"- " << mdd.
Name() <<
"\n";
444 if (0 == hitcount) cout <<
"none\n";
447 <<
"*-------------------------------------------------------------------*\n\n";
454 cerr <<
"The name " << input <<
" matches neither the name of a\n" 455 <<
"workspace variable, nor the name of a workspace variable group.\n";
479 if (
"all" == workspacevariables) {
480 if (!parameters.
plain) {
482 <<
"\n*-------------------------------------------------------------------*\n" 483 <<
"Complete list of ARTS workspace variables:\n" 484 <<
"---------------------------------------------------------------------\n";
488 if (!parameters.
plain) cout <<
"- ";
492 if (!parameters.
plain)
494 <<
"*-------------------------------------------------------------------*\n\n";
499 map<String, Index>::const_iterator mi =
MdMap.find(workspacevariables);
500 if (mi !=
MdMap.end()) {
509 <<
"\n*-------------------------------------------------------------------*\n" 510 <<
"Generic workspace variables required by " << mdr.
Name()
512 <<
"---------------------------------------------------------------------\n";
517 if (0 == hitcount) cout <<
"none\n";
522 <<
"\n---------------------------------------------------------------------\n" 523 <<
"Specific workspace variables required by " << mdr.
Name() <<
":\n" 524 <<
"---------------------------------------------------------------------\n";
529 if (0 == hitcount) cout <<
"none\n";
532 <<
"*-------------------------------------------------------------------*\n\n";
538 cerr <<
"The name " << workspacevariables <<
" matches neither `all',\n" 539 <<
"nor the name of a workspace method.\n";
557 map<String, Index>::const_iterator
i =
MdRawMap.find(describe);
577 cerr <<
"The name " << describe <<
" matches neither method nor variable.\n";
588 if (stat(filename.c_str(), &buf) != -1) {
589 String ts = ctime(&buf.st_mtime);
590 return String(
" (compiled ") + ts.substr(0, ts.length() - 1) +
")";
612 int main(
int argc,
char** argv) {
618 struct tms arts_cputime_start;
619 clock_t arts_realtime_start;
620 arts_realtime_start = times(&arts_cputime_start);
630 if (parameters.
help) {
632 cout <<
"\n" << parameters.
usage <<
"\n\n";
633 cout << parameters.
helptext <<
"\n\n";
644 osfeatures <<
"Features in this build: " << endl
645 <<
" Numeric precision: " 646 << ((
sizeof(
Numeric) ==
sizeof(
double)) ?
"double" :
"float")
648 <<
" OpenMP support: " 652 <<
"disabled" << endl
654 <<
" Documentation server: " 655 #ifdef ENABLE_DOCSERVER 658 <<
"disabled" << endl
660 <<
" Zipped XML support: " 664 <<
"disabled" << endl
666 <<
" NetCDF support: " 670 <<
"disabled" << endl
672 <<
" Fortran support: " 673 #ifdef FORTRAN_COMPILER 676 <<
"disabled" << endl
678 <<
" Legacy Fortran Disort:" 682 <<
"disabled" << endl
688 <<
"disabled" << endl
690 <<
" FASTEM support: " 694 <<
"disabled" << endl
699 <<
" MPI support for OEM: " 703 <<
"disabled" << endl
706 <<
"disabled" << endl
708 <<
" Refice support: " 712 <<
"disabled" << endl
714 <<
" Tmatrix support: " 715 #ifdef ENABLE_TMATRIX 716 #ifdef ENABLE_TMATRIX_QUAD 717 <<
"enabled (quad-precision)" << endl
719 <<
"enabled (double-precision)" << endl
722 <<
"disabled" << endl
724 <<
" Hitran Xsec support: " 726 <<
"enabled (experimental)" << endl
728 <<
"enabled (experimental, no FFTW support, using slow convolution method)" 733 osfeatures <<
"Include search paths: " << endl;
735 osfeatures <<
" " << path << endl;
738 osfeatures <<
"Data searchpaths: " << endl;
739 for (
auto& path : parameters.
datapath) {
740 osfeatures <<
" " << path << endl;
746 cout << osfeatures.
str();
752 omp_set_num_threads((
int)parameters.
numthreads);
754 cerr <<
"Ignoring commandline option --numthreads/-n.\n" 755 <<
"This option only works with an OpenMP enabled ARTS build.\n";
808 #ifdef ENABLE_DOCSERVER 811 const auto broken_links = Docserver::list_broken_description_links();
812 const size_t nbroken = std::get<0>(broken_links);
813 for (
auto&& s : std::get<1>(broken_links)) {
814 std::cout << s << std::endl;
816 std::cout << std::endl
817 << nbroken <<
" broken link" << (nbroken == 1 ?
"" :
"s")
818 <<
" found." << std::endl;
819 arts_exit(nbroken ? EXIT_FAILURE : EXIT_SUCCESS);
827 if (
"" != parameters.
methods) {
835 if (
"" != parameters.
input) {
859 if (!parameters.
plain) {
861 <<
"\n*-------------------------------------------------------------------*\n" 862 <<
"Complete list of ARTS workspace variable groups:\n" 863 <<
"---------------------------------------------------------------------\n";
867 if (!parameters.
plain) cout <<
"- ";
871 if (!parameters.
plain)
873 <<
"*-------------------------------------------------------------------*\n\n";
877 #ifdef ENABLE_DOCSERVER 883 docserver.launch(parameters.
daemon);
886 cout <<
"Docserver daemon started with PID: " << pid << endl;
891 cout <<
"Starting the arts documentation server." << endl;
892 docserver.launch(parameters.
daemon);
902 cerr <<
"You must specify at least one control file name.\n";
912 out_basename = fileparts[fileparts.
nelem() - 1];
921 cerr <<
"The controlfile must have the extension .arts.\n";
926 out_basename.erase(p);
954 report_file_ext <<
".rep";
956 }
catch (
const std::runtime_error& x) {
957 cerr << x.what() <<
"\n" 958 <<
"I have to be able to write to my report file.\n";
965 out1 <<
"Executing ARTS.\n";
968 out1 <<
"Command line:\n";
970 out1 << argv[
i] <<
" ";
978 out2 << osfeatures.
str() <<
"\n";
982 out2 <<
"Running with OpenMP, " 986 out2 <<
"Running without OpenMP.\n";
991 #pragma omp parallel default(none) shared(out3) 995 os <<
" Thread " << tn <<
": ready.\n";
1002 struct tm* timeinfo;
1005 timeinfo = localtime(&rawtime);
1006 out2 <<
"Run started: " << asctime(timeinfo) <<
"\n";
1010 out3 <<
"Verbosity settings: Agendas: " 1017 out3 <<
"\nReading control files:\n";
1042 Arts2(workspace, tasklist, verbosity);
1043 }
catch (
const std::exception& x) {
1045 os <<
"Run-time error in controlfile: " << parameters.
controlfiles[
i]
1048 throw runtime_error(os.
str());
1051 }
catch (
const std::runtime_error& x) {
1053 struct tms arts_cputime_end;
1054 clock_t arts_realtime_end;
1057 clktck = sysconf(_SC_CLK_TCK);
1058 arts_realtime_end = times(&arts_cputime_end);
1059 if (clktck > 0 && arts_realtime_start != (clock_t)-1 &&
1060 arts_realtime_end != (clock_t)-1) {
1061 out1 <<
"This run took " << fixed << setprecision(2)
1062 << (
Numeric)(arts_realtime_end - arts_realtime_start) /
1064 <<
"s (" << fixed << setprecision(2)
1066 (arts_cputime_end.tms_stime - arts_cputime_start.tms_stime) +
1067 (arts_cputime_end.tms_utime - arts_cputime_start.tms_utime)) /
1077 struct tms arts_cputime_end;
1078 clock_t arts_realtime_end;
1081 clktck = sysconf(_SC_CLK_TCK);
1082 arts_realtime_end = times(&arts_cputime_end);
1083 if (clktck > 0 && arts_realtime_start != (clock_t)-1 &&
1084 arts_realtime_end != (clock_t)-1) {
1085 out1 <<
"This run took " << fixed << setprecision(2)
1086 << (
Numeric)(arts_realtime_end - arts_realtime_start) / (
Numeric)clktck
1087 <<
"s (" << fixed << setprecision(2)
1089 (arts_cputime_end.tms_stime - arts_cputime_start.tms_stime) +
1090 (arts_cputime_end.tms_utime - arts_cputime_start.tms_utime)) /
1096 out1 <<
"Everything seems fine. Goodbye.\n";
String arts_mod_time(String)
This function returns the modification time of the arts executable as a string.
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
Global WSV data.
bool daemon
Flag to run the docserver in the background.
ArrayOfString controlfiles
The filenames of the controlfiles.
void define_md_map()
Define MdMap.
void option_input(const String &input)
React to option `input'.
void polite_goodby()
Remind the user of –help and exit return value 1.
Index get_agenda_verbosity() const
Index nelem() const
Number of elements.
#define ARTS_FULL_VERSION
void arts_exit(int status)
This is the exit function of ARTS.
String baseurl
Baseurl for the docserver.
void option_methods(const String &methods)
React to option `methods'.
Declarations having to do with the four output streams.
bool check_docs
Flag to check built-in documentation.
String basename
If this is specified (with the -b –basename option), it is used as the base name for the report file...
String describe(ConstTensor7View x)
Describe Tensor7.
Declarations for the arts documentation server.
void initialize()
Reset the size of the workspace.
int arts_omp_get_thread_num()
Wrapper for omp_get_thread_num.
bool groups
Print a list of all workspace variable groups.
void parse_tasklist()
Public interface to the main function of the parser.
String out_basename
The basename for the report file and for all other output files.
void initialize()
Initialization dispatch functions.
int arts_omp_get_max_threads()
Wrapper for omp_get_max_threads.
const ArrayOfIndex & Out() const
void option_describe(const String &describe)
React to option `describe'.
void set_agenda_verbosity(Index v)
const map< String, Index > MdRawMap
The map associated with md_data_raw.
This file contains basic functions to handle ASCII files.
Structure to hold all command line Parameters.
String methods
If this is given the argument `all', it simply prints a list of all methods.
All information for one workspace method.
void set_reporting_level(Index r)
Set the reporting level.
void define_species_map()
String input
This is complementary to the methods switch.
const String & Name() const
ArrayOfString includepath
List of paths to search for include files.
void define_agenda_data()
const map< String, Index > MdMap
The map associated with md_data.
This file contains the Workspace class.
ArrayOfString datapath
List of paths to search for data files.
WorkspaceMemoryHandler workspace_memory_handler
The workspace memory handler Defined in workspace_ng.cc.
void expand_md_data_raw_to_md_data()
Expand supergeneric methods.
Index numthreads
The maximum number of threads to use.
The global header file for ARTS.
Parameters parameters
Holds the command line parameters.
_CS_string_type str() const
bool help
Only display the help text.
static void define_wsv_data()
Define workspace variables.
const ArrayOfIndex & In() const
void set_file_verbosity(Index v)
void set_main_agenda(bool main_agenda)
The declarations of all the exception classes.
Index reporting
This should be a two digit integer.
bool check_agenda_data()
Check that agendas.cc and workspace.cc are consistent.
std::vector< Method > methods()
ofstream report_file
The report file.
const ArrayOfArrayOfIndex & GInSpecType() const
void option_workspacevariables(const String &workspacevariables)
React to option `workspacevariables'.
NUMERIC Numeric
The type to use for all floating point numbers.
Index docserver
Port to use for the docserver.
Declarations required for the calculation of absorption coefficients.
int main(int argc, char **argv)
This is the main function of ARTS.
String usage
Short message how to call the program.
void define_species_data()
void arts_exit_with_error_message(const String &m, ArtsOut &out)
Print error message and exit.
void define_md_raw_map()
Define MdRawMap.
This can be used to make arrays out of anything.
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 set_name(const String &nname)
Set agenda name.
static map< String, Index > WsvMap
Global map associated with wsv_data.
Index get_file_verbosity() const
bool get_parameters(int argc, char **argv)
Get the command line parameters.
void define_md_data_raw()
String workspacevariables
If this is given the argument `all', it simply prints a list of all workspace variables.
const ArrayOfArrayOfIndex & GOutSpecType() const
const Array< MdRecord > md_data
Lookup information for workspace methods.
Verbosity verbosity_at_launch
The global message verbosity settings:
bool version
Display version information.
static void define_wsv_map()
Map WSV names to indices.
const ArrayOfIndex & GInType() const
static const Index npos
Define npos:
Index get_screen_verbosity() const
Header file for helper functions for OpenMP.
This file contains header information for the dealing with command line parameters.
constexpr Rational end(Rational Ju, Rational Jl, Polarization type) noexcept
Gives the largest M for a polarization type of this transition.
bool valid() const
Check if artsmessages contains valid message levels.
bool plain
Generate plain help out suitable for script processing.
Declaration of the class MdRecord.
my_basic_string< char > String
The String type for ARTS.
Declarations for AgRecord, storing lookup information for one agenda.
This file contains the definition of String, the ARTS string class.
void Arts2(Workspace &ws, const Agenda &input_agenda, const Verbosity &verbosity)
WORKSPACE METHOD: Arts2.
const Array< MdRecord > md_data_raw
Lookup information for workspace methods.
void set_screen_verbosity(Index v)
String describe
Print the description String of the given workspace variable or method.
Auxiliary header stuff related to workspace variable groups.
String helptext
Longer message explaining the options.