ARTS  2.3.1285(git:92a29ea9-dirty)
m_general.cc File Reference

Workspace functions of a general and overall character. More...

#include "arts.h"
#include <cstdlib>
#include <stdexcept>
#include "array.h"
#include "check_input.h"
#include "m_general.h"
#include "messages.h"
#include "mystring.h"
#include "math_funcs.h"
#include "wsv_aux.h"
#include "auto_md.h"
#include "workspace_ng.h"
#include "sensor.h"
#include "fastem.h"
#include "tessem.h"

Go to the source code of this file.

Functions

void INCLUDE (const Verbosity &)
 WORKSPACE METHOD: INCLUDE. More...
 
void Print (Workspace &ws, const Agenda &x, const Index &level, const Verbosity &verbosity)
 
void Print (Workspace &ws, const ArrayOfAgenda &x, const Index &level, const Verbosity &verbosity)
 
void Print (const ArrayOfGridPos &x, const Index &level, const Verbosity &verbosity)
 
void Print (const ArrayOfCIARecord &cia_data, const Index &level, const Verbosity &verbosity)
 
void Print (const ArrayOfString &x, const Index &level, const Verbosity &verbosity)
 
void Print (const Ppath &x, const Index &level, const Verbosity &verbosity)
 
void Print (const ArrayOfPpath &x, const Index &level, const Verbosity &verbosity)
 
void Print (const Timer &, const Index &level, const Verbosity &verbosity)
 
void Print (const TessemNN &x, const Index &level, const Verbosity &verbosity)
 
void PrintWorkspace (Workspace &ws, const Index &only_allocated, const Index &level, const Verbosity &verbosity)
 
void StringJoin (String &out, const String &in1, const String &in2, const String &in3, const String &in4, const String &in5, const String &in6, const String &in7, const String &in8, const String &in9, const String &in10, const Verbosity &)
 WORKSPACE METHOD: StringJoin. More...
 
void timerStart (Timer &, const Verbosity &)
 WORKSPACE METHOD: timerStart. More...
 
void timerStop (const Timer &, const Verbosity &)
 
void Error (const String &msg, const Verbosity &verbosity)
 WORKSPACE METHOD: Error. More...
 
void Exit (const Verbosity &verbosity)
 WORKSPACE METHOD: Exit. More...
 
void TestArrayOfAgenda (Workspace &ws, const ArrayOfAgenda &test_agenda_array, const Index &index, const Verbosity &)
 WORKSPACE METHOD: TestArrayOfAgenda. More...
 
void Test (const Verbosity &)
 WORKSPACE METHOD: Test. More...
 
void verbosityInit (Verbosity &verbosity)
 WORKSPACE METHOD: verbosityInit. More...
 
void verbositySet (Verbosity &verbosity, const Index &agenda, const Index &screen, const Index &file)
 WORKSPACE METHOD: verbositySet. More...
 
void verbositySetAgenda (Verbosity &verbosity, const Index &level)
 WORKSPACE METHOD: verbositySetAgenda. More...
 
void verbositySetFile (Verbosity &verbosity, const Index &level)
 WORKSPACE METHOD: verbositySetFile. More...
 
void verbositySetScreen (Verbosity &verbosity, const Index &level)
 WORKSPACE METHOD: verbositySetScreen. More...
 
void GetEnvironmentVariable (String &str, const String &envvar, const Verbosity &)
 WORKSPACE METHOD: GetEnvironmentVariable. More...
 
void GetNumberOfThreads (Index &nthreads, const Verbosity &)
 WORKSPACE METHOD: GetNumberOfThreads. More...
 
void GetEnvironmentVariable (Index &i, const String &envvar, const Verbosity &)
 WORKSPACE METHOD: GetEnvironmentVariable. More...
 
void SetNumberOfThreads (const Index &, const Verbosity &verbosity)
 WORKSPACE METHOD: SetNumberOfThreads. More...
 

Variables

const Numeric SPEED_OF_LIGHT
 

Detailed Description

Workspace functions of a general and overall character.

