forked from RudolfWeeber/espresso-virtual-sites
-
Notifications
You must be signed in to change notification settings - Fork 0
/
debug.h
287 lines (235 loc) · 6.28 KB
/
debug.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
/*
Copyright (C) 2010 The ESPResSo project
Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010 Max-Planck-Institute for Polymer Research, Theory Group, PO Box 3148, 55021 Mainz, Germany
This file is part of ESPResSo.
ESPResSo is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ESPResSo is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/** \file debug.h
This file controls debug facilities.
The implementation is found in
\ref debug.c "debug.c".
For every define there exists a macro that can be used to encapsulate short lines (like printf("...",...);)
of code that should be executed iff the respective *_DEBUG macro is defined.
*/
#include "config.h"
#include <tcl.h>
#ifdef MEM_DEBUG
#ifdef __GNUC__
#define realloc(v,s) __realloc((v),(s),__FILE__, __LINE__)
#define malloc(s) __malloc((s),__FILE__, __LINE__)
#define free(v) __free((v),__FILE__, __LINE__)
#else
#define realloc(v,s) __realloc((v),(s), "no line info", 0)
#define malloc(s) __malloc((s), "no line info", 0)
#define free(v) __free((v),"no line info", 0)
#endif
/** memory allocation test routine */
void *__realloc(void *old, unsigned int size, char *where, int line);
/** memory allocation test routine */
void *__malloc(unsigned int size, char *where, int line);
/** memory allocation test routine */
void __free(void *p, char *where, int line);
#endif
/** callback for debug status. */
int debug_callback(Tcl_Interp *interp);
#if defined FORCE_CORE || defined MPI_CORE
/** this functions kills the task with SIGSEGV */
void core();
#endif
#ifdef ADDITIONAL_CHECKS
/** this performs a lot of tests which will very likely detect corruptions of
\ref local_particles and the cell structure.
*/
void check_particle_consistency();
/** check the consistency of the cells and particle_node. Called from
mpi_bcast_event(CHECK_PARTICLES)
*/
void check_particles();
#endif
/** Print all particle positions contained in \ref cells::cells array. */
void print_particle_positions();
/** Print all particle forces contained in \ref cells::cells array. */
void print_particle_forces();
/** by setting this variable to 1, a regular exit is
indicated. In that case, no core dump is generated.
*/
extern int regular_exit;
/** Identity of the particle to check extensively if ONEPART_DEBUG is defined. */
extern int check_id;
#ifdef COMM_DEBUG
#define COMM_TRACE(cmd) { cmd; }
#else
/** Equals { cmd } iff COMM_DEBUG is set. */
#define COMM_TRACE(cmd)
#endif
#ifdef EVENT_DEBUG
#define EVENT_TRACE(cmd) { cmd; }
#else
/** Equals { cmd } iff EVENT_DEBUG is set. */
#define EVENT_TRACE(cmd)
#endif
#ifdef PARTICLE_DEBUG
#define PART_TRACE(cmd) { cmd; }
#else
/** Equals { cmd } iff PARTICLE_DEBUG is set. */
#define PART_TRACE(cmd)
#endif
#ifdef INTEG_DEBUG
#define INTEG_TRACE(cmd) { cmd; }
#else
/** Equals { cmd } iff INTEG_DEBUG is set. */
#define INTEG_TRACE(cmd)
#endif
#ifdef CELL_DEBUG
#define CELL_TRACE(cmd) { cmd; }
#else
/** Equals { cmd } iff CELL_DEBUG is set. */
#define CELL_TRACE(cmd)
#endif
#ifdef GHOST_DEBUG
#define GHOST_TRACE(cmd) { cmd; }
#else
/** Equals { cmd } iff GHOST_DEBUG is set. */
#define GHOST_TRACE(cmd)
#endif
#ifdef HALO_DEBUG
#define HALO_TRACE(cmd) { cmd; }
#else
/** Equals { cmd } iff HALO_DEBUG is set. */
#define HALO_TRACE(cmd)
#endif
#ifdef GRID_DEBUG
#define GRID_TRACE(cmd) { cmd; }
#else
/** Equals { cmd } iff GRID_DEBUG is set. */
#define GRID_TRACE(cmd)
#endif
#ifdef LATTICE_DEBUG
#define LATTICE_TRACE(cmd) { cmd; }
#else
/** Equals { cmd } iff LATTICE_DEBUG is set. */
#define LATTICE_TRACE(cmd)
#endif
#ifdef FORCE_DEBUG
#define FORCE_TRACE(cmd) { cmd; }
#else
/** Equals { cmd } iff FORCE_DEBUG is set. */
#define FORCE_TRACE(cmd)
#endif
#ifdef VERLET_DEBUG
#define VERLET_TRACE(cmd) { cmd; }
#else
/** Equals { cmd } iff VERLET_DEBUG is set. */
#define VERLET_TRACE(cmd)
#endif
#ifdef P3M_DEBUG
#define P3M_TRACE(cmd) { cmd; }
#else
/** Equals { cmd } iff P3M_DEBUG is set. */
#define P3M_TRACE(cmd)
#endif
#ifdef EWALD_DEBUG
#define EWALD_TRACE(cmd) { cmd; }
#else
/** Equals { cmd } if EWALD_DEBUG is set. */
#define EWALD_TRACE(cmd)
#endif
#ifdef MAGGS_DEBUG
#define MAGGS_TRACE(cmd) { cmd; }
#else
/** Equals { cmd } iff MAGGS_DEBUG is set. */
#define MAGGS_TRACE(cmd)
#endif
#ifdef FFT_DEBUG
#define FFT_TRACE(cmd) { cmd; }
#else
/** Equals { cmd } iff FFT_DEBUG is set. */
#define FFT_TRACE(cmd)
#endif
#ifdef RANDOM_DEBUG
#define RANDOM_TRACE(cmd) { cmd; }
#else
#define RANDOM_TRACE(cmd)
#endif
#ifdef THERMO_DEBUG
#define THERMO_TRACE(cmd) { cmd; }
#else
#define THERMO_TRACE(cmd)
#endif
#ifdef LJ_DEBUG
#define LJ_TRACE(cmd) { cmd; }
#else
#define LJ_TRACE(cmd)
#endif
#ifdef MORSE_DEBUG
#define MORSE_TRACE(cmd) { cmd; }
#else
#define MORSE_TRACE(cmd)
#endif
#ifdef BUCK_DEBUG
#define BUCK_TRACE(cmd) { cmd; }
#else
#define BUCK_TRACE(cmd)
#endif
#ifdef ESR_DEBUG
#define ESR_TRACE(cmd) { cmd; }
#else
#define ESR_TRACE(cmd)
#endif
#ifdef ESK_DEBUG
#define ESK_TRACE(cmd) { cmd; }
#else
#define ESK_TRACE(cmd)
#endif
#ifdef FENE_DEBUG
#define FENE_TRACE(cmd) { cmd; }
#else
#define FENE_TRACE(cmd)
#endif
#ifdef GHOST_FORCE_DEBUG
#define GHOST_FORCE_TRACE(cmd) { cmd; }
#else
#define GHOST_FORCE_TRACE(cmd)
#endif
#ifdef ONEPART_DEBUG
#define ONEPART_TRACE(cmd) { cmd; }
#else
#define ONEPART_TRACE(cmd)
#endif
#ifdef STAT_DEBUG
#define STAT_TRACE(cmd) { cmd; }
#else
/** Equals { cmd } iff STAT_DEBUG is set. */
#define STAT_TRACE(cmd)
#endif
#ifdef POLY_DEBUG
#define POLY_TRACE(cmd) { cmd; }
#else
/** Equals { cmd } iff POLY_DEBUG is set. */
#define POLY_TRACE(cmd)
#endif
#ifdef MOLFORCES_DEBUG
#define MOLFORCES_TRACE(cmd) { cmd; }
#else
#define MOLFORCES_TRACE(cmd)
#endif
#ifdef PTENSOR_DEBUG
#define PTENSOR_TRACE(cmd) { cmd; }
#else
#define PTENSOR_TRACE(cmd)
#endif
#ifdef LB_DEBUG
#define LB_TRACE(cmd) { cmd; }
#else
/** Equals { cmd } iff LB_DEBUG is set. */
#define LB_TRACE(cmd)
#endif