PIPS
tools.h File Reference
#include <complex.h>
+ Include dependency graph for tools.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void init_data_file (const char *file)
 
void close_data_file ()
 
void print_array_float (const char *name, const float *arr, const unsigned int n)
 
void print_array_int (const char *name, const int *arr, const unsigned int n)
 
void print_array_double (const char *name, const float *arr, const unsigned int n)
 
void print_array_long (const char *name, const long *arr, const unsigned int n)
 
void print_array_cplx (const char *name, const float complex *arr, const unsigned int n)
 
int init_data_float (float *ptr, const unsigned int n)
 
int init_data_double (double *ptr, const unsigned int n)
 
int init_data_long (long *ptr, const unsigned int n)
 
int init_data_int (int *ptr, const unsigned int n)
 
int init_data_cplx (float complex *ptr, const unsigned int n)
 
void init_args (int argc, char **argv)
 

Function Documentation

◆ close_data_file()

void close_data_file ( )

Definition at line 48 of file tools.c.

49 {
50  if (_f_data_file != 0)
51  fclose(_f_data_file);
52 }
static FILE * _f_data_file
Definition: tools.c:32

References _f_data_file.

Referenced by main().

+ Here is the caller graph for this function:

◆ init_args()

void init_args ( int  argc,
char **  argv 
)

Definition at line 151 of file tools.c.

152 {
153  if (argc < 3)
154  {
155  fprintf(stderr, "Usage: %s kernel_size data_file\n", argv[0]);
156  exit(1);
157  }
158  init_data_file(argv[2]);
159 }
#define exit(code)
Definition: misc-local.h:54
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
void init_data_file(const char *data_file)
Definition: tools.c:36

References exit, fprintf(), and init_data_file().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_data_cplx()

int init_data_cplx ( float complex *  ptr,
const unsigned int  n 
)

Definition at line 146 of file tools.c.

147 {
148  return 0;
149 }

◆ init_data_double()

int init_data_double ( double *  ptr,
const unsigned int  n 
)

Definition at line 131 of file tools.c.

132 {
133  return init_data_gen(ptr, n, sizeof(double));
134 }
int init_data_gen(void *ptr, const unsigned int n, const ssize_t stype)
Definition: tools.c:120

References init_data_gen().

+ Here is the call graph for this function:

◆ init_data_file()

void init_data_file ( const char *  file)

Definition at line 36 of file tools.c.

37 {
38  if (_f_data_file != 0)
39  return;
40  _f_data_file = fopen(data_file, "r");
41  if (_f_data_file == 0)
42  {
43  perror("open data file");
44  exit(errno);
45  }
46 }

References _f_data_file, and exit.

Referenced by init_args(), and main().

+ Here is the caller graph for this function:

◆ init_data_float()

int init_data_float ( float *  ptr,
const unsigned int  n 
)

Definition at line 125 of file tools.c.

126 {
127  int r = init_data_gen(ptr, n, sizeof(float));
128  return r;
129 }

References init_data_gen().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_data_int()

int init_data_int ( int ptr,
const unsigned int  n 
)

Definition at line 141 of file tools.c.

142 {
143  return init_data_gen(ptr, n, sizeof(int));
144 }

References init_data_gen().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_data_long()

int init_data_long ( long *  ptr,
const unsigned int  n 
)

Definition at line 136 of file tools.c.

137 {
138  return init_data_gen(ptr, n, sizeof(long));
139 }

References init_data_gen().

+ Here is the call graph for this function:

◆ print_array_cplx()

void print_array_cplx ( const char *  name,
const float complex *  arr,
const unsigned int  n 
)

Definition at line 74 of file tools.c.

75 {
76  int i;
77  for (i=0; i<n;i++)
78  {
79  printf("%f %f\n",crealf(arr[i]),cimagf(arr[i]));
80  }
81 }
int printf()

References printf().

+ Here is the call graph for this function:

◆ print_array_double()

void print_array_double ( const char *  name,
const float *  arr,
const unsigned int  n 
)

Definition at line 64 of file tools.c.

65 {
66  _print_array(name, arr, n, "%a", sizeof(double));
67 }
#define _print_array(name, ptr, n, format, stype)
Definition: tools.c:19

References _print_array.

◆ print_array_float()

void print_array_float ( const char *  name,
const float *  arr,
const unsigned int  n 
)

Definition at line 54 of file tools.c.

55 {
56  _print_array(name, arr, n, "%f", sizeof(float));
57 }

References _print_array.

Referenced by main().

+ Here is the caller graph for this function:

◆ print_array_int()

void print_array_int ( const char *  name,
const int arr,
const unsigned int  n 
)

Definition at line 59 of file tools.c.

60 {
61  _print_array(name, arr, n, "%d", sizeof(int));
62 }

References _print_array.

◆ print_array_long()

void print_array_long ( const char *  name,
const long *  arr,
const unsigned int  n 
)

Definition at line 69 of file tools.c.

70 {
71  _print_array(name, arr, n, "%a", sizeof(long));
72 }

References _print_array.