ARTS  2.0.49
m_agenda.cc
Go to the documentation of this file.
1 /* Copyright (C) 2002-2008 Stefan Buehler <sbuehler@ltu.se>
2 
3  This program is free software; you can redistribute it and/or modify it
4  under the terms of the GNU General Public License as published by the
5  Free Software Foundation; either version 2, or (at your option) any
6  later version.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16  USA. */
17 
26 #include <map>
27 #include "agenda_class.h"
28 #include "messages.h"
29 #include "wsv_aux.h"
30 #include "agenda_record.h"
31 #include "workspace_ng.h"
32 
33 
34 /* Workspace method: Doxygen documentation will be auto-generated */
36  // WS Generic Input:
37  const Agenda& this_agenda,
38  const Verbosity& verbosity)
39 {
41  out3 << " Manual agenda execution\n";
42  this_agenda.execute(ws);
43 }
44 
45 
46 /* Workspace method: Doxygen documentation will be auto-generated */
48  // WS Generic Output:
49  Agenda& output_agenda,
50  // WS Generic Output Names:
51  const String& agenda_name,
52  // Agenda from controlfile:
53  const Agenda& input_agenda,
54  const Verbosity& verbosity)
55 {
56  output_agenda = input_agenda;
57  output_agenda.set_name(agenda_name);
58 
59  output_agenda.check(ws, verbosity);
60 }
61 
62 
63 /* Workspace method: Doxygen documentation will be auto-generated */
65  // WS Generic Output:
66  Agenda& output_agenda,
67  // WS Generic Output Names:
68  const String& output_agenda_name,
69  // WS Generic Input:
70  const Agenda& in_agenda _U_,
71  // WS Generic Input Names:
72  const String& in_agenda_name,
73  // Agenda from controlfile:
74  const Agenda& input_agenda,
75  const Verbosity& verbosity)
76 {
77  if (output_agenda_name != in_agenda_name)
78  {
79  ostringstream os;
80  os << "Output and input agenda must be the same!" << endl
81  << "*" << output_agenda_name << "* and *" << in_agenda_name << "* "
82  << "are not.";
83  throw runtime_error (os.str());
84  }
85 
86  Array<MRecord> methods = output_agenda.Methods();
87  for (Index i = 0; i < input_agenda.Methods().nelem(); i++)
88  methods.push_back(input_agenda.Methods()[i]);
89 
90  output_agenda.set_methods (methods);
91  output_agenda.check(ws, verbosity);
92 }
93 
94 
95 /* Workspace method: Doxygen documentation will be auto-generated */
97  // Agenda from controlfile:
98  const Agenda&,
99  const Verbosity& verbosity)
100 {
102  arts_exit_with_error_message("The 'Arts' method is obsolete. Arts1 controlfiles are no longer supported.",
103  out0);
104 }
105 
106 
107 /* Workspace method: Doxygen documentation will be auto-generated */
108 void Arts2(Workspace& ws,
109  // Agenda from controlfile:
110  const Agenda& input_agenda,
111  const Verbosity& verbosity)
112 {
113  Verbosity *v = (Verbosity*)ws[get_wsv_id("verbosity")];
114 
115  // If the verbosity in the current workspace and the verbosity parameter point
116  // to the same variable in memory, that means we were called
117  // from inside a controlfile by the user. That is not permitted.
118  if (v == &verbosity)
119  {
121  arts_exit_with_error_message("The 'Arts2' method can't be called directly.", out0);
122  }
123  (*v) = verbosity;
124  input_agenda.execute(ws);
125 }
126 
agenda_record.h
Declarations for AgRecord, storing lookup information for one agenda.
Agenda::execute
void execute(Workspace &ws) const
Execute an agenda.
Definition: agenda_class.cc:166
get_wsv_id
Index get_wsv_id(const String &name)
Get index of WSV.
Definition: workspace.cc:4555
Agenda::set_methods
void set_methods(const Array< MRecord > &ml)
Definition: agenda_class.h:71
Agenda
The Agenda class.
Definition: agenda_class.h:44
Array< MRecord >
agenda_class.h
Declarations for agendas.
CREATE_OUT3
#define CREATE_OUT3
Definition: messages.h:208
CREATE_OUT0
#define CREATE_OUT0
Definition: messages.h:205
AgendaAppend
void AgendaAppend(Workspace &ws, Agenda &output_agenda, const String &output_agenda_name, const Agenda &in_agenda, const String &in_agenda_name, const Agenda &input_agenda, const Verbosity &verbosity)
WORKSPACE METHOD: AgendaAppend.
Definition: m_agenda.cc:64
messages.h
Declarations having to do with the four output streams.
_U_
#define _U_
Definition: config.h:158
my_basic_string
The implementation for String, the ARTS string class.
Definition: mystring.h:62
AgendaSet
void AgendaSet(Workspace &ws, Agenda &output_agenda, const String &agenda_name, const Agenda &input_agenda, const Verbosity &verbosity)
WORKSPACE METHOD: AgendaSet.
Definition: m_agenda.cc:47
Verbosity
Definition: messages.h:50
Arts
void Arts(Workspace &, const Agenda &, const Verbosity &verbosity)
WORKSPACE METHOD: Arts.
Definition: m_agenda.cc:96
Agenda::check
void check(Workspace &ws, const Verbosity &verbosity)
Checks consistency of an agenda.
Definition: agenda_class.cc:92
workspace_ng.h
This file contains the declaration and partly the implementation of the workspace class.
Arts2
void Arts2(Workspace &ws, const Agenda &input_agenda, const Verbosity &verbosity)
WORKSPACE METHOD: Arts2.
Definition: m_agenda.cc:108
Workspace
Workspace class.
Definition: workspace_ng.h:47
AgendaExecute
void AgendaExecute(Workspace &ws, const Agenda &this_agenda, const Verbosity &verbosity)
WORKSPACE METHOD: AgendaExecute.
Definition: m_agenda.cc:35
Agenda::set_name
void set_name(const String &nname)
Set agenda name.
Definition: agenda_class.cc:602
Index
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
Agenda::Methods
const Array< MRecord > & Methods() const
Definition: agenda_class.h:70
arts_exit_with_error_message
void arts_exit_with_error_message(const String &m, ArtsOut &out)
Print error message and exit.
Definition: arts.cc:64
wsv_aux.h
Auxiliary header stuff related to workspace variable groups.