61 const map<String, Index>::const_iterator i2 =
MdMap.find(methodname);
62 assert(i2 !=
MdMap.end());
63 Index id = i2->second;
111 os <<
"The agenda " <<
mname <<
" must generate the output WSV " 113 <<
"but it does not. It only generates:\n";
116 throw runtime_error(os.
str());
128 os <<
"The agenda " <<
mname <<
" must use the input WSV " 130 <<
"but it does not. It only uses:\n";
133 throw runtime_error(os.
str());
151 os <<
"Agenda *" <<
mname <<
"* hasn't been checked for consistency yet." 153 <<
"This check is usually done by AgendaSet or AgendaAppend." << endl
154 <<
"There are two possible causes for this:" << endl
155 <<
"1) You're trying to execute an agenda that has been created in" 157 <<
" the controlfile with AgendaCreate. This is not allowed. You have" 159 <<
" to use *Copy* to store it into one of the predefined agendas and" 161 <<
" execute that one." << endl
162 <<
"2) Developer error: If you have written code that modifies an Agenda" 164 <<
" directly (changing its name or altering its method list), it's up" 166 <<
" to you to call Agenda::check in your code after your modifications.";
167 throw runtime_error(os.
str());
192 aout1 <<
"Executing " <<
name() <<
"\n" 209 out3 <<
"- " + mdd.
Name() +
"\n";
211 out1 <<
"- " + mdd.
Name() +
"\n";
217 for (
Index s = 0; s < v.nelem(); ++s)
218 if ((s != v.nelem() - 1 || !mdd.
SetMethod()) &&
221 "Method " + mdd.
Name() +
230 throw runtime_error(
"Method " + mdd.
Name() +
231 " needs input variable: " +
238 }
catch (
const std::bad_alloc& x) {
242 os <<
"Memory allocation error in method: " << mdd.
Name() <<
'\n' 243 <<
"For memory intensive jobs it could help to limit the\n" 244 <<
"number of threads with the -n option.\n" 247 throw runtime_error(os.
str());
248 }
catch (
const std::exception& x) {
252 os <<
"Run-time error in method: " << mdd.
Name() <<
'\n' << x.what();
254 throw runtime_error(os.
str());
278 set<Index> outs2push;
281 const Index WsmAgendaExecuteIndex =
MdMap.find(
"AgendaExecute")->second;
282 const Index WsmAgendaExecuteExclIndex =
283 MdMap.find(
"AgendaExecuteExclusive")->second;
284 const Index WsmDeleteIndex =
MdMap.find(
"Delete")->second;
295 souts.insert(gouts.begin(), gouts.end());
299 inputs.insert(gins.begin(), gins.end());
305 if (method->Id() == WsmDeleteIndex) {
306 souts.insert(gins.begin(), gins.end());
313 if (method->Id() == WsmAgendaExecuteIndex ||
314 method->Id() == WsmAgendaExecuteExclIndex) {
315 for (
Index j = 0; j <
md_data[method->Id()].GInType().nelem(); j++) {
316 if (
md_data[method->Id()].GInType()[j] == WsvAgendaGroupIndex) {
318 const map<String, Index>::const_iterator agenda_it =
323 os <<
"Manual execution of the agenda \"" << agenda_name
324 <<
"\" is not supported.";
325 throw std::runtime_error(os.
str());
328 souts.insert(agouts.begin(), agouts.end());
330 inputs.insert(agins.begin(), agins.end());
336 outputs.insert(souts.begin(), souts.end());
341 set_intersection(souts.begin(),
345 insert_iterator<set<Index> >(outs2dup, outs2dup.begin()));
352 inputs.insert(output[mdinout[j]]);
357 set_difference(outputs.begin(),
361 insert_iterator<set<Index> >(outs2push, outs2push.begin()));
372 saout.insert(aout.begin(), aout.end());
373 sain.insert(ain.begin(), ain.end());
381 set<Index> outs2push_without_agenda_input;
387 insert_iterator<set<Index> >(outs2push_without_agenda_input,
388 outs2push_without_agenda_input.begin()));
392 outs2push_without_agenda_input.begin(),
393 outs2push_without_agenda_input.end(),
396 insert_iterator<ArrayOfIndex>(
moutput_push, moutput_push.begin()));
401 set<Index> outs2dup_without_agenda_input;
407 insert_iterator<set<Index> >(outs2dup_without_agenda_input,
408 outs2dup_without_agenda_input.begin()));
412 outs2dup_without_agenda_input.begin(),
413 outs2dup_without_agenda_input.end(),
416 insert_iterator<ArrayOfIndex>(
moutput_dup, moutput_dup.begin()));
422 set<Index> saout_only;
424 set_difference(saout.begin(),
428 insert_iterator<set<Index> >(saout_only, saout_only.begin()));
431 set_intersection(outs2dup.begin(),
435 insert_iterator<ArrayOfIndex>(
436 agenda_only_out_wsm_in, agenda_only_out_wsm_in.begin()));
442 set<Index> sain_only;
444 set_difference(sain.begin(),
448 insert_iterator<set<Index> >(sain_only, sain_only.begin()));
451 set_intersection(outs2push.begin(),
455 insert_iterator<ArrayOfIndex>(
456 agenda_only_in_wsm_out, agenda_only_in_wsm_out.begin()));
460 out3 <<
" [Agenda::pushpop] : " <<
name() <<
"\n";
461 out3 <<
" [Agenda::pushpop] - # Funcs in Ag : " <<
mml.
nelem() <<
"\n";
462 out3 <<
" [Agenda::pushpop] - AgOut : ";
465 out3 <<
" [Agenda::pushpop] - AgIn : ";
468 out3 <<
" [Agenda::pushpop] - All WSM output: ";
471 out3 <<
" [Agenda::pushpop] - All WSM input : ";
474 out3 <<
" [Agenda::pushpop] - Output WSVs push : ";
477 out3 <<
" [Agenda::pushpop] - Output WSVs dup : ";
480 out3 <<
" [Agenda::pushpop] - Ag inp dup : ";
483 out3 <<
" [Agenda::pushpop] - Ag out dup : ";
506 const Index WsmAgendaExecuteIndex =
MdMap.find(
"AgendaExecute")->second;
507 const Index WsmAgendaExecuteExclIndex =
508 MdMap.find(
"AgendaExecuteExclusive")->second;
528 if (var == input[j])
return true;
536 if (var == output[mdinout[j]])
return true;
542 if (this_method.
Id() == WsmAgendaExecuteIndex ||
543 this_method.
Id() == WsmAgendaExecuteExclIndex) {
544 for (
Index j = 0; j <
md_data[this_method.
Id()].GInType().nelem();
546 if (
md_data[this_method.
Id()].GInType()[j] == WsvAgendaGroupIndex) {
548 const map<String, Index>::const_iterator agenda_it =
553 os <<
"Manual execution of the agenda \"" << agenda_name
554 <<
"\" is not supported.";
555 throw std::runtime_error(os.
str());
558 for (
Index k = 0; k < agins.nelem(); ++k) {
559 if (var == agins[k])
return true;
588 const Index WsmAgendaExecuteIndex =
MdMap.find(
"AgendaExecute")->second;
589 const Index WsmAgendaExecuteExclIndex =
590 MdMap.find(
"AgendaExecuteExclusive")->second;
606 if (var == output[j])
return true;
612 if (this_method.
Id() == WsmAgendaExecuteIndex ||
613 this_method.
Id() == WsmAgendaExecuteExclIndex) {
614 for (
Index j = 0; j <
md_data[this_method.
Id()].GInType().nelem();
616 if (
md_data[this_method.
Id()].GInType()[j] == WsvAgendaGroupIndex) {
617 const String& agenda_name =
619 const map<String, Index>::const_iterator agenda_it =
624 os <<
"Manual execution of the agenda \"" << agenda_name
625 <<
"\" is not supported.";
626 throw std::runtime_error(os.
str());
629 for (
Index k = 0; k < agouts.nelem(); k++)
630 if (agouts[k] == var)
return true;
677 !found && it !=
mml.end();
679 if (
md_data[it->Id()].Name() == methodname) found =
true;
699 mml[
i].print(os, indent);
752 os << indent << tmd.
Name();
761 for (
Index i = 0;
i < Out().nelem(); ++
i) {
770 for (
Index i = 0;
i < In().nelem(); ++
i) {
782 if (0 != Tasks().
nelem()) {
784 Tasks().print(os, indent +
" ");
785 os << indent <<
"}\n";
INDEX Index
The type to use for all integer numbers and indices.
static Array< WsvRecord > wsv_data
Global WSV data.
Lookup information for one agenda.
void set_outputs_to_push_and_dup(const Verbosity &verbosity)
Retrieve indexes of all input and output WSVs.
void var(VectorView var, const Vector &y, const ArrayOfVector &ys, const Index start=0, const Index end=-1)
Compute the variance of the ranged ys.
void print(ostream &os, const String &indent) const
Print an MRecord.
String name() const
Agenda name.
Index nelem() const
Number of elements.
void check(Workspace &ws, const Verbosity &verbosity)
Checks consistency of an agenda.
Declarations having to do with the four output streams.
map< String, Index > AgendaMap
The map associated with agenda_data.
const ArrayOfIndex & In() const
void duplicate(Index i)
Duplicate WSV.
void(* getaways[])(Workspace &, const MRecord &)
void pop_free(Index i)
Remove the topmost WSV from its stack and free its memory.
bool is_initialized(Index i)
Checks existence of the given WSV.
const ArrayOfIndex & Out() const
const ArrayOfIndex & Out() const
void PrintWsvNames(OutputStream &outstream, const Container &container)
Print list of WSV names to output stream.
All information for one workspace method.
const String & Name() const
const map< String, Index > MdMap
The map associated with md_data.
This file contains the Workspace class.
Index get_wsv_id(const String &name)
Get index of WSV.
The global header file for ARTS.
bool mchecked
Flag indicating that the agenda was checked for consistency.
bool has_method(const String &methodname) const
Check if method is in Agenda.
_CS_string_type str() const
bool is_main_agenda() const
Declarations for agendas.
void set_main_agenda(bool main_agenda)
ArrayOfIndex moutput_push
bool is_input(Workspace &ws, Index var) const
Check if given variable is agenda input.
void execute(Workspace &ws) const
Execute an agenda.
const Array< AgRecord > agenda_data
The lookup information for the agendas.
const ArrayOfIndex & In() const
Index nelem() const
Return the number of agenda elements.
const ArrayOfIndex & InOut() const
bool isInternal() const
Indicates the origin of this method.
const ArrayOfIndex & GOutType() const
void print(ostream &os, const String &indent) const
Print an agenda.
void set_name(const String &nname)
Set agenda name.
ostream & operator<<(ostream &os, const Agenda &a)
Output operator for Agenda.
const map< String, Index > WsvGroupMap
The map associated with wsv_group_names.
bool is_output(Index var) const
Check if given variable is agenda output.
const Array< MdRecord > md_data
Lookup information for workspace methods.
const ArrayOfIndex & GInType() const
Header file for helper functions for OpenMP.
This stores arbitrary token values and remembers the type.
Declaration of the class MdRecord.
Declarations for AgRecord, storing lookup information for one agenda.
void append(const String &methodname, const TokVal &keywordvalue)
Appends methods to an agenda.