Author
Patrick Eriksson Patri.nosp@m.ck.E.nosp@m.rikss.nosp@m.on@c.nosp@m.halme.nosp@m.rs.s.nosp@m.e
Date
2002-05-08

This file is for general functions that do not fit in any other "m_"-file.

These functions are listed in the doxygen documentation as entries of the file auto_md.h.

Definition in file m_general.cc.

Function Documentation

◆ Error()

void Error ( const String msg,
const Verbosity verbosity 
)

WORKSPACE METHOD: Error.

Issues an error and exits ARTS.

This method can be placed in agendas that must be specified, but are expected not to be used for the particular case. An inclusion in surface_rtprop_agenda could look like: <br> Error{"Surface interceptions of propagation path not expected."}

Ignore and other dummy method calls must still be included.

Author
Patrick Eriksson
Parameters
[in]msgGeneric Input

Definition at line 398 of file m_general.cc.

References CREATE_OUT0.

Referenced by Error_g().

◆ Exit()

void Exit ( const Verbosity verbosity)

WORKSPACE METHOD: Exit.

Stops the execution and exits ARTS.

This method is handy if you want to debug one of your control files. You can insert it anywhere in the control file. When it is reached, it will terminate the program.

Author
Patrick Eriksson

Definition at line 404 of file m_general.cc.

References arts_exit(), and CREATE_OUT1.

Referenced by Exit_g().

◆ GetEnvironmentVariable() [1/2]

void GetEnvironmentVariable ( String out,
const String in,
const Verbosity verbosity 
)

WORKSPACE METHOD: GetEnvironmentVariable.

Copy the contents of an environment variable to an ARTS String or Index.

Author
Oliver Lemke
Parameters
[out]outSupergeneric output
[in]inGeneric Input

Definition at line 477 of file m_general.cc.

Referenced by GetEnvironmentVariable_sg_Index_g(), and GetEnvironmentVariable_sg_String_g().

◆ GetEnvironmentVariable() [2/2]

void GetEnvironmentVariable ( Index out,
const String in,
const Verbosity verbosity 
)

WORKSPACE METHOD: GetEnvironmentVariable.

Copy the contents of an environment variable to an ARTS String or Index.

Author
Oliver Lemke
Parameters
[out]outSupergeneric output
[in]inGeneric Input

Definition at line 498 of file m_general.cc.

References SetNumberOfThreads(), and _CS_basic_sstream_base< _CS_cT, _CS_Tr, _CS_Al >::str().

◆ GetNumberOfThreads()

void GetNumberOfThreads ( Index nthreads,
const Verbosity verbosity 
)

WORKSPACE METHOD: GetNumberOfThreads.

Returns the number of threads used by ARTS.

Author
Oliver Lemke
Parameters
[out]nthreadsGeneric output

Definition at line 493 of file m_general.cc.

References arts_omp_get_max_threads().

Referenced by GetNumberOfThreads_g().

◆ INCLUDE()

void INCLUDE ( const Verbosity verbosity)

WORKSPACE METHOD: INCLUDE.

Includes the contents of another controlfile.

The INCLUDE statement inserts the contents of the controlfile with the given name into the current controlfile. If the filename is given without path information, ARTS will first search for the file in all directories specified with the -I (see arts -h) commandline option and then in directories given in the environment variable ARTS_INCLUDE_PATH. In the environment variable multiple paths have to be separated by colons.

Note that INCLUDE is not a workspace method and thus the syntax is different:

Arts { <br> INCLUDE "general.arts" }

Includes can also be nested. In the example above general.arts can contain further includes which will then be treated the same way.

The idea behind this mechanism is that you can write common settings for a bunch of calculations into one file. Then, you can create several controlfiles which include the basic settings and tweak them for different cases. When you decide to make changes to your setup that should apply to all calculations, you only have to make a single change in the include file instead of modifying all your controlfiles.

Author
Oliver Lemke

Definition at line 73 of file m_general.cc.

Referenced by INCLUDE_g().

◆ Print() [1/9]

void Print ( Workspace ws,
const Agenda x,
const Index level,
const Verbosity verbosity 
)

Definition at line 76 of file m_general.cc.

