ARTS  2.3.1285(git:92a29ea9-dirty)
m_general.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2012 Oliver Lemke <olemke@core-dump.info>
2 
3  This program is free software; you can redistribute it and/or
4  modify it under the terms of the GNU General Public License as
5  published by the Free Software Foundation; either version 2 of the
6  License, or (at your option) any 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 
27 #ifndef m_general_h
28 #define m_general_h
29 
30 #include "arts.h"
31 
32 #include <iostream>
33 #ifdef TIME_SUPPORT
34 #include <sys/times.h>
35 #endif
36 #include <stdexcept>
37 #include "cia.h"
38 #include "messages.h"
39 #include "mystring.h"
40 #include "ppath.h"
41 #include "special_interp.h"
42 #include "tessem.h"
43 
44 class Workspace;
45 
46 #define SWITCH_OUTPUT(x, y) \
47  { \
48  ostringstream so_os; \
49  so_os << y << '\n'; \
50  switch (x) { \
51  case 0: \
52  out0 << so_os.str(); \
53  break; \
54  case 1: \
55  out1 << so_os.str(); \
56  break; \
57  case 2: \
58  out2 << so_os.str(); \
59  break; \
60  case 3: \
61  out3 << so_os.str(); \
62  break; \
63  default: \
64  throw runtime_error("Output level must have value from 0-3"); \
65  } \
66  }
67 
68 class Timer {
69  public:
70  Timer() : running(false), finished(false) {}
71  bool running;
72  bool finished;
73 #ifdef TIME_SUPPORT
74  struct tms cputime_start;
75  clock_t realtime_start;
76  struct tms cputime_end;
77  clock_t realtime_end;
78 #endif
79 };
80 
81 /* Workspace method: Doxygen documentation will be auto-generated */
82 template <typename T>
83 void Print(
84  // WS Generic Input:
85  const T& x,
86  // Keywords:
87  const Index& level,
88  const Verbosity& verbosity) {
90  SWITCH_OUTPUT(level, x)
91 }
92 
93 /* Workspace method: Doxygen documentation will be auto-generated */
94 void Print(Workspace& ws,
95  // WS Generic Input:
96  const Agenda& x,
97  // Keywords:
98  const Index& level,
99  const Verbosity& verbosity);
100 
101 /* Workspace method: Doxygen documentation will be auto-generated */
102 void Print(Workspace& ws,
103  // WS Generic Input:
104  const ArrayOfAgenda& x,
105  // Keywords:
106  const Index& level,
107  const Verbosity& verbosity);
108 
109 /* Workspace method: Doxygen documentation will be auto-generated */
110 void Print( // WS Generic Input:
111  const ArrayOfGridPos& x,
112  // Keywords:
113  const Index& level,
114  const Verbosity& verbosity);
115 
116 /* Workspace method: Doxygen documentation will be auto-generated */
117 void Print( // WS Generic Input:
118  const ArrayOfCIARecord& x,
119  // Keywords:
120  const Index& level,
121  const Verbosity& verbosity);
122 
123 /* Workspace method: Doxygen documentation will be auto-generated */
124 void Print( // WS Generic Input:
125  const ArrayOfString& x,
126  // Keywords:
127  const Index& level,
128  const Verbosity& verbosity);
129 
130 /* Workspace method: Doxygen documentation will be auto-generated */
131 void Print( // WS Generic Input:
132  const Ppath& ppath,
133  // Keywords:
134  const Index& level,
135  const Verbosity& verbosity);
136 
137 /* Workspace method: Doxygen documentation will be auto-generated */
138 void Print( // WS Generic Input:
139  const ArrayOfPpath& x,
140  // Keywords:
141  const Index& level,
142  const Verbosity& verbosity);
143 
144 /* Workspace method: Doxygen documentation will be auto-generated */
145 void Print( // WS Generic Input:
146  const Timer& x,
147  // Keywords:
148  const Index& level,
149  const Verbosity& verbosity);
150 
151 /* Workspace method: Doxygen documentation will be auto-generated */
152 void Print( // WS Generic Input:
153  const TessemNN& x,
154  // Keywords:
155  const Index& level,
156  const Verbosity& verbosity);
157 
158 /* Workspace method: Doxygen documentation will be auto-generated */
159 void PrintWorkspace( // Workspace reference
160  Workspace& ws,
161  // Keywords:
162  const Index& only_allocated,
163  const Index& level,
164  const Verbosity& verbosity);
165 
166 #endif /* m_general_h */
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
Header file for work with HITRAN collision induced absorption (CIA).
void Print(const T &x, const Index &level, const Verbosity &verbosity)
WORKSPACE METHOD: Print.
Definition: m_general.h:83
The Agenda class.
Definition: agenda_class.h:44
Declarations having to do with the four output streams.
void PrintWorkspace(Workspace &ws, const Index &only_allocated, const Index &level, const Verbosity &verbosity)
Definition: m_general.cc:309
The global header file for ARTS.
#define CREATE_OUTS
Definition: messages.h:209
bool finished
Definition: m_general.h:72
Timer()
Definition: m_general.h:70
This file contains functions that are adapted from TESSEM code which is used to calculate surface emi...
bool running
Definition: m_general.h:71
Header file for special_interp.cc.
Propagation path structure and functions.
This can be used to make arrays out of anything.
Definition: array.h:40
Workspace class.
Definition: workspace_ng.h:40
The structure to describe a propagation path and releated quantities.
Definition: ppath.h:48
#define SWITCH_OUTPUT(x, y)
Definition: m_general.h:46
This file contains the definition of String, the ARTS string class.