ARTS  2.2.66
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 "messages.h"
38 #include "ppath.h"
39 #include "special_interp.h"
40 #include "mystring.h"
41 #include "cia.h"
42 
43 class Workspace;
44 
45 #define SWITCH_OUTPUT(x,y) \
46 { \
47 ostringstream so_os; \
48 so_os << y << '\n'; \
49 switch (x) { \
50 case 0: out0 << so_os.str(); break; \
51 case 1: out1 << so_os.str(); break; \
52 case 2: out2 << so_os.str(); break; \
53 case 3: out3 << so_os.str(); break; \
54 default: throw runtime_error ("Output level must have value from 0-3"); \
55 } \
56 }
57 
58 
59 class Timer {
60 public:
61  Timer() : running(false), finished(false) {}
62  bool running;
63  bool finished;
64 #ifdef TIME_SUPPORT
65  struct tms cputime_start;
66  clock_t realtime_start;
67  struct tms cputime_end;
68  clock_t realtime_end;
69 #endif
70 };
71 
72 /* Workspace method: Doxygen documentation will be auto-generated */
73 template<typename T> void
75  // WS Generic Input:
76  const T& x,
77  // Keywords:
78  const Index& level,
79  const Verbosity& verbosity)
80 {
82  SWITCH_OUTPUT (level, x)
83 }
84 
85 
86 /* Workspace method: Doxygen documentation will be auto-generated */
87 void
88 Print(Workspace& ws,
89  // WS Generic Input:
90  const Agenda& x,
91  // Keywords:
92  const Index& level,
93  const Verbosity& verbosity);
94 
95 
96 /* Workspace method: Doxygen documentation will be auto-generated */
97 void
98 Print(// WS Generic Input:
99  const ArrayOfGridPos& x,
100  // Keywords:
101  const Index& level,
102  const Verbosity& verbosity);
103 
104 
105 /* Workspace method: Doxygen documentation will be auto-generated */
106 void
107 Print(// WS Generic Input:
108  const ArrayOfCIARecord& x,
109  // Keywords:
110  const Index& level,
111  const Verbosity& verbosity);
112 
113 
114 /* Workspace method: Doxygen documentation will be auto-generated */
115 void
116 Print(// WS Generic Input:
117  const ArrayOfString& x,
118  // Keywords:
119  const Index& level,
120  const Verbosity& verbosity);
121 
122 
123 /* Workspace method: Doxygen documentation will be auto-generated */
124 void
125 Print(// WS Generic Input:
126  const Ppath& ppath,
127  // Keywords:
128  const Index& level,
129  const Verbosity& verbosity);
130 
131 
132 /* Workspace method: Doxygen documentation will be auto-generated */
133 void Print(// WS Generic Input:
134  const ArrayOfPpath& x,
135  // Keywords:
136  const Index& level,
137  const Verbosity& verbosity);
138 
139 
140 /* Workspace method: Doxygen documentation will be auto-generated */
141 void Print(// WS Generic Input:
142  const Timer& x,
143  // Keywords:
144  const Index& level,
145  const Verbosity& verbosity);
146 
147 
148 /* Workspace method: Doxygen documentation will be auto-generated */
149 void PrintWorkspace(// Workspace reference
150  Workspace& ws,
151  // Keywords:
152  const Index& only_allocated,
153  const Index& level,
154  const Verbosity& verbosity);
155 
156 #endif /* m_general_h */
157 
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:35
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:74
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:300
The global header file for ARTS.
#define CREATE_OUTS
Definition: messages.h:216
bool finished
Definition: m_general.h:63
Timer()
Definition: m_general.h:61
bool running
Definition: m_general.h:62
Header file for special_interp.cc.
Propagation path structure and functions.
Workspace class.
Definition: workspace_ng.h:47
The structure to describe a propagation path and releated quantities.
Definition: ppath.h:59
#define SWITCH_OUTPUT(x, y)
Definition: m_general.h:45
This file contains the definition of String, the ARTS string class.