60 const TokVal& keywordvalue)
64 const map<String, Index>::const_iterator i2 =
MdMap.find(methodname);
65 assert(i2 !=
MdMap.end());
66 Index id = i2->second;
113 Index this_wsv = this_data.
Out()[i];
118 os <<
"The agenda " <<
mname 119 <<
" must generate the output WSV " 121 <<
"but it does not. It only generates:\n";
125 throw runtime_error(os.str());
134 Index this_wsv = this_data.
In()[i];
139 os <<
"The agenda " <<
mname 140 <<
" must use the input WSV " 142 <<
"but it does not. It only uses:\n";
146 throw runtime_error(os.str());
168 os <<
"Agenda *" <<
mname <<
"* hasn't been checked for consistency yet." << endl
169 <<
"This check is usually done by AgendaSet or AgendaAppend." << endl
170 <<
"There are two possible causes for this:" << endl
171 <<
"1) You're trying to execute an agenda that has been created in" << endl
172 <<
" the controlfile with AgendaCreate. This is not allowed. You have" << endl
173 <<
" to use *Copy* to store it into one of the predefined agendas and" << endl
174 <<
" execute that one." << endl
175 <<
"2) Developer error: If you have written code that modifies an Agenda" << endl
176 <<
" directly (changing its name or altering its method list), it's up" << endl
177 <<
" to you to call Agenda::check in your code after your modifications.";
178 throw runtime_error(os.str());
203 aout1 <<
"Executing " <<
name() <<
"\n" 223 out3 <<
"- " + mdd.
Name() +
"\n";
227 out1 <<
"- " + mdd.
Name() +
"\n";
233 for (
Index s = 0; s < v.nelem(); ++s)
234 if ((s != v.nelem()-1 || !mdd.
SetMethod())
236 throw runtime_error(
"Method "+mdd.
Name()+
" needs input variable: "+
245 throw runtime_error(
"Method "+mdd.
Name()+
" needs input variable: "+
253 catch (runtime_error x)
258 os <<
"Run-time error in method: " << mdd.
Name() <<
'\n' 261 throw runtime_error(os.str());
263 catch (std::bad_alloc x)
268 os <<
"Memory allocation error in method: " << mdd.
Name() <<
'\n' 269 <<
"For memory intensive jobs it could help to limit the\n" 270 <<
"number of threads with the -n option.\n" 273 throw runtime_error(os.str());
295 set<Index> outs2push;
299 method !=
mml.end(); method++)
308 souts.insert(outs.begin(), outs.end());
309 souts.insert(gouts.begin(), gouts.end());
313 inputs.insert(gins.begin(), gins.end());
319 if (
md_data[method->Id()].Name() ==
"Delete")
321 souts.insert(gins.begin(), gins.end());
326 inputs.insert(ins.begin(), ins.end());
329 outputs.insert(souts.begin(), souts.end());
334 set_intersection(souts.begin(), souts.end(),
335 inputs.begin(), inputs.end(),
336 insert_iterator< set<Index> >(outs2dup,
342 set_difference(outputs.begin(), outputs.end(),
343 outs2dup.begin(), outs2dup.end(),
344 insert_iterator< set<Index> >(outs2push,
359 saout.insert(aout.begin(), aout.end());
360 sain.insert(ain.begin(), ain.end());
368 set<Index> outs2push_without_agenda_input;
369 set_difference(outs2push.begin(), outs2push.end(),
370 sain.begin(), sain.end(),
371 insert_iterator< set<Index> >(outs2push_without_agenda_input,
372 outs2push_without_agenda_input.begin()));
375 set_difference(outs2push_without_agenda_input.begin(),
376 outs2push_without_agenda_input.end(),
377 saout.begin(), saout.end(),
379 moutput_push.begin()));
384 set<Index> outs2dup_without_agenda_input;
385 set_difference(outs2dup.begin(), outs2dup.end(),
386 sain.begin(), sain.end(),
387 insert_iterator< set<Index> >(outs2dup_without_agenda_input,
388 outs2dup_without_agenda_input.begin()));
391 set_difference(outs2dup_without_agenda_input.begin(),
392 outs2dup_without_agenda_input.end(),
393 saout.begin(), saout.end(),
395 moutput_dup.begin()));
401 set<Index> saout_only;
403 set_difference(saout.begin(), saout.end(),
404 sain.begin(), sain.end(),
405 insert_iterator< set<Index> >(saout_only,
406 saout_only.begin()));
409 set_intersection(outs2dup.begin(), outs2dup.end(),
410 saout_only.begin(), saout_only.end(),
411 insert_iterator<ArrayOfIndex>(agenda_only_out_wsm_in,
412 agenda_only_out_wsm_in.begin()));
418 set<Index> sain_only;
420 set_difference(sain.begin(), sain.end(),
421 saout.begin(), saout.end(),
422 insert_iterator< set<Index> >(sain_only,
426 set_intersection(outs2push.begin(), outs2push.end(),
427 sain_only.begin(), sain_only.end(),
428 insert_iterator<ArrayOfIndex>(agenda_only_in_wsm_out,
429 agenda_only_in_wsm_out.begin()));
433 out3 <<
" [Agenda::pushpop] : " <<
name() <<
"\n";
434 out3 <<
" [Agenda::pushpop] - # Funcs in Ag : " <<
mml.
nelem() <<
"\n";
435 out3 <<
" [Agenda::pushpop] - AgOut : ";
438 out3 <<
" [Agenda::pushpop] - AgIn : ";
441 out3 <<
" [Agenda::pushpop] - All WSM output: ";
444 out3 <<
" [Agenda::pushpop] - WSVs push : ";
447 out3 <<
" [Agenda::pushpop] - WSVs dup : ";
450 out3 <<
" [Agenda::pushpop] - Ag inp dup : ";
453 out3 <<
" [Agenda::pushpop] - Ag out dup : ";
457 if (agenda_only_in_wsm_out.nelem())
460 err <<
"At least one variable is only defined as input\n" 461 <<
"in agenda " <<
name() <<
", but\n" 462 <<
"used as output in a WSM called by the agenda!!!\n" 463 <<
"This is not allowed.\n" 466 throw runtime_error(err.str());
491 Index WsvAgendaGroupIndex = 0;
495 WsvAgendaGroupIndex = i;
511 if (var == input[j])
return true;
522 if (var == input[j])
return true;
528 for (
Index j = 0; j <
md_data[this_method.
Id()].GInType().nelem(); j++)
530 if (
md_data[this_method.
Id()].GInType()[j] == WsvAgendaGroupIndex)
532 Agenda* AgendaFromGeneralInput =
535 if ((*AgendaFromGeneralInput).is_input(ws, var))
574 if (var == output[j])
return true;
585 if (var == output[j])
return true;
629 cout <<
md_data[mr->Id()].Name() <<
": ";
630 cout << mr->In() << endl;
632 if (
md_data[mr->Id()].Name() ==
"AgendaExecute")
634 cout <<
"AgendaExecute" << endl;
638 for (ArrayOfIndex::const_iterator it = mr->In().begin();
639 it != mr->In().end(); it++)
640 if (find(in_vars.begin(), in_vars.end(), *it) == in_vars.end())
641 in_vars.push_back(*it);
643 for (ArrayOfIndex::const_iterator it = mr->Out().begin();
644 it != mr->Out().end(); it++)
645 if (find(out_vars.begin(), out_vars.end(), *it) == out_vars.end())
646 out_vars.push_back(*it);
649 while (mr !=
mml.begin());
651 cout <<
"In : " << in_vars << endl;
652 cout <<
"Out: " << out_vars << endl;
674 !found && it !=
mml.end();
677 if (
md_data[it->Id()].Name() == methodname)
697 const String& indent)
const 702 mml[i].print(os, indent);
759 os << indent << tmd.
Name();
769 for (
Index i = 0; i < Out().nelem(); ++i)
771 if (first) first =
false;
777 for (
Index i = 0; i < In().nelem(); ++i)
779 if (first) first =
false;
788 if (0 != Tasks().
nelem())
791 Tasks().print(os, indent+
" ");
792 os << indent <<
"}\n";
INDEX Index
The type to use for all integer numbers and indices.
static Array< WsvRecord > 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(* getaways[])(Workspace &, const MRecord &)
void find_unused_variables()
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.
const ArrayOfIndex & In() const
map< String, Index > AgendaMap
The map associated with agenda_data.
void duplicate(Index i)
Duplicate WSV.
void pop_free(Index i)
Pop 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 declaration and partly the implementation of 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.
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
const ArrayOfString wsv_group_names
The names associated with Wsv groups as Strings.
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.
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.