ARTS 2.5.11 (git: 725533f0)
|
#include <agenda_class.h>
Public Member Functions | |
Agenda ()=default | |
Agenda (Workspace &workspace) | |
Agenda (const Agenda &x)=default | |
void | append (const String &methodname, const TokVal &keywordvalue) |
Appends methods to an agenda. | |
void | check (Workspace &ws_in, const Verbosity &verbosity) |
Checks consistency of an agenda. | |
void | push_back (const MRecord &n) |
Append a new method to end of list. | |
void | execute (Workspace &ws_in) const |
Execute an agenda. | |
void | resize (Index n) |
Resize the method list. | |
Index | nelem () const |
Return the number of agenda elements. | |
Agenda & | operator= (const Agenda &x) |
const Array< MRecord > & | Methods () const |
bool | has_method (const String &methodname) const |
Check if method is in Agenda. | |
void | set_methods (const Array< MRecord > &ml) |
void | set_outputs_to_push_and_dup (const Verbosity &verbosity) |
Retrieve indexes of all input and output WSVs. | |
bool | is_input (Workspace &ws_in, Index var) const |
Check if given variable is agenda input. | |
bool | is_output (Index var) const |
Check if given variable is agenda output. | |
void | set_name (const String &nname) |
Set agenda name. | |
String | name () const |
Agenda name. | |
const ArrayOfIndex & | get_output2push () const |
const ArrayOfIndex & | get_output2dup () const |
void | print (ostream &os, const String &indent) const |
Print an agenda. | |
void | set_main_agenda () |
bool | is_main_agenda () const |
bool | checked () const |
bool | has_same_origin (const Workspace &ws2) const |
std::shared_ptr< Workspace > | workspace () const |
void | set_workspace (Workspace &x) |
Agenda | deepcopy_if (Workspace &) const |
Creates a deep copy of the agenda if necessary (i.e., different workspace)! | |
std::pair< ArrayOfIndex, ArrayOfIndex > | get_global_inout () const |
Get index lists of global input and output variables from agenda_data of this agenda. | |
Private Attributes | |
std::weak_ptr< Workspace > | ws |
String | mname |
Array< MRecord > | mml |
ArrayOfIndex | moutput_push |
ArrayOfIndex | moutput_dup |
bool | main_agenda {false} |
Is set to true if this is the main agenda. | |
bool | mchecked {false} |
Flag indicating that the agenda was checked for consistency. | |
Friends | |
ostream & | operator<< (ostream &os, const Agenda &a) |
Output operator for Agenda. | |
The Agenda class.
An agenda is a list of workspace methods (including keyword data) to be executed. There are workspace variables of class agenda that can contain a list of methods to execute for a particular purpose, for example to compute the lineshape in an absorption calculation.
Definition at line 52 of file agenda_class.h.
|
default |
Referenced by append().
|
explicit |
Definition at line 46 of file agenda_class.cc.
|
default |
Copies an agenda.
Appends methods to an agenda.
This function appends a workspace method to the agenda. It currently only supports appending WSMs which have no generic input or output, and which are defined as Set methods which take only one keyword.
The keyword value has to be a string, which for no value should be of length zero.
methodname | The name of the WSM |
keywordvalue | The value of the keyword |
Definition at line 68 of file agenda_class.cc.
References Agenda(), ARTS_ASSERT, mchecked, global_data::md_data, global_data::MdMap, mml, and workspace().
Referenced by jacobianAddAbsSpecies(), jacobianAddBasicCatalogParameter(), jacobianAddFreqShift(), jacobianAddFreqStretch(), jacobianAddMagField(), jacobianAddNLTE(), jacobianAddPointingZa(), jacobianAddPolyfit(), jacobianAddScatSpecies(), jacobianAddShapeCatalogParameter(), jacobianAddSinefit(), jacobianAddSpecialSpecies(), jacobianAddSurfaceQuantity(), jacobianAddTemperature(), and jacobianAddWind().
Checks consistency of an agenda.
Checks that the input used by the agenda and the output produced by the actual methods corresponds to what is desired in the lookup data.
Definition at line 90 of file agenda_class.cc.
References global_data::agenda_data, global_data::AgendaMap, ARTS_USER_ERROR_IF, has_same_origin(), AgRecord::In(), is_input(), is_output(), mchecked, mname, nelem(), AgRecord::Out(), set_outputs_to_push_and_dup(), workspace(), and Workspace::wsv_data_ptr.
Referenced by AgendaAppend(), AgendaSet(), ArrayOfAgendaAppend(), Copy(), AgendaManip::AgendaCreator::finalize(), and jacobianClose().
|
inline |
Definition at line 85 of file agenda_class.h.
References mchecked.
Referenced by AgendaExecute(), dobatch_calc_agendaExecute(), doit_conv_test_agendaExecute(), doit_mono_agendaExecute(), doit_rte_agendaExecute(), doit_scat_field_agendaExecute(), forloop_agendaExecute(), g0_agendaExecute(), gas_scattering_agendaExecute(), inversion_iterate_agendaExecute(), iy_cloudbox_agendaExecute(), iy_independent_beam_approx_agendaExecute(), iy_loop_freqs_agendaExecute(), iy_main_agendaExecute(), iy_radar_agendaExecute(), iy_space_agendaExecute(), iy_surface_agendaExecute(), jacobian_agendaExecute(), met_profile_calc_agendaExecute(), pha_mat_spt_agendaExecute(), pnd_agenda_arrayExecute(), ppath_agendaExecute(), ppath_step_agendaExecute(), propmat_clearsky_agendaExecute(), refr_index_air_agendaExecute(), sensor_response_agendaExecute(), spt_calc_agendaExecute(), surface_rtprop_agenda_arrayExecute(), surface_rtprop_agendaExecute(), test_agenda_arrayExecute(), water_p_eq_agendaExecute(), and ybatch_calc_agendaExecute().
Creates a deep copy of the agenda if necessary (i.e., different workspace)!
Definition at line 933 of file agenda_class.cc.
References has_same_origin(), main_agenda, make_same_wsvs(), mchecked, mml, mname, moutput_dup, moutput_push, and workspace().
Referenced by Workspace::deepcopy(), and MRecord::deepcopy_if().
void Agenda::execute | ( | Workspace & | ws_in | ) | const |
Execute an agenda.
This executes the methods specified in tasklist on the given workspace. It also checks for errors during the method execution and stops the program if an error has occured.
Definition at line 169 of file agenda_class.cc.
References ARTS_ASSERT, ARTS_USER_ERROR_IF, CREATE_OUT1, CREATE_OUT3, Workspace::duplicate(), Workspace::get(), getaways, has_same_origin(), MRecord::Id(), MRecord::In(), MdRecord::InOut(), Workspace::is_initialized(), is_main_agenda(), MRecord::isInternal(), mchecked, global_data::md_data, mml, mname, name(), MdRecord::Name(), Array< base >::nelem(), MRecord::Out(), Workspace::pop(), Verbosity::set_main_agenda(), MdRecord::SetMethod(), v, Workspace::wsv_data_ptr, and Workspace::WsvMap_ptr.
Referenced by AgendaExecute(), Arts2(), and auto_md_agenda_execute_helper().
std::pair< ArrayOfIndex, ArrayOfIndex > Agenda::get_global_inout | ( | ) | const |
Get index lists of global input and output variables from agenda_data of this agenda.
Definition at line 947 of file agenda_class.cc.
References global_data::agenda_data, global_data::AgendaMap, AgRecord::In(), name(), and AgRecord::Out().
Referenced by AgendaExecute(), and set_outputs_to_push_and_dup().
|
inline |
Definition at line 78 of file agenda_class.h.
References moutput_dup.
Referenced by AgendaExecute(), and auto_md_agenda_execute_helper().
|
inline |
Definition at line 77 of file agenda_class.h.
References moutput_push.
Referenced by AgendaExecute(), and auto_md_agenda_execute_helper().
bool Agenda::has_method | ( | const String & | methodname | ) | const |
Check if method is in Agenda.
This function checks if the method with the given name is called by this agenda.
methodname | Name of method to look for. |
Definition at line 690 of file agenda_class.cc.
References global_data::md_data, and mml.
Referenced by abs_xsec_agenda_checkedCalc(), and propmat_clearsky_agenda_checkedCalc().
bool Agenda::has_same_origin | ( | const Workspace & | ws2 | ) | const |
Definition at line 762 of file agenda_class.cc.
References Workspace::original_workspace, and workspace().
Referenced by check(), deepcopy_if(), MRecord::deepcopy_if(), and execute().
bool Agenda::is_input | ( | Workspace & | ws_in, |
Index | var | ||
) | const |
Check if given variable is agenda input.
A variable is agenda input if it is an input variable to any of the methods making up the agenda.
[in] | var | The workspace variable to check. |
Definition at line 516 of file agenda_class.cc.
References global_data::agenda_data, global_data::AgendaMap, ARTS_ASSERT, MRecord::Id(), MRecord::In(), global_data::md_data, global_data::MdMap, mml, nelem(), Array< base >::nelem(), MRecord::Out(), Workspace::wsv_data_ptr, and global_data::WsvGroupMap.
Referenced by check().
|
inline |
bool Agenda::is_output | ( | Index | var | ) | const |
Check if given variable is agenda output.
A variable is agenda output if it is an output variable to any of the methods making up the agenda.
var | The workspace variable to check. |
Definition at line 598 of file agenda_class.cc.
References global_data::agenda_data, global_data::AgendaMap, MRecord::Id(), MRecord::In(), global_data::md_data, global_data::MdMap, mml, nelem(), Array< base >::nelem(), MRecord::Out(), workspace(), and global_data::WsvGroupMap.
Referenced by check().
Definition at line 69 of file agenda_class.h.
References mml.
Referenced by AgendaAppend(), and AgendaManip::AgendaCreator::finalize().
String Agenda::name | ( | ) | const |
Agenda name.
Returns the private member mname.
Definition at line 676 of file agenda_class.cc.
References mname.
Referenced by AgendaExecute(), auto_md_agenda_execute_helper(), dobatch_calc_agendaExecute(), doit_conv_test_agendaExecute(), doit_mono_agendaExecute(), doit_rte_agendaExecute(), doit_scat_field_agendaExecute(), execute(), AgendaManip::AgendaCreator::finalize(), forloop_agendaExecute(), g0_agendaExecute(), gas_scattering_agendaExecute(), get_global_inout(), inversion_iterate_agendaExecute(), iy_cloudbox_agendaExecute(), iy_independent_beam_approx_agendaExecute(), iy_loop_freqs_agendaExecute(), iy_main_agendaExecute(), iy_radar_agendaExecute(), iy_space_agendaExecute(), iy_surface_agendaExecute(), iySurfaceRtpropAgenda(), iySurfaceRtpropCalc(), jacobian_agendaExecute(), met_profile_calc_agendaExecute(), pha_mat_spt_agendaExecute(), pnd_agenda_arrayExecute(), ppath_agendaExecute(), ppath_step_agendaExecute(), Print(), propmat_clearsky_agendaExecute(), refr_index_air_agendaExecute(), sensor_response_agendaExecute(), set_outputs_to_push_and_dup(), spt_calc_agendaExecute(), surface_rtprop_agenda_arrayExecute(), surface_rtprop_agendaExecute(), test_agenda_arrayExecute(), water_p_eq_agendaExecute(), and ybatch_calc_agendaExecute().
Index Agenda::nelem | ( | ) | const |
Return the number of agenda elements.
This is needed, so that we can find out the correct size for resize, befor we do a copy.
Definition at line 739 of file agenda_class.cc.
References mml, and Array< base >::nelem().
Referenced by check(), chk_not_empty(), is_input(), is_output(), and MRecord::print().
Definition at line 752 of file agenda_class.cc.
References mchecked, mml, mname, moutput_dup, moutput_push, and ws.
void Agenda::print | ( | ostream & | os, |
const String & | indent | ||
) | const |
Print an agenda.
This prints an agenda, by printing the individual methods, just as they would appear in the controlfile.
os | Output stream. |
indent | How many characters of indentation. |
Definition at line 719 of file agenda_class.cc.
References mml, and Array< base >::nelem().
Referenced by MRecord::print(), and Print().
void Agenda::push_back | ( | const MRecord & | n | ) |
Append a new method to end of list.
This is used by the parser to fill up the agenda.
n | New method to add. |
Definition at line 747 of file agenda_class.cc.
Referenced by AgendaManip::AgendaCreator::finalize(), ArtsParser::parse_agenda(), AgendaManip::AgendaCreator::set(), and ArtsParser::tasklist_insert_set_delete().
void Agenda::resize | ( | Index | n | ) |
Resize the method list.
Resizes the agenda's method list to n elements
Definition at line 730 of file agenda_class.cc.
References mml.
Referenced by ArtsParser::parse_method().
|
inline |
Definition at line 80 of file agenda_class.h.
References main_agenda, and mchecked.
Definition at line 703 of file agenda_class.cc.
Referenced by AgendaAppend().
void Agenda::set_name | ( | const String & | nname | ) |
Set agenda name.
This sets the private member mname to the given string.
nname | The name for the agenda. |
Definition at line 665 of file agenda_class.cc.
References mchecked, and mname.
Referenced by AgendaManip::AgendaCreator::AgendaCreator(), AgendaSet(), ArrayOfAgendaAppend(), cloudboxOff(), Copy(), gas_scatteringOff(), and jacobianInit().
void Agenda::set_outputs_to_push_and_dup | ( | const Verbosity & | verbosity | ) |
Retrieve indexes of all input and output WSVs.
Builds arrays of WSM output variables which need to be duplicated or pushed on the WSV stack before the agenda is executed.
Definition at line 291 of file agenda_class.cc.
References global_data::agenda_data, global_data::AgendaMap, CREATE_OUT3, get_global_inout(), global_data::md_data, global_data::MdMap, mml, moutput_dup, moutput_push, name(), Array< base >::nelem(), PrintWsvNames(), workspace(), and global_data::WsvGroupMap.
Referenced by check().
void Agenda::set_workspace | ( | Workspace & | x | ) |
Definition at line 961 of file agenda_class.cc.
Referenced by Workspace::claim_agenda_ownership(), and MRecord::set_workspace().
std::shared_ptr< Workspace > Agenda::workspace | ( | ) | const |
Definition at line 764 of file agenda_class.cc.
References ARTS_USER_ERROR_IF, workspace(), and ws.
Referenced by append(), check(), deepcopy_if(), MRecord::deepcopy_if(), has_same_origin(), is_output(), MRecord::print(), set_outputs_to_push_and_dup(), and workspace().
|
friend |
Output operator for Agenda.
This is useful for debugging.
os | Output stream. |
a | The Agenda to write. |
Definition at line 785 of file agenda_class.cc.
|
private |
Is set to true if this is the main agenda.
Definition at line 111 of file agenda_class.h.
Referenced by deepcopy_if(), is_main_agenda(), and set_main_agenda().
|
private |
Flag indicating that the agenda was checked for consistency.
Definition at line 114 of file agenda_class.h.
Referenced by append(), check(), checked(), deepcopy_if(), execute(), operator=(), push_back(), set_main_agenda(), set_methods(), and set_name().
The actual list of methods to execute.
Definition at line 104 of file agenda_class.h.
Referenced by append(), deepcopy_if(), execute(), has_method(), is_input(), is_output(), Methods(), nelem(), operator=(), print(), push_back(), resize(), set_methods(), set_outputs_to_push_and_dup(), and set_workspace().
|
private |
Agenda name.
Definition at line 103 of file agenda_class.h.
Referenced by check(), deepcopy_if(), execute(), name(), operator=(), and set_name().
|
private |
Definition at line 108 of file agenda_class.h.
Referenced by deepcopy_if(), get_output2dup(), operator=(), and set_outputs_to_push_and_dup().
|
private |
Definition at line 106 of file agenda_class.h.
Referenced by deepcopy_if(), get_output2push(), operator=(), and set_outputs_to_push_and_dup().
|
private |
The workspace upon which this Agenda lives.
Definition at line 102 of file agenda_class.h.
Referenced by operator=(), set_workspace(), and workspace().