source: pcp/src/helpers.h@ 88e890

Last change on this file since 88e890 was 9275a3, checked in by Frederik Heber <heber@…>, 17 years ago

Free(): now takes a debug string to know where free error occured
debug(): now depends on HAVE_DEBUG

  • Property mode set to 100644
File size: 2.5 KB
Line 
1#ifndef helpers_h
2#define helpers_h
3/** \file helpers.h
4 * Header file for \ref helpers.c
5 *
6 * Contains declarations of the functions implemented in \ref helpers.c and one
7 * inline function which gets current time via an MPI call: GetTime().
8 *
9 Project: ParallelCarParrinello
10 Jan Hamaekers
11 2000
12
13 File: helpers.h
14 $Id: helpers.h,v 1.9 2007/02/09 09:13:48 foo Exp $
15*/
16
17#include<stddef.h> /* fuer size_t */
18
19// taken out of TREMOLO
20/*@-namechecks@*/
21#ifndef __GNUC__
22# undef __attribute__
23# define __attribute__(x)
24#endif
25/*@=namechecks@*/
26
27
28/* Behandelt aufgetretene Fehler. error ist der Fehlertyp(enum Errors)
29 void *SpecialData ist ein untypisierter Zeiger auf Spezielle Daten zur Fehlerbehandlung.
30 Man koennte auch noch einen Zeiger auf eine Funktion uebergeben */
31extern void /*@exits@*/ debug(struct Problem *P, const char *output);
32 //__attribute__ ((__return__));
33#define debug(err, data) debug_in((err), (data), __FILE__, __LINE__)
34
35extern void /*@exits@*/ debug_in(struct Problem *P, const char *output,
36 const char *file, const int line);
37 //__attribute__ ((__return__));
38
39/* Eigene malloc, die bei einem Fehler an Error output uebergibt */
40void* Malloc(size_t size, const char* output);
41
42char* MallocString(size_t size, const char* output);
43
44/* Eigene malloc, die bei einem Fehler erzeugten (ein int rein) output an Error uebergibt */
45void* Malloci(size_t size, const char* output, int i);
46
47/* Eigene malloc, die bei einem Fehler erzeugten (zwei int rein) output an Error uebergibt */
48void* Mallocii(size_t size, const char* output, int i, int j);
49
50/* Dasselbe wie oben mit realloc */
51void* Realloc(void* pointer, size_t size, const char* output);
52void* Realloci(void* pointer, size_t size, const char* output, int i);
53void* Reallocii(void* pointer, size_t size, const char* output, int i, int j);
54void Free (void *ptr, const char* output);
55
56void GetRGB(int i, unsigned int max, double* rgb);
57
58/** Get current time.
59 * Uses MPI_Wtime() to get current system time, synchronously for all processes.
60 * \return current time
61 */
62static inline /*@unused@*/ double GetTime(void)
63{
64 double t;
65 t = MPI_Wtime();
66 return t;
67};
68
69void InitSpeedMeasure(struct Problem *P);
70void SpeedMeasure(struct Problem *P, enum TimeTypes TT, enum TimeDoTypes TOT);
71void CompleteSpeedMeasure(struct Problem *P);
72void StartParallel (struct Problem *P, char **argv);
73void WaitForOtherProcs(struct Problem *P, int out);
74/*void SetArrayToDouble0(double *a, int n);*/
75void RemoveEverything(struct Problem *P);
76#endif
Note: See TracBrowser for help on using the repository browser.