References CREATE_OUTS, Agenda::name(), Agenda::print(), _CS_basic_sstream_base< _CS_cT, _CS_Tr, _CS_Al >::str(), and SWITCH_OUTPUT.

Referenced by CIAInfo(), Print(), Print_sg_AbsorptionLines_g(), Print_sg_Agenda_g(), Print_sg_ArrayOfAbsorptionLines_g(), Print_sg_ArrayOfAgenda_g(), Print_sg_ArrayOfArrayOfAbsorptionLines_g(), Print_sg_ArrayOfArrayOfGriddedField1_g(), Print_sg_ArrayOfArrayOfGriddedField2_g(), Print_sg_ArrayOfArrayOfGriddedField3_g(), Print_sg_ArrayOfArrayOfIndex_g(), Print_sg_ArrayOfArrayOfMatrix_g(), Print_sg_ArrayOfArrayOfPropagationMatrix_g(), Print_sg_ArrayOfArrayOfRadiationVector_g(), Print_sg_ArrayOfArrayOfScatteringMetaData_g(), Print_sg_ArrayOfArrayOfSingleScatteringData_g(), Print_sg_ArrayOfArrayOfSpeciesTag_g(), Print_sg_ArrayOfArrayOfStokesVector_g(), Print_sg_ArrayOfArrayOfString_g(), Print_sg_ArrayOfArrayOfTensor3_g(), Print_sg_ArrayOfArrayOfTensor6_g(), Print_sg_ArrayOfArrayOfTime_g(), Print_sg_ArrayOfArrayOfTransmissionMatrix_g(), Print_sg_ArrayOfArrayOfVector_g(), Print_sg_ArrayOfCIARecord_g(), Print_sg_ArrayOfGriddedField1_g(), Print_sg_ArrayOfGriddedField2_g(), Print_sg_ArrayOfGriddedField3_g(), Print_sg_ArrayOfGriddedField4_g(), Print_sg_ArrayOfIndex_g(), Print_sg_ArrayOfMatrix_g(), Print_sg_ArrayOfPpath_g(), Print_sg_ArrayOfPropagationMatrix_g(), Print_sg_ArrayOfQuantumIdentifier_g(), Print_sg_ArrayOfRadiationVector_g(), Print_sg_ArrayOfRetrievalQuantity_g(), Print_sg_ArrayOfScatteringMetaData_g(), Print_sg_ArrayOfSingleScatteringData_g(), Print_sg_ArrayOfSparse_g(), Print_sg_ArrayOfStokesVector_g(), Print_sg_ArrayOfString_g(), Print_sg_ArrayOfTelsemAtlas_g(), Print_sg_ArrayOfTensor3_g(), Print_sg_ArrayOfTensor4_g(), Print_sg_ArrayOfTensor5_g(), Print_sg_ArrayOfTensor6_g(), Print_sg_ArrayOfTensor7_g(), Print_sg_ArrayOfTime_g(), Print_sg_ArrayOfTransmissionMatrix_g(), Print_sg_ArrayOfVector_g(), Print_sg_ArrayOfXsecRecord_g(), Print_sg_CIARecord_g(), Print_sg_CovarianceMatrix_g(), Print_sg_EnergyLevelMap_g(), Print_sg_GasAbsLookup_g(), Print_sg_GriddedField1_g(), Print_sg_GriddedField2_g(), Print_sg_GriddedField3_g(), Print_sg_GriddedField4_g(), Print_sg_GriddedField5_g(), Print_sg_GriddedField6_g(), Print_sg_GridPos_g(), Print_sg_HitranRelaxationMatrixData_g(), Print_sg_Index_g(), Print_sg_Matrix_g(), Print_sg_MCAntenna_g(), Print_sg_Numeric_g(), Print_sg_Ppath_g(), Print_sg_PropagationMatrix_g(), Print_sg_QuantumIdentifier_g(), Print_sg_RadiationVector_g(), Print_sg_Rational_g(), Print_sg_ScatteringMetaData_g(), Print_sg_SingleScatteringData_g(), Print_sg_Sparse_g(), Print_sg_SpeciesAuxData_g(), Print_sg_StokesVector_g(), Print_sg_String_g(), Print_sg_TelsemAtlas_g(), Print_sg_Tensor3_g(), Print_sg_Tensor4_g(), Print_sg_Tensor5_g(), Print_sg_Tensor6_g(), Print_sg_Tensor7_g(), Print_sg_TessemNN_g(), Print_sg_Time_g(), Print_sg_Timer_g(), Print_sg_TransmissionMatrix_g(), Print_sg_Vector_g(), and Print_sg_Verbosity_g().

