/****   Copyright (c) 1997,2001-2003  Alexandros V. Gerbessiotis
 ****
 ****   Permission to use, copy, modify, and distribute this software,
 ****   and to incorporate it, in whole or in part, into other software,
 ****   is hereby granted without fee, provided that
 ****     (1) the above copyright notice and this permission notice appear in
 ****         all copies of the source code, and the above copyright notice
 ****         appear in clearly visible form on all supporting documentation
 ****         and distribution media, and
 ****     (2) any redistribution of the software, in original
 ****         or modified form, be without fee and subject to
 ****         these same conditions.
 ****   No guarantee is offered that the code works as
 ****   advertised or is absent of any, even damaging,
 ****   side-effects; use this code on your own personal risk
 ****/

#include <memory.h>
#include <math.h>
#include "ai.h"
typedef float   data;

#ifdef MPILIB
#undef  BRDPPF_PUSH
#endif

#ifdef BSPLIB
#undef BRDPPF_PUSH
#endif

#define BRD_CUTOFF	1200
#define PPF_CUTOFF	200	


/* Definitions */
#ifndef TRUE
#define TRUE            1
#endif
#ifndef FALSE
#define	FALSE		0
#endif

#ifndef MIN
#define	MIN(x,y)	((x)<=(y)?(x):(y)) 
#endif
#ifndef MAX
#define	MAX(x,y)	((x)>=(y)?(x):(y))
#endif
#define CEIL(X,Y)       ((X != 0)?(1+ (X-1)/Y):0)  
#define FLOOR(X,Y)      (X/Y)  
#define LEFT(x,y)       (x-(x/y)*y)


extern double __my_estimate_l ;
extern double __my_estimate_g ;
extern int    __my_estimate_nprocs;
extern int    __my_first_call;
extern int    __my_estimate_brd;
extern int    __my_estimate_ppf;

/*	Function declarations */
void __my_estimate_bsp_values(void);
#define bsp_2_mprefix(A,B,C,D,E)      ai2mprefix ((A),(B),(C),(D),(E))
#define bsp_mprefix(A,B,C,D,E,F)      aitmprefix  ((A),(B),(C),(D),(E),(F))
#define bsp_mmprefix(A,B,C,D,E,F)     aitmmprefix ((A),(B),(C),(D),(E),(F))
#define bsp_prefix(A,B,C,D)           aiprefix   ((A),(B),(C),(D))
#define bsp_multiprefix(A,B,C,D,E)    aimprefix ((A),(B),(C),(D),(E))
void ai2mprefix(void (*)(),int,char *, char *, int);
void ai2sprefix(void (*)(),int,char *, char *, int,char *);
void aitmprefix(void (*)(),int,int,char *, char *, int);
void aitmmprefix(void (*)(),int,int,char *, char *, int);
void aiprefix(void (*)(),char *,char *, int);
void aimprefix(void (*)(),int,char*,char*,int);

