38 #include <sys/types.h> 42 #include <sys/times.h> 67 cerr <<
"Try `arts --help' for help.\n";
108 if ( !verbosity_at_launch.
valid() )
110 cerr <<
"Illegal value specified for --reporting (-r).\n" 111 <<
"The specified value is " << r <<
", which would be\n" 112 <<
"interpreted as:\n" 116 <<
"Only values of 0-3 are allowed for each verbosity.\n";
145 if (
"all" == methods )
147 if (!parameters.
plain)
150 <<
"\n*-------------------------------------------------------------------*\n" 151 <<
"Complete list of ARTS workspace methods:\n" 152 <<
"---------------------------------------------------------------------\n";
156 if (!parameters.
plain) cout <<
"- ";
160 if (!parameters.
plain)
161 cout <<
"*-------------------------------------------------------------------*\n\n";
170 map<String, Index>::const_iterator mi =
175 Index wsv_key = mi->second;
180 <<
"\n*-------------------------------------------------------------------*\n" 181 <<
"Generic and supergeneric methods that can generate " <<
Workspace::wsv_data[wsv_key].Name()
183 <<
"---------------------------------------------------------------------\n";
197 cout <<
"- " << mdd.
Name() <<
"\n";
200 else if ( count( mdd.
GOutType().begin(),
214 cout <<
"- " << mdd.
Name() <<
"\n";
220 cout <<
"- " << mdd.
Name() <<
"\n";
233 <<
"\n---------------------------------------------------------------------\n" 236 <<
"---------------------------------------------------------------------\n";
245 if ( count( mdd.
Out().begin(),
249 cout <<
"- " << mdd.
Name() <<
"\n";
257 <<
"*-------------------------------------------------------------------*\n\n";
279 <<
"\n*-------------------------------------------------------------------*\n" 280 <<
"Generic and supergeneric methods that can generate variables of group " 282 <<
"---------------------------------------------------------------------\n";
296 cout <<
"- " << mdd.
Name() <<
"\n";
299 else if ( count( mdd.
GOutType().begin(),
313 cout <<
"- " << mdd.
Name() <<
"\n";
319 cout <<
"- " << mdd.
Name() <<
"\n";
330 <<
"*-------------------------------------------------------------------*\n\n";
337 cerr <<
"The name " << methods <<
" matches neither `all',\n" 338 <<
"nor the name of a workspace variable, nor the name\n" 339 <<
"of a workspace variable group.\n";
360 map<String, Index>::const_iterator mi =
369 Index wsv_key = mi->second;
373 <<
"\n*-------------------------------------------------------------------*\n" 374 <<
"Generic and supergeneric methods that can use " <<
Workspace::wsv_data[wsv_key].Name() <<
":\n" 375 <<
"---------------------------------------------------------------------\n";
385 if ( count( mdd.
GInType().begin(),
389 cout <<
"- " << mdd.
Name() <<
"\n";
392 else if ( count( mdd.
GInType().begin(),
406 cout <<
"- " << mdd.
Name() <<
"\n";
412 cout <<
"- " << mdd.
Name() <<
"\n";
425 <<
"\n---------------------------------------------------------------------\n" 428 <<
"---------------------------------------------------------------------\n";
437 if ( count( mdd.
In().begin(),
441 cout <<
"- " << mdd.
Name() <<
"\n";
449 <<
"*-------------------------------------------------------------------*\n\n";
474 <<
"\n*-------------------------------------------------------------------*\n" 475 <<
"Generic and supergeneric methods that require a variable of group " 477 <<
"---------------------------------------------------------------------\n";
487 if ( count( mdd.
GInType().begin(),
491 cout <<
"- " << mdd.
Name() <<
"\n";
494 else if ( count( mdd.
GInType().begin(),
508 cout <<
"- " << mdd.
Name() <<
"\n";
514 cout <<
"- " << mdd.
Name() <<
"\n";
525 <<
"*-------------------------------------------------------------------*\n\n";
532 cerr <<
"The name " << input <<
" matches neither the name of a\n" 533 <<
"workspace variable, nor the name of a workspace variable group.\n";
559 if (
"all" == workspacevariables )
561 if (!parameters.
plain)
564 <<
"\n*-------------------------------------------------------------------*\n" 565 <<
"Complete list of ARTS workspace variables:\n" 566 <<
"---------------------------------------------------------------------\n";
571 if (!parameters.
plain) cout <<
"- ";
575 if (!parameters.
plain)
576 cout <<
"*-------------------------------------------------------------------*\n\n";
582 map<String, Index>::const_iterator mi =
583 MdMap.find(workspacevariables);
584 if ( mi !=
MdMap.end() )
594 <<
"\n*-------------------------------------------------------------------*\n" 595 <<
"Generic workspace variables required by " << mdr.
Name()
597 <<
"---------------------------------------------------------------------\n";
609 <<
"\n---------------------------------------------------------------------\n" 610 <<
"Specific workspace variables required by " << mdr.
Name() <<
":\n" 611 <<
"---------------------------------------------------------------------\n";
621 <<
"*-------------------------------------------------------------------*\n\n";
627 cerr <<
"The name " << workspacevariables <<
" matches neither `all',\n" 628 <<
"nor the name of a workspace method.\n";
648 map<String, Index>::const_iterator i =
671 cerr <<
"The name " << describe
672 <<
" matches neither method nor variable.\n";
685 if (stat (filename.c_str(), &buf) != -1)
687 String ts = ctime (&buf.st_mtime);
688 return String(
" (compiled ") + ts.substr (0, ts.length()-1) +
")";
715 int main (
int argc,
char **argv)
723 struct tms arts_cputime_start;
724 clock_t arts_realtime_start;
725 arts_realtime_start = times (&arts_cputime_start);
740 cout <<
"\n" << parameters.
usage <<
"\n\n";
741 cout << parameters.
helptext <<
"\n\n";
745 ostringstream osfeatures;
754 <<
"Features in this build: " << endl
755 <<
" Numeric precision: " 756 << ((
sizeof (
Numeric) ==
sizeof (
double)) ?
"double" :
"float") << endl
757 <<
" OpenMP support: " 761 <<
"disabled" << endl
763 <<
" Documentation server: " 764 #ifdef ENABLE_DOCSERVER 767 <<
"disabled" << endl
769 <<
" Zipped XML support: " 773 <<
"disabled" << endl
775 <<
" NetCDF support: " 779 <<
"disabled" << endl
781 <<
" Fortran support: " 782 #ifdef FORTRAN_COMPILER 785 <<
"disabled" << endl
787 <<
" Refice support: " 791 <<
"disabled" << endl
793 <<
" Tmatrix support: " 794 #ifdef ENABLE_TMATRIX 797 <<
"disabled" << endl
800 <<
"Include search paths: " << endl;
802 for (ArrayOfString::const_iterator it = parameters.
includepath.begin();
805 osfeatures <<
" " << (*it) << endl;
807 osfeatures <<
"Data search paths: " << endl;
809 for (ArrayOfString::const_iterator it = parameters.
datapath.begin();
810 it != parameters.
datapath.end(); it++)
812 osfeatures <<
" " << (*it) << endl;
819 cout << osfeatures.str();
826 omp_set_num_threads ((
int)parameters.
numthreads);
828 cerr <<
"Ignoring commandline option --numthreads/-n.\n" 829 <<
"This option only works with an OpenMP enabled ARTS build.\n";
890 if (
"" != parameters.
methods )
899 if (
"" != parameters.
input )
928 if (!parameters.
plain)
931 <<
"\n*-------------------------------------------------------------------*\n" 932 <<
"Complete list of ARTS workspace variable groups:\n" 933 <<
"---------------------------------------------------------------------\n";
938 if (!parameters.
plain) cout <<
"- ";
942 if (!parameters.
plain)
943 cout <<
"*-------------------------------------------------------------------*\n\n";
947 #ifdef ENABLE_DOCSERVER 955 docserver.launch(parameters.
daemon);
960 cout <<
"Docserver daemon started with PID: " << pid << endl;
967 cout <<
"Starting the arts documentation server." << endl;
968 docserver.launch(parameters.
daemon);
988 cerr <<
"You must specify at least one control file name.\n";
999 out_basename = fileparts[fileparts.
nelem()-1];
1009 cerr <<
"The controlfile must have the extension .arts.\n";
1014 out_basename.erase(p);
1019 out_basename = parameters.
basename;
1043 ostringstream report_file_ext;
1045 report_file_ext <<
".rep";
1048 catch (runtime_error x)
1050 cerr << x.what() <<
"\n" 1051 <<
"I have to be able to write to my report file.\n";
1059 out1 <<
"Executing ARTS.\n";
1062 out1 <<
"Command line:\n";
1063 for (
Index i=0; i<argc; ++i) {
1064 out1 << argv[i] <<
" ";
1072 out2 << osfeatures.str() <<
"\n";
1076 out2 <<
"Running with OpenMP, " 1077 <<
"maximum number of threads = " 1080 out2 <<
"Running without OpenMP.\n";
1086 #pragma omp parallel \ 1092 os <<
" Thread " << tn <<
": ready.\n";
1099 struct tm * timeinfo;
1102 timeinfo = localtime ( &rawtime );
1103 out2 <<
"Run started: " << asctime(timeinfo) <<
"\n";
1112 out3 <<
"\nReading control files:\n";
1138 Arts2(workspace, tasklist, verbosity);
1140 catch (
const runtime_error x)
1143 os <<
"Run-time error in controlfile: " << parameters.
controlfiles[i] <<
'\n' 1145 throw runtime_error(os.str());
1149 catch (
const runtime_error x)
1152 struct tms arts_cputime_end;
1153 clock_t arts_realtime_end;
1156 clktck = sysconf (_SC_CLK_TCK);
1157 arts_realtime_end = times (&arts_cputime_end);
1159 && arts_realtime_start != (clock_t)-1
1160 && arts_realtime_end != (clock_t)-1)
1162 out1 <<
"This run took " << fixed << setprecision(2)
1164 (arts_realtime_end - arts_realtime_start)
1166 <<
"s (" << fixed << setprecision(2) << (
Numeric)
1167 ((arts_cputime_end.tms_stime - arts_cputime_start.tms_stime)
1168 + (arts_cputime_end.tms_utime - arts_cputime_start.tms_utime))
1169 / (
Numeric)clktck <<
"s CPU time)\n";
1177 struct tms arts_cputime_end;
1178 clock_t arts_realtime_end;
1181 clktck = sysconf (_SC_CLK_TCK);
1182 arts_realtime_end = times (&arts_cputime_end);
1184 && arts_realtime_start != (clock_t)-1
1185 && arts_realtime_end != (clock_t)-1)
1187 out1 <<
"This run took " << fixed << setprecision(2)
1189 (arts_realtime_end - arts_realtime_start)
1191 <<
"s (" << fixed << setprecision(2) << (
Numeric)
1192 ((arts_cputime_end.tms_stime - arts_cputime_start.tms_stime)
1193 + (arts_cputime_end.tms_utime - arts_cputime_start.tms_utime))
1194 / (
Numeric)clktck <<
"s CPU time)\n";
1198 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
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'.
Parameters parameters
Holds the command line parameters.
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.
void define_lineshape_data()
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.
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.
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_lineshape_norm_data()
String input
This is complementary to the methods switch.
String out_basename
The basename for the report file and for all other output files.
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 declaration and partly the implementation of the workspace class...
ArrayOfString datapath
List of paths to search for data files.
The implementation for String, the ARTS string class.
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.
bool help
Only display the help text.
static void define_wsv_data()
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.
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.
bool gui
Flag to run with graphical user interface.
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
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.
bool version
Display version information.
static void define_wsv_map()
const ArrayOfIndex & GInType() const
static const Index npos
Define npos:
Verbosity verbosity_at_launch
Index get_screen_verbosity() const
Header file for helper functions for OpenMP.
This file contains header information for the dealing with command line parameters.
bool valid() const
Check if artsmessages contains valid message levels.
void define_species_map()
Define the species data map.
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.