1 #ifndef _sprng_h_ 2 #define _sprng_h_ 3 4 #include "interface.h" 5 6 #define SPRNG_DEFAULT 0 7 #define CRAYLCG 0 8 #define DRAND48 1 9 #define FISH1 2 10 #define FISH2 3 11 #define FISH3 4 12 #define FISH4 5 13 #define FISH5 6 14 #define LECU1 0 15 #define LECU2 1 16 #define LECU3 2 17 #define LAG1279 0 18 #define LAG17 1 19 #define LAG31 2 20 #define LAG55 3 21 #define LAG63 4 22 #define LAG127 5 23 #define LAG521 6 24 #define LAG521B 7 25 #define LAG607 8 26 #define LAG607B 9 27 #define LAG1279B 10 28 29 #define CHECK 1 30 31 #define MAX_PACKED_LENGTH 24000 32 33 #ifdef SPRNG_USE_MPI 34 #define MPINAME(A) A ## _mpi 35 #else 36 #define MPINAME(A) A 37 #endif 38 39 #define make_sprng_seed MPINAME(make_new_seed) 40 41 #if defined(SIMPLE_SPRNG) 42 43 /* HAS ;-) */ 44 #if 0 45 #define pack_sprng pack_rng_simple 46 #define unpack_sprng unpack_rng_simple 47 #define isprng MPINAME(get_rn_int_simple) 48 #define init_sprng MPINAME(init_rng_simple) 49 #define print_sprng print_rng_simple 50 51 #ifdef FLOAT_GEN 52 #define sprng MPINAME(get_rn_flt_simple) 53 #else 54 #define sprng MPINAME(get_rn_dbl_simple) 55 #endif 56 #endif 57 58 #elif !defined(CHECK_POINTERS) 59 60 #define free_sprng free_rng 61 #define pack_sprng pack_rng 62 #define unpack_sprng unpack_rng 63 #define isprng get_rn_int 64 #define spawn_sprng(A,B,C) spawn_rng(A,B,C,!CHECK) 65 #define init_sprng init_rng 66 #define print_sprng print_rng 67 68 #ifdef FLOAT_GEN 69 #define sprng get_rn_flt 70 #else 71 #define sprng get_rn_dbl 72 #endif 73 74 #else 75 76 /* HAS ;-) */ 77 #if 0 78 #define free_sprng(A) ((deleteID(A)==NULL) ? -1 : free_rng(A)) 79 #define pack_sprng(A,B) ((checkID(A)==NULL) ? 0 : pack_rng(A,B)) 80 #define unpack_sprng(A) addID(unpack_rng(A)) 81 #define isprng(A) ((checkID(A)==NULL) ? -1 : get_rn_int(A)) 82 #define spawn_sprng(A,B,C) ((checkID(A)==NULL) ? 0 : spawn_rng(A,B,C,CHECK)) 83 #define init_sprng(A,B,C,D) addID(init_rng(A,B,C,D)) 84 #define print_sprng(A) ((checkID(A)==NULL) ? 0 : print_rng(A)) 85 86 #ifdef FLOAT_GEN 87 #define sprng(A) ((checkID(A)==NULL) ? -1.0 : get_rn_flt(A)) 88 #else 89 #define sprng(A) ((checkID(A)==NULL) ? -1.0 : get_rn_dbl(A)) 90 #endif 91 #endif 92 93 #endif 94 95 #endif 96