◆ Print() [2/9]

void Print ( Workspace ws,
const ArrayOfAgenda x,
const Index level,
const Verbosity verbosity 
)

◆ Print() [3/9]

void Print ( const ArrayOfGridPos x,
const Index level,
const Verbosity verbosity 
)

◆ Print() [4/9]

void Print ( const ArrayOfCIARecord cia_data,
const Index level,
const Verbosity verbosity 
)

◆ Print() [5/9]

void Print ( const ArrayOfString x,
const Index level,
const Verbosity verbosity 
)

◆ Print() [6/9]

◆ Print() [7/9]

void Print ( const ArrayOfPpath x,
const Index level,
const Verbosity verbosity 
)

◆ Print() [8/9]

void Print ( const Timer ,
const Index level,
const Verbosity verbosity 
)

Definition at line 286 of file m_general.cc.

References SWITCH_OUTPUT.

◆ Print() [9/9]

void Print ( const TessemNN x,
const Index level,
const Verbosity verbosity 
)

◆ PrintWorkspace()

void PrintWorkspace ( Workspace ws,
const Index only_allocated,
const Index level,
const Verbosity verbosity 
)

◆ SetNumberOfThreads()

void SetNumberOfThreads ( const Index nthreads,
const Verbosity verbosity 
)

WORKSPACE METHOD: SetNumberOfThreads.

Change the number of threads used by ARTS.

Author
Oliver Lemke
Parameters
[in]nthreadsGeneric Input

Definition at line 527 of file m_general.cc.

References CREATE_OUT1.

Referenced by GetEnvironmentVariable(), and SetNumberOfThreads_g().

◆ StringJoin()

void StringJoin ( String out,
const String in1,
const String in2,
const String in3,
const String in4,
const String in5,
const String in6,
const String in7,
const String in8,
const String in9,
const String in10,
const Verbosity verbosity 
)

WORKSPACE METHOD: StringJoin.

Concatenate two or more strings.

The output string is overwritten, but is allowed to appear in the input list. Up to 10 strings can be concatenated at once.

Author
Oliver Lemke
Parameters
[out]outGeneric output
[in]in1Generic Input
[in]in2Generic Input
[in]in3Generic Input (Default: "")
[in]in4Generic Input (Default: "")
[in]in5Generic Input (Default: "")
[in]in6Generic Input (Default: "")
[in]in7Generic Input (Default: "")
[in]in8Generic Input (Default: "")
[in]in9Generic Input (Default: "")
[in]in10Generic Input (Default: "")

Definition at line 338 of file m_general.cc.

References Timer::finished, Timer::running, and timerStart().

Referenced by StringJoin_g().

◆ Test()

void Test ( const Verbosity verbosity)

WORKSPACE METHOD: Test.

A dummy method that can be used for test purposes.

This method can be used by ARTS developers to quickly test stuff. The implementation is in file m_general.cc. This just saves you the trouble of adding a dummy method everytime you want to try something out quickly.

Author
Patrick Eriksson

Definition at line 421 of file m_general.cc.

References add_za_aa(), and diff_za_aa().

Referenced by Test_g().

◆ TestArrayOfAgenda()

void TestArrayOfAgenda ( Workspace ws,
const ArrayOfAgenda test_agenda_array,
const Index index,
const Verbosity verbosity 
)

WORKSPACE METHOD: TestArrayOfAgenda.

A method that is used for the TestArrayOfAgenda test case.

Author
Oliver Lemke
Parameters
[in,out]wsWorkspace
[in]test_agenda_arrayWS Input
[in]indexGeneric Input (Default: "0")

Definition at line 411 of file m_general.cc.

References Array< base >::nelem(), _CS_basic_sstream_base< _CS_cT, _CS_Tr, _CS_Al >::str(), and test_agenda_arrayExecute().

Referenced by TestArrayOfAgenda_g().

◆ timerStart()

void timerStart ( Timer timer,
const Verbosity verbosity 
)

WORKSPACE METHOD: timerStart.

Initializes the CPU timer. Use timerStop to stop the timer.

Usage example: <br> timerStart <br> ReadXML(f_grid,"frequencies.xml") <br> timerStop <br> Print(timer)

Author
Oliver Lemke
Parameters
[out]timerWS Output

Definition at line 365 of file m_general.cc.

References Timer::finished, Timer::running, and timerStop().

Referenced by main(), StringJoin(), and timerStart_g().

◆ timerStop()

void timerStop ( const Timer ,
const Verbosity  
)

Definition at line 389 of file m_general.cc.

Referenced by timerStart(), and timerStop_g().

◆ verbosityInit()

void verbosityInit ( Verbosity verbosity)

WORKSPACE METHOD: verbosityInit.

Initializes the verbosity levels.

Sets verbosity to defaults or the levels specified by -r on the command line.

Author
Oliver Lemke
Parameters
[in,out]verbosityWS Input/Output

Definition at line 431 of file m_general.cc.

References Verbosity::get_agenda_verbosity(), Verbosity::get_file_verbosity(), Verbosity::get_screen_verbosity(), Verbosity::set_agenda_verbosity(), Verbosity::set_file_verbosity(), Verbosity::set_screen_verbosity(), and verbosity_at_launch.

Referenced by verbosityInit_g().

◆ verbositySet()

void verbositySet ( Verbosity verbosity,
const Index agenda,
const Index screen,
const Index file 
)

WORKSPACE METHOD: verbositySet.

Sets the verbosity levels.

Sets the reporting level for agenda calls, screen and file. All reporting levels can reach from 0 (only error messages) to 3 (everything). The agenda setting applies in addition to both screen and file output.

Author
Oliver Lemke
Parameters
[in,out]verbosityWS Input/Output
[in]agendaGeneric Input
[in]screenGeneric Input
[in]fileGeneric Input

Definition at line 441 of file m_general.cc.

References Verbosity::set_agenda_verbosity(), Verbosity::set_file_verbosity(), and Verbosity::set_screen_verbosity().

Referenced by verbositySet_g().

◆ verbositySetAgenda()

void verbositySetAgenda ( Verbosity verbosity,
const Index level 
)

WORKSPACE METHOD: verbositySetAgenda.

Sets the verbosity level for agenda output.

See verbositySet

Author
Oliver Lemke
Parameters
[in,out]verbosityWS Input/Output
[in]levelGeneric Input

Definition at line 453 of file m_general.cc.

References Verbosity::set_agenda_verbosity().

Referenced by verbositySetAgenda_g().

◆ verbositySetFile()

void verbositySetFile ( Verbosity verbosity,
const Index level 
)

WORKSPACE METHOD: verbositySetFile.

Sets the verbosity level for report file output.

See verbositySet

Author
Oliver Lemke
Parameters
[in,out]verbosityWS Input/Output
[in]levelGeneric Input

Definition at line 461 of file m_general.cc.

References Verbosity::set_file_verbosity().

Referenced by verbositySetFile_g().

◆ verbositySetScreen()

void verbositySetScreen ( Verbosity verbosity,
const Index level 
)

WORKSPACE METHOD: verbositySetScreen.

Sets the verbosity level for screen output.

See verbositySet

Author
Oliver Lemke
Parameters
[in,out]verbosityWS Input/Output
[in]levelGeneric Input

Definition at line 469 of file m_general.cc.

References Verbosity::set_screen_verbosity().

Referenced by verbositySetScreen_g().

Variable Documentation

◆ SPEED_OF_LIGHT

const Numeric SPEED_OF_LIGHT

Referenced by Print().