ARTS  2.2.66
m_agenda.cc
Go to the documentation of this file.
1 /* Copyright (C) 2002-2012 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 /* Workspace method: Doxygen documentation will be auto-generated */
47  // WS Generic Input:
48  const Agenda& this_agenda,
49  const Verbosity& verbosity)
50 {
52  out3 << " Manual, exclusive agenda execution\n";
53 
54  #pragma omp critical(AgendaExecuteExclusive_region)
55  this_agenda.execute(ws);
56 }
57 
58 
59 /* Workspace method: Doxygen documentation will be auto-generated */
61  // WS Generic Output:
62  Agenda& output_agenda,
63  // WS Generic Output Names:
64  const String& agenda_name,
65  // Agenda from controlfile:
66  const Agenda& input_agenda,
67  const Verbosity& verbosity)
68 {
69  output_agenda = input_agenda;
70  output_agenda.set_name(agenda_name);
71 
72  output_agenda.check(ws, verbosity);
73 }
74 
75 
76 /* Workspace method: Doxygen documentation will be auto-generated */
78  // WS Generic Output:
79  Agenda& output_agenda,
80  // WS Generic Output Names:
81  const String& output_agenda_name,
82  // WS Generic Input:
83  const Agenda& in_agenda _U_,
84  // WS Generic Input Names:
85  const String& in_agenda_name,
86  // Agenda from controlfile:
87  const Agenda& input_agenda,
88  const Verbosity& verbosity)
89 {
90  if (output_agenda_name != in_agenda_name)
91  {
92  ostringstream os;
93  os << "Output and input agenda must be the same!" << endl
94  << "*" << output_agenda_name << "* and *" << in_agenda_name << "* "
95  << "are not.";
96  throw runtime_error (os.str());
97  }
98 
99  Array<MRecord> methods = output_agenda.Methods();
100  for (Index i = 0; i < input_agenda.Methods().nelem(); i++)
101  methods.push_back(input_agenda.Methods()[i]);
102 
103  output_agenda.set_methods (methods);
104  output_agenda.check(ws, verbosity);
105 }
106 
107 
108 /* Workspace method: Doxygen documentation will be auto-generated */
110  // Agenda from controlfile:
111  const Agenda&,
112  const Verbosity& verbosity)
113 {
114  CREATE_OUT0;
115  arts_exit_with_error_message("The 'Arts' method is obsolete. Arts1 controlfiles are no longer supported.",
116  out0);
117 }
118 
119 
120 /* Workspace method: Doxygen documentation will be auto-generated */
121 void Arts2(Workspace& ws,
122  // Agenda from controlfile:
123  const Agenda& input_agenda,
124  const Verbosity& verbosity)
125 {
126  Verbosity *v = (Verbosity*)ws[get_wsv_id("verbosity")];
127 
128  // If the verbosity in the current workspace and the verbosity parameter point
129  // to the same variable in memory, that means we were called
130  // from inside a controlfile by the user. That is not permitted.
131  if (v == &verbosity)
132  {
133  CREATE_OUT0;
134  arts_exit_with_error_message("The 'Arts2' method can't be called directly.", out0);
135  }
136  (*v) = verbosity;
137  input_agenda.execute(ws);
138 }
139 
void AgendaExecuteExclusive(Workspace &ws, const Agenda &this_agenda, const Verbosity &verbosity)
WORKSPACE METHOD: AgendaExecuteExclusive.
Definition: m_agenda.cc:46
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:35
The Agenda class.
Definition: agenda_class.h:44
Index nelem() const
Number of elements.
Definition: array.h:176
void check(Workspace &ws, const Verbosity &verbosity)
Checks consistency of an agenda.
Definition: agenda_class.cc:84
Declarations having to do with the four output streams.
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:77
This file contains the declaration and partly the implementation of the workspace class...
Index get_wsv_id(const String &name)
Get index of WSV.
Definition: workspace.cc:4998
The implementation for String, the ARTS string class.
Definition: mystring.h:63
void Arts(Workspace &, const Agenda &, const Verbosity &verbosity)
WORKSPACE METHOD: Arts.
Definition: m_agenda.cc:109
Declarations for agendas.
void execute(Workspace &ws) const
Execute an agenda.
void set_methods(const Array< MRecord > &ml)
Definition: agenda_class.h:72
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:60
void arts_exit_with_error_message(const String &m, ArtsOut &out)
Print error message and exit.
Definition: arts.cc:64
void set_name(const String &nname)
Set agenda name.
const Array< MRecord > & Methods() const
Definition: agenda_class.h:70
Workspace class.
Definition: workspace_ng.h:47
#define _U_
Definition: config.h:167
#define CREATE_OUT0
Definition: messages.h:211
#define CREATE_OUT3
Definition: messages.h:214
void AgendaExecute(Workspace &ws, const Agenda &this_agenda, const Verbosity &verbosity)
WORKSPACE METHOD: AgendaExecute.
Definition: m_agenda.cc:35
Declarations for AgRecord, storing lookup information for one agenda.
void Arts2(Workspace &ws, const Agenda &input_agenda, const Verbosity &verbosity)
WORKSPACE METHOD: Arts2.
Definition: m_agenda.cc:121
Auxiliary header stuff related to workspace variable